blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 5
146
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
7
| license_type
stringclasses 2
values | repo_name
stringlengths 6
79
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 4
values | visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.07k
426M
⌀ | star_events_count
int64 0
27
| fork_events_count
int64 0
12
| gha_license_id
stringclasses 3
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 6
values | src_encoding
stringclasses 26
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 1
class | length_bytes
int64 20
6.28M
| extension
stringclasses 20
values | content
stringlengths 20
6.28M
| authors
listlengths 1
16
| author_lines
listlengths 1
16
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2b5915001a3a0020210f64e42aa81a2154d451d9 | b2d46af9c6152323ce240374afc998c1574db71f | /cursovideojuegos/theflostiproject/3rdParty/boost/libs/range/test/const_ranges.cpp | 8e318746e7d53fd92975af9b23fa5e21018b63a9 | []
| no_license | bugbit/cipsaoscar | 601b4da0f0a647e71717ed35ee5c2f2d63c8a0f4 | 52aa8b4b67d48f59e46cb43527480f8b3552e96d | refs/heads/master | 2021-01-10T21:31:18.653163 | 2011-09-28T16:39:12 | 2011-09-28T16:39:12 | 33,032,640 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,884 | cpp | // Boost.Range library
//
// Copyright Thorsten Ottosen 2003-2004. Use, modification and
// distribution is subject to the Boost Software License, Version
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// For more information, see http://www.boost.org/libs/range/
//
#include <boost/detail/workaround.hpp>
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
# pragma warn -8091 // supress warning in Boost.Test
# pragma warn -8057 // unused argument argc/argv in Boost.Test
#endif
#include <boost/range.hpp>
#include <string>
// This should be included before "using namespace boost",
// otherwise gcc headers will be confused with boost::iterator
// namespace.
#include <boost/test/included/unit_test_framework.hpp>
using namespace boost;
using namespace std;
template< class T >
const T& as_const( const T& r )
{
return r;
}
void check_const_ranges()
{
std::string foo( "foo" );
const std::string bar( "bar" );
BOOST_CHECK( const_begin( foo ) == begin( as_const( foo ) ) );
BOOST_CHECK( const_end( foo ) == end( as_const( foo ) ) );
BOOST_CHECK( const_rbegin( foo ) == rbegin( as_const( foo ) ) );
BOOST_CHECK( const_rend( foo ) == rend( as_const( foo ) ) );
BOOST_CHECK( const_begin( bar ) == begin( as_const( bar ) ) );
BOOST_CHECK( const_end( bar ) == end( as_const( bar ) ) );
BOOST_CHECK( const_rbegin( bar ) == rbegin( as_const( bar ) ) );
BOOST_CHECK( const_rend( bar ) == rend( as_const( bar ) ) );
}
using boost::unit_test_framework::test_suite;
test_suite* init_unit_test_suite( int argc, char* argv[] )
{
test_suite* test = BOOST_TEST_SUITE( "Range Test Suite" );
test->add( BOOST_TEST_CASE( &check_const_ranges ) );
return test;
}
| [
"ohernandezba@71d53fa2-cca5-e1f2-4b5e-677cbd06613a"
]
| [
[
[
1,
69
]
]
]
|
5fc098ba84ce4fa629bd147e3bd9a964afec4979 | 724cded0e31f5fd52296d516b4c3d496f930fd19 | /source/Bittorrent/tools/libtorrenttest/libtorrent/src/entry.cpp | 711564598bbabe00dfcc1135d633ae76528bf139 | []
| no_license | yubik9/p2pcenter | 0c85a38f2b3052adf90b113b2b8b5b312fefcb0a | fc4119f29625b1b1f4559ffbe81563e6fcd2b4ea | refs/heads/master | 2021-08-27T15:40:05.663872 | 2009-02-19T00:13:33 | 2009-02-19T00:13:33 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,664 | cpp | /*
Copyright (c) 2003, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the distribution.
* Neither the name of the author nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#include <algorithm>
#include "libtorrent/entry.hpp"
#include <boost/bind.hpp>
#include <boost/next_prior.hpp>
#if defined(_MSC_VER)
namespace std
{
using ::isprint;
}
#define for if (false) {} else for
#endif
namespace
{
template <class T>
void call_destructor(T* o)
{
assert(o);
o->~T();
}
struct compare_string
{
compare_string(char const* s): m_str(s) {}
bool operator()(
std::pair<std::string
, libtorrent::entry> const& e) const
{
return e.first == m_str;
}
char const* m_str;
};
// bubble_sort code does not work with vc++2005, and is rather useless with a std::list anyway.
bool sortpred(const std::pair<std::string,libtorrent::entry> &left, const std::pair<std::string,libtorrent::entry> &right) {
return left.first < right.first;
}
/*template <class It, class Pred>
void bubble_sort(It start, It end, Pred p)
{
if (start == end) return;
--end;
for (It i = start; i != end; ++i)
{
bool unsorted = false;
for (It j = i; j != end; ++j)
{
It next = boost::next(j);
if (!p(*j, *next))
{
swap(*j, *next);
unsorted = true;
}
}
if (!unsorted) return;
}
}*/
}
namespace libtorrent
{
namespace detail
{
char const* integer_to_str(char* buf, int size, entry::integer_type val)
{
int sign = 0;
if (val < 0)
{
sign = 1;
val = -val;
}
buf[--size] = '\0';
if (val == 0) buf[--size] = '0';
for (; size > sign && val != 0;)
{
buf[--size] = '0' + char(val % 10);
val /= 10;
}
if (sign) buf[--size] = '-';
return buf + size;
}
}
entry& entry::operator[](char const* key)
{
dictionary_type::iterator i = std::find_if(
dict().begin()
, dict().end()
, compare_string(key));
if (i != dict().end()) return i->second;
dictionary_type::iterator ret = dict().insert(
dict().end()
, std::make_pair(std::string(key), entry()));
return ret->second;
}
entry& entry::operator[](std::string const& key)
{
return (*this)[key.c_str()];
}
entry* entry::find_key(char const* key)
{
dictionary_type::iterator i = std::find_if(
dict().begin()
, dict().end()
, compare_string(key));
if (i == dict().end()) return 0;
return &i->second;
}
entry const* entry::find_key(char const* key) const
{
dictionary_type::const_iterator i = std::find_if(
dict().begin()
, dict().end()
, compare_string(key));
if (i == dict().end()) return 0;
return &i->second;
}
const entry& entry::operator[](char const* key) const
{
dictionary_type::const_iterator i = std::find_if(
dict().begin()
, dict().end()
, compare_string(key));
if (i == dict().end()) throw type_error("key not found");
return i->second;
}
const entry& entry::operator[](std::string const& key) const
{
return (*this)[key.c_str()];
}
entry::entry(const dictionary_type& v)
{
new(data) dictionary_type(v);
m_type = dictionary_t;
}
entry::entry(const string_type& v)
{
new(data) string_type(v);
m_type = string_t;
}
entry::entry(const list_type& v)
{
new(data) list_type(v);
m_type = list_t;
}
entry::entry(const integer_type& v)
{
new(data) integer_type(v);
m_type = int_t;
}
void entry::operator=(const dictionary_type& v)
{
destruct();
new(data) dictionary_type(v);
m_type = dictionary_t;
}
void entry::operator=(const string_type& v)
{
destruct();
new(data) string_type(v);
m_type = string_t;
}
void entry::operator=(const list_type& v)
{
destruct();
new(data) list_type(v);
m_type = list_t;
}
void entry::operator=(const integer_type& v)
{
destruct();
new(data) integer_type(v);
m_type = int_t;
}
bool entry::operator==(entry const& e) const
{
if (m_type != e.m_type) return false;
switch(m_type)
{
case int_t:
return integer() == e.integer();
case string_t:
return string() == e.string();
case list_t:
return list() == e.list();
case dictionary_t:
return dict() == e.dict();
default:
assert(m_type == undefined_t);
return true;
}
}
void entry::construct(data_type t)
{
m_type = t;
switch(m_type)
{
case int_t:
new(data) integer_type;
break;
case string_t:
new(data) string_type;
break;
case list_t:
new(data) list_type;
break;
case dictionary_t:
new (data) dictionary_type;
break;
default:
assert(m_type == undefined_t);
m_type = undefined_t;
}
}
void entry::copy(const entry& e)
{
m_type = e.m_type;
switch(m_type)
{
case int_t:
new(data) integer_type(e.integer());
break;
case string_t:
new(data) string_type(e.string());
break;
case list_t:
new(data) list_type(e.list());
break;
case dictionary_t:
new (data) dictionary_type(e.dict());
break;
default:
m_type = undefined_t;
}
}
void entry::destruct()
{
switch(m_type)
{
case int_t:
call_destructor(reinterpret_cast<integer_type*>(data));
break;
case string_t:
call_destructor(reinterpret_cast<string_type*>(data));
break;
case list_t:
call_destructor(reinterpret_cast<list_type*>(data));
break;
case dictionary_t:
call_destructor(reinterpret_cast<dictionary_type*>(data));
break;
default:
assert(m_type == undefined_t);
break;
}
}
void entry::sort()
{
dict().sort(sortpred);
}
void entry::print(std::ostream& os, int indent) const
{
assert(indent >= 0);
for (int i = 0; i < indent; ++i) os << " ";
switch (m_type)
{
case int_t:
os << integer() << "\n";
break;
case string_t:
{
bool binary_string = false;
for (std::string::const_iterator i = string().begin(); i != string().end(); ++i)
{
if (!std::isprint(static_cast<unsigned char>(*i)))
{
binary_string = true;
break;
}
}
if (binary_string)
{
os.unsetf(std::ios_base::dec);
os.setf(std::ios_base::hex);
for (std::string::const_iterator i = string().begin(); i != string().end(); ++i)
os << static_cast<unsigned int>((unsigned char)*i);
os.unsetf(std::ios_base::hex);
os.setf(std::ios_base::dec);
os << "\n";
}
else
{
os << string() << "\n";
}
} break;
case list_t:
{
os << "list\n";
for (list_type::const_iterator i = list().begin(); i != list().end(); ++i)
{
i->print(os, indent+1);
}
} break;
case dictionary_t:
{
os << "dictionary\n";
for (dictionary_type::const_iterator i = dict().begin(); i != dict().end(); ++i)
{
for (int j = 0; j < indent+1; ++j) os << " ";
os << "[" << i->first << "]";
if (i->second.type() != entry::string_t && i->second.type() != entry::int_t) os << "\n";
else os << " ";
i->second.print(os, indent+2);
}
} break;
default:
os << "<uninitialized>\n";
}
}
}
| [
"fuwenke@b5bb1052-fe17-11dd-bc25-5f29055a2a2d"
]
| [
[
[
1,
379
]
]
]
|
24a57c2148ae71642b9120efb9ab003e8d612c38 | 72a2eb6600382e79f3a099775c8c2cf924cb7acb | /GameInterface_deprecated/GameInterface.cpp | 6316bd6a47e810b494bb95ef1f8c2ff5bb6de24d | []
| no_license | beuville/minesweepersolver | b8d666fd7ffcb5f48be3cc6454e3f2aba5fbe910 | 7940175a15d356dea243d236559fe16cb9b758e5 | refs/heads/master | 2021-01-25T07:35:18.270328 | 2008-12-02T15:21:52 | 2008-12-02T15:21:52 | 32,225,286 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,470 | cpp | #include "Gameboard.h"
#include "GameInterface.h"
;//Compile errors in VS9 without ";"
using namespace std;
Game_specs GameInterface::reportSpecs(){
return board_specs;
}
/* Send game commands to the gameboard
* Allowed commands are:
* GETBOARD - returns integer array of current board values
* PICKSQUARE - picks the square at x,y coordinate
*/
int *** GameInterface::sendCommand(Commands cmd){
if(cmd.cmd_num == GETBOARD){
return board->getBoard();
}else if(cmd.cmd_num == PICKSQUARE){
board->pickSquare(cmd.posx, cmd.posy);
}
return NULL;
}
/* The percentage of completion on this board
return - board completion percentage
*/
float GameInterface::report(){
return board->percentComplete();
}
/* Initializes a gameboard of mine sweeper
* difficulty - the game difficulty
* seed - the random seed value
*/
void GameInterface::initGame(string difficulty="easy", int seed=-1){
if(difficulty.compare("easy")){
width = 9;
height = 9;
mines = 10;
}else if(difficulty.compare("intermediate")){
width = 16;
height = 16;
mines = 40;
}else if(difficulty.compare("hard")){
width = 30;
height = 16;
mines = 99;
}else{
perror("Unknown difficulty setting, shutting down");
exit(1);
}
board = new Gameboard(width, height, mines, seed);
board_specs.Height = height;
board_specs.Width = width;
board_specs.Mines = mines;
board_specs.difficulty = difficulty;
}
| [
"Beau.Furrow@7e498df5-8955-0410-9177-9339b6f37624"
]
| [
[
[
1,
61
]
]
]
|
bd45accd5b69951a04f8bf35da73e90dbe1f7c4d | 847cccd728e768dc801d541a2d1169ef562311cd | /src/EntitySystem/Components/PolygonCollider.h | 12d3ad3f243923a297844803567078cdbc60669d | []
| no_license | aadarshasubedi/Ocerus | 1bea105de9c78b741f3de445601f7dee07987b96 | 4920b99a89f52f991125c9ecfa7353925ea9603c | refs/heads/master | 2021-01-17T17:50:00.472657 | 2011-03-25T13:26:12 | 2011-03-25T13:26:12 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,217 | h | /// @file
/// Physical representation of a collidable entity.
#ifndef Collidable_h__
#define Collidable_h__
#include "../ComponentMgr/Component.h"
namespace EntityComponents
{
/// Physical representation of static entities. This component works as a layer between entities and the physics engine.
/// It attaches itself to a physical body if there is any in the entity, or to a fixture (null body) otherwise.
class PolygonCollider: public RTTIGlue<PolygonCollider, Component>
{
public:
/// Called after the component is created.
virtual void Create(void);
/// Called before the component is destroyed.
virtual void Destroy(void);
/// Called when a new message arrives.
virtual EntityMessage::eResult HandleMessage(const EntityMessage& msg);
/// Called from RTTI when the component is allowed to set up its properties.
static void RegisterReflection(void);
/// Definition of the polygon.
Array<Vector2>* GetPolygon(void) const { return const_cast<Array<Vector2>*>(&mPolygon); }
/// Definition of the polygon.
void SetPolygon(Array<Vector2>* val);
/// Density of the shape's material.
float32 GetDensity(void) const;
/// Density of the shape's material.
void SetDensity(float32 val);
/// Friction of the material.
float32 GetFriction(void) const;
/// Friction of the material.
void SetFriction(float32 val);
/// Restitution of the material.
float32 GetRestitution(void) const;
/// Restitution of the material.
void SetRestitution(float32 val);
/// Physical shape.
PhysicalShape* GetShape(void) const { return mShape; }
private:
PhysicalShape* mShape;
PhysicalBody* mSensorBody;
Array<Vector2> mPolygon;
Vector2 mPolygonScale;
mutable float32 mDensity;
mutable float32 mFriction;
mutable float32 mRestitution;
/// Creates the shape from scratch. If any previous shape existed it gets deleted.
void RecreateShape(void);
/// Removes the shape from world (body).
void DestroyShape(void);
/// Fills the array with raw vertices for Box2d.
void GetBox2dVertices(Array<Vector2>* polygon, b2Vec2* vertices);
};
}
#endif // Collidable_h__
| [
"[email protected]"
]
| [
[
[
1,
79
]
]
]
|
5944bf9a1cff2ef6985933743c45139eb4734806 | 6ddcebe1a27cceece232d0b13b45651cbb4c9726 | /code/arduino/libs/Motor_Driver/motor_driver.h | 4333de189fd11012c5436d7ba0516cd539c7f0cd | []
| no_license | stevenweaver/projectrobo | 86d8adbb45783ebeabbefff592a9e3622f03fa89 | 67d7b90904df45ac0ac0a78d66a5ce007e9a8074 | refs/heads/master | 2020-04-22T02:29:16.814951 | 2010-05-23T03:17:50 | 2010-05-23T03:17:50 | 32,096,258 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 714 | h |
// create a directory named Motor_Driver in libraries directory of arduino and add
// this file(motor_driver.h) and motor_driver.cpp in it to have motor_driver library
#ifndef Motor_Driver_h
class Motor_Driver
{
public:
Motor_Driver(int enable_pin_right , int control_1_pin_right, int control_2_pin_right,
int enable_pin_left , int control_1_pin_left, int control_2_pin_left);
void Forward();
void Backward();
void Right();
void Left();
void Reset();
void Stop();
int pwm_pin_right, pwm_pin_left;
private:
int enable_pin_right, control_1_pin_right, control_2_pin_right, enable_pin_left, control_1_pin_left, control_2_pin_left;
};
#endif
| [
"asterothe@699f617c-11bd-11df-a1e4-8def113ae3e8"
]
| [
[
[
1,
42
]
]
]
|
af2e079324dbd8ad56a03b883fb7eb53f64bd5da | 29fe525ea96253174002c81a12f945eeca9573e0 | /myPTM/Scheduler.cpp | bccecaa0f8dcc8f99668c96d920229260c9f4e3b | []
| no_license | coolboy/myptm | c1d74a57540f8a590e13c90d1b6a1fd360cdbf76 | 222da87c0e54b6cf45442ab1f09b24b00a609afe | refs/heads/master | 2016-09-06T01:49:25.249072 | 2010-04-24T01:26:30 | 2010-04-24T01:26:30 | 32,131,717 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,514 | cpp | #include "StdAfx.h"
#include "Scheduler.h"
#include "LockManager.h"
#undef max
using namespace std;
using namespace boost;
typedef list<TranManager::Operation> OpLst;
//////////////////////////////////////////////////////////////////////////
//Get trans by id
OpLst GetTransactionsById(const OpLst& ls, int tid)
{
OpLst ret;
for_each(ls.begin(), ls.end(), [&ret, &tid] (const TranManager::Operation& op) {
if (op.m0 == tid)
ret.push_back(op);
}
);
return ret;
}
//remove trans by id
void RemoveTransactionById( OpLst& ls, OpLst::iterator beg, OpLst::iterator end, int tid)
{
for (auto iter = beg; iter != end; ){
if (iter->m0 == tid)
ls.erase(iter++);
else
iter++;
}
}
//Move the trans with id outside
OpLst TakeTransactionsById(const OpLst& ls, int tid)
{
OpLst ret = ls;
for (auto iter = ret.begin(); iter != ret.end(); iter++){
if (iter->m0 == tid){
ret.push_back(*iter);
ret.erase(iter);
}
}
return ret;
}
//Get Last Trans Position
OpLst::const_iterator GetLastPositionById(const OpLst& ls, int tid)
{
auto ret = ls.end();
for (auto iter = ls.begin(); iter != ls.end(); iter++){
if (iter->m0 == tid){
ret = iter;
}
}
return ret;
}
OpLst::const_iterator GetLastPositionById(const OpLst& ls, const TIDS& tids)
{
auto ret = ls.end();
for (auto iter = ls.begin(); iter != ls.end(); iter++){
if (tids.find(iter->m0) != tids.end()){
ret = iter;
}
}
return ret;
}
//Get age of the transaction till end
int GetAge(OpLst::const_iterator beg, OpLst::const_iterator end, int tid)
{
int ret = 0;
for_each(beg, end, [&](TranManager::Operation op){
if (op.m0 == tid)
++ret;
});
return ret;
}
//Schedule the transactions by the lock
Operations ScheduleOperations(const Operations& ops, LockManager& lm)
{
Operations new_ret = ops;
std::map<int, int> calc;
for (auto iter = new_ret.begin(); iter != new_ret.end(); ++iter){
++calc[iter->m0];
}
std::vector<int> aids;
for (auto iter = new_ret.begin(); iter != new_ret.end(); ++iter){
if (iter->m1 == TranManager::ABORT)
aids.push_back(iter->m0);
}
auto numVictim = ceil((double)calc.size() * 0.2);
if (numVictim == calc.size())
--numVictim;
std::vector<pair<int, int>> rank;
for (auto iter = calc.begin(); iter != calc.end(); ++iter){
rank.push_back(*iter);
}
sort (rank.begin(), rank.end(), [](const pair<int, int>& left, const pair<int, int>& right)->bool{
return left.second < right.second;
});
OpLst opsls;
copy(new_ret.begin(), new_ret.end(), back_inserter(opsls));
while (numVictim--){
RemoveTransactionById(opsls, opsls.begin(), opsls.end(), rank[0].first);
rank.pop_back();
}
for each(int aid in aids){
RemoveTransactionById(opsls, opsls.begin(), opsls.end(), aid);
}
new_ret.clear();
copy(opsls.begin(), opsls.end(), back_inserter(new_ret));
OpLst ret;
for (auto iter = ret.end(); iter != ret.end(); ++iter)
{
TranManager::Operation op = *iter;
auto tid = op.m0;
auto itemid = op.m4;
auto type = (int)op.m1;//0 read 1 write 2 delete
auto filename = op.m3;
auto mode = op.m2;// 1 transaction 0 proc
assert (type != -1);
////////////////////////////////////////////////////////////////////////
//commit
//abort handler!!
LockCondition lc;
if (type == 0 || type == 1)
lc = lm.Lock(tid, itemid, type, filename);
else if (type == 2)
lc = lm.Lock(tid, filename);
if (lc.deadlock_ids.empty())
continue;
if (lc.get == true)//get the lock
continue;
else {
if (!lc.deadlock_ids.empty())//dead lock
/* select the id from the ids which is the youngest one as the victim.
if the mode is process(0), just delete the rest of this 'transaction'
if the mode is transaction(1), just delete the whole transaction
*/{
//////////////////only break this first cycle////////////////////////////
TIDS& result = lc.deadlock_ids[0];
int youngestId = -1;
int currentYoungestAge = std::numeric_limits<int>::max();
for_each(result.begin(), result.end(), [&](int tid){
int age = GetAge(ret.begin(), iter, tid);
if (age < currentYoungestAge) {
currentYoungestAge = age;
youngestId = tid;
}
});
assert (youngestId != -1);
if (mode == 1)
RemoveTransactionById(ret, ret.begin(), ret.end(), youngestId);
else if (mode == 0)
RemoveTransactionById(ret, iter, ret.end(), youngestId);
else
assert (0);
break;
}
else if (!lc.owners.empty())//no dead lock
/*Just move all current trans operations down the the last operation of the
current lock owner trans.
*/{
auto currentBlockedTrans = TakeTransactionsById(ret, tid);
auto rid = lc .owners;
auto lastPosOfRid = GetLastPositionById(ret, rid);
ret.splice(lastPosOfRid, currentBlockedTrans);
break;
}
}
}
return new_ret;
}
//////////////////////////////////////////////////////////////////////////
Scheduler::Scheduler(void){}
void Scheduler::ScheduleTransactions(Operations Transactions)
{
//OpLst ls;
LockManager lm;
//copy(Transactions.begin(), Transactions.end(), back_inserter(ls));
//while (ls != ScheduleOperations(ls, lm)){}
commitedOps = ScheduleOperations(Transactions, lm);
}
Scheduler::~Scheduler(void)
{
}
Operations Scheduler::GetCommitedOutput()
{
return commitedOps;
}
| [
"yong1222@2f7a96df-5cd0-918d-fbe9-3cda5cb4a5af",
"coolcute@2f7a96df-5cd0-918d-fbe9-3cda5cb4a5af"
]
| [
[
[
1,
1
],
[
3,
3
],
[
5,
5
],
[
10,
10
],
[
91,
91
],
[
202,
202
],
[
206,
206
],
[
208,
208
],
[
215,
220
]
],
[
[
2,
2
],
[
4,
4
],
[
6,
9
],
[
11,
90
],
[
92,
201
],
[
203,
205
],
[
207,
207
],
[
209,
214
],
[
221,
225
]
]
]
|
1e4753024de9b2110039f1d9c40e3ba62d231576 | b4d726a0321649f907923cc57323942a1e45915b | /CODE/NETWORK/multi_options.cpp | 702dc7bb8befd0e0cc96ddd639bf84181c2ced22 | []
| no_license | chief1983/Imperial-Alliance | f1aa664d91f32c9e244867aaac43fffdf42199dc | 6db0102a8897deac845a8bd2a7aa2e1b25086448 | refs/heads/master | 2016-09-06T02:40:39.069630 | 2010-10-06T22:06:24 | 2010-10-06T22:06:24 | 967,775 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 24,337 | cpp | /*
* Copyright (C) Volition, Inc. 1999. All rights reserved.
*
* All source code herein is the property of Volition, Inc. You may not sell
* or otherwise commercially exploit the source or things you created based on the
* source.
*
*/
/*
* $Logfile: /Freespace2/code/Network/multi_options.cpp $
* $Revision: 1.1.1.1 $
* $Date: 2004/08/13 22:47:42 $
* $Author: Spearhawk $
*
* $Log: multi_options.cpp,v $
* Revision 1.1.1.1 2004/08/13 22:47:42 Spearhawk
* no message
*
* Revision 1.1.1.1 2004/08/13 21:23:15 Darkhill
* no message
*
* Revision 2.3 2004/03/05 09:02:02 Goober5000
* Uber pass at reducing #includes
* --Goober5000
*
* Revision 2.2 2002/08/01 01:41:08 penguin
* The big include file move
*
* Revision 2.1 2002/07/22 01:22:25 penguin
* Linux port -- added NO_STANDALONE ifdefs
*
* Revision 2.0 2002/06/03 04:02:26 penguin
* Warpcore CVS sync
*
* Revision 1.1 2002/05/02 18:03:11 mharris
* Initial checkin - converted filenames and includes to lower case
*
*
* 22 8/27/99 12:32a Dave
* Allow the user to specify a local port through the launcher.
*
* 21 8/22/99 1:19p Dave
* Fixed up http proxy code. Cleaned up scoring code. Reverse the order in
* which d3d cards are detected.
*
* 20 8/04/99 6:01p Dave
* Oops. Make sure standalones log in.
*
* 19 7/09/99 9:51a Dave
* Added thick polyline code.
*
* 18 5/03/99 8:32p Dave
* New version of multi host options screen.
*
* 17 4/25/99 7:43p Dave
* Misc small bug fixes. Made sun draw properly.
*
* 16 4/20/99 6:39p Dave
* Almost done with artillery targeting. Added support for downloading
* images on the PXO screen.
*
* 15 3/10/99 6:50p Dave
* Changed the way we buffer packets for all clients. Optimized turret
* fired packets. Did some weapon firing optimizations.
*
* 14 3/09/99 6:24p Dave
* More work on object update revamping. Identified several sources of
* unnecessary bandwidth.
*
* 13 3/08/99 7:03p Dave
* First run of new object update system. Looks very promising.
*
* 12 2/21/99 6:01p Dave
* Fixed standalone WSS packets.
*
* 11 2/19/99 2:55p Dave
* Temporary checking to report the winner of a squad war match.
*
* 10 2/12/99 6:16p Dave
* Pre-mission Squad War code is 95% done.
*
* 9 2/11/99 3:08p Dave
* PXO refresh button. Very preliminary squad war support.
*
* 8 11/20/98 11:16a Dave
* Fixed up IPX support a bit. Making sure that switching modes and
* loading/saving pilot files maintains proper state.
*
* 7 11/19/98 4:19p Dave
* Put IPX sockets back in psnet. Consolidated all multiplayer config
* files into one.
*
* 6 11/19/98 8:03a Dave
* Full support for D3-style reliable sockets. Revamped packet lag/loss
* system, made it receiver side and at the lowest possible level.
*
* 5 11/17/98 11:12a Dave
* Removed player identification by address. Now assign explicit id #'s.
*
* 4 10/13/98 9:29a Dave
* Started neatening up freespace.h. Many variables renamed and
* reorganized. Added AlphaColors.[h,cpp]
*
* 3 10/07/98 6:27p Dave
* Globalized mission and campaign file extensions. Removed Silent Threat
* special code. Moved \cache \players and \multidata into the \data
* directory.
*
* 2 10/07/98 10:53a Dave
* Initial checkin.
*
* 1 10/07/98 10:50a Dave
*
* 20 9/10/98 1:17p Dave
* Put in code to flag missions and campaigns as being MD or not in Fred
* and Freespace. Put in multiplayer support for filtering out MD
* missions. Put in multiplayer popups for warning of non-valid missions.
*
* 19 7/07/98 2:49p Dave
* UI bug fixes.
*
* 18 6/04/98 11:04a Allender
* object update level stuff. Don't reset to high when becoming an
* observer of any type. default to low when guy is a dialup customer
*
* 17 5/24/98 3:45a Dave
* Minor object update fixes. Justify channel information on PXO. Add a
* bunch of configuration stuff for the standalone.
*
* 16 5/19/98 1:35a Dave
* Tweaked pxo interface. Added rankings url to pxo.cfg. Make netplayer
* local options update dynamically in netgames.
*
* 15 5/08/98 5:05p Dave
* Go to the join game screen when quitting multiplayer. Fixed mission
* text chat bugs. Put mission type symbols on the create game list.
* Started updating standalone gui controls.
*
* 14 5/06/98 12:36p Dave
* Make sure clients can leave the debrief screen easily at all times. Fix
* respawn count problem.
*
* 13 5/03/98 7:04p Dave
* Make team vs. team work mores smoothly with standalone. Change how host
* interacts with standalone for picking missions. Put in a time limit for
* ingame join ship select. Fix ingame join ship select screen for Vasudan
* ship icons.
*
* 12 5/03/98 2:52p Dave
* Removed multiplayer furball mode.
*
* 11 4/23/98 6:18p Dave
* Store ETS values between respawns. Put kick feature in the text
* messaging system. Fixed text messaging system so that it doesn't
* process or trigger ship controls. Other UI fixes.
*
* 10 4/22/98 5:53p Dave
* Large reworking of endgame sequencing. Updated multi host options
* screen for new artwork. Put in checks for host or team captains leaving
* midgame.
*
* 9 4/16/98 11:39p Dave
* Put in first run of new multiplayer options screen. Still need to
* complete final tab.
*
* 8 4/13/98 4:50p Dave
* Maintain status of weapon bank/links through respawns. Put # players on
* create game mission list. Make observer not have engine sounds. Make
* oberver pivot point correct. Fixed respawn value getting reset every
* time host options screen started.
*
* 7 4/09/98 11:01p Dave
* Put in new multi host options screen. Tweaked multiplayer options a
* bit.
*
* 6 4/09/98 5:43p Dave
* Remove all command line processing from the demo. Began work fixing up
* the new multi host options screen.
*
* 5 4/06/98 6:37p Dave
* Put in max_observers netgame server option. Make sure host is always
* defaulted to alpha 1 or zeta 1. Changed create game so that MAX_PLAYERS
* can always join but need to be kicked before commit can happen. Put in
* support for server ending a game and notifying clients of a special
* condition.
*
* 4 4/04/98 4:22p Dave
* First rev of UDP reliable sockets is done. Seems to work well if not
* overly burdened.
*
* 3 4/03/98 1:03a Dave
* First pass at unreliable guaranteed delivery packets.
*
* 2 3/31/98 4:51p Dave
* Removed medals screen and multiplayer buttons from demo version. Put in
* new pilot popup screen. Make ships in mp team vs. team have proper team
* ids. Make mp respawns a permanent option saved in the player file.
*
* 1 3/30/98 6:24p Dave
*
*
* $NoKeywords: $
*/
#include "cmdline/cmdline.h"
#include "osapi/osregistry.h"
#include "network/multi.h"
#include "network/multimsgs.h"
#include "network/multi_oo.h"
#include "freespace2/freespace.h"
#include "network/stand_gui.h"
#include "network/multiutil.h"
#include "network/multi_voice.h"
#include "network/multi_options.h"
#include "network/multi_team.h"
#include "mission/missioncampaign.h"
#include "mission/missionparse.h"
#include "parse/parselo.h"
#include "playerman/player.h"
#include "cfile/cfile.h"
// ----------------------------------------------------------------------------------
// MULTI OPTIONS DEFINES/VARS
//
// packet codes
#define MULTI_OPTION_SERVER 0 // server update follows
#define MULTI_OPTION_LOCAL 1 // local netplayer options follow
#define MULTI_OPTION_START_GAME 2 // host's start game options on the standalone server
#define MULTI_OPTION_MISSION 3 // host's mission selection stuff on a standalone server
// global options
#define MULTI_CFG_FILE NOX("multi.cfg")
multi_global_options Multi_options_g;
char Multi_options_proxy[512] = "";
ushort Multi_options_proxy_port = 0;
// ----------------------------------------------------------------------------------
// MULTI OPTIONS FUNCTIONS
//
// load in the config file
#define NEXT_TOKEN() do { tok = strtok(NULL, "\n"); if(tok != NULL){ drop_leading_white_space(tok); drop_trailing_white_space(tok); } } while(0);
#define SETTING(s) ( !stricmp(tok, s) )
void multi_options_read_config()
{
CFILE *in;
char str[512];
char *tok = NULL;
// set default value for the global multi options
memset(&Multi_options_g, 0, sizeof(multi_global_options));
Multi_options_g.protocol = NET_TCP;
// do we have a forced port via commandline or registry?
ushort forced_port = (ushort)os_config_read_uint(NULL, "ForcePort", 0);
Multi_options_g.port = (Cmdline_network_port >= 0) ? (ushort)Cmdline_network_port : forced_port == 0 ? (ushort)DEFAULT_GAME_PORT : forced_port;
Multi_options_g.log = (Cmdline_multi_log) ? 1 : 0;
Multi_options_g.datarate_cap = OO_HIGH_RATE_DEFAULT;
strcpy(Multi_options_g.user_tracker_ip, "");
strcpy(Multi_options_g.game_tracker_ip, "");
strcpy(Multi_options_g.pxo_ip, "");
strcpy(Multi_options_g.pxo_rank_url, "");
strcpy(Multi_options_g.pxo_create_url, "");
strcpy(Multi_options_g.pxo_verify_url, "");
strcpy(Multi_options_g.pxo_banner_url, "");
// standalone values
Multi_options_g.std_max_players = -1;
Multi_options_g.std_datarate = OBJ_UPDATE_HIGH;
Multi_options_g.std_voice = 1;
memset(Multi_options_g.std_passwd, 0, STD_PASSWD_LEN);
memset(Multi_options_g.std_pname, 0, STD_NAME_LEN);
Multi_options_g.std_framecap = 30;
// read in the config file
in = cfopen(MULTI_CFG_FILE, "rt", CFILE_NORMAL, CF_TYPE_DATA);
// if we failed to open the config file, user default settings
if(in == NULL){
nprintf(("Network","Failed to open network config file, using default settings\n"));
return;
}
while(!cfeof(in)){
// read in the game info
memset(str,0,512);
cfgets(str,512,in);
// parse the first line
tok = strtok(str," \t");
// check the token
if(tok != NULL){
drop_leading_white_space(tok);
drop_trailing_white_space(tok);
} else {
continue;
}
#ifndef NO_STANDALONE
// all possible options
// only standalone cares about the following options
if(Is_standalone){
if(SETTING("+pxo")){
// setup PXO mode
NEXT_TOKEN();
if(tok != NULL){
// whee!
}
} else
if(SETTING("+name")){
// set the standalone server's permanent name
NEXT_TOKEN();
if(tok != NULL){
strncpy(Multi_options_g.std_pname, tok, STD_NAME_LEN);
}
} else
if(SETTING("+no_voice")){
// standalone won't allow voice transmission
Multi_options_g.std_voice = 0;
} else
if(SETTING("+max_players")){
// set the max # of players on the standalone
NEXT_TOKEN();
if(tok != NULL){
if(!((atoi(tok) < 1) || (atoi(tok) > MAX_PLAYERS))){
Multi_options_g.std_max_players = atoi(tok);
}
}
} else
if(SETTING("+ban")){
// ban a player
NEXT_TOKEN();
if(tok != NULL){
std_add_ban(tok);
}
} else
if(SETTING("+passwd")){
// set the standalone host password
NEXT_TOKEN();
if(tok != NULL){
strncpy(Multi_options_g.std_passwd, tok, STD_PASSWD_LEN);
#ifdef _WIN32
// yuck
extern HWND Multi_std_host_passwd;
SetWindowText(Multi_std_host_passwd, Multi_options_g.std_passwd);
#else
// TODO: get password ?
// argh, gonna have to figure out how to do this - mharris 07/07/2002
#endif
}
} else
if(SETTING("+low_update")){
// set standalone to low updates
Multi_options_g.std_datarate = OBJ_UPDATE_LOW;
} else
if(SETTING("+med_update")){
// set standalone to medium updates
Multi_options_g.std_datarate = OBJ_UPDATE_MEDIUM;
} else
if(SETTING("+high_update")){
// set standalone to high updates
Multi_options_g.std_datarate = OBJ_UPDATE_HIGH;
} else
if(SETTING("+lan_update")){
// set standalone to high updates
Multi_options_g.std_datarate = OBJ_UPDATE_LAN;
}
}
#endif
// common to all modes
if(SETTING("+user_server")){
// ip addr of user tracker
NEXT_TOKEN();
if(tok != NULL){
strcpy(Multi_options_g.user_tracker_ip, tok);
}
} else
if(SETTING("+game_server")){
// ip addr of game tracker
NEXT_TOKEN();
if(tok != NULL){
strcpy(Multi_options_g.game_tracker_ip, tok);
}
} else
if(SETTING("+chat_server")){
// ip addr of pxo chat server
NEXT_TOKEN();
if(tok != NULL){
strcpy(Multi_options_g.pxo_ip, tok);
}
} else
if(SETTING("+rank_url")){
// url of pilot rankings page
NEXT_TOKEN();
if(tok != NULL){
strcpy(Multi_options_g.pxo_rank_url, tok);
}
} else
if(SETTING("+create_url")){
// url of pxo account create page
NEXT_TOKEN();
if(tok != NULL){
strcpy(Multi_options_g.pxo_create_url, tok);
}
} else
if(SETTING("+verify_url")){
// url of pxo account verify page
NEXT_TOKEN();
if(tok != NULL){
strcpy(Multi_options_g.pxo_verify_url, tok);
}
} else
if(SETTING("+banner_url")){
// url of pxo account verify page
NEXT_TOKEN();
if(tok != NULL){
strcpy(Multi_options_g.pxo_banner_url, tok);
}
} else
if(SETTING("+datarate")){
// set the max datarate for high updates
NEXT_TOKEN();
if(tok != NULL){
if(atoi(tok) >= 4000){
Multi_options_g.datarate_cap = atoi(tok);
}
}
}
if(SETTING("+http_proxy")){
// get the proxy server
NEXT_TOKEN();
if(tok != NULL){
char *ip = strtok(tok, ":");
if(ip != NULL){
strcpy(Multi_options_proxy, ip);
}
ip = strtok(NULL, "");
if(ip != NULL){
Multi_options_proxy_port = (ushort)atoi(ip);
} else {
strcpy(Multi_options_proxy, "");
}
}
}
}
// close the config file
cfclose(in);
in = NULL;
}
// set netgame defaults
// NOTE : should be used when creating a newpilot
void multi_options_set_netgame_defaults(multi_server_options *options)
{
// any player can do squadmate messaging
options->squad_set = MSO_SQUAD_ANY;
// only the host can end the game
options->endgame_set = MSO_END_HOST;
// allow ingame file xfer and custom pilot pix
options->flags = (MSO_FLAG_INGAME_XFER | MSO_FLAG_ACCEPT_PIX);
// set the default time limit to be -1 (no limit)
options->mission_time_limit = fl2f(-1.0f);
// set the default max kills for a mission
options->kill_limit = 9999;
// set the default # of respawns
options->respawn = 2;
// set the default # of max observers
options->max_observers = 2;
// set the default netgame qos
options->voice_qos = 10;
// set the default token timeout
options->voice_token_wait = 2000; // he must wait 2 seconds between voice gets
// set the default max voice record time
options->voice_record_time = 5000;
}
// set local netplayer defaults
// NOTE : should be used when creating a newpilot
void multi_options_set_local_defaults(multi_local_options *options)
{
// accept pix by default and broadcast on the local subnet
options->flags = (MLO_FLAG_ACCEPT_PIX | MLO_FLAG_LOCAL_BROADCAST);
// set the object update level based on the type of network connection specified by the user
// at install (or launcher) time.
if ( Psnet_connection == NETWORK_CONNECTION_DIALUP ) {
options->obj_update_level = OBJ_UPDATE_LOW;
} else {
options->obj_update_level = OBJ_UPDATE_HIGH;
}
}
// fill in the passed netgame options struct with the data from my player file data (only host/server should do this)
void multi_options_netgame_load(multi_server_options *options)
{
if(options != NULL){
memcpy(options,&Player->m_server_options,sizeof(multi_server_options));
}
}
// fill in the passed local options struct with the data from my player file data (all machines except standalone should do this)
void multi_options_local_load(multi_local_options *options, net_player *pxo_pl)
{
if(options != NULL){
memcpy(options,&Player->m_local_options,sizeof(multi_local_options));
}
// stuff pxo squad info
if(pxo_pl != NULL){
strcpy(pxo_pl->p_info.pxo_squad_name, Multi_tracker_squad_name);
}
}
// update everyone on the current netgame options
void multi_options_update_netgame()
{
ubyte data[MAX_PACKET_SIZE],code;
int packet_size = 0;
Assert(Net_player->flags & NETINFO_FLAG_GAME_HOST);
// build the header and add the opcode
BUILD_HEADER(OPTIONS_UPDATE);
code = MULTI_OPTION_SERVER;
ADD_DATA(code);
// add the netgame options
ADD_DATA(Netgame.options);
// send the packet
if(Net_player->flags & NETINFO_FLAG_AM_MASTER){
multi_io_send_to_all_reliable(data, packet_size);
} else {
multi_io_send_reliable(Net_player, data, packet_size);
}
}
// update everyone with my local settings
void multi_options_update_local()
{
ubyte data[MAX_PACKET_SIZE],code;
int packet_size = 0;
// if i'm the server, don't do anything
if(Net_player->flags & NETINFO_FLAG_AM_MASTER){
return;
}
// build the header and add the opcode
BUILD_HEADER(OPTIONS_UPDATE);
code = MULTI_OPTION_LOCAL;
ADD_DATA(code);
// add the netgame options
ADD_DATA(Net_player->p_info.options);
// send the packet
multi_io_send_reliable(Net_player, data, packet_size);
}
// update the standalone with the settings I have picked at the "start game" screen
void multi_options_update_start_game(netgame_info *ng)
{
ubyte data[MAX_PACKET_SIZE],code;
int packet_size = 0;
// should be a host on a standalone
Assert((Net_player->flags & NETINFO_FLAG_GAME_HOST) && !(Net_player->flags & NETINFO_FLAG_AM_MASTER));
// build the header
BUILD_HEADER(OPTIONS_UPDATE);
code = MULTI_OPTION_START_GAME;
ADD_DATA(code);
// add the start game options
ADD_STRING(ng->name);
ADD_DATA(ng->mode);
ADD_DATA(ng->security);
// add mode-specific data
switch(ng->mode){
case NG_MODE_PASSWORD:
ADD_STRING(ng->passwd);
break;
case NG_MODE_RANK_ABOVE:
case NG_MODE_RANK_BELOW:
ADD_DATA(ng->rank_base);
break;
}
// send to the standalone server
multi_io_send_reliable(Net_player, data, packet_size);
}
// update the standalone with the mission settings I have picked (mission filename, etc)
void multi_options_update_mission(netgame_info *ng, int campaign_mode)
{
ubyte data[MAX_PACKET_SIZE],code;
int packet_size = 0;
// should be a host on a standalone
Assert((Net_player->flags & NETINFO_FLAG_GAME_HOST) && !(Net_player->flags & NETINFO_FLAG_AM_MASTER));
// build the header
BUILD_HEADER(OPTIONS_UPDATE);
code = MULTI_OPTION_MISSION;
ADD_DATA(code);
// type (coop or team vs. team)
ADD_DATA(ng->type_flags);
// respawns
ADD_DATA(ng->respawn);
// add the mission/campaign filename
code = (ubyte)campaign_mode;
ADD_DATA(code);
if(campaign_mode){
ADD_STRING(ng->campaign_name);
} else {
ADD_STRING(ng->mission_name);
}
// send to the server
multi_io_send_reliable(Net_player, data, packet_size);
}
// ----------------------------------------------------------------------------------
// MULTI OPTIONS FUNCTIONS
//
// process an incoming multi options packet
void multi_options_process_packet(unsigned char *data, header *hinfo)
{
ubyte code;
multi_local_options bogus;
int idx,player_index;
char str[255];
int offset = HEADER_LENGTH;
// find out who is sending this data
player_index = find_player_id(hinfo->id);
// get the packet code
GET_DATA(code);
switch(code){
// get the start game options
case MULTI_OPTION_START_GAME:
Assert(Game_mode & GM_STANDALONE_SERVER);
// get the netgame name
GET_STRING(Netgame.name);
// get the netgame mode
GET_DATA(Netgame.mode);
// get the security #
GET_DATA(Netgame.security);
// get mode specific data
switch(Netgame.mode){
case NG_MODE_PASSWORD:
GET_STRING(Netgame.passwd);
break;
case NG_MODE_RANK_ABOVE:
case NG_MODE_RANK_BELOW:
GET_DATA(Netgame.rank_base);
break;
}
#ifndef NO_STANDALONE
// update standalone stuff
std_connect_set_gamename(Netgame.name);
std_multi_update_netgame_info_controls();
#endif
break;
// get mission choice options
case MULTI_OPTION_MISSION:
netgame_info ng;
char title[NAME_LENGTH+1];
int campaign_type,max_players;
memset(&ng,0,sizeof(netgame_info));
Assert(Game_mode & GM_STANDALONE_SERVER);
// coop or team vs. team mode
GET_DATA(ng.type_flags);
if((ng.type_flags & NG_TYPE_TEAM) && !(Netgame.type_flags & NG_TYPE_TEAM)){
multi_team_reset();
}
// if squad war was switched on
if((ng.type_flags & NG_TYPE_SW) && !(Netgame.type_flags & NG_TYPE_SW)){
mprintf(("STANDALONE TURNED ON SQUAD WAR!!\n"));
}
Netgame.type_flags = ng.type_flags;
// new respawn count
GET_DATA(Netgame.respawn);
// name string
memset(str,255,0);
GET_DATA(code);
// campaign mode
if(code){
GET_STRING(ng.campaign_name);
// set the netgame max players here if the filename has changed
if(strcmp(Netgame.campaign_name,ng.campaign_name)){
memset(title,0,NAME_LENGTH+1);
if(!mission_campaign_get_info(ng.campaign_name,title,&campaign_type,&max_players)){
Netgame.max_players = 0;
} else {
Netgame.max_players = max_players;
}
strcpy(Netgame.campaign_name,ng.campaign_name);
}
Netgame.campaign_mode = 1;
#ifndef NO_STANDALONE
// put brackets around the campaign name
if(Game_mode & GM_STANDALONE_SERVER){
strcpy(str,"(");
strcat(str,Netgame.campaign_name);
strcat(str,")");
std_multi_set_standalone_mission_name(str);
}
#endif
}
// non-campaign mode
else {
GET_STRING(ng.mission_name);
if(strcmp(Netgame.mission_name,ng.mission_name)){
if(strlen(ng.mission_name)){
Netgame.max_players = mission_parse_get_multi_mission_info( ng.mission_name );
} else {
// setting this to -1 will prevent us from being seen on the network
Netgame.max_players = -1;
}
strcpy(Netgame.mission_name,ng.mission_name);
strcpy(Game_current_mission_filename,Netgame.mission_name);
}
Netgame.campaign_mode = 0;
#ifndef NO_STANDALONE
// set the mission name
if(Game_mode & GM_STANDALONE_SERVER){
std_multi_set_standalone_mission_name(Netgame.mission_name);
}
#endif
}
send_netgame_update_packet();
break;
// get the netgame options
case MULTI_OPTION_SERVER:
GET_DATA(Netgame.options);
// if we're a standalone set for no sound, do so here
if((Game_mode & GM_STANDALONE_SERVER) && !Multi_options_g.std_voice){
Netgame.options.flags |= MSO_FLAG_NO_VOICE;
} else {
// maybe update the quality of sound
multi_voice_maybe_update_vars(Netgame.options.voice_qos,Netgame.options.voice_record_time);
}
// set the skill level
Game_skill_level = Netgame.options.skill_level;
if((Game_mode & GM_STANDALONE_SERVER) && !(Game_mode & GM_CAMPAIGN_MODE)){
Netgame.respawn = Netgame.options.respawn;
}
// if we have the "temp closed" flag toggle
if(Netgame.options.flags & MLO_FLAG_TEMP_CLOSED){
Netgame.flags ^= NG_FLAG_TEMP_CLOSED;
}
Netgame.options.flags &= ~(MLO_FLAG_TEMP_CLOSED);
// if i'm the standalone server, I should rebroadcast to all other players
if(Game_mode & GM_STANDALONE_SERVER){
for(idx=0;idx<MAX_PLAYERS;idx++){
if(MULTI_CONNECTED(Net_players[idx]) && (Net_player != &Net_players[idx]) && (&Net_players[idx] != &Net_players[player_index]) ){
multi_io_send_reliable(&Net_players[idx], data, offset);
}
}
send_netgame_update_packet();
}
break;
// local netplayer options
case MULTI_OPTION_LOCAL:
if(player_index == -1){
GET_DATA(bogus);
} else {
GET_DATA(Net_players[player_index].p_info.options);
}
break;
}
PACKET_SET_SIZE();
}
| [
"[email protected]"
]
| [
[
[
1,
831
]
]
]
|
a3d220219b29aa3fa8081d0125983cc2811a5da7 | f4b649f3f48ad288550762f4439fcfffddc08d0e | /eRacer/Source/Graphics/BoundingSphere.cpp | 5af65cbab3e0138ace712f065a9bd2e11e583c1a | []
| no_license | Knio/eRacer | 0fa27c8f7d1430952a98ac2896ab8b8ee87116e7 | 65941230b8bed458548a920a6eac84ad23c561b8 | refs/heads/master | 2023-09-01T16:02:58.232341 | 2010-04-26T23:58:20 | 2010-04-26T23:58:20 | 506,897 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,140 | cpp | #include "BoundingSphere.h"
#include <cassert>
namespace Graphics{
void BoundingSphere::recompute(ID3DXMesh& mesh){
unsigned int positionOffset = -1;
D3DVERTEXELEMENT9 vertexElement[MAX_FVF_DECL_SIZE];
mesh.GetDeclaration(vertexElement);
unsigned int i=0;
while(i<MAX_FVF_DECL_SIZE && vertexElement[i].Stream != 0xFF){
if(D3DDECLUSAGE_POSITION==vertexElement[i].Usage){
positionOffset = vertexElement[i].Offset;
}
i++;
}
assert(positionOffset>=0);
unsigned char* vertices;
assert(SUCCEEDED(mesh.LockVertexBuffer(D3DLOCK_READONLY,(LPVOID*) &vertices)));
recompute(vertices, mesh.GetNumVertices(), mesh.GetNumBytesPerVertex());
mesh.UnlockVertexBuffer();
}
void BoundingSphere::recompute(const unsigned char* vertices, unsigned int nVertices, unsigned int bytesPerVertex){
unsigned int index = bytesPerVertex;
Vector3 sum = *((Vector3*)vertices);
for(unsigned int i = 1; i<nVertices; i++, index+=bytesPerVertex)
sum += *(Point3*)(vertices+index);
center = sum /= (float)nVertices;
float radiusSquared = 0;
for(unsigned int i = 0, index =0; i<nVertices; i++, index+=bytesPerVertex){
Point3 v = *(Point3*)(vertices+index);
float newRadiusSquared = D3DXVec3LengthSq(&(v-center));
if(newRadiusSquared > radiusSquared)
radiusSquared = newRadiusSquared;
}
radius = sqrt(radiusSquared);
}
void BoundingSphere::merge(const BoundingSphere& sphere){
Vector3 centerDifference = sphere.center - center;
float centerDistanceSquared = D3DXVec3LengthSq(¢erDifference);
float radiusDistance = sphere.radius - radius;
float radiusDistanceSquared = radiusDistance*radiusDistance;
if(radiusDistanceSquared >= centerDistanceSquared){
if(radiusDistance > 0.0f)
*this = sphere;
}
else{
float centerDistance = sqrt(centerDistanceSquared);
float u = (centerDistance+radiusDistance)/(2*centerDistance);
center+=u*centerDifference;
radius = (centerDistance + radius + sphere.radius)/2;
}
}
bool BoundingSphere::cull(const Plane& plane) const{
return dot(plane.normal,center) - plane.distance < -radius;
}
} | [
"[email protected]"
]
| [
[
[
1,
75
]
]
]
|
1c4c2eccf6ac9907fd099df198ee8e4e67009dd3 | 29f0a6c56e3c4528f64c3a1ad18fc5f074ae1146 | /Praktikum Info2/Aufgabenblock_2/Losfahren.h | 7f450cb2fd1805cc75bf4278f2636bb92a6f4209 | []
| no_license | JohN-D/Info-2-Praktikum | 8ccb0348bedf38a619a39b17b0425d6b4c16a72d | c11a274e9c4469a31f40d0abec2365545344b534 | refs/heads/master | 2021-01-01T18:34:31.347062 | 2011-10-19T20:18:47 | 2011-10-19T20:18:47 | 2,608,736 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 256 | h | #pragma once
#include "fahrausnahme.h"
class Losfahren : public FahrAusnahme
{
public:
Losfahren(void);
~Losfahren(void);
virtual void vBearbeiten(void);
Losfahren(Fahrzeug* pFahrzeug, Weg* pWeg) : FahrAusnahme(pFahrzeug, pWeg) {};
};
| [
"[email protected]"
]
| [
[
[
1,
13
]
]
]
|
4c43df83db86b4bdcc019c076a3a440ccaafae97 | 3949d20551a203cf29801d888844d83d297d8118 | /Sources/LudoRenderer/LudoTexture.h | a2ba0e170ac3ae18bcf89cf2baa8da56876922f3 | []
| no_license | Cuihuo/sorgamedev | 2197cf5f19a6e8b3b7bba51d46ebc1f8c1f5731e | fa6eb43a586b0e175ac291e8cd583343c0f7a337 | refs/heads/master | 2021-01-10T17:38:50.996616 | 2008-11-28T17:13:19 | 2008-11-28T17:13:19 | 49,120,070 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 913 | h | #pragma once
#include <string>
#include <d3d9.h>
#include "../External/DirectXSDK/Include/d3dx9.h"
#include "../LudoCore/LudoGlobal.h"
class LudoTexture
{
public:
LudoTexture();
LudoTexture(std::string filename);
~LudoTexture();
void LoadTexture();
void UnloadTexture();
LPDIRECT3DTEXTURE9 GetTexture();
std::string GetTextureFile();
bool GetTextureLoaded(){ return m_TextureLoaded; };
int GetWidth();
int GetHeight();
void SetTextureFile(std::string filename);
void SetSize(int height, int width);
private:
LPDIRECT3DTEXTURE9 m_Texture;
std::string m_Name;
bool m_TextureLoaded;
int m_Width;
int m_Height;
};
| [
"sikhan.ariel.lee@a3e5f5c2-bd6c-11dd-94c0-21daf384169b"
]
| [
[
[
1,
32
]
]
]
|
3a2e429797ffdd23ebe42b37f3450784964b66cc | 5dc78c30093221b4d2ce0e522d96b0f676f0c59a | /src/modules/sound/SoundData.h | 3c01cd74ee109aabe31536cc31323070eb678aac | [
"Zlib"
]
| permissive | JackDanger/love | f03219b6cca452530bf590ca22825170c2b2eae1 | 596c98c88bde046f01d6898fda8b46013804aad6 | refs/heads/master | 2021-01-13T02:32:12.708770 | 2009-07-22T17:21:13 | 2009-07-22T17:21:13 | 142,595 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,696 | h | /**
* Copyright (c) 2006-2009 LOVE Development Team
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
**/
#ifndef LOVE_SOUND_SOUND_DATA_H
#define LOVE_SOUND_SOUND_DATA_H
// LOVE
#include <filesystem/File.h>
#include "Decoder.h"
namespace love
{
namespace sound
{
class SoundData : public love::Data
{
private:
char * data;
int size;
int sampleRate;
int bits;
int channels;
public:
SoundData(Decoder * decoder);
SoundData(int samples, int sampleRate, int bits, int channels);
virtual ~SoundData();
// Implements Data.
void * getData() const;
int getSize() const;
int getChannels() const;
int getBits() const;
int getSampleRate() const;
void setSample(int i, float sample);
float getSample(int i) const;
}; // SoundData
} // sound
} // love
#endif // LOVE_SOUND_SOUND_DATA_H
| [
"prerude@3494dbca-881a-0410-bd34-8ecbaf855390"
]
| [
[
[
1,
67
]
]
]
|
ade10caf0fa85019c64bc54a10c056996a71f558 | 35231241243cb13bd3187983d224e827bb693df3 | /cgpsmapper/MPReader/db_create.h | f1768db7d8d6bc6c702bfa696582d4b45b549e66 | []
| no_license | casaretto/cgpsmapper | b597aa2775cc112bf98732b182a9bc798c3dd967 | 76d90513514188ef82f4d869fc23781d6253f0ba | refs/heads/master | 2021-05-15T01:42:47.532459 | 2011-06-25T23:16:34 | 2011-06-25T23:16:34 | 1,943,334 | 2 | 2 | null | 2019-06-11T00:26:40 | 2011-06-23T18:31:36 | C++ | UTF-8 | C++ | false | false | 688 | h | #ifndef __MP_DB_CREATE
#define __MP_DB_CREATE
#include <string>
#include "typeTranslation.h"
#include ".\..\sqlite-source\sqlite3.h"
#include "mp_types.h"
#include "mp_process.h"
#include "wx\wx.h"
#include "wx\tokenzr.h"
class DBCreate {
private:
sqlite3 *MPbase;
bool _constructor_error;
public:
DBCreate::DBCreate(const char* _databaseName);
~DBCreate();
bool constructorError() { return _constructor_error; };
//utworzenie czesci bazy odpowiadajacej za przechowywanie danych wejsciowych
void createInputDB();
//baza musi juz istniec, tworzy tabele konieczne do przetwarzania do IMG
void createProcessDB();
sqlite3* getDB();
};
#endif | [
"cgpsmapper@ad713ecf-6e55-4363-b790-59b81426eeec"
]
| [
[
[
1,
32
]
]
]
|
fc3353c6e9b7158a9369fbd3b4f687a23c18b91b | 994d3e64acd5dd5b325b8f11cdd4ea4c159e8087 | /LoveTest/src/UVi_begin.cpp | baaeac5bc07554863f291f37cf7896dd3d8457ca | []
| no_license | csyfek/sdl-sparks | 56a3e9ee4f5dfb7fb2b6d3e505db07f96600242d | 390e799eec008d3b726dc489fc7626b474f81a1f | refs/heads/master | 2020-04-19T05:33:21.575362 | 2010-06-21T04:35:55 | 2010-06-21T04:35:55 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 12,482 | cpp | #include "UVi_begin.h"
void UVi_begin(const ScreenSurface& screen)
{
const int BEGIN_X = 50;
const int BEGIN_Y = 150;
screen.fillColor();
screen.flip();
SDL_Event gameEvent;
int flashCtrl = 0;
bool flash = true;
for ( int i = 0; i < 600; i++){
while ( SDL_PollEvent(&gameEvent) != 0 ){
if ( gameEvent.type == SDL_KEYDOWN ){
return;
}
if ( gameEvent.type == SDL_MOUSEBUTTONDOWN ){
return;
}
}
screen.fillColor();
int size = 150-i;
if ( size <= 80 )
size = 80;
int x = BEGIN_X+i;
if ( x >= 150 )
x = 150;
int y = BEGIN_Y+i;
if ( y >= 180 )
y = 180;
StringData bText("Common");
TextSurface UVi_logo("UVi Soft", screen, 215, 195, 122, size);
TextSurface begin(bText[10], screen, 215, 195, 122);
UVi_logo.blit(x, y);
if ( flashCtrl == 0 )
flash = true;
if ( flashCtrl == 30 )
flash = false;
if ( size == 80 && x == 150 && y == 180 ){
if ( flash == true ){
begin.blit(200, 400);
flashCtrl++;
}
else {
flashCtrl--;
}
}
screen.flip();
}
return;
}
bool title_loop_quit(const ScreenSurface& screen)
{
SDL_Event gameEvent;
StringData myText("Common");
PictureSurface bg("./images/h3_bg.png", screen);
TextSurface gameTitle(myText[6], screen, 215, 195, 122, 50);
TextSurface copyright(myText[7], screen, 215, 195, 122);
const int centre_x = (screen.point()->w) / 2;
const int title_x = centre_x - (gameTitle.point()->w / 2);
const int title_y = 150;
const int copyright_x = centre_x - (copyright.point()->w /2);
const int copyright_y = 420;
const int button_x = centre_x - (120/2);
const int button_y = 300;
const int version_x = 20;
const int version_y = 20;
Button beginButton("./images/begin_button_off.png", "./images/begin_button_over.png", screen);
beginButton.setup(button_x, button_y, 5);
TextSurface beginTextOff(myText[8], screen, 185, 165, 97);
TextSurface beginTextOver(myText[8], screen, 215, 195, 122);
beginButton.addText(beginTextOff, beginTextOver);
TextSurface version("Version 1.04.1", screen, 215, 195, 122, 20);
version.toSolid();
bg.blit(0);
gameTitle.blit(title_x, title_y);
copyright.blit(copyright_x,copyright_y);
beginButton.blitOut();
version.blit(version_x, version_y);
screen.flip();
while( true ){
while ( SDL_PollEvent(&gameEvent) != 0 ){
if ( gameEvent.type == SDL_QUIT ){
if ( quit_dialog(screen) == true ){
return true;
}
}
if ( gameEvent.type == SDL_KEYDOWN ){
if ( gameEvent.key.keysym.sym == SDLK_ESCAPE ){
if ( quit_dialog(screen) == true ){
return true;
}
}
}
//beginButton.getEvent(gameEvent);
bg.blit(0);
gameTitle.blit(title_x, title_y);
copyright.blit(copyright_x,copyright_y);
version.blit(version_x, version_y);
if ( beginButton.effectiveClick(gameEvent) == true )
return false;
screen.flip();
}
SDL_Delay(10);
}
}
bool show_result_quit(const std::vector<char>& result, const ScreenSurface& screen)
{
//there are 8 questions and 8 answers.
StringData aText("Result");
const int SIZE = 18;
std::vector<TextSurface> answers;
//1;
answers.push_back(TextSurface (aText[0], screen, 200, 200, 200, SIZE));
if ( result[0] == 'a' ){
answers.push_back(TextSurface(aText[1], screen, 215, 195, 122, SIZE));
answers.push_back(TextSurface(aText[2], screen, 215, 195, 122, SIZE));
}
else if ( result[0] == 'b' ){
answers.push_back(TextSurface(aText[3], screen, 215, 195, 122, SIZE));
answers.push_back(TextSurface(aText[4], screen, 215, 195, 122, SIZE));
}
else if ( result[0] == 'c' ){
answers.push_back(TextSurface(aText[5], screen, 215, 195, 122, SIZE));
answers.push_back(TextSurface(aText[6], screen, 215, 195, 122, SIZE));
}
else if ( result[0] == 'd' ){
answers.push_back(TextSurface(aText[7], screen, 215, 195, 122, SIZE));
answers.push_back(TextSurface(aText[8], screen, 215, 195, 122, SIZE));
}
//2
answers.push_back(TextSurface (aText[9], screen, 200, 200, 200, SIZE));
if ( result[1] == 'a' ){
answers.push_back(TextSurface(aText[10], screen, 215, 195, 122, SIZE));
answers.push_back(TextSurface(aText[11], screen, 215, 195, 122, SIZE));
}
else if ( result[1] == 'b' ){
answers.push_back(TextSurface(aText[12], screen, 215, 195, 122, SIZE));
answers.push_back(TextSurface(aText[13], screen, 215, 195, 122, SIZE));
}
else if ( result[1] == 'c' ){
answers.push_back(TextSurface(aText[14], screen, 215, 195, 122, SIZE));
answers.push_back(TextSurface(aText[15], screen, 215, 195, 122, SIZE));
}
else if ( result[1] == 'd' ){
answers.push_back(TextSurface(aText[16], screen, 215, 195, 122, SIZE));
answers.push_back(TextSurface(aText[17], screen, 215, 195, 122, SIZE));
}
//3
answers.push_back(TextSurface (aText[18], screen, 200, 200, 200, SIZE));
if ( result[2] == 'a' ){
answers.push_back(TextSurface(aText[19], screen, 215, 195, 122, SIZE));
answers.push_back(TextSurface(aText[20], screen, 215, 195, 122, SIZE));
}
else if ( result[2] == 'b' ){
answers.push_back(TextSurface(aText[21], screen, 215, 195, 122, SIZE));
answers.push_back(TextSurface(aText[22], screen, 215, 195, 122, SIZE));
}
else if ( result[2] == 'c' ){
answers.push_back(TextSurface(aText[23], screen, 215, 195, 122, SIZE));
answers.push_back(TextSurface(aText[24], screen, 215, 195, 122, SIZE));
}
else if ( result[2] == 'd' ){
answers.push_back(TextSurface(aText[25], screen, 215, 195, 122, SIZE));
answers.push_back(TextSurface(aText[26], screen, 215, 195, 122, SIZE));
}
//4
answers.push_back(TextSurface (aText[27], screen, 200, 200, 200, SIZE));
if ( result[3] == 'a' ){
answers.push_back(TextSurface(aText[28], screen, 215, 195, 122, SIZE));
answers.push_back(TextSurface(aText[29], screen, 215, 195, 122, SIZE));
}
else if ( result[3] == 'b' ){
answers.push_back(TextSurface(aText[30], screen, 215, 195, 122, SIZE));
answers.push_back(TextSurface(aText[31], screen, 215, 195, 122, SIZE));
}
else if ( result[3] == 'c' ){
answers.push_back(TextSurface(aText[32], screen, 215, 195, 122, SIZE));
answers.push_back(TextSurface(aText[33], screen, 215, 195, 122, SIZE));
}
else if ( result[3] == 'd' ){
answers.push_back(TextSurface(aText[34], screen, 215, 195, 122, SIZE));
answers.push_back(TextSurface(aText[35], screen, 215, 195, 122, SIZE));
}
//5
answers.push_back(TextSurface(aText[36], screen, 200, 200, 200, SIZE));
if ( result[4] == 'a' ){
answers.push_back(TextSurface(aText[37], screen, 215, 195, 122, SIZE));
answers.push_back(TextSurface(aText[38], screen, 215, 195, 122, SIZE));
}
else if ( result[4] == 'b' ){
answers.push_back(TextSurface(aText[39], screen, 215, 195, 122, SIZE));
answers.push_back(TextSurface(aText[40], screen, 215, 195, 122, SIZE));
}
else if ( result[4] == 'c' ){
answers.push_back(TextSurface(aText[41], screen, 215, 195, 122, SIZE));
answers.push_back(TextSurface(aText[42], screen, 215, 195, 122, SIZE));
}
else if ( result[4] == 'd' ){
answers.push_back(TextSurface(aText[43], screen, 215, 195, 122, SIZE));
answers.push_back(TextSurface(aText[44], screen, 215, 195, 122, SIZE));
}
//6
answers.push_back(TextSurface(aText[45], screen, 200, 200, 200, SIZE));
if ( result[5] == 'a' ){
answers.push_back(TextSurface(aText[46], screen, 215, 195, 122, SIZE));
answers.push_back(TextSurface(aText[47], screen, 215, 195, 122, SIZE));
}
else if ( result[5] == 'b' ){
answers.push_back(TextSurface(aText[48], screen, 215, 195, 122, SIZE));
answers.push_back(TextSurface(aText[49], screen, 215, 195, 122, SIZE));
}
else if ( result[5] == 'c' ){
answers.push_back(TextSurface(aText[50], screen, 215, 195, 122, SIZE));
answers.push_back(TextSurface(aText[51], screen, 215, 195, 122, SIZE));
}
else if ( result[5] == 'd' ){
answers.push_back(TextSurface(aText[52], screen, 215, 195, 122, SIZE));
answers.push_back(TextSurface(aText[53], screen, 215, 195, 122, SIZE));
}
//7
answers.push_back(TextSurface(aText[54], screen, 200, 200, 200, SIZE));
if ( result[6] == 'a' ){
answers.push_back(TextSurface(aText[55], screen, 215, 195, 122, SIZE));
answers.push_back(TextSurface(aText[56], screen, 215, 195, 122, SIZE));
}
else if ( result[6] == 'b' ){
answers.push_back(TextSurface(aText[57], screen, 215, 195, 122, SIZE));
answers.push_back(TextSurface(aText[58], screen, 215, 195, 122, SIZE));
}
else if ( result[6] == 'c' ){
answers.push_back(TextSurface(aText[59], screen, 215, 195, 122, SIZE));
answers.push_back(TextSurface(aText[60], screen, 215, 195, 122, SIZE));
}
else if ( result[6] == 'd' ){
answers.push_back(TextSurface(aText[61], screen, 215, 195, 122, SIZE));
answers.push_back(TextSurface(aText[62], screen, 215, 195, 122, SIZE));
}
//8
answers.push_back(TextSurface(aText[63], screen, 200, 200, 200, SIZE));
if ( result[7] == 'a' ){
answers.push_back(TextSurface(aText[64], screen, 215, 195, 122, SIZE));
answers.push_back(TextSurface(aText[65], screen, 215, 195, 122, SIZE));
}
else if ( result[7] == 'b' ){
answers.push_back(TextSurface(aText[66], screen, 215, 195, 122, SIZE));
answers.push_back(TextSurface(aText[67], screen, 215, 195, 122, SIZE));
}
else if ( result[7] == 'c' ){
answers.push_back(TextSurface(aText[68], screen, 215, 195, 122, SIZE));
answers.push_back(TextSurface(aText[69], screen, 215, 195, 122, SIZE));
}
else if ( result[7] == 'd' ){
answers.push_back(TextSurface(aText[70], screen, 215, 195, 122, SIZE));
answers.push_back(TextSurface(aText[71], screen, 215, 195, 122, SIZE));
}
//
PictureSurface resultBG("./images/h3_bg.png", screen);
const int X = 30;
const int DELTA = 16;
const int LINE_NUM = 24;
int y[LINE_NUM];
for ( int i = 0; i < LINE_NUM; i++ )
y[i] = 20 + (DELTA * i);
resultBG.blit(0);
for ( int i = 0; i < LINE_NUM; i++ ){
answers[i].blit(X, y[i]);
}
screen.flip();
const int LB_X = 160 - 60;
const int RB_X = 160*3 - 60;
const int B_Y = 410;
Button restartButton("./images/begin_button_off.png", "./images/begin_button_over.png", screen);
Button endButton("./images/begin_button_off.png", "./images/begin_button_over.png", screen);
restartButton.setup(LB_X, B_Y, 5);
endButton.setup(RB_X, B_Y, 5);
TextSurface re_off(aText[72], screen, 185, 165, 92);
TextSurface re_over(aText[72], screen, 215, 195, 122);
TextSurface end_off(aText[73], screen, 185, 165, 92);
TextSurface end_over(aText[73], screen, 215, 195, 122);
restartButton.addText(re_off, re_over);
endButton.addText(end_off, end_over);
restartButton.blitOut();
endButton.blitOut();
screen.flip();
SDL_Event gameEvent;
while ( true ){
while ( SDL_PollEvent(&gameEvent) != 0 ){
if ( gameEvent.type == SDL_QUIT ){
return true;
}
if ( gameEvent.type == SDL_KEYDOWN ){
if ( gameEvent.key.keysym.sym == SDLK_ESCAPE ){
return true;
}
}
resultBG.blit(10, 410, 10, 410, 620, 70);
if ( restartButton.effectiveClick(gameEvent) == true ){
return false;
}
if ( endButton.effectiveClick(gameEvent) == true ){
return true;
}
screen.flip();
}
SDL_Delay(10);
}
}
void end_show(const ScreenSurface& screen)
{
StringData endText("End");
PictureSurface endBG("./images/h3_bg.png", screen);
TextSurface line0(endText[0], screen, 215, 195, 122, 40);
TextSurface line1(endText[1], screen, 215, 195, 122);
TextSurface line2(endText[2], screen, 215, 195, 122);
TextSurface line3(endText[3], screen, 215, 195, 122);
TextSurface line4(endText[4], screen, 215, 195, 122);
TextSurface line5(endText[5], screen, 215, 195, 122);
TextSurface line6(endText[6], screen, 215, 195, 122);
endBG.blit(0);
line0.blit(50,50);
line1.blit(50,100);
line2.blit(50,140);
line3.blit(50,180);
line4.blit(50,220);
line5.blit(50,260);
line6.blit(50,300);
screen.flip();
SDL_Event gameEvent;
for ( int i = 0; i < 505; i++ ){
while ( SDL_PollEvent(&gameEvent) != 0 ){
if ( gameEvent.type == SDL_QUIT ){
return;
}
if ( gameEvent.type == SDL_KEYDOWN ){
return;
}
if ( gameEvent.type == SDL_MOUSEBUTTONDOWN ){
return;
}
}
show_loading(i/5, endBG, screen);
}
return;
}
| [
"s3e(at)gmail.com@localhost"
]
| [
[
[
1,
375
]
]
]
|
77de60c555b1403c542075d2694ff8d15615948a | 2ca3ad74c1b5416b2748353d23710eed63539bb0 | /Src/Lokapala/Operator/RuleDataDTO.cpp | a6d6f6fe3ca6f4fc7fe46b01428f8f1b951e8a13 | []
| no_license | sjp38/lokapala | 5ced19e534bd7067aeace0b38ee80b87dfc7faed | dfa51d28845815cfccd39941c802faaec9233a6e | refs/heads/master | 2021-01-15T16:10:23.884841 | 2009-06-03T14:56:50 | 2009-06-03T14:56:50 | 32,124,140 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 979 | cpp | /**@file RuleDataDTO.cpp
* @brief CRuleDataDTO 클래스의 멤버함수를 구현한다.
* @author siva
*/
#include "stdafx.h"
#include "RuleDataDTO.h"
/**@brief 생성자. */
CRuleDataDTO::CRuleDataDTO(CString a_processName, CString a_caption,
CString a_targetSeatId, CString a_targetUserId, int a_targetLevel,
Reactions a_reaction, CString a_reactionArgument)
{
m_processName = a_processName;
m_caption = a_caption;
m_targetSeatId = a_targetSeatId;
m_targetUserId = a_targetUserId;
m_targetLevel = a_targetLevel;
m_reaction = a_reaction;
m_reactionArgument = a_reactionArgument;
}
/**@brief RulesData 에서 프로세스 이름만 가지고 룰을 검색하고자 룰을 만들 때의 생성자.
*/
CRuleDataDTO::CRuleDataDTO(CString a_processName)
{
m_processName = a_processName;
m_caption = _T("");
m_targetSeatId = _T("");
m_targetUserId = _T("");
m_reaction = WARN;
m_reactionArgument = _T("");
}
| [
"nilakantha38@b9e76448-5c52-0410-ae0e-a5aea8c5d16c"
]
| [
[
[
1,
33
]
]
]
|
1c82edb435f839f3eb192ebb321ff47c70ecf271 | 96e96a73920734376fd5c90eb8979509a2da25c0 | /C3DE/Shape.h | 9498b995fb013e50ff2bcdf7da3518e05c72f81c | []
| no_license | lianlab/c3de | 9be416cfbf44f106e2393f60a32c1bcd22aa852d | a2a6625549552806562901a9fdc083c2cacc19de | refs/heads/master | 2020-04-29T18:07:16.973449 | 2009-11-15T10:49:36 | 2009-11-15T10:49:36 | 32,124,547 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 106 | h | #ifndef SHAPE_H
#define SHAPE_H
class Shape
{
public:
Shape();
virtual ~Shape() = 0;
};
#endif | [
"caiocsabino@7e2be596-0d54-0410-9f9d-cf4183935158"
]
| [
[
[
1,
10
]
]
]
|
236acfdc43a164eabe6c988a6dafba9dd9ecca27 | d7320c9c1f155e2499afa066d159bfa6aa94b432 | /ghostgproxy/game.h | 1a6845f6f73375a2fe3e9bb79b76c6dfebfa3bb7 | []
| no_license | HOST-PYLOS/ghostnordicleague | c44c804cb1b912584db3dc4bb811f29f3761a458 | 9cb262d8005dda0150b75d34b95961d664b1b100 | refs/heads/master | 2016-09-05T10:06:54.279724 | 2011-02-23T08:02:50 | 2011-02-23T08:02:50 | 32,241,503 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 3,090 | h | /*
Copyright [2008] [Trevor Hogan]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
CODE PORTED FROM THE ORIGINAL GHOST PROJECT: http://ghost.pwner.org/
*/
#ifndef GAME_H
#define GAME_H
//
// CGame
//
class CDBBan;
class CDBGame;
class CDBGamePlayer;
class CStats;
class CCallableBanCheck;
class CCallableBanAdd;
class CCallableGameAdd;
class CCallableGamePlayerSummaryCheck;
class CCallableDotAPlayerSummaryCheck;
class CCallableSaveReplay;
typedef pair<string,CCallableBanCheck *> PairedBanCheck;
typedef pair<string,CCallableBanAdd *> PairedBanAdd;
typedef pair<string,CCallableGamePlayerSummaryCheck *> PairedGPSCheck;
typedef pair<string,CCallableDotAPlayerSummaryCheck *> PairedDPSCheck;
class CGame : public CBaseGame
{
protected:
CDBBan *m_DBBanLast; // last ban for the !banlast command - this is a pointer to one of the items in m_DBBans
vector<CDBBan *> m_DBBans; // vector of potential ban data for the database (see the Update function for more info, it's not as straightforward as you might think)
CDBGame *m_DBGame; // potential game data for the database
vector<CDBGamePlayer *> m_DBGamePlayers; // vector of potential gameplayer data for the database
CStats *m_Stats; // class to keep track of game stats such as kills/deaths/assists in dota
CCallableGameAdd *m_CallableGameAdd; // threaded database game addition in progress
CCallableSaveReplay *m_CallableReplaySave; // threaded replay save in progress
vector<PairedBanCheck> m_PairedBanChecks; // vector of paired threaded database ban checks in progress
vector<PairedBanAdd> m_PairedBanAdds; // vector of paired threaded database ban adds in progress
vector<PairedGPSCheck> m_PairedGPSChecks; // vector of paired threaded database game player summary checks in progress
vector<PairedDPSCheck> m_PairedDPSChecks; // vector of paired threaded database DotA player summary checks in progress
public:
CGame( CGHost *nGHost, CMap *nMap, CSaveGame *nSaveGame, uint16_t nHostPort, unsigned char nGameState, string nGameName, string nOwnerName, string nCreatorName, string nCreatorServer );
virtual ~CGame( );
virtual bool Update( void *fd, void *send_fd );
virtual void EventPlayerDeleted( CGamePlayer *player );
virtual void EventPlayerAction( CGamePlayer *player, CIncomingAction *action );
virtual bool EventPlayerBotCommand( CGamePlayer *player, string command, string payload );
virtual void EventGameStarted( );
virtual bool IsGameDataSaved( );
virtual void SaveGameData( );
};
#endif
| [
"fredrik.sigillet@4a4c9648-eef2-11de-9456-cf00f3bddd4e",
"[email protected]@4a4c9648-eef2-11de-9456-cf00f3bddd4e"
]
| [
[
[
1,
36
],
[
38,
52
],
[
54,
72
]
],
[
[
37,
37
],
[
53,
53
]
]
]
|
6a393a2deb915dec62beecd5a2ee2719009b5402 | 6bdb3508ed5a220c0d11193df174d8c215eb1fce | /Codes/Halak/Vector2RangeSequence.cpp | 285cdd43dabf96a6e6dabd3e459e8ff7743ce3f3 | []
| no_license | halak/halak-plusplus | d09ba78640c36c42c30343fb10572c37197cfa46 | fea02a5ae52c09ff9da1a491059082a34191cd64 | refs/heads/master | 2020-07-14T09:57:49.519431 | 2011-07-09T14:48:07 | 2011-07-09T14:48:07 | 66,716,624 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,414 | cpp | #include <Halak/PCH.h>
#include <Halak/Vector2RangeSequence.h>
#include <Halak/SequenceTemplate.h>
namespace Halak
{
Vector2RangeKeyframe::Vector2RangeKeyframe()
: Value(Vector2::Zero, Vector2::Zero),
Duration(0.0f),
StartTime(0.0f)
{
}
Vector2RangeKeyframe::Vector2RangeKeyframe(ValueType value, float duration)
: Value(value),
Duration(duration),
StartTime(0.0f)
{
}
////////////////////////////////////////////////////////////////////////////////////////////////////
Vector2RangeSequence::Vector2RangeSequence()
: s(new SequenceTemplate<KeyframeType>())
{
}
Vector2RangeSequence::~Vector2RangeSequence()
{
delete s;
}
void Vector2RangeSequence::AddKeyframe(const KeyframeType& item)
{
s->AddKeyframe(item);
}
void Vector2RangeSequence::InsertKeyframe(int index, const KeyframeType& item)
{
s->InsertKeyframe(index, item);
}
void Vector2RangeSequence::InsertKeyframe(float time, const KeyframeType& item)
{
s->InsertKeyframe(time, item);
}
void Vector2RangeSequence::RemoveKeyframe(int index)
{
s->RemoveKeyframe(index);
}
void Vector2RangeSequence::RemoveKeyframe(float time)
{
s->RemoveKeyframe(time);
}
void Vector2RangeSequence::RemoveAllKeyframes()
{
s->RemoveAllKeyframes();
}
int Vector2RangeSequence::GetNumberOfKeyframes()
{
return s->GetNumberOfKeyframes();
}
const Vector2RangeSequence::KeyframeType& Vector2RangeSequence::GetKeyframe(int index)
{
return s->GetKeyframe(index);
}
const Vector2RangeSequence::KeyframeType& Vector2RangeSequence::GetKeyframe(float time)
{
return s->GetKeyframe(time);
}
int Vector2RangeSequence::GetKeyframeIndex(float time)
{
return s->GetKeyframeIndex(time);
}
int Vector2RangeSequence::GetKeyframeIndex(float time, int startIndex)
{
return s->GetKeyframeIndex(time, startIndex);
}
void Vector2RangeSequence::SetKeyframe(int index, const KeyframeType& item)
{
return s->SetKeyframe(index, item);
}
float Vector2RangeSequence::GetDuration()
{
return s->GetDuration();
}
} | [
"[email protected]"
]
| [
[
[
1,
97
]
]
]
|
5c1f3e09ffefb13ae9b9e3234517d44c0187711b | 138a353006eb1376668037fcdfbafc05450aa413 | /source/ogre/OgreNewt/boost/mpl/insert.hpp | e8b5a0e51ae4c1a641ad4be8a26ae68b54cc9479 | []
| no_license | sonicma7/choreopower | 107ed0a5f2eb5fa9e47378702469b77554e44746 | 1480a8f9512531665695b46dcfdde3f689888053 | refs/heads/master | 2020-05-16T20:53:11.590126 | 2009-11-18T03:10:12 | 2009-11-18T03:10:12 | 32,246,184 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,180 | hpp |
#ifndef BOOST_MPL_INSERT_HPP_INCLUDED
#define BOOST_MPL_INSERT_HPP_INCLUDED
// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Source: /cvsroot/ogre/ogreaddons/ogrenewt/OgreNewt_Main/inc/boost/mpl/insert.hpp,v $
// $Date: 2006/04/17 23:48:05 $
// $Revision: 1.1 $
#include <boost/mpl/insert_fwd.hpp>
#include <boost/mpl/sequence_tag.hpp>
#include <boost/mpl/aux_/insert_impl.hpp>
#include <boost/mpl/aux_/na_spec.hpp>
#include <boost/mpl/aux_/lambda_support.hpp>
namespace boost { namespace mpl {
template<
typename BOOST_MPL_AUX_NA_PARAM(Sequence)
, typename BOOST_MPL_AUX_NA_PARAM(Pos_or_T)
, typename BOOST_MPL_AUX_NA_PARAM(T)
>
struct insert
: insert_impl< typename sequence_tag<Sequence>::type >
::template apply< Sequence,Pos_or_T,T >
{
BOOST_MPL_AUX_LAMBDA_SUPPORT(3,insert,(Sequence,Pos_or_T,T))
};
BOOST_MPL_AUX_NA_SPEC(3, insert)
}}
#endif // BOOST_MPL_INSERT_HPP_INCLUDED
| [
"Sonicma7@0822fb10-d3c0-11de-a505-35228575a32e"
]
| [
[
[
1,
41
]
]
]
|
2b050518e1ee8d54be826d47d954d24fce336b9e | 39d36b98402c4ad75aadee357295b92b2f0c0d3d | /src/fceu/netplay.cpp | 503c03226c8ee62e67201a8dcb707e7887e37859 | []
| no_license | xxsl/fceux-ps3 | 9eda7c1ee49e69f14b695ddda904b1cc3a79d51a | dc0674a4b8e8c52af6969c8d59330c072486107c | refs/heads/master | 2021-01-20T04:26:05.430450 | 2011-01-02T21:22:47 | 2011-01-02T21:22:47 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,470 | cpp | /* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
//#include <unistd.h> //mbg merge 7/17/06 removed
#include <zlib.h>
#ifdef GEKKO
extern FILE* tmpfile();
#include <alloca.h>
#endif
#include "types.h"
#include "file.h"
#include "utils/endian.h"
#include "netplay.h"
#include "fceu.h"
#include "state.h"
#include "cheat.h"
#include "input.h"
#include "driver.h"
#include "utils/memory.h"
int FCEUnetplay=0;
static uint8 netjoy[4]; // Controller cache.
static int numlocal;
static int netdivisor;
static int netdcount;
//NetError should only be called after a FCEUD_*Data function returned 0, in the function
//that called FCEUD_*Data, to prevent it from being called twice.
static void NetError(void)
{
FCEU_DispMessage("Network error/connection lost!",0);
FCEUD_NetworkClose();
}
void FCEUI_NetplayStop(void)
{
if(FCEUnetplay)
{
FCEUnetplay = 0;
FCEU_FlushGameCheats(0,1); //Don't save netplay cheats.
FCEU_LoadGameCheats(0); //Reload our original cheats.
}
else puts("Check your code!");
}
int FCEUI_NetplayStart(int nlocal, int divisor)
{
FCEU_FlushGameCheats(0, 0); //Save our pre-netplay cheats.
FCEU_LoadGameCheats(0); // Load them again, for pre-multiplayer action.
FCEUnetplay = 1;
memset(netjoy,0,sizeof(netjoy));
numlocal = nlocal;
netdivisor = divisor;
netdcount = 0;
return(1);
}
int FCEUNET_SendCommand(uint8 cmd, uint32 len)
{
//mbg merge 7/17/06 changed to alloca
//uint8 buf[numlocal + 1 + 4];
uint8 *buf = (uint8*)alloca(numlocal+1+4);
buf[0] = 0xFF;
FCEU_en32lsb(&buf[numlocal], len);
buf[numlocal + 4] = cmd;
if(!FCEUD_SendData(buf,numlocal + 1 + 4))
{
NetError();
return(0);
}
return(1);
}
void FCEUI_NetplayText(uint8 *text)
{
uint32 len;
len = strlen((char*)text); //mbg merge 7/17/06 added cast
if(!FCEUNET_SendCommand(FCEUNPCMD_TEXT,len)) return;
if(!FCEUD_SendData(text,len))
NetError();
}
int FCEUNET_SendFile(uint8 cmd, char *fn)
{
uint32 len;
uLongf clen;
char *buf, *cbuf;
FILE *fp;
struct stat sb;
if(!(fp=FCEUD_UTF8fopen(fn,"rb"))) return(0);
fstat(fileno(fp),&sb);
len = sb.st_size;
buf = (char*)FCEU_dmalloc(len); //mbg merge 7/17/06 added cast
fread(buf, 1, len, fp);
fclose(fp);
cbuf = (char*)FCEU_dmalloc(4 + len + len / 1000 + 12); //mbg merge 7/17/06 added cast
FCEU_en32lsb((uint8*)cbuf, len); //mbg merge 7/17/06 added cast
compress2((uint8*)cbuf + 4, &clen, (uint8*)buf, len, 7); //mbg merge 7/17/06 added casts
free(buf);
//printf("Sending file: %s, %d, %d\n",fn,len,clen);
len = clen + 4;
if(!FCEUNET_SendCommand(cmd,len))
{
free(cbuf);
return(0);
}
if(!FCEUD_SendData(cbuf, len))
{
NetError();
free(cbuf);
return(0);
}
free(cbuf);
return(1);
}
static FILE *FetchFile(uint32 remlen)
{
uint32 clen = remlen;
char *cbuf;
uLongf len;
char *buf;
FILE *fp;
if(clen > 500000) // Sanity check
{
NetError();
return(0);
}
//printf("Receiving file: %d...\n",clen);
if((fp = tmpfile()))
{
cbuf = (char *)FCEU_dmalloc(clen); //mbg merge 7/17/06 added cast
if(!FCEUD_RecvData(cbuf, clen))
{
NetError();
fclose(fp);
free(cbuf);
return(0);
}
len = FCEU_de32lsb((uint8*)cbuf); //mbg merge 7/17/06 added cast
if(len > 500000) // Another sanity check
{
NetError();
fclose(fp);
free(cbuf);
return(0);
}
buf = (char *)FCEU_dmalloc(len); //mbg merge 7/17/06 added cast
uncompress((uint8*)buf, &len, (uint8*)cbuf + 4, clen - 4); //mbg merge 7/17/06 added casts
fwrite(buf, 1, len, fp);
free(buf);
fseek(fp, 0, SEEK_SET);
return(fp);
}
return(0);
}
void NetplayUpdate(uint8 *joyp)
{
static uint8 buf[5]; /* 4 play states, + command/extra byte */
static uint8 joypb[4];
memcpy(joypb,joyp,4);
/* This shouldn't happen, but just in case. 0xFF is used as a command escape elsewhere. */
if(joypb[0] == 0xFF)
joypb[0] = 0xF;
if(!netdcount)
if(!FCEUD_SendData(joypb,numlocal))
{
NetError();
return;
}
if(!netdcount)
{
do
{
if(!FCEUD_RecvData(buf,5))
{
NetError();
return;
}
switch(buf[4])
{
default: FCEU_DoSimpleCommand(buf[4]);break;
case FCEUNPCMD_TEXT:
{
uint8 *tbuf;
uint32 len = FCEU_de32lsb(buf);
if(len > 100000) // Insanity check!
{
NetError();
return;
}
tbuf = (uint8*)malloc(len + 1); //mbg merge 7/17/06 added cast
tbuf[len] = 0;
if(!FCEUD_RecvData(tbuf, len))
{
NetError();
free(tbuf);
return;
}
FCEUD_NetplayText(tbuf);
free(tbuf);
}
break;
case FCEUNPCMD_SAVESTATE:
{
//mbg todo netplay
//char *fn;
//FILE *fp;
////Send the cheats first, then the save state, since
////there might be a frame or two in between the two sendfile
////commands on the server side.
//fn = strdup(FCEU_MakeFName(FCEUMKF_CHEAT,0,0).c_str());
////why??????
////if(!
// FCEUNET_SendFile(FCEUNPCMD_LOADCHEATS,fn);
//// {
//// free(fn);
//// return;
//// }
//free(fn);
//if(!FCEUnetplay) return;
//fn = strdup(FCEU_MakeFName(FCEUMKF_NPTEMP,0,0).c_str());
//fp = fopen(fn, "wb");
//if(FCEUSS_SaveFP(fp,Z_BEST_COMPRESSION))
//{
// fclose(fp);
// if(!FCEUNET_SendFile(FCEUNPCMD_LOADSTATE, fn))
// {
// unlink(fn);
// free(fn);
// return;
// }
// unlink(fn);
// free(fn);
//}
//else
//{
// fclose(fp);
// FCEUD_PrintError("File error. (K)ill, (M)aim, (D)estroy? Now!");
// unlink(fn);
// free(fn);
// return;
//}
}
break;
case FCEUNPCMD_LOADCHEATS:
{
FILE *fp = FetchFile(FCEU_de32lsb(buf));
if(!fp) return;
FCEU_FlushGameCheats(0,1);
FCEU_LoadGameCheats(fp);
}
break;
//mbg 6/16/08 - netplay doesnt work right now anyway
/*case FCEUNPCMD_LOADSTATE:
{
FILE *fp = FetchFile(FCEU_de32lsb(buf));
if(!fp) return;
if(FCEUSS_LoadFP(fp,SSLOADPARAM_BACKUP))
{
fclose(fp);
FCEU_DispMessage("Remote state loaded.",0);
} else FCEUD_PrintError("File error. (K)ill, (M)aim, (D)estroy?");
}
break;*/
}
} while(buf[4]);
netdcount=(netdcount+1)%netdivisor;
memcpy(netjoy,buf,4);
*(uint32 *)joyp=*(uint32 *)netjoy;
}
}
| [
"[email protected]"
]
| [
[
[
1,
331
]
]
]
|
bc94ae9a7e50fcf91e99afddfd3eba8c56fae7b8 | 5efdf4f304c39c1aa8a24ab5a9690afad3340c00 | /src/HockeyData.h | 7cc526a5a7d04d0b9edb08b302a270df5beeb7a5 | []
| no_license | asquared/hockeyboard | 286f57d8bea282e74425cbe77d915d692398f722 | 06480cb228dcd6d4792964837e20a1dddea89d1b | refs/heads/master | 2016-09-06T11:16:20.947224 | 2011-01-09T21:23:16 | 2011-01-09T21:23:16 | 1,236,086 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,072 | h | #ifndef _hockeydata_h_
#define _hockeydata_h_
/* needs to come first so winsock2.h comes first... stupid MSFT */
#include "SyncSocket.h"
#include "FreeType.h"
#include "HockeyRoster.h"
#include "Mclock.h"
#include "serialsync.h"
#include <string>
#include <sstream>
#ifdef _MSC_VER
#define snprintf _snprintf // stupid Microsoft
#endif
// default period length is 20 min
//const int PERLEN = 20 * 60 * 1000;
// intermission length is 12 min
//const int INTLEN = 12 * 60 * 1000;
const int FINAL = 0x7f;
// penalty timer queue length
#ifdef LAX
#define ACTIVE_QUEUE 3
#define Q_LEN 30000 // 30 seconds
#else
#define ACTIVE_QUEUE 2
#define Q_LEN 60000 // 1 minute
#endif
const int MAX_QUEUE = 16;
// text translation functions
string int2str(int i);
string getclock(int min, int sec, int tenths);
string getclock_nt(int min, int sec, int tenths);
inline void get_clock_parts(Mclock& clk, int& min, int& sec, int& tenths) {
int ms = clk.read();
if ( ms % 100 == 0 ) tenths = ms / 100;
else tenths = (ms + 100) / 100;
min = tenths / (60 * 10);
sec = (tenths / 10) % 60;
tenths %= 10;
}
// 'time' is time since start of 1st period at which the penalty ends.
// queue is all zeros if fully inactive.
class PenaltyQueue {
friend class HockeyData; // avoiding a huge mess
private:
int time[ACTIVE_QUEUE]; // time that the currently running penalty ends
unsigned short rem_m[ACTIVE_QUEUE]; // minutes left on upper/lower timer
unsigned short rem_s[ACTIVE_QUEUE]; // seconds left on upper/lower timer
unsigned short qt[ACTIVE_QUEUE]; // time queued on upper/lower timers
short qm[MAX_QUEUE]; // the (single) queue
void split_queue(); // splits queued penalties into upper/lower timers
int pop_queue(int slot, int curr, int time_mode); // pop penalty from queue, returns time, or zero if empty
int push_queue(int min); // push penalty to queue, returns position of added penalty
inline bool active() {
#ifdef LAX
return (qm[0] > 0 || qm[1] > 0 || qm[2] > 0);
#else
return (qm[0] > 0 || qm[1] > 0);
#endif
}
inline bool active(unsigned int t) {
return (t < MAX_QUEUE && qm[t] > 0);
}
inline int count() {
int out = 0;
for (int q = 0; q < MAX_QUEUE; ++q) if (qm[0] > 0) ++out;
return out;
}
};
struct TeamData {
string name; // name used next to score
string lname; // name used on info bar area
string fname; // name used on (future) slideshow feature
string rs; // name of roster used for this team
unsigned char sc;
unsigned char sog;
};
class HockeyData {
public:
//string name[2];
//string lname[2];
//string fname[2];
//unsigned char sc[2];
TeamData tm[2];
unsigned char period;
int perlen, intlen; // former constants
int otlen; // overtime length (5 or 20 min, but in ms)
int clock_last_stopped;
Mclock clock;
Mclock int_clock;
Mclock* active_clock;
Mclock red_flash_clock; // used to control red flash effect
int FLASH_LEN,
FLASH_CYC,
FLASH_OFF; // red flash timing variables
unsigned char red_flash_team;
unsigned char keymode;
bool yellow_v, yellow_h;
// sync stuff
SerialSync ssync;
SyncSocket sync_sock;
char sstat;
bool sync;
static const int SYNC_GREENLIGHT = 0;
static const int SYNC_TRANSITION = 1;
static const int SYNC_UDP = 2;
static const int SYNC_MAX = 3; /* invalid */
int sync_mode;
bool use_tenths;
int start_delay;
int stop_delay;
// new transition-based sync stuff
int sync_ignore_count;
unsigned char c_last;
bool allow_quit;
string roster_file;
RosterList* rl;
//PenaltyTimer pt[4];
PenaltyQueue pq[2];
unsigned int pt_low_index; // index of lowest of the 4 (LAX:6) timers, which is displayed
void reloadRosters();
void addPenalty(unsigned char team, unsigned char beginperiod, int begintime, int min);
//void addPenaltyToSlot(unsigned char index, unsigned char beginperiod, int begintime, int min);
void delPenalty(unsigned int team);
void delPenalty(unsigned int team, unsigned int slot);
void delLastPenalty(unsigned int team);
void setPenaltyTime(unsigned int team, unsigned int slot, int per, int time, bool start);
void adjustPenaltyTime(unsigned int team, unsigned int slot, int time);
void setRemPenaltyTime(unsigned int team, unsigned int slot, int time);
void editQueue(unsigned int team, std::string qstr);
void delPenaltyAuto();
void updatePenalty();
void getPenaltyInfo(unsigned short& vis, unsigned short& home, unsigned short& rmin, unsigned short& rsec);
void printPenalties(std::string* disp, freetype::font_data* base);
string getStringPeriod();
bool getRedFlash();
void startRedFlash(unsigned char team);
void stopRedFlash(unsigned char team);
void setppyellow();
void do_sync();
void do_sync_tr();
void do_socket_sync( );
const char *sync_mode_as_string( );
void draw_if(freetype::font_data* base);
HockeyData();
~HockeyData();
};
#endif
| [
"pymlofy@4cf78214-6c29-4fb8-b038-d2ccc4421ee9",
"armena@.(none)",
"[email protected]"
]
| [
[
[
1,
3
],
[
7,
10
],
[
12,
116
],
[
118,
119
],
[
127,
164
],
[
168,
174
]
],
[
[
4,
6
],
[
11,
11
]
],
[
[
117,
117
],
[
120,
126
],
[
165,
167
],
[
175,
175
]
]
]
|
5ccaa80f6966b272a0746cbfbd519791d10f0464 | 9aec3c531b578e307a77d639785245480986f393 | /DJFaceAPI.cpp | a2292a66aab35cca8d4907177c17e4c00884ad9d | []
| no_license | djkimgogo/epnr | 16c4d00d98d9e0ea48fadabd066f16fedb0cea41 | 8c17338d49256b0317872edf87e427838ee582e9 | refs/heads/master | 2020-12-31T01:35:43.892721 | 2009-11-19T06:46:03 | 2009-11-19T06:46:03 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,736 | cpp | // DJFaceAPI.cpp : Defines the entry point for the console application.
//
#include <stdio.h>
#include "cv.h"
#include "highgui.h"
#include "cvmser.h"
//using namespace std;
#define M_PI (3.1415926535897932384626433832795)
int main(int argc, char* argv[])
{
IplImage* img = 0;
IplImage* o_img = 0;
IplImage* t_img[10];
cvNamedWindow("Display0");
CvSeq* contours;
CvMemStorage* storage;
int i, j;
char user_str[256];
int img_no = 1;
storage = cvCreateMemStorage(0);
for (i=8; i<10; i++) {
sprintf( user_str, "C:\\myjava\\faces\\t%d.jpg", i+1 );
t_img[i] = cvLoadImage( user_str, 0 );
}
int sW, sH, sw, sh;
double tt;
while (1) {
sprintf( user_str, "c:\\myjava\\faces\\img%03d.jpg", img_no );
img = cvLoadImage( user_str, 0 );
if (!img) break;
o_img = cvCreateImage(cvSize(img->width*2,img->height),8,3);
cvSetImageROI( o_img, cvRect(0,0,img->width,img->height) );
cvMerge( img, img, img, 0, o_img );
cvResetImageROI( o_img );
uchar* rsptr = (uchar*)o_img->imageData;
IplImage* wh_img = cvCreateImage( cvSize(img->width,img->height), 8, 1 );
cvSetZero( wh_img );
cvResize( img, wh_img );
sW = wh_img->width; sH = wh_img->height;
IplImage* tt_img;
IplImage* mt_img;
tt = (double)cvGetTickCount();
for (i=8; i<10; i++) {
tt_img = cvCloneImage( t_img[i] );
sw = tt_img->width; sh = tt_img->height;
mt_img = cvCreateImage( cvSize(sW-sw+1,sH-sh+1), 32, 1 );
cvSetZero( mt_img );
/*
Match Template test
*/
cvMatchTemplate( wh_img, tt_img, mt_img, CV_TM_SQDIFF_NORMED);
double min_val = 2.0f;
double max_val = -0.1f;
CvPoint min_loc, max_loc;
//cvMinMaxLoc( mt_img, &min_val, &max_val, &min_loc, &max_loc );
double sum_val = 0.0f;
for (j=0; j<10; j++) {
min_val = 2.0f; max_val = -0.1f;
cvMinMaxLoc( mt_img, &min_val, &max_val, &min_loc, &max_loc );
if (min_val == 1.0f)
continue;
sum_val += min_val;
//float out_elem[4] = {num_id, min_val, min_loc.x, min_loc.y};
//cvSeqPush( output, out_elem);
cvSetReal2D( mt_img, min_loc.y, min_loc.x, max_val );
//printf("[%d] %f @ %d,%d - %f\n",i, min_val, min_loc.x, min_loc.y, max_val );
//mt_img->imageData[min_loc.x + min_loc.y * mt_img->width] = max_val;
cvCircle( o_img, cvPoint(min_loc.x+sw/2,min_loc.y+sh/2), 2, CV_RGB(255-(int)((float)i/8.0f*255.0f),0,(int)((float)i/8.0f*255.0f)), -1 );
}
//cvCircle( o_img, cvPoint(min_loc.x + sw/2,min_loc.y + sh/2), 3, CV_RGB(0,255,0), -1 );
printf( "[temp#%d] %.3f \n", i, sum_val/10.0f);
}
tt = (double)cvGetTickCount() - tt;
printf( "frame#%d is processed in %g ms.\n", img_no+1, tt/((double)cvGetTickFrequency()*1000.) );
/*
MSER test
*/
/*cvExtractMSER( img, NULL, &contours, storage,
cvMSERParams( 1, cvRound(.0001*img->width*img->height),
cvRound(.04*img->width*img->height), .25, .2) );
for ( i = contours->total-1; i >= 0; i-- ) {
CvSeq* r = *(CvSeq**)cvGetSeqElem( contours, i );
for ( j = 0; j < r->total; j++ ) {
CvPoint* pt = CV_GET_SEQ_ELEM( CvPoint, r, j );
rsptr[(pt->x + img->width)*3 + pt->y*o_img->widthStep] = 255-(uchar)((float)j/(float)r->total*255.0f);
rsptr[(pt->x + img->width)*3+1 + pt->y*o_img->widthStep] = (uchar)((float)j/(float)r->total*255.0f);
rsptr[(pt->x + img->width)*3+2 + pt->y*o_img->widthStep] = (uchar)((float)j/(float)r->total*255.0f);
}
}
*/
cvShowImage("Display0", o_img);
cvWaitKey();
cvReleaseImage( &o_img );
img_no++;
}
cvDestroyAllWindows();
cvReleaseImage( &img );
return 0;
}
| [
"djkimgo@5b5c467a-9c33-11de-8595-bbd473b9459f"
]
| [
[
[
1,
147
]
]
]
|
4e5d66d4a881f149aa84ff5abd00b5dd20074db1 | 2112057af069a78e75adfd244a3f5b224fbab321 | /branches/refactor/src_root/src/ireon_client/world/object.cpp | 2d8fd1e1ad73d16b3d40486399e9034c81ded09c | []
| no_license | blockspacer/ireon | 120bde79e39fb107c961697985a1fe4cb309bd81 | a89fa30b369a0b21661c992da2c4ec1087aac312 | refs/heads/master | 2023-04-15T00:22:02.905112 | 2010-01-07T20:31:07 | 2010-01-07T20:31:07 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,956 | cpp | /* Copyright (C) 2005 ireon.org developers council
* $Id: object.cpp 361 2005-12-09 12:30:12Z llyeli $
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
/**
* @file object.cpp
* Object class
*/
#include "stdafx.h"
#include "world/object.h"
#include "world/world.h"
CObject::CObject(const String& name):
m_type(NONE),
m_name(name),
m_body(NULL),
m_geometry(NULL),
m_entity(NULL),
m_node(NULL),
m_entityNode(NULL)
{
};
CObject::~CObject()
{
if( m_entityNode )
m_entityNode->detachAllObjects();
if( m_node )
{
m_node->detachAllObjects();
m_node->removeAndDestroyAllChildren();
CWorld::instance()->sceneManager()->destroySceneNode(m_node->getName());
}
if( m_entity )
CWorld::instance()->sceneManager()->removeEntity(m_entity);
if( m_geometry )
delete m_geometry;
if( m_body )
delete m_body;
};
void CObject::setPosition(const Vector3 &pos)
{
m_body->setPosition(pos);
};
void CObject::setPosition(const Vector2& pos)
{
Vector3 pos3(pos.x,0,pos.y);
if( CWorld::instance()->loaded() )
{
pos3.y = CWorld::instance()->heightAt(pos3);
Real y = CWorld::instance()->heightAt(pos3);
y = 5;
}
m_body->setPosition(pos3);
};
void CObject::setOrientation(const Quaternion &q)
{
m_body->setOrientation(q);
};
Vector3 CObject::getPosition()
{
return m_body->getPosition();
};
Vector2 CObject::getPosition2()
{
return Vector2(m_body->getPosition().x, m_body->getPosition().z);
};
Quaternion CObject::getOrientation()
{
return m_body->getOrientation();
};
void CObject::pitch(const Radian& angle)
{
Vector3 xAxis = getOrientation() * Vector3::UNIT_X;
rotate(xAxis, angle);
};
void CObject::yaw(const Radian& angle)
{
Vector3 yAxis = getOrientation() * Vector3::UNIT_Y;
rotate(yAxis, angle);
};
void CObject::roll(const Radian& angle)
{
Vector3 zAxis = getOrientation() * Vector3::UNIT_Z;
rotate(zAxis, angle);
};
void CObject::rotate(const Vector3 &axis, const Radian &angle)
{
Quaternion q;
q.FromAngleAxis(angle,axis);
rotate(q);
};
void CObject::rotate(const Quaternion& q)
{
setOrientation(getOrientation() * q);
};
bool CObject::visible()
{
return CWorld::instance()->pointIsVisible(getPosition());
};
| [
"[email protected]"
]
| [
[
[
1,
128
]
]
]
|
82e12a218a1043b88ba28e448a254b9585996a88 | fac8de123987842827a68da1b580f1361926ab67 | /inc/physics/Physics/Dynamics/Phantom/hkpSimpleShapePhantom.h | a6ebe83c0e1549b6b8ca250d604d3d76d18a3286 | []
| no_license | blockspacer/transporter-game | 23496e1651b3c19f6727712a5652f8e49c45c076 | 083ae2ee48fcab2c7d8a68670a71be4d09954428 | refs/heads/master | 2021-05-31T04:06:07.101459 | 2009-02-19T20:59:59 | 2009-02-19T20:59:59 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,303 | h | /*
*
* Confidential Information of Telekinesys Research Limited (t/a Havok). Not for disclosure or distribution without Havok's
* prior written consent.This software contains code, techniques and know-how which is confidential and proprietary to Havok.
* Level 2 and Level 3 source code contains trade secrets of Havok. Havok Software (C) Copyright 1999-2008 Telekinesys Research Limited t/a Havok. All Rights Reserved. Use of this software is subject to the terms of an end user license agreement.
*
*/
#ifndef HK_DYNAMICS2_SIMPLE_SHAPE_PHANTOM_H
#define HK_DYNAMICS2_SIMPLE_SHAPE_PHANTOM_H
#include <Physics/Dynamics/Phantom/hkpShapePhantom.h>
class hkCollisionEnvironment;
class hkpCollisionDispatcher;
class hkpCollidable;
class hkpCollisionAgent;
struct hkpLinearCastCollisionInput;
struct hkpCollisionInput;
class hkpCdPointCollector;
class hkpCdBodyPairCollector;
extern const hkClass hkpSimpleShapePhantomClass;
/// Please read hkpShapePhantom documentation first.<br>
/// The hkpSimpleShapePhantom class implements an hkpShapePhantom with minimal memory overhead
/// (all collision results are recalculated every time).
/// Because hkpSimpleShapePhantom does not cache collision information
/// you may wish to use it (in preference to the hkpCachingShapePhantom) if any of the following criteria apply:
/// - You are short of memory.
/// - Your shape is an hkpSphereShape or an hkpCapsuleShape (caches are usually not so important with spheres and capsules because they create full manifolds against triangles on a single call).
/// - You move the phantom a large distance every frame, so the caches are useless.
class hkpSimpleShapePhantom : public hkpShapePhantom
{
public:
HK_DECLARE_REFLECTION();
/// Constructor takes a shape, a transform, and an optional collision filter info
hkpSimpleShapePhantom( const hkpShape* shape, const hkTransform& transform, hkUint32 m_collisionFilterInfo = 0 );
~hkpSimpleShapePhantom();
/// Gets the hkpPhantom type. For this class the type is HK_PHANTOM_SIMPLE_SHAPE
/// ###ACCESS_CHECKS###( [m_world,HK_ACCESS_IGNORE] [this,HK_ACCESS_RO] );
virtual hkpPhantomType getType() const;
// Implementation of hkpShapePhantom::setPositionAndLinearCast
/// ###ACCESS_CHECKS###( [m_world,HK_ACCESS_RW] [this,HK_ACCESS_RW] );
virtual void setPositionAndLinearCast( const hkVector4& position, const hkpLinearCastInput& input, hkpCdPointCollector& castCollector, hkpCdPointCollector* startCollector );
// Implementation of hkpShapePhantom::getClosestPoints
/// ###ACCESS_CHECKS###( [m_world,HK_ACCESS_RO] [this,HK_ACCESS_RO] );
void getClosestPoints( hkpCdPointCollector& collector, const hkpCollisionInput* input = HK_NULL );
// Implementation of hkpShapePhantom::getPenetrations
/// ###ACCESS_CHECKS###( [m_world,HK_ACCESS_RO] [this,HK_ACCESS_RO] );
void getPenetrations( hkpCdBodyPairCollector& collector, const hkpCollisionInput* input = HK_NULL );
/// hkpPhantom clone functionality
/// ###ACCESS_CHECKS###( [m_world,HK_ACCESS_IGNORE] [this,HK_ACCESS_RO] );
virtual hkpPhantom* clone() const;
public:
//
// hkpPhantom interface
//
/// ###ACCESS_CHECKS###( [m_world,HK_ACCESS_IGNORE] [this,HK_ACCESS_RW] );
virtual void addOverlappingCollidable( hkpCollidable* collidable );
// hkpPhantom interface implementation
/// ###ACCESS_CHECKS###( [m_world,HK_ACCESS_IGNORE] [this,HK_ACCESS_RO] );
virtual hkBool isOverlappingCollidableAdded( hkpCollidable* collidable );
/// ###ACCESS_CHECKS###( [m_world,HK_ACCESS_IGNORE] [this,HK_ACCESS_RW] );
virtual void removeOverlappingCollidable( hkpCollidable* collidable );
/// ###ACCESS_CHECKS###( [m_world,HK_ACCESS_IGNORE] [this,HK_ACCESS_RO] );
void calcStatistics( hkStatisticsCollector* collector ) const;
public:
struct CollisionDetail
{
HK_DECLARE_NONVIRTUAL_CLASS_ALLOCATOR( HK_MEMORY_CLASS_DYNAMICS, hkpSimpleShapePhantom::CollisionDetail );
HK_DECLARE_REFLECTION();
class hkpCollidable* m_collidable;
};
inline hkArray<struct CollisionDetail>& getCollisionDetails();
protected:
hkArray<struct CollisionDetail> m_collisionDetails; //+nosave
public:
hkpSimpleShapePhantom( class hkFinishLoadedObjectFlag flag ) : hkpShapePhantom( flag ) {}
//
// INTERNAL USE ONLY
//
/// ###ACCESS_CHECKS###( [m_world,HK_ACCESS_IGNORE] [this,HK_ACCESS_RW] );
virtual void deallocateInternalArrays();
};
#include <Physics/Dynamics/Phantom/hkpSimpleShapePhantom.inl>
#endif //HK_DYNAMICS2_SIMPLE_SHAPE_PHANTOM_H
/*
* Havok SDK - NO SOURCE PC DOWNLOAD, BUILD(#20080529)
*
* Confidential Information of Havok. (C) Copyright 1999-2008
* Telekinesys Research Limited t/a Havok. All Rights Reserved. The Havok
* Logo, and the Havok buzzsaw logo are trademarks of Havok. Title, ownership
* rights, and intellectual property rights in the Havok software remain in
* Havok and/or its suppliers.
*
* Use of this software for evaluation purposes is subject to and indicates
* acceptance of the End User licence Agreement for this product. A copy of
* the license is included with this software and is also available at
* www.havok.com/tryhavok
*
*/
| [
"uraymeiviar@bb790a93-564d-0410-8b31-212e73dc95e4"
]
| [
[
[
1,
130
]
]
]
|
e751c0ef36f6e4685ef5cdc3a709195210cc3f44 | d7910157c6f2b58f159ec8dc2634e0acfe6d678e | /qtdemo/guide.h | 6ecf4aae19755c42bf481949397f15191a36dc44 | []
| no_license | TheProjecter/qtdemo-plugin | 7699b19242aacea9c5b2c741e615e6b1e62c6c11 | 4db5ffe7e8607e01686117820ce1fcafb72eb311 | refs/heads/master | 2021-01-19T06:30:22.017229 | 2010-02-05T06:36:25 | 2010-02-05T06:36:25 | 43,904,026 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,750 | h | /****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation ([email protected])
**
** This file is part of the demonstration applications of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial Usage
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you have questions regarding the use of this file, please contact
** Nokia at [email protected].
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef GUIDE_H
#define GUIDE_H
#include "demoitem.h"
class Guide
{
public:
Guide(Guide *follows = 0);
virtual ~Guide();
virtual void guide(DemoItem *item, float moveSpeed) = 0;
void move(DemoItem *item, QPointF &dest, float moveSpeed);
virtual QPointF startPos(){ return QPointF(0, 0); };
virtual QPointF endPos(){ return QPointF(0, 0); };
virtual float length(){ return 1; };
float lengthAll();
void setScale(float scaleX, float scaleY, bool all = true);
void setFence(const QRectF &fence, bool all = true);
int startLength;
Guide *nextGuide;
Guide *firstGuide;
Guide *prevGuide;
float scaleX;
float scaleY;
QRectF fence;
};
#endif // GUIDE_H
| [
"douyongwang@152bb772-114e-11df-9f54-17e475596acb"
]
| [
[
[
1,
73
]
]
]
|
76d72cc32f1fa7d3e7dd9270ec829906587db32c | daa67e21cc615348ba166d31eb25ced40fba9dc7 | /GameCode/UtilityFunction.cpp | 16335dcc74f67e5cbd5872b68ae1c6bd7382097b | []
| no_license | gearsin/geartesttroject | 443d48b7211f706ab2c5104204bad7228458c3f2 | f86f255f5e9d1d34a00a4095f601a8235e39aa5a | refs/heads/master | 2020-05-19T14:27:35.821340 | 2008-09-02T19:51:16 | 2008-09-02T19:51:16 | 32,342,555 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,469 | cpp | //------------------------------------------------------------------------------------------------------------------
#include "StdAfx.h"
//------------------------------------------------------------------------------------------------------------------
void Assert( bool pExpression, const char * pMsg, ... )
{
if( !pExpression )
{
char szBuffer[1024];
va_list args;
va_start( args, pMsg );
vsprintf_s( szBuffer, pMsg, args );
Log( szBuffer );
__debugbreak();
}
}
//------------------------------------------------------------------------------------------------------------------
void Log( const WCHAR * pFormat, ... )
{
WCHAR szBuffer[1024];
va_list args;
va_start( args, pFormat );
vswprintf_s( szBuffer, pFormat, args );
OutputDebugStringW( szBuffer );
}
//------------------------------------------------------------------------------------------------------------------
void Log( const char * pFormat, ... )
{
char szBuffer[1024];
va_list args;
va_start( args, pFormat );
vsprintf_s( szBuffer, pFormat, args );
OutputDebugStringA( szBuffer );
}
//------------------------------------------------------------------------------------------------------------------
char * TrimString( char * pStr )
{
unsigned int strLen = strlen( pStr );
int removeCharIdx = 0;
//Left trim
while( *( pStr + removeCharIdx ) == ' ' || *( pStr + removeCharIdx ) == '\t' )
{
removeCharIdx++;
}
//trim left
unsigned int idx = 0;
for( idx = 0; idx < strlen( pStr ); idx++ )
{
pStr[idx] = pStr[removeCharIdx + idx ];
}
strLen = strlen( pStr ) - 1;
//Right trim
while( *( pStr + strLen ) == ' ' || *( pStr + strLen ) == '\t' )
{
strLen--;
}
pStr[strLen+1] = '\0';
return pStr;
}
//------------------------------------------------------------------------------------------------------------------
float * GetVectorFromString( std::string pStr )
{
float vec[3];
int seprator = pStr.find( ' ' );
std::string strFloat = pStr.substr( 0, seprator );
vec[0] = (float)atof( strFloat.c_str() );
int seprator2 = pStr.find( ' ', seprator + 1 );
strFloat = pStr.substr( seprator + 1, ( seprator2 - seprator ) );
vec[1] = (float)atof( strFloat.c_str() );
int seprator3 = pStr.find( ' ', seprator + 1 );
strFloat = pStr.substr( seprator3, ( seprator3 - seprator2 ) );
vec[2] = (float)atof( strFloat.c_str() );
return vec;
}
| [
"sunil.ssingh@592c7993-d951-0410-8115-35849596357c"
]
| [
[
[
1,
94
]
]
]
|
d2e17715f9db153d25e892891f1fd3d1b28abc59 | f08e489d72121ebad042e5b408371eaa212d3da9 | /TP1_v1/src/Estructuras/Bucket.cpp | 26dba709bf110ff6db261e18116dac7c9d260376 | []
| no_license | estebaneze/datos022011-tp1-vane | 627a1b3be9e1a3e4ab473845ef0ded9677e623e0 | 33f8a8fd6b7b297809a0feac14d10f9815f8388b | refs/heads/master | 2021-01-20T03:35:36.925750 | 2011-12-04T18:19:55 | 2011-12-04T18:19:55 | 41,821,700 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,346 | cpp | #include "Bucket.h"
#include "key_node.h"
Bucket::Bucket()
{}
Bucket::Bucket(int N, int prof)
{
this->N = N;
this->refs = prof;
}
Bucket::Bucket(const Bucket &toCopy)
{
this->N = toCopy.N;
this->bucket = toCopy.bucket;
this->refs = toCopy.refs;
}
int Bucket::getNBucket() const
{
return this->N;
}
std::vector<std::pair<Key_Node,Refs> > Bucket::getBucket()
{
return this->bucket;
}
std::pair<Key_Node,Refs> Bucket::at(int i)
{
return (this->bucket.at(i));
}
bool Bucket::exists ( Key_Node &key)
{
for (unsigned int i = 0; i< bucket.size(); i++)
{
std::pair<Key_Node,Refs> b = bucket.at(i);
int aux = b.first.compareTo(key);
if (aux==0)
return true;
}
return false;
}
void Bucket::insertKey ( Key_Node &key, Refs value)
{
if (exists(key))
cout<< "Error la Clave Existe en el Bucket"<< endl;
else
{
std::pair<Key_Node,Refs> Temp_KeyValue;
Temp_KeyValue.first = key;
Temp_KeyValue.second=value;
Key_Node k= Key_Node(key);
bucket.push_back(Temp_KeyValue);
}
}
void Bucket::deleteKey ( Key_Node &key)
{
if (!exists(key))
cout<< "Error la Clave NO Existe en el Bucket"<< endl;
else
{
std::vector<std::pair<Key_Node,Refs> >::iterator it = bucket.begin();
unsigned int i = 0;
while (i < bucket.size())
{
if (bucket.at(i).first.compareTo(key)==0)
bucket.erase(it);
it++;
i++;
}
}
}
bool Bucket::empty()
{
return this->bucket.empty();
}
int Bucket::size()
{
return this->bucket.size();
}
void Bucket::clear()
{
return this->bucket.clear();
}
Refs * Bucket::getValue( Key_Node &key)
{
if (!exists(key))
return NULL;
else
{
unsigned int i = 0;
while (i < bucket.size())
{
if (bucket.at(i).first.compareTo(key)==0)
{
Refs * r1=new Refs();
*r1=bucket.at(i).second;
return r1;
}
i++;
}
}
}
int Bucket::getRef()
{
return this->refs;
}
void Bucket::addRef()
{
this->refs++;
}
void Bucket::updateRef(int ref)
{
this->refs=ref;
}
void Bucket::duplicateRef()
{
this->refs=refs*2;
}
void Bucket::divRef()
{
this->refs=refs/2;
}
Bucket::~Bucket()
{}
| [
"[email protected]"
]
| [
[
[
1,
150
]
]
]
|
61c31f0de2bd4f41d7615631ba638bf36fbb33a2 | 85556d2252328c785bb57528878b7ad621a4af76 | /LuaCppFSM/src/BaseGameEntity.h | 8751e1a2e7479373ef6a80890ad630976a8f7f8c | []
| no_license | turdann/luacppfsm | 86ace1cf742e767597e452ef58ef1495422f1441 | 0bc5334c88e4eeae6caa926ee6a3546ea0f34cd4 | refs/heads/master | 2021-01-10T02:01:14.662585 | 2008-08-08T09:45:15 | 2008-08-08T09:45:15 | 52,820,764 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,943 | h | #ifndef ENTITY_H
#define ENTITY_H
//------------------------------------------------------------------------
//
// Name: BaseGameEntity.h
//
// Desc: Base class for a game object
//
// Author: Mat Buckland 2002 ([email protected])
//
//------------------------------------------------------------------------
#include <string>
#include "Telegram.h"
/*!
* @brief Definicion de la clase base para las entidades del juego.
*
* Todo tipo de entidades diferentes dentro del juego se derivan
* desde esta clase. Actor, .....
*
*/
class BaseGameEntity {
public:
/*!
* @brief Creacion entidad base del juego.
* @param id Identificador unico de entidad.
* @return
*/
BaseGameEntity(int id) {
SetID(id);
}
/*!
*
* @return
*/
virtual ~BaseGameEntity() {
}
/*!
* Todas las entidades han de implementar una funcion Update.
*/
virtual void Update()=0;
/*!
* @brief Manejo de los mensajes.
*
* Todas las entidades se pueden comunicar usando mensajaes. Se envian mediante la
* clase MenssageDispatch singleton.
*
* @param msg Mensaje a tratar.
* @return
*/
virtual bool HandleMessage(const Telegram& msg)=0;
/*!
* @brief Obtencion del identificador de la entidad.
*
* @return
*/
int ID() const {
return m_ID;
}
private:
/*!
* @brief Numero de identificacion de la unidad.
*
* Cada entidad ha de tener una identificacion unica.
*/
int m_ID;
/*!
*
* this is the next valid ID. Each time a BaseGameEntity is instantiated
* this value is updated
*/
static int m_iNextValidID;
/*!
* Se llamara a este metodo dentro del constructor para asegurarse que el ID
* es correcto. Verifica que el valor pasado al metodo es mayor o igual
* al siguiente ID valido, antes de poner el ID e incrementar el siguiente
* ID valido.
*
* @param val
*/
void SetID(int val);
};
#endif
| [
"[email protected]"
]
| [
[
[
1,
88
]
]
]
|
09aea8e316dadac1c22c6eb65f5b1310b7740ccb | 629e4fdc23cb90c0144457e994d1cbb7c6ab8a93 | /lib/entity/properties/meshproperty.cpp | e0f1fd1f7b2a98eae8d144567180a2c2abb76a31 | []
| no_license | akin666/ice | 4ed846b83bcdbd341b286cd36d1ef5b8dc3c0bf2 | 7cfd26a246f13675e3057ff226c17d95a958d465 | refs/heads/master | 2022-11-06T23:51:57.273730 | 2011-12-06T22:32:53 | 2011-12-06T22:32:53 | 276,095,011 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 406 | cpp | /*
* meshproperty.cpp
*
* Created on: 16.11.2011
* Author: akin
*/
#include "meshproperty.h"
namespace ice
{
const std::string MeshProperty::KEY("mesh");
MeshProperty::MeshProperty()
: Property( KEY )
{
}
MeshProperty::~MeshProperty()
{
}
void MeshProperty::attach( Entity& entity )
{
}
void MeshProperty::detach( Entity& entity )
{
}
} /* namespace ice */
| [
"akin@localhost"
]
| [
[
[
1,
31
]
]
]
|
826b0048e2fb977c7c86146715311bae46d76230 | ea12fed4c32e9c7992956419eb3e2bace91f063a | /zombie/code/zombie/ngrass/src/nvegetation/nvegetationmeshcacheentry.cc | 429b2fc561f89a43aa19624ef44379051f1a526a | []
| no_license | ugozapad/TheZombieEngine | 832492930df28c28cd349673f79f3609b1fe7190 | 8e8c3e6225c2ed93e07287356def9fbdeacf3d6a | refs/heads/master | 2020-04-30T11:35:36.258363 | 2011-02-24T14:18:43 | 2011-02-24T14:18:43 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,236 | cc | #include "precompiled/pchngrass.h"
//------------------------------------------------------------------------------
// nvegetationmeshcacheentry.cc
// (C) 2005 Conjurer Services, S.A.
//------------------------------------------------------------------------------
#include "nvegetation/nvegetationmeshcacheentry.h"
#include "nvegetation/nVegetationMeshResourceLoader.h"
#include "nvegetation/ngrassmodule.h"
#ifndef NGAME
#ifndef __ZOMBIE_EXPORTER__
#include "ndebug/ndebugtext.h"
#include "ndebug/ndebuggraphicsserver.h"
#include "kernel/ntimeserver.h"
#include "nvegetation/ncterrainvegetationclass.h"
#include "napplication/napplication.h"
#endif
#endif
/*-----------------------------------------------------------------------------
@file nvegetationmeshcacheentry.cc
@ingroup NebulaGrass
@author Cristobal Castillo Domingo
@brief cache entry for vegetation mesh
(C) 2004 Conjurer Services, S.A.
*/
//---------------------------------------------------------------------------
/**
*/
nVegetationMeshCacheEntry::nVegetationMeshCacheEntry() :
hasMesh(false),
terrainClass(0)
{
/// empty
}
//---------------------------------------------------------------------------
/**
*/
nVegetationMeshCacheEntry::~nVegetationMeshCacheEntry()
{
this->Unload();
this->Dealloc();
}
//---------------------------------------------------------------------------
/**
*/
bool
nVegetationMeshCacheEntry::Alloc()
{
nCacheEntry::Alloc();
nString resloader = nVegetationMeshResourceLoader::Instance()->GetFullName();
this->terrainClass = 0;
this->mesh = nGfxServer2::Instance()->NewMesh(0);
n_assert(this->mesh);
this->mesh->SetResourceLoader(resloader.Get());
/*
this->mesh->SetFilename(resName);
this->mesh->Load();
*/
return true;
}
//---------------------------------------------------------------------------
/**
*/
bool
nVegetationMeshCacheEntry::Dealloc()
{
this-> terrainClass = 0;
if (this->mesh.isvalid())
{
if ( this->mesh->IsLoaded() )
{
this->mesh->Unload();
}
this->mesh->Release();
this->mesh.invalidate();
}
return nCacheEntry::Dealloc();
}
//---------------------------------------------------------------------------
/**
*/
bool
nVegetationMeshCacheEntry::Load(nCacheKey key, nCacheInfo * terrainClass)
{
nCacheEntry::Load(key, 0);
this->terrainClass = terrainClass;
#ifndef NGAME // For show the debug info
#ifndef __ZOMBIE_EXPORTER__
nTime time(0);
static float ypos = 0.45f;
if ( ncTerrainVegetationClass::debugInfo )
{
time = nTimeServer::Instance()->GetTime();
}
#endif
#endif
nString fileName(key);
this->mesh->SetFilename(fileName);
if ( this->mesh->GetVertexBufferByteSize() == 0 ) //if not has vertex buffer create
{
this->mesh->Load();
this->hasMesh = this->mesh->IsValid();
}
else
{
// not use directly load method's mesh because it need a unload object
this->hasMesh = nVegetationMeshResourceLoader::Instance()->Load( fileName.Get(), this->mesh);
if (hasMesh)
{
this->mesh->SetState(nResource::Valid);
} else
{
this->mesh->SetState(nResource::Empty); // Mark as create but invalid data
// it is necesary when device lost, unload the resource
}
}
#ifndef NGAME
#ifndef __ZOMBIE_EXPORTER__
// For show debug info
if ( ncTerrainVegetationClass::debugInfo )
{
time = nTimeServer::Instance()->GetTime() - time;
// Create a different color for diffferent frame id
float col= 0.1f*( nApplication::Instance()->GetFrameId() % 11);
vector3 color( col , 1.0f, 1.0f - col);
nDebugText * text = nDebugGraphicsServer::Instance()->NewDebugText( );
text->SetScreenPos( -0.99f, ypos);
text->SetColor(color);
text->Format(" Growth mesh create %.8X time:%f ms", key , 1000.0f*time );
text->SetLife( nGrassModule::lifeTimeDebugText );
nDebugGraphicsServer::Instance()->Kill( text );
ypos+=0.05f;
if ( ypos>0.9f) ypos=0.45f;
nGrassModule::AddMeshLoadTime(1000.f * float(time) );
}
#endif
#endif
return true;
}
//---------------------------------------------------------------------------
/**
*/
bool
nVegetationMeshCacheEntry::Unload()
{
if ( this->mesh.isvalid() )
{
if ( this->mesh->IsLoaded() )
{
// Not unload the mesh because the unload method destroy the vertex buffer
this->hasMesh = false; // The mesh is not load
}
}
return nCacheEntry::Unload();
}
//------------------------------------------------------------------------------
nMesh2 *
nVegetationMeshCacheEntry::GetMesh()
{
return this->mesh;
}
//------------------------------------------------------------------------------
bool
nVegetationMeshCacheEntry::HasMesh()
{
return this->hasMesh;
}
| [
"magarcias@c1fa4281-9647-0410-8f2c-f027dd5e0a91"
]
| [
[
[
1,
193
]
]
]
|
140541c034b0c468aeac104db5b95a1a64006b8f | 1e299bdc79bdc75fc5039f4c7498d58f246ed197 | /stdobj/folder_dialog.h | 8a817aa7a67e2f7455f41626b14b4f43edbee6ce | []
| no_license | moosethemooche/Certificate-Server | 5b066b5756fc44151b53841482b7fa603c26bf3e | 887578cc2126bae04c09b2a9499b88cb8c7419d4 | refs/heads/master | 2021-01-17T06:24:52.178106 | 2011-07-13T13:27:09 | 2011-07-13T13:27:09 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,275 | h | //--------------------------------------------------------------------------------
//
// Copyright (c) 1999 MarkCare Solutions
//
// Programming by Rich Schonthal
//
//--------------------------------------------------------------------------------
#if !defined(AFX_MYFD_H__F9CB9441_F91B_11D1_8610_0040055C08D9__INCLUDED_)
#define AFX_MYFD_H__F9CB9441_F91B_11D1_8610_0040055C08D9__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// MyFD.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CFolderDialog dialog
//--------------------------------------------------------------------------------
class CFolderDialog : public CFileDialog
{
DECLARE_DYNAMIC(CFolderDialog)
public:
static WNDPROC m_wndProc;
virtual void OnInitDone( );
CString* m_pPath;
CFolderDialog(CString* pPath);
protected:
//{{AFX_MSG(CFolderDialog)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MYFD_H__F9CB9441_F91B_11D1_8610_0040055C08D9__INCLUDED_)
| [
"[email protected]"
]
| [
[
[
1,
42
]
]
]
|
27d5880504ab36ce800f25cc855c76b38133887b | 555ce7f1e44349316e240485dca6f7cd4496ea9c | /DirectShowFilters/TsReader/source/AudioPin.cpp | 876265334c97f0ebeca7d2ee51f903b0bc376b60 | []
| no_license | Yura80/MediaPortal-1 | c71ce5abf68c70852d261bed300302718ae2e0f3 | 5aae402f5aa19c9c3091c6d4442b457916a89053 | refs/heads/master | 2021-04-15T09:01:37.267793 | 2011-11-25T20:02:53 | 2011-11-25T20:11:02 | 2,851,405 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 20,662 | cpp | /*
* Copyright (C) 2005 Team MediaPortal
* http://www.team-mediaportal.com
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
#pragma warning(disable:4996)
#pragma warning(disable:4995)
#include <afx.h>
#include <afxwin.h>
#include <winsock2.h>
#include <ws2tcpip.h>
#include <streams.h>
#include <sbe.h>
#include "tsreader.h"
#include "audiopin.h"
#include "videopin.h"
#include "pmtparser.h"
// For more details for memory leak detection see the alloctracing.h header
#include "..\..\alloctracing.h"
#define MAX_TIME 86400000L
byte MPEG1AudioFormat[] =
{
0x50, 0x00, //wFormatTag
0x02, 0x00, //nChannels
0x80, 0xBB, 0x00, 0x00, //nSamplesPerSec
0x00, 0x7D, 0x00, 0x00, //nAvgBytesPerSec
0x00, 0x03, //nBlockAlign
0x00, 0x00, //wBitsPerSample
0x16, 0x00, //cbSize
0x02, 0x00, //wValidBitsPerSample
0x00, 0xE8, //wSamplesPerBlock
0x03, 0x00, //wReserved
0x01, 0x00, 0x01,0x00, //dwChannelMask
0x01, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
extern void LogDebug(const char *fmt, ...) ;
CAudioPin::CAudioPin(LPUNKNOWN pUnk, CTsReaderFilter *pFilter, HRESULT *phr,CCritSec* section) :
CSourceStream(NAME("pinAudio"), phr, pFilter, L"Audio"),
m_pTsReaderFilter(pFilter),
CSourceSeeking(NAME("pinAudio"),pUnk,phr,section),
m_section(section)
{
m_bConnected=false;
m_rtStart=0;
m_dwSeekingCaps =
AM_SEEKING_CanSeekAbsolute |
AM_SEEKING_CanSeekForwards |
AM_SEEKING_CanSeekBackwards |
AM_SEEKING_CanGetStopPos |
AM_SEEKING_CanGetDuration |
//AM_SEEKING_CanGetCurrentPos |
AM_SEEKING_Source;
m_bSubtitleCompensationSet=false;
}
CAudioPin::~CAudioPin()
{
LogDebug("pin:dtor()");
}
STDMETHODIMP CAudioPin::NonDelegatingQueryInterface( REFIID riid, void ** ppv )
{
if (riid == IID_IMediaSeeking)
{
return CSourceSeeking::NonDelegatingQueryInterface( riid, ppv );
}
if (riid == IID_IMediaPosition)
{
return CSourceSeeking::NonDelegatingQueryInterface( riid, ppv );
}
return CSourceStream::NonDelegatingQueryInterface(riid, ppv);
}
HRESULT CAudioPin::GetMediaType(CMediaType *pmt)
{
//LogDebug("aud:GetMediaType()");
CDeMultiplexer& demux=m_pTsReaderFilter->GetDemultiplexer();
int audioIndex = 0;
demux.GetAudioStream(audioIndex);
//demux.GetAudioStreamType(demux.GetAudioStream(), *pmt);
demux.GetAudioStreamType(audioIndex, *pmt);
return S_OK;
}
void CAudioPin::SetDiscontinuity(bool onOff)
{
m_bDiscontinuity=onOff;
}
HRESULT CAudioPin::CheckConnect(IPin *pReceivePin)
{
//LogDebug("aud:CheckConnect()");
return CBaseOutputPin::CheckConnect(pReceivePin);
}
HRESULT CAudioPin::DecideBufferSize(IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *pRequest)
{
HRESULT hr;
CheckPointer(pAlloc, E_POINTER);
CheckPointer(pRequest, E_POINTER);
if (pRequest->cBuffers == 0)
{
pRequest->cBuffers = 30;
}
pRequest->cbBuffer = 8192;
ALLOCATOR_PROPERTIES Actual;
hr = pAlloc->SetProperties(pRequest, &Actual);
if (FAILED(hr))
{
return hr;
}
if (Actual.cbBuffer < pRequest->cbBuffer)
{
return E_FAIL;
}
return S_OK;
}
HRESULT CAudioPin::CompleteConnect(IPin *pReceivePin)
{
LogDebug("aud:CompleteConnect()");
HRESULT hr = CBaseOutputPin::CompleteConnect(pReceivePin);
if (SUCCEEDED(hr))
{
LogDebug("aud:CompleteConnect() done");
m_bConnected=true;
}
else
{
LogDebug("aud:CompleteConnect() failed:%x",hr);
}
if (m_pTsReaderFilter->IsTimeShifting())
{
//m_rtDuration=CRefTime(MAX_TIME);
REFERENCE_TIME refTime;
m_pTsReaderFilter->GetDuration(&refTime);
m_rtDuration=CRefTime(refTime);
}
else
{
REFERENCE_TIME refTime;
m_pTsReaderFilter->GetDuration(&refTime);
m_rtDuration=CRefTime(refTime);
}
//LogDebug("aud:CompleteConnect() ok");
return hr;
}
HRESULT CAudioPin::BreakConnect()
{
m_bConnected=false;
//LogDebug("aud:BreakConnect()");
return CSourceStream::BreakConnect();
}
HRESULT CAudioPin::FillBuffer(IMediaSample *pSample)
{
try
{
CDeMultiplexer& demux=m_pTsReaderFilter->GetDemultiplexer();
CBuffer* buffer=NULL;
do
{
//get file-duration and set m_rtDuration
GetDuration(NULL);
//if the filter is currently seeking to a new position
//or this pin is currently seeking to a new position then
//we dont try to read any packets, but simply return...
if (m_pTsReaderFilter->IsSeeking() || m_pTsReaderFilter->IsStopping())// /*|| m_bSeeking*/ || m_pTsReaderFilter->IsSeekingToEof())
{
//if (m_pTsReaderFilter->m_ShowBufferAudio) LogDebug("aud:isseeking");
Sleep(20);
pSample->SetTime(NULL,NULL);
pSample->SetActualDataLength(0);
pSample->SetSyncPoint(FALSE);
pSample->SetDiscontinuity(TRUE);
return NOERROR;
}
buffer=demux.GetAudio();
//did we reach the end of the file
if (demux.EndOfFile()) // || ((GetTickCount()-m_LastTickCount > 3000) && !m_pTsReaderFilter->IsTimeShifting()))
{
LogDebug("aud:set eof");
pSample->SetTime(NULL,NULL);
pSample->SetActualDataLength(0);
pSample->SetSyncPoint(FALSE);
pSample->SetDiscontinuity(TRUE);
return S_FALSE; //S_FALSE will notify the graph that end of file has been reached
}
if (buffer==NULL)
{
Sleep(10);
}
else
{
int cntA,cntV ;
CRefTime firstAudio, lastAudio;
CRefTime firstVideo, lastVideo;
cntA = demux.GetAudioBufferPts(firstAudio, lastAudio) + 1; // this one...
cntV = demux.GetVideoBufferPts(firstVideo, lastVideo);
#define PRESENT_DELAY 0000000
// Ambass : Coming here means we've a minimum of audio(>=1)/video buffers waiting...
if (!m_pTsReaderFilter->m_bStreamCompensated)
{
// Ambass : Find out the best compensation to apply in order to have fast Audio/Video delivery
CRefTime BestCompensation ;
CRefTime AddVideoCompensation ;
LogDebug("Audio Samples : %d, First : %03.3f, Last : %03.3f",cntA, (float)firstAudio.Millisecs()/1000.0f,(float)lastAudio.Millisecs()/1000.0f);
LogDebug("Video Samples : %d, First : %03.3f, Last : %03.3f",cntV, (float)firstVideo.Millisecs()/1000.0f,(float)lastVideo.Millisecs()/1000.0f);
if (m_pTsReaderFilter->GetVideoPin()->IsConnected())
{
/*
if( !m_EnableSlowMotionOnZapping &&
( lastAudio.Millisecs() < demux.m_IframeSample.Millisecs() ) &&
demux.GetVideoServiceType() != SERVICE_TYPE_VIDEO_UNKNOWN )
{
// Drop audio sample, do not allow slow motion video on channel changes
delete buffer;
buffer=NULL ;
return NOERROR;
}
*/
if (firstAudio.Millisecs() < firstVideo.Millisecs())
{
if (lastAudio.Millisecs() - 200 < firstVideo.Millisecs())
{
BestCompensation = lastAudio - 2000000 - m_pTsReaderFilter->m_RandomCompensation - m_rtStart ; //demux.m_IframeSample /*firstVideo*/ -m_rtStart ;
AddVideoCompensation = ( firstVideo - lastAudio + 2000000 ) ;
LogDebug("Compensation : ( Rnd : %d mS ) Audio pts greatly ahead Video pts . Add %03.3f sec of extra video comp to start now !...( real time TV )",(DWORD)m_pTsReaderFilter->m_RandomCompensation/10000,(float)AddVideoCompensation.Millisecs()/1000.0f) ;
}
else
{
BestCompensation = firstVideo - m_pTsReaderFilter->m_RandomCompensation - m_rtStart ; //demux.m_IframeSample /*firstVideo*/ -m_rtStart ;
AddVideoCompensation = 0 ; // ( demux.m_IframeSample-firstAudio ) ;
LogDebug("Compensation : ( Rnd : %d mS ) Audio pts ahead Video Pts ( Recover skipping Audio ) ....",m_pTsReaderFilter->m_RandomCompensation/10000) ;
}
}
else
{
// if (lastVideo.Millisecs() < firstAudio.Millisecs())
// {
// BestCompensation = lastVideo-m_rtStart ;
// AddVideoCompensation = 0 ;
// LogDebug("Compensation : Suspicious case, Audio pts greatly behind Videop pts ...") ;
// }
// else
// {
BestCompensation = firstAudio-m_rtStart ;
AddVideoCompensation = 0 ;
LogDebug("Compensation : Audio pts behind Video Pts ( Recover skipping Video ) ....") ;
// }
}
// if (lastVideo.Millisecs()==firstVideo.Millisecs()) // temporary hack for channels containing full GOP into single PES.
// {
// BestCompensation -= (REFERENCE_TIME)5000000 ;
// AddVideoCompensation += (REFERENCE_TIME)5000000 ;
// }
m_pTsReaderFilter->m_RandomCompensation += 500000 ; // Stupid feature required to have FFRW working with DVXA ( at least ATI.. ) to avoid frozen picture. ( it moves just moves the sample time a bit !! )
m_pTsReaderFilter->m_RandomCompensation = m_pTsReaderFilter->m_RandomCompensation % 1000000 ;
}
else
{
BestCompensation = firstAudio-m_rtStart - 4000000 ; // Need add delay before playing...
AddVideoCompensation = 0 ;
}
// Here, clock filter should be running, but : EVR is generally running and need to be compensated accordingly
// with current elapsed time from "RUN" to avoid beeing late.
// VMR9 is generally waiting I-frame + 1 or 2 frames to start clock and "RUN"
// Apply a margin of 200 mS seems safe to avoid being late.
if (m_pTsReaderFilter->State() == State_Running)
{
REFERENCE_TIME RefClock = 0;
m_pTsReaderFilter->GetMediaPosition(&RefClock) ;
m_pTsReaderFilter->m_ClockOnStart = RefClock - m_rtStart.m_time ;
if (m_pTsReaderFilter->m_bLiveTv)
{
LogDebug("Elapsed time from pause to Audio/Video ( total zapping time ) : %d mS",GetTickCount()-m_pTsReaderFilter->m_lastPause);
}
}
else
{
m_pTsReaderFilter->m_ClockOnStart=0 ;
}
// set the current compensation
m_pTsReaderFilter->Compensation.m_time=(BestCompensation.m_time - m_pTsReaderFilter->m_ClockOnStart.m_time) - PRESENT_DELAY ;
m_pTsReaderFilter->AddVideoComp=AddVideoCompensation ;
LogDebug("aud:Compensation:%03.3f, Clock on start %03.3f m_rtStart:%d ",(float)m_pTsReaderFilter->Compensation.Millisecs()/1000.0f, m_pTsReaderFilter->m_ClockOnStart.Millisecs()/1000.0f, m_rtStart.Millisecs());
//set flag to false so we dont keep compensating
m_pTsReaderFilter->m_bStreamCompensated = true;
m_bSubtitleCompensationSet = false;
}
// Subtitle filter is "found" only after Run() has been completed
if(!m_bSubtitleCompensationSet)
{
IDVBSubtitle* pDVBSubtitleFilter(m_pTsReaderFilter->GetSubtitleFilter());
if(pDVBSubtitleFilter)
{
LogDebug("aud:pDVBSubtitleFilter->SetTimeCompensation");
pDVBSubtitleFilter->SetTimeCompensation(m_pTsReaderFilter->Compensation);
m_bSubtitleCompensationSet=true;
}
}
CRefTime RefTime,cRefTime ;
bool HasTimestamp ;
//check if it has a timestamp
if ((HasTimestamp=buffer->MediaTime(RefTime)))
{
cRefTime = RefTime ;
cRefTime -= m_rtStart ;
//adjust the timestamp with the compensation
cRefTime-= m_pTsReaderFilter->Compensation ;
if (cRefTime.m_time >= m_pTsReaderFilter->m_ClockOnStart) // m_rtStart.m_time+m_pTsReaderFilter->Compensation.m_time) // + PRESENT_DELAY)
{
m_bPresentSample = true ;
Sleep(5) ;
}
else
{
// Sample is too late.
m_bPresentSample = false ;
}
}
if (m_bPresentSample && m_dRateSeeking == 1.0)
{
//do we need to set the discontinuity flag?
if (m_bDiscontinuity || buffer->GetDiscontinuity())
{
//ifso, set it
LogDebug("aud:set discontinuity");
pSample->SetDiscontinuity(TRUE);
m_bDiscontinuity=FALSE;
}
if (HasTimestamp)
{
//now we have the final timestamp, set timestamp in sample
REFERENCE_TIME refTime=(REFERENCE_TIME)cRefTime;
refTime /= m_dRateSeeking;
pSample->SetSyncPoint(TRUE);
pSample->SetTime(&refTime,&refTime);
if (m_dRateSeeking == 1.0)
{
REFERENCE_TIME RefClock = 0;
m_pTsReaderFilter->GetMediaPosition(&RefClock) ;
float clock = (double)(RefClock-m_rtStart.m_time)/10000000.0 ;
float fTime=(float)cRefTime.Millisecs()/1000.0f - clock ;
if (m_pTsReaderFilter->m_ShowBufferAudio || fTime < 0.030)
{
LogDebug("Aud/Ref : %03.3f, Late Compensated = %03.3f ( %0.3f A/V buffers=%02d/%02d), Clk : %f, State %d", (float)RefTime.Millisecs()/1000.0f, (float)cRefTime.Millisecs()/1000.0f, fTime,cntA,cntV, clock, m_pTsReaderFilter->State());
}
if (m_pTsReaderFilter->m_ShowBufferAudio) m_pTsReaderFilter->m_ShowBufferAudio--;
}
}
else
{
//buffer has no timestamp
pSample->SetTime(NULL,NULL);
pSample->SetSyncPoint(FALSE);
}
//copy buffer in sample
BYTE* pSampleBuffer;
pSample->SetActualDataLength(buffer->Length());
pSample->GetPointer(&pSampleBuffer);
memcpy(pSampleBuffer,buffer->Data(),buffer->Length());
//delete the buffer and return
delete buffer;
}
else
{ // Buffer was not displayed because it was out of date, search for next.
delete buffer;
buffer=NULL ;
}
}
} while (buffer==NULL);
return NOERROR;
}
// Should we return something else than NOERROR when hitting an exception?
catch(int e)
{
LogDebug("aud:fillbuffer exception %d", e);
}
catch(...)
{
LogDebug("aud:fillbuffer exception ...");
}
return NOERROR;
}
bool CAudioPin::IsConnected()
{
return m_bConnected;
}
HRESULT CAudioPin::ChangeStart()
{
UpdateFromSeek();
return S_OK;
}
HRESULT CAudioPin::ChangeStop()
{
UpdateFromSeek();
return S_OK;
}
HRESULT CAudioPin::ChangeRate()
{
/*if( m_dRateSeeking <= 0 )
{
m_dRateSeeking = 1.0; // Reset to a reasonable value.
return E_FAIL;
}*/
LogDebug("aud: ChangeRate, m_dRateSeeking %f, Force seek done %d",(float)m_dRateSeeking, m_pTsReaderFilter->m_bSeekAfterRcDone);
if (!m_pTsReaderFilter->m_bSeekAfterRcDone) //Don't force seek if another pin has already triggered it
{
m_pTsReaderFilter->m_bForceSeekAfterRateChange = true;
}
UpdateFromSeek();
return S_OK;
}
//******************************************************
/// Called when thread is about to start delivering data to the codec
///
HRESULT CAudioPin::OnThreadStartPlay()
{
//set flag to compensate any differences in the stream time & file time
m_pTsReaderFilter->m_bStreamCompensated = false;
m_pTsReaderFilter->GetDemultiplexer().m_bAudioVideoReady=false ;
//set discontinuity flag indicating to codec that the new data
//is not belonging to any previous data
m_bDiscontinuity = TRUE;
m_bPresentSample = false;
LogDebug("aud:OnThreadStartPlay(%f) %02.2f", (float)m_rtStart.Millisecs()/1000.0f, m_dRateSeeking);
//start playing
DeliverNewSegment(m_rtStart, m_rtStop, m_dRateSeeking);
return CSourceStream::OnThreadStartPlay( );
}
void CAudioPin::SetStart(CRefTime rtStartTime)
{
m_rtStart = rtStartTime ;
}
STDMETHODIMP CAudioPin::SetPositions(LONGLONG *pCurrent, DWORD CurrentFlags, LONGLONG *pStop, DWORD StopFlags)
{
return CSourceSeeking::SetPositions(pCurrent, CurrentFlags, pStop, StopFlags);
}
//******************************************************
/// UpdateFromSeek() called when need to seek to a specific timestamp in the file
/// m_rtStart contains the time we need to seek to...
///
void CAudioPin::UpdateFromSeek()
{
m_pTsReaderFilter->SeekPreStart(m_rtStart);
// LogDebug("aud: seek done %f/%f",(float)m_rtStart.Millisecs()/1000.0f,(float)m_rtDuration.Millisecs()/1000.0f);
return ;
}
//******************************************************
/// GetAvailable() returns
/// pEarliest -> the earliest (pcr) timestamp in the file
/// pLatest -> the latest (pcr) timestamp in the file
///
STDMETHODIMP CAudioPin::GetAvailable( LONGLONG * pEarliest, LONGLONG * pLatest )
{
//LogDebug("aud:GetAvailable");
//if we are timeshifting, the earliest/latest timestamp can change
if (m_pTsReaderFilter->IsTimeShifting())
{
CTsDuration duration=m_pTsReaderFilter->GetDuration();
if (pEarliest)
{
//return the startpcr, which is the earliest pcr timestamp available in the timeshifting file
double d2=duration.StartPcr().ToClock();
d2*=1000.0f;
CRefTime mediaTime((LONG)d2);
*pEarliest= mediaTime;
}
if (pLatest)
{
//return the endpcr, which is the latest pcr timestamp available in the timeshifting file
double d2=duration.EndPcr().ToClock();
d2*=1000.0f;
CRefTime mediaTime((LONG)d2);
*pLatest= mediaTime;
}
return S_OK;
}
//not timeshifting, then leave it to the default sourceseeking class
//which returns earliest=0, latest=m_rtDuration
return CSourceSeeking::GetAvailable( pEarliest, pLatest );
}
//******************************************************
/// Returns the file duration in REFERENCE_TIME
/// For nomal .ts files it returns the current pcr - first pcr in the file
/// for timeshifting files it returns the current pcr - the first pcr ever read
/// So the duration keeps growing, even if timeshifting files are wrapped and being resued!
//
STDMETHODIMP CAudioPin::GetDuration(LONGLONG *pDuration)
{
//LogDebug("aud:GetDuration");
if (m_pTsReaderFilter->IsTimeShifting())
{
CTsDuration duration=m_pTsReaderFilter->GetDuration();
CRefTime totalDuration=duration.TotalDuration();
m_rtDuration=totalDuration;
}
else
{
REFERENCE_TIME refTime;
m_pTsReaderFilter->GetDuration(&refTime);
m_rtDuration=CRefTime(refTime);
}
if (pDuration!=NULL)
{
return CSourceSeeking::GetDuration(pDuration);
}
return S_OK;
}
//******************************************************
/// GetCurrentPosition() simply returns that this is not implemented by this pin
/// reason is that only the audio/video renderer now exactly the
/// current playing position and they do implement GetCurrentPosition()
///
STDMETHODIMP CAudioPin::GetCurrentPosition(LONGLONG *pCurrent)
{
//LogDebug("aud:GetCurrentPosition");
return E_NOTIMPL;//CSourceSeeking::GetCurrentPosition(pCurrent);
}
STDMETHODIMP CAudioPin::Notify(IBaseFilter * pSender, Quality q)
{
return E_NOTIMPL;
} | [
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]"
]
| [
[
[
1,
3
],
[
9,
9
],
[
14,
14
],
[
17,
17
],
[
40,
40
],
[
42,
53
],
[
59,
60
],
[
62,
62
],
[
65,
71
],
[
73,
73
],
[
79,
79
],
[
89,
89
],
[
104,
104
],
[
120,
122
],
[
124,
125
],
[
127,
127
],
[
129,
129
],
[
131,
134
],
[
136,
136
],
[
138,
139
],
[
141,
141
],
[
143,
143
],
[
148,
152
],
[
154,
158
],
[
173,
174
],
[
180,
180
],
[
184,
184
],
[
188,
189
],
[
191,
192
],
[
194,
199
],
[
204,
204
],
[
207,
207
],
[
210,
210
],
[
213,
213
],
[
216,
219
],
[
221,
221
],
[
224,
228
],
[
230,
230
],
[
235,
237
],
[
239,
244
],
[
246,
246
],
[
256,
257
],
[
259,
270
],
[
272,
272
],
[
274,
285
],
[
287,
298
],
[
301,
306
],
[
315,
316
],
[
318,
318
],
[
320,
324
],
[
326,
326
],
[
341,
362
],
[
365,
365
],
[
368,
380
],
[
383,
383
],
[
385,
385
],
[
387,
387
],
[
392,
392
],
[
394,
394
],
[
396,
396
],
[
398,
419
],
[
421,
422
],
[
424,
424
],
[
445,
445
],
[
451,
451
],
[
467,
467
],
[
472,
472
],
[
474,
475
],
[
477,
478
],
[
483,
483
],
[
488,
488
],
[
493,
493
],
[
503,
503
],
[
505,
506
],
[
513,
513
],
[
516,
516
],
[
526,
526
],
[
534,
534
],
[
578,
578
],
[
580,
580
]
],
[
[
4,
8
],
[
10,
13
],
[
15,
16
],
[
18,
23
],
[
29,
33
],
[
35,
35
],
[
39,
39
],
[
41,
41
],
[
54,
58
],
[
61,
61
],
[
63,
64
],
[
75,
78
],
[
80,
88
],
[
90,
95
],
[
97,
97
],
[
105,
110
],
[
112,
113
],
[
115,
119
],
[
123,
123
],
[
128,
128
],
[
130,
130
],
[
137,
137
],
[
142,
142
],
[
144,
147
],
[
153,
153
],
[
159,
172
],
[
175,
179
],
[
181,
183
],
[
185,
187
],
[
190,
190
],
[
193,
193
],
[
201,
201
],
[
203,
203
],
[
205,
206
],
[
208,
209
],
[
212,
212
],
[
215,
215
],
[
220,
220
],
[
222,
223
],
[
229,
229
],
[
238,
238
],
[
245,
245
],
[
299,
299
],
[
367,
367
],
[
420,
420
],
[
423,
423
],
[
430,
431
],
[
433,
440
],
[
442,
444
],
[
446,
446
],
[
448,
450
],
[
452,
452
],
[
454,
455
],
[
457,
457
],
[
465,
466
],
[
468,
471
],
[
473,
473
],
[
479,
480
],
[
485,
487
],
[
489,
492
],
[
494,
502
],
[
504,
504
],
[
507,
507
],
[
510,
512
],
[
514,
515
],
[
517,
518
],
[
520,
525
],
[
527,
533
],
[
535,
555
],
[
557,
569
],
[
571,
571
],
[
573,
577
],
[
579,
579
],
[
581,
582
],
[
584,
588
],
[
590,
590
]
],
[
[
24,
26
],
[
34,
34
],
[
36,
38
],
[
72,
72
],
[
74,
74
],
[
96,
96
],
[
111,
111
],
[
114,
114
],
[
126,
126
],
[
135,
135
],
[
140,
140
],
[
200,
200
],
[
211,
211
],
[
214,
214
],
[
231,
234
],
[
247,
255
],
[
258,
258
],
[
271,
271
],
[
273,
273
],
[
286,
286
],
[
300,
300
],
[
307,
314
],
[
317,
317
],
[
319,
319
],
[
325,
325
],
[
327,
340
],
[
363,
364
],
[
388,
391
],
[
395,
395
],
[
425,
429
],
[
432,
432
],
[
441,
441
],
[
447,
447
],
[
453,
453
],
[
458,
459
],
[
476,
476
],
[
481,
482
],
[
484,
484
],
[
508,
509
],
[
519,
519
],
[
556,
556
],
[
570,
570
],
[
572,
572
],
[
583,
583
],
[
589,
589
]
],
[
[
27,
28
]
],
[
[
98,
103
]
],
[
[
202,
202
],
[
366,
366
],
[
381,
382
],
[
384,
384
],
[
386,
386
],
[
393,
393
],
[
397,
397
],
[
456,
456
],
[
460,
464
]
]
]
|
4a0c7c9c66513b5846194304cf7f5b19729b9d06 | 4be39d7d266a00f543cf89bcf5af111344783205 | /include/base64.hpp | 9286fff72a4ee4984147ff2b23c3029dc6fea98c | []
| no_license | nkzxw/lastigen-haustiere | 6316bb56b9c065a52d7c7edb26131633423b162a | bdf6219725176ae811c1063dd2b79c2d51b4bb6a | refs/heads/master | 2021-01-10T05:42:05.591510 | 2011-02-03T14:59:11 | 2011-02-03T14:59:11 | 47,530,529 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,705 | hpp | //TODO: renombrar archivo
#ifndef BASE64_HPP
#define BASE64_HPP
#include <string>
#include <iostream>
#include "boost/archive/iterators/base64_from_binary.hpp"
#include "boost/archive/iterators/binary_from_base64.hpp"
#include "boost/archive/iterators/transform_width.hpp"
using namespace std;
using namespace boost::archive::iterators;
//inline String base64_encode(InputContainerType const & cont)
template<typename InputContainerType>
inline std::string base64_encode(const InputContainerType const & cont)
{
using namespace boost::archive::iterators;
//typedef base64_from_binary< transform_width< typename InputContainerType::const_pointer, 6, 8, boost::uint8_t > > base64_t;
typedef base64_from_binary< transform_width< typename InputContainerType::const_pointer, 6, 8 > > base64_t;
//return String(base64_t(&cont[0]), base64_t(&cont[0] + cont.size()));
std::string str = std::string(base64_t(&cont[0]), base64_t(&cont[0] + cont.size()));
//str.append(str.size() % 4, CharT('='));
//int sz = str.size();
//std::cout << sz << std::endl;
//std::cout << (4-(str.size() % 4)) << std::endl;
str.append(4-(str.size() % 4), '=');
return str;
}
template<typename Container, typename CharT>
inline Container base64_decode(std::basic_string<CharT> str)
{
//str.append(str.size() % 4, CharT('='));
//typedef boost::archive::iterators::transform_width< boost::archive::iterators::binary_from_base64<CharT *>, 8, 6, boost::uint8_t > binary_t;
typedef boost::archive::iterators::transform_width< boost::archive::iterators::binary_from_base64<CharT *>, 8, 6 > binary_t;
typename std::basic_string<CharT>::size_type pos = str.find_last_not_of(CharT('='));
// calculate how many characters we need to process
pos = (pos == str.size() -1 ? str.size() : pos );
return Container(binary_t(&str[0]), binary_t(&str[0] + pos));
}
//int main()
//{
//
// string str("admin:1234");
// cout << str << endl;
//
// std::string enc = base64_encode(str);
//
// cout << enc << endl;
//
// str = base64_decode<std::string>(enc);
//
// cout << str << endl;
//
//
//
//
// //string str("Hello, world!");
// ////string str("admin:1234");
// //cout << str << endl;
// ////string enc(base64_t(str.begin()), base64_t(str.end()));
//
// //std::string enc;
//
//
// //std::copy(
// // base64_t(BOOST_MAKE_PFTO_WRAPPER(str.begin())),
// // base64_t(BOOST_MAKE_PFTO_WRAPPER(str.end())),
// // std::back_inserter(enc)
// //);
//
//
//
// //cout << enc << endl;
// //string dec(binary_t(enc.begin()), binary_t(enc.end()));
// //cout << dec << endl;
// return 0;
//}
#endif // BASE64_HPP
| [
"fpelliccioni@c29dda52-a065-11de-a33f-1de61d9b9616"
]
| [
[
[
1,
94
]
]
]
|
8965c8838023b690c85bf44a15d2b0792543d302 | 7f72fc855742261daf566d90e5280e10ca8033cf | /branches/full-calibration/ground/src/plugins/uavobjects/firmwareiapobj.h | f8566ed471d0e29bbf425888ce99f1af3c1f305b | []
| no_license | caichunyang2007/my_OpenPilot_mods | 8e91f061dc209a38c9049bf6a1c80dfccb26cce4 | 0ca472f4da7da7d5f53aa688f632b1f5c6102671 | refs/heads/master | 2023-06-06T03:17:37.587838 | 2011-02-28T10:25:56 | 2011-02-28T10:25:56 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,716 | h | /**
******************************************************************************
*
* @file firmwareiapobj.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @see The GNU Public License (GPL) Version 3
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup UAVObjectsPlugin UAVObjects Plugin
* @{
*
* @note Object definition file: firmwareiap.xml.
* This is an automatically generated file.
* DO NOT modify manually.
*
* @brief The UAVUObjects GCS plugin
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef FIRMWAREIAPOBJ_H
#define FIRMWAREIAPOBJ_H
#include "uavdataobject.h"
#include "uavobjectmanager.h"
class UAVOBJECTS_EXPORT FirmwareIAPObj: public UAVDataObject
{
Q_OBJECT
public:
// Field structure
typedef struct {
quint16 Command;
quint32 Port;
quint8 Version[3];
quint16 SVN;
quint32 crc;
} __attribute__((packed)) DataFields;
// Field information
// Field Command information
// Field Port information
// Field Version information
/* Number of elements for field Version */
static const quint32 VERSION_NUMELEM = 3;
// Field SVN information
// Field crc information
// Constants
static const quint32 OBJID = 1075803696U;
static const QString NAME;
static const bool ISSINGLEINST = 1;
static const bool ISSETTINGS = 0;
static const quint32 NUMBYTES = sizeof(DataFields);
// Functions
FirmwareIAPObj();
DataFields getData();
void setData(const DataFields& data);
Metadata getDefaultMetadata();
UAVDataObject* clone(quint32 instID);
static FirmwareIAPObj* GetInstance(UAVObjectManager* objMngr, quint32 instID = 0);
private:
DataFields data;
void setDefaultFieldValues();
};
#endif // FIRMWAREIAPOBJ_H
| [
"jonathan@ebee16cc-31ac-478f-84a7-5cbb03baadba"
]
| [
[
[
1,
88
]
]
]
|
e66b4da3359f8bb22f5152dbe145e7620d1cf818 | 1df8e73545f4cce1cc3df5af42e6cc8a711d7f13 | /printview.cpp | 999ab155c47f9356fe305eed8da9e9f214b90d03 | []
| no_license | Mohamedss/qt-segy-viewer | 6e5c84a846e63e5e61b1489ef675a36e799c3929 | 54a55718a91bae8b9eab2610c1d23eddc0abb95d | refs/heads/master | 2021-01-19T09:44:00.639450 | 2010-12-21T00:36:15 | 2010-12-21T00:36:15 | 35,456,892 | 5 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,431 | cpp | /****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation ([email protected])
**
** This file is part of the demonstration applications of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial Usage
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you have questions regarding the use of this file, please contact
** Nokia at [email protected].
** $QT_END_LICENSE$
**
****************************************************************************/
#include <printview.h>
#include <QPrinter>
#include <QStyleOptionViewItem>
PrintView::PrintView()
{
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
}
void PrintView::print(QPrinter *printer)
{
#ifndef QT_NO_PRINTER
resize(printer->width(), printer->height());
render(printer);
#endif
}
| [
"[email protected]@ba798d5c-232d-d148-425a-647f199d9ac8"
]
| [
[
[
1,
58
]
]
]
|
c20d8d7bd3457ac6304885cec9482a58c63574e7 | a30b091525dc3f07cd7e12c80b8d168a0ee4f808 | /EngineAll/Math/DenseMatrix.h | 0a566ee496f064dd45a08b74f3c9c214cf343fab | []
| no_license | ghsoftco/basecode14 | f50dc049b8f2f8d284fece4ee72f9d2f3f59a700 | 57de2a24c01cec6dc3312cbfe200f2b15d923419 | refs/heads/master | 2021-01-10T11:18:29.585561 | 2011-01-23T02:25:21 | 2011-01-23T02:25:21 | 47,255,927 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 33,813 | h | /*
DenseMatrix.h
Written by Matthew Fisher
a dense matrix structure.
*/
#pragma once
template<class T> class SparseMatrix;
template<class T>
class DenseMatrix
{
public:
DenseMatrix();
explicit DenseMatrix(UINT Size);
explicit DenseMatrix(UINT RowCount, UINT ColCount);
explicit DenseMatrix(const SparseMatrix<T> &M);
DenseMatrix(const DenseMatrix<T> &M);
~DenseMatrix();
//
// Memory
//
void Allocate(UINT RowCount, UINT ColCount);
void Clear(T Value = 0.0);
void FreeMemory();
DenseMatrix<T>& operator = (const DenseMatrix<T> &M);
//
// Files
//
void LoadFromFile(const String &Filename);
void SaveToMATLAB(const String &Filename) const;
//
// Accessors
//
__forceinline T* operator [] (int Row)
{
return &_Data[Row * _ColCount];
}
__forceinline const T* operator [] (int Row) const
{
return &_Data[Row * _ColCount];
}
__forceinline T& Cell(int Row, int Col)
{
return _Data[Row * _ColCount + Col];
}
__forceinline const T& Cell(int Row, int Col) const
{
return _Data[Row * _ColCount + Col];
}
__forceinline UINT RowCount() const
{
return _RowCount;
}
__forceinline UINT ColCount() const
{
return _ColCount;
}
//
// Operators
//
void operator += (const DenseMatrix &M);
//
// In-place modifiers
//
void Identity();
void Identity(UINT Size);
void InvertInPlace();
//
// Query
//
bool Square() const;
bool ElementsValid();
T Determinant();
void ExtractRow(UINT Row, Vector<T> &Result);
void ExtractCol(UINT Col, Vector<T> &Result);
Vector<T> ExtractRow(UINT Row);
Vector<T> ExtractCol(UINT Col);
//
// Linear algebra
//
DenseMatrix<T> Inverse();
DenseMatrix<T> Transpose();
void LUDecomposition(DenseMatrix<T> &L, DenseMatrix<T> &U);
void LUSolve(Vector<T> &x, const Vector<T> &b);
bool EigenSystem(Vector<T> &Eigenvalues, DenseMatrix<T> &Eigenvectors) const;
bool EigenSystem(T *Eigenvalues, T **Eigenvectors) const;
String EigenTest(const Vector<T> &Eigenvalues, const DenseMatrix<T> &Eigenvectors) const;
String EigenTest(const T *Eigenvalues, const T **Eigenvectors) const;
bool VictorEigenSystem(Vector<T> &Eigenvalues, DenseMatrix<T> &Eigenvectors) const;
//
// Conversion
//
/*void ToColumnVector(Vector<T> &Result)
{
Assert(_ColCount == 1, "ToColumnVector called with more than 1 column");
Result.ReSize(_RowCount);
for(UINT RowIndex = 0; RowIndex < _RowCount; RowIndex++)
{
Result[RowIndex] = Cell(RowIndex, 0);
}
}*/
//
// Static helper functions for functional-style sparse matrix manipulation. Since the copy constructor
// for a dense matrix can be costly, this approach may be more efficient that using operator overloading.
//
static void Multiply(DenseMatrix<T> &Result, const DenseMatrix<T> &Left, const DenseMatrix<T> &Right);
static void Multiply(DenseMatrix<T> &Result, const SparseMatrix<T> &Left, const DenseMatrix<T> &Right);
static void Multiply(DenseMatrix<T> &Result, const DenseMatrix<T> &Left, const SparseMatrix<T> &Right);
static void MultiplyMMTranspose(DenseMatrix<T> &Result, const DenseMatrix<T> &M);
static void MultiplyMMTranspose(DenseMatrix<T> &Result, const SparseMatrix<T> &M);
static void Multiply(Vector<T> &Result, const DenseMatrix<T> &Left, const Vector<T> &Right);
static void MultiplyInPlace(DenseMatrix<T> &Result, T Right);
static DenseMatrix<T> OuterProduct(const Vector<T> &A, const Vector<T> &B);
static T CompareMatrices(const DenseMatrix<T> &Left, const DenseMatrix<T> &Right);
private:
UINT _RowCount, _ColCount;
//Vector<T> _Data;
T *_Data;
};
//
// Overloaded operators
//
template<class T> ostream& operator << (ostream &os, const DenseMatrix<T> &m);
template<class T> DenseMatrix<T> operator * (const DenseMatrix<T> &Left, const DenseMatrix<T> &Right);
template<class T> DenseMatrix<T> operator * (const DenseMatrix<T> &Left, const SparseMatrix<T> &Right);
template<class T> DenseMatrix<T> operator * (const SparseMatrix<T> &Left, const DenseMatrix<T> &Right);
template<class T> DenseMatrix<T> operator * (const DenseMatrix<T> &Left, T Right);
template<class T> DenseMatrix<T> operator * (T Left, const DenseMatrix<T> &Right);
template<class T> DenseMatrix<T> operator + (const DenseMatrix<T> &Left, const DenseMatrix<T> &Right);
template<class T> DenseMatrix<T> operator - (const DenseMatrix<T> &Left, const DenseMatrix<T> &Right);
//#include "DenseMatrix.cpp"
template<class T>
DenseMatrix<T>::DenseMatrix()
{
_RowCount = 0;
_ColCount = 0;
_Data = NULL;
}
template<class T>
DenseMatrix<T>::DenseMatrix(UINT Size)
{
_RowCount = 0;
_ColCount = 0;
_Data = NULL;
Allocate(Size, Size);
}
template<class T>
DenseMatrix<T>::DenseMatrix(UINT RowCount, UINT ColCount)
{
_RowCount = 0;
_ColCount = 0;
_Data = NULL;
Allocate(RowCount, ColCount);
}
template<class T>
DenseMatrix<T>::DenseMatrix(const DenseMatrix<T>&M)
{
_RowCount = 0;
_ColCount = 0;
_Data = NULL;
Allocate(M.RowCount(), M.ColCount());
memcpy(_Data, M._Data, sizeof(T) * M.RowCount() * M.ColCount());
}
template<class T>
DenseMatrix<T>::DenseMatrix(const SparseMatrix<T> &M)
{
_RowCount = 0;
_ColCount = 0;
_Data = NULL;
Allocate(M.RowCount(), M.ColCount());
for(UINT Row = 0; Row < _RowCount; Row++)
{
for(UINT Col = 0; Col < _ColCount; Col++)
{
Cell(Row, Col) = M.GetElement(Row, Col);
}
}
}
template<class T>
DenseMatrix<T>::~DenseMatrix()
{
FreeMemory();
}
template<class T>
void DenseMatrix<T>::FreeMemory()
{
//_Data.FreeMemory();
if(_Data != NULL)
{
delete[] _Data;
_Data = NULL;
}
_RowCount = 0;
_ColCount = 0;
}
template<class T>
void DenseMatrix<T>::Allocate(UINT RowCount, UINT ColCount)
{
if(_RowCount != RowCount || _ColCount != ColCount)
{
_RowCount = RowCount;
_ColCount = ColCount;
_Data = new T[_RowCount * _ColCount];
//_Data.Allocate(_RowCount * _ColCount);
}
}
template<class T>
void DenseMatrix<T>::SaveToMATLAB(const String &Filename) const
{
ofstream File(Filename.CString());
for(UINT Row = 0; Row < _RowCount; Row++)
{
for(UINT Col = 0; Col < _ColCount; Col++)
{
File << Cell(Row, Col);
if(Col != _ColCount - 1)
{
File << '\t';
}
}
File << endl;
}
}
template<class T>
void DenseMatrix<T>::LoadFromFile(const String &Filename)
{
Vector<String> Lines, Words;
Utility::GetFileLines(Filename, Lines);
UINT TargetColCount = 0;
Vector<T> AllData;
for(UINT LineIndex = 0; LineIndex < Lines.Length(); LineIndex++)
//for(UINT LineIndex = 0; LineIndex < 1000; LineIndex++)
{
const String &CurLine = Lines[LineIndex];
if(CurLine.Length() > 2)
{
CurLine.Partition(' ', Words);
if(TargetColCount == 0)
{
TargetColCount = Words.Length();
}
else
{
Assert(TargetColCount == Words.Length(), "Invalid file in DenseMatrix<T>::LoadFromFile");
}
for(UINT WordIndex = 0; WordIndex < TargetColCount; WordIndex++)
{
AllData.PushEnd(T(Words[WordIndex].ConvertToDouble()));
}
}
}
PersistentAssert(TargetColCount != 0 && AllData.Length() > 0, "Invalid file in DenseMatrix<T>::LoadFromFile");
Allocate(AllData.Length() / TargetColCount, TargetColCount);
memcpy(_Data, AllData.CArray(), sizeof(T) * AllData.Length());
/*for(UINT Row = 0; Row < _RowCount; Row++)
{
for(UINT Col = 0; Col < _ColCount; Col++)
{
}
}*/
}
template<class T>
void DenseMatrix<T>::ExtractRow(UINT Row, Vector<T> &Result)
{
Result.Allocate(_ColCount);
for(UINT Col = 0; Col < _ColCount; Col++)
{
Result[Col] = _Data[Row * _ColCount + Col];
}
}
template<class T>
void DenseMatrix<T>::ExtractCol(UINT Col, Vector<T> &Result)
{
Result.Allocate(_RowCount);
for(UINT Row = 0; Row < _RowCount; Row++)
{
Result[Row] = _Data[Row * _ColCount + Col];
}
}
template<class T>
Vector<T> DenseMatrix<T>::ExtractRow(UINT Row)
{
Vector<T> Result(_ColCount);
for(UINT Col = 0; Col < _ColCount; Col++)
{
Result[Col] = _Data[Row * _ColCount + Col];
}
return Result;
}
template<class T>
Vector<T> DenseMatrix<T>::ExtractCol(UINT Col)
{
Vector<T> Result(_RowCount);
for(UINT Row = 0; Row < _RowCount; Row++)
{
Result[Row] = _Data[Row * _ColCount + Col];
}
return Result;
}
template<class T>
void DenseMatrix<T>::Clear(T Value)
{
for(UINT Index = 0; Index < _RowCount * _ColCount; Index++)
{
_Data[Index] = Value;
}
}
template<class T>
DenseMatrix<T>& DenseMatrix<T>::operator = (const DenseMatrix<T>&M)
{
Allocate(M.RowCount(), M.ColCount());
memcpy(_Data, M._Data, sizeof(T) * M.RowCount() * M.ColCount());
return (*this);
}
template<class T>
DenseMatrix<T> DenseMatrix<T>::OuterProduct(const Vector<T> &A, const Vector<T> &B)
{
Assert(A.Length() == B.Length() && A.Length() != 0, "Invalid vector dimensions in DenseMatrix<T>::OuterProduct");
const UINT Size = A.Length();
DenseMatrix Result, AMat(Size, 1), BMat(1, Size);
for(UINT Index = 0; Index < Size; Index++)
{
AMat[Index][0] = A[Index];
BMat[0][Index] = B[Index];
}
DenseMatrix::Multiply(Result, AMat, BMat);
return Result;
}
template<class T>
T DenseMatrix<T>::CompareMatrices(const DenseMatrix<T> &Left, const DenseMatrix<T> &Right)
{
T Result = T(0.0);
UINT RowCount = Left.RowCount();
UINT ColCount = Left.ColCount();
for(UINT Row = 0; Row < RowCount; Row++)
{
for(UINT Col = 0; Col < ColCount; Col++)
{
Result += Math::Abs(Left[Row][Col] - Right[Row][Col]);
}
}
return Result;
}
template<class T>
void DenseMatrix<T>::LUSolve(Vector<T> &x, const Vector<T> &b)
{
Assert(Square() && b.Length() == _RowCount, "Invalid paramater DenseMatrix<T>::LUSolve");
Vector<T> y;
x.Allocate(b.Length());
y.Allocate(b.Length());
DenseMatrix<T>L, U, Copy;
Copy = *this;
Copy.LUDecomposition(L, U);
for(UINT i = 0; i < _RowCount; i++)
{
T Sum = 0.0f;
for(UINT j = 0; j < i; j++)
{
Sum += L[i][j] * y[j];
}
y[i] = b[i] - Sum;
}
for(int i = _RowCount - 1; i >= 0; i--)
{
T Sum = 0.0;
for(int j = i + 1; j < int(_RowCount); j++)
{
Sum += U[i][j] * x[j];
}
x[i] = (y[i] - Sum) / U[i][i];
}
}
template<class T>
void DenseMatrix<T>::operator += (const DenseMatrix &M)
{
Assert(M._RowCount == _RowCount && M._ColCount == _ColCount, "Invalid matrix dimensions");
for(UINT Row = 0; Row < _RowCount; Row++)
{
for(UINT Col = 0; Col < _ColCount; Col++)
{
(*this)[Row][Col] += M[Row][Col];
}
}
}
template<class T>
void DenseMatrix<T>::LUDecomposition(DenseMatrix<T>&L, DenseMatrix<T>&U)
{
Assert(Square(), "DenseMatrix<T>::LUDecomposition called on non-square matrix");
L.Identity(_RowCount);
U.Identity(_RowCount);
for(UINT k = 0; k < _RowCount; k++)
{
U[k][k] = Cell(k, k);
for(UINT i = k; i < _RowCount; i++)
{
L[i][k] = Cell(i, k) / U[k][k];
U[k][i] = Cell(k, i);
}
for(UINT i = k; i < _RowCount; i++)
{
for(UINT j = k; j < _RowCount; j++)
{
Cell(i, j) -= L[i][k] * U[k][j];
}
}
}
}
template<class T>
bool DenseMatrix<T>::VictorEigenSystem(Vector<T> &Eigenvalues, DenseMatrix<T> &Eigenvectors) const
{
PersistentAssert(Square(), "Eigensystem requires a square matrix");
const UINT N = _RowCount;
std::complex<double> *A = new std::complex<double>[N * N];
for(UINT Col = 0; Col < N; Col++)
{
for(UINT Row = 0; Row < N; Row++)
{
A[Col * N + Row] = std::complex<double>(Cell(Row, Col), 0.0);
}
}
std::complex<double> *evals = new std::complex<double>[N];
std::complex<double> *evecs = new std::complex<double>[N * N];
size_t nrot;
size_t MaxIterations = (int)(2 + 2.8 * log((double)N) / log(2.0));
if(MaxIterations < 8)
{
MaxIterations = 8;
}
Console::WriteLine(String("Eigensystem solve, sweeps: ") + String(MaxIterations));
RNP::Eigensystem(N, A, N, evals, evecs, N, MaxIterations, &nrot);
Eigenvalues.Allocate(N);
Eigenvectors.Allocate(N, N);
for(UINT Col = 0; Col < N; Col++)
{
Eigenvalues[Col] = evals[Col].real();
for(UINT Row = 0; Row < N; Row++)
{
Eigenvectors.Cell(Row, Col) = evecs[Col * N + Row].real();
}
}
delete [] A;
delete [] evecs;
delete [] evals;
return true;
}
#define VTK_ROTATE(a,i,j,k,l) g=a[i][j];h=a[k][l];a[i][j]=g-s*(h+g*tau);\
a[k][l]=h+s*(g-h*tau)
#define VTK_MAX_ROTATIONS 20
template<class T>
bool DenseMatrix<T>::EigenSystem(Vector<T> &Eigenvalues, DenseMatrix<T> &Eigenvectors) const
{
const UINT Dimension = _RowCount;
Eigenvalues.Allocate(Dimension);
Eigenvectors.Allocate(Dimension, Dimension);
Vector<T*> EigenvectorList(Dimension);
for(UINT DimensionIndex = 0; DimensionIndex < Dimension; DimensionIndex++)
{
EigenvectorList[DimensionIndex] = Eigenvectors[DimensionIndex];
}
return EigenSystem(Eigenvalues.CArray(), EigenvectorList.CArray());
}
template<class T>
String DenseMatrix<T>::EigenTest(const Vector<T> &Eigenvalues, const DenseMatrix<T> &Eigenvectors) const
{
const UINT Dimension = _RowCount;
Vector<const T*> EigenvectorList(Dimension);
for(UINT DimensionIndex = 0; DimensionIndex < Dimension; DimensionIndex++)
{
EigenvectorList[DimensionIndex] = Eigenvectors[DimensionIndex];
}
return EigenTest(Eigenvalues.CArray(), EigenvectorList.CArray());
}
//
// Jacobi iteration for the solution of eigenvectors/eigenvalues of a nxn
// real symmetric matrix. Square nxn matrix a; size of matrix in n;
// output eigenvalues in w; and output eigenvectors in Eigenvectors. Resulting
// eigenvalues/vectors are sorted in decreasing order; eigenvectors are
// normalized.
//
// Code modified from VTK vtkJacobiN function
//
template<class T>
bool DenseMatrix<T>::EigenSystem(T *Eigenvalues, T **Eigenvectors) const
{
PersistentAssert(Square() && _RowCount >= 2, "Invalid matrix dimensions");
int i, j, k, iq, ip, numPos, n = int(_RowCount);
double tresh, theta, tau, t, sm, s, h, g, c, tmp;
double bspace[4], zspace[4];
double *b = bspace;
double *z = zspace;
//
// Jacobi iteration destroys the matrix so create a temporary copy
//
DenseMatrix<double> a(_RowCount);
for(UINT Row = 0; Row < _RowCount; Row++)
{
for(UINT Col = 0; Col < _ColCount; Col++)
{
a.Cell(Row, Col) = Cell(Row, Col);
}
}
//
// only allocate memory if the matrix is large
//
if (n > 4)
{
b = new double[n];
z = new double[n];
}
//
// initialize
//
for (ip=0; ip<n; ip++)
{
for (iq=0; iq<n; iq++)
{
Eigenvectors[ip][iq] = 0.0;
}
Eigenvectors[ip][ip] = 1.0;
}
for (ip=0; ip<n; ip++)
{
b[ip] = a[ip][ip];
Eigenvalues[ip] = T(a[ip][ip]);
z[ip] = 0.0;
}
// begin rotation sequence
for (i=0; i<VTK_MAX_ROTATIONS; i++)
{
sm = 0.0;
for (ip=0; ip<n-1; ip++)
{
for (iq=ip+1; iq<n; iq++)
{
sm += fabs(a[ip][iq]);
}
}
if (sm == 0.0)
{
break;
}
if (i < 3) // first 3 sweeps
{
tresh = 0.2*sm/(n*n);
}
else
{
tresh = 0.0;
}
for (ip=0; ip<n-1; ip++)
{
for (iq=ip+1; iq<n; iq++)
{
g = T(100.0*fabs(a[ip][iq]));
// after 4 sweeps
if (i > 3 && (fabs(Eigenvalues[ip])+g) == fabs(Eigenvalues[ip])
&& (fabs(Eigenvalues[iq])+g) == fabs(Eigenvalues[iq]))
{
a[ip][iq] = 0.0;
}
else if (fabs(a[ip][iq]) > tresh)
{
h = Eigenvalues[iq] - Eigenvalues[ip];
if ( (fabs(h)+g) == fabs(h))
{
t = (a[ip][iq]) / h;
}
else
{
theta = 0.5*h / (a[ip][iq]);
t = 1.0 / (fabs(theta)+sqrt(1.0+theta*theta));
if (theta < 0.0)
{
t = -t;
}
}
c = 1.0 / sqrt(1+t*t);
s = t*c;
tau = s/(1.0+c);
h = t*a[ip][iq];
z[ip] -= h;
z[iq] += h;
Eigenvalues[ip] -= T(h);
Eigenvalues[iq] += T(h);
a[ip][iq] = 0.0;
// ip already shifted left by 1 unit
for (j = 0;j <= ip-1;j++)
{
VTK_ROTATE(a,j,ip,j,iq);
}
// ip and iq already shifted left by 1 unit
for (j = ip+1;j <= iq-1;j++)
{
VTK_ROTATE(a,ip,j,j,iq);
}
// iq already shifted left by 1 unit
for (j=iq+1; j<n; j++)
{
VTK_ROTATE(a,ip,j,iq,j);
}
for (j=0; j<n; j++)
{
#pragma warning ( disable : 4244 )
VTK_ROTATE(Eigenvectors,j,ip,j,iq);
#pragma warning ( default : 4244 )
}
}
}
}
for (ip=0; ip<n; ip++)
{
b[ip] += z[ip];
Eigenvalues[ip] = T(b[ip]);
z[ip] = 0.0;
}
}
//
// this is NEVER called
//
if ( i >= VTK_MAX_ROTATIONS )
{
SignalError("VTK_MAX_ROTATIONS exceeded");
return false;
}
// sort eigenfunctions these changes do not affect accuracy
for (j=0; j<n-1; j++) // boundary incorrect
{
k = j;
tmp = Eigenvalues[k];
for (i=j+1; i<n; i++) // boundary incorrect, shifted already
{
if (Eigenvalues[i] >= tmp) // why exchage if same?
{
k = i;
tmp = Eigenvalues[k];
}
}
if (k != j)
{
Eigenvalues[k] = Eigenvalues[j];
Eigenvalues[j] = T(tmp);
for (i=0; i<n; i++)
{
tmp = Eigenvectors[i][j];
Eigenvectors[i][j] = Eigenvectors[i][k];
Eigenvectors[i][k] = T(tmp);
}
}
}
//
// insure eigenvector consistency (i.e., Jacobi can compute vectors that
// are negative of one another (.707,.707,0) and (-.707,-.707,0). This can
// reek havoc in hyperstreamline/other stuff. We will select the most
// positive eigenvector.
//
int ceil_half_n = (n >> 1) + (n & 1);
for (j=0; j<n; j++)
{
for (numPos=0, i=0; i<n; i++)
{
if ( Eigenvectors[i][j] >= 0.0 )
{
numPos++;
}
}
// if ( numPos < ceil(double(n)/double(2.0)) )
if ( numPos < ceil_half_n)
{
for(i=0; i<n; i++)
{
Eigenvectors[i][j] *= -1.0;
}
}
}
if (n > 4)
{
delete [] b;
delete [] z;
}
return true;
}
template<class T>
String DenseMatrix<T>::EigenTest(const T *Eigenvalues, const T **Eigenvectors) const
{
const bool Verbose = false;
String Description;
PersistentAssert(Square() && _RowCount >= 2, "Invalid matrix dimensions");
Vector<T> Eigenvector(_RowCount), Result;
double MaxError = 0.0;
for(UINT EigenIndex = 0; EigenIndex < _RowCount; EigenIndex++)
{
for(UINT ElementIndex = 0; ElementIndex < _RowCount; ElementIndex++)
{
Eigenvector[ElementIndex] = Eigenvectors[ElementIndex][EigenIndex];
}
DenseMatrix<T>::Multiply(Result, *this, Eigenvector);
double Error = 0.0;
T CurEigenvalue = Eigenvalues[EigenIndex];
for(UINT ElementIndex = 0; ElementIndex < _RowCount; ElementIndex++)
{
Error += Math::Abs(Eigenvector[ElementIndex] * CurEigenvalue - Result[ElementIndex]);
}
if(Verbose)
{
Description += String("Eigenvector ") + String(EigenIndex) + String(" absolute error: ") + String(Error) + String("\n");
}
MaxError = Math::Max(Error, MaxError);
}
Description += String("Max eigenvector error: ") + String(MaxError) + String("\n");
return Description;
}
template<class T>
T DenseMatrix<T>::Determinant()
{
Assert(Square(), "Determinant called on non-square matrix");
if(_RowCount == 2)
{
return Cell(0, 0) * Cell(1, 1) - Cell(1, 0) * Cell(0, 1);
}
else if(_RowCount == 3)
{
return (Cell(0, 0) * Cell(1, 1) * Cell(2, 2) + Cell(0, 1) * Cell(1, 2) * Cell(2, 0) + Cell(0, 2) * Cell(1, 0) * Cell(2, 1)) -
(Cell(2, 0) * Cell(1, 1) * Cell(0, 2) + Cell(2, 1) * Cell(1, 2) * Cell(0, 0) + Cell(2, 2) * Cell(1, 0) * Cell(0, 1));
}
else
{
SignalError("Not implemented");
return 0.0f;
}
}
template<class T>
DenseMatrix<T>DenseMatrix<T>::Inverse()
{
DenseMatrix<T>Result = *this;
Result.InvertInPlace();
return Result;
}
template<class T>
void DenseMatrix<T>::InvertInPlace()
{
Assert(Square(), "DenseMatrix<T>::Invert called on non-square matrix");
for (UINT i = 1; i < _RowCount; i++)
{
Cell(0, i) /= Cell(0, 0);
}
for (UINT i = 1; i < _RowCount; i++)
{
//
// do a column of L
//
for (UINT j = i; j < _RowCount; j++)
{
T Sum = 0.0f;
for (UINT k = 0; k < i; k++)
{
Sum += Cell(j, k) * Cell(k, i);
}
Cell(j, i) -= Sum;
}
if (i == _RowCount - 1)
{
continue;
}
//
// do a row of U
//
for (UINT j = i + 1; j < _RowCount; j++)
{
T Sum = 0.0f;
for (UINT k = 0; k < i; k++)
Sum += Cell(i, k) * Cell(k, j);
Cell(i, j) = (Cell(i, j) - Sum) / Cell(i, i);
}
}
//
// invert L
//
for (UINT i = 0; i < _RowCount; i++)
for (UINT j = i; j < _RowCount; j++)
{
T Sum = 1.0f;
if ( i != j )
{
Sum = 0.0f;
for (UINT k = i; k < j; k++ )
{
Sum -= Cell(j, k) * Cell(k, i);
}
}
Cell(j, i) = Sum / Cell(j, j);
}
//
// invert U
//
for (UINT i = 0; i < _RowCount; i++)
for (UINT j = i; j < _RowCount; j++)
{
if ( i == j )
{
continue;
}
T Sum = 0.0f;
for (UINT k = i; k < j; k++)
{
T Val = 1.0f;
if(i != k)
{
Val = Cell(i, k);
}
Sum += Cell(k, j) * Val;
}
Cell(i, j) = -Sum;
}
//
// final inversion
//
for (UINT i = 0; i < _RowCount; i++)
{
for (UINT j = 0; j < _RowCount; j++)
{
T Sum = 0.0f;
UINT Larger = j;
if(i > j)
{
Larger = i;
}
for (UINT k = Larger; k < _RowCount; k++)
{
T Val = 1.0f;
if(j != k)
{
Val = Cell(j, k);
}
Sum += Val * Cell(k, i);
}
Cell(j, i) = Sum;
}
}
//Assert(ElementsValid(), "Degenerate Matrix inversion.");
}
template<class T>
void DenseMatrix<T>::Identity()
{
Assert(Square(), "DenseMatrix<T>::Identity called on non-square Matrix4.");
for(UINT i = 0; i < _RowCount; i++)
{
for(UINT i2 = 0; i2 < _RowCount; i2++)
{
if(i == i2)
{
Cell(i, i2) = 1.0f;
}
else
{
Cell(i, i2) = 0.0f;
}
}
}
}
template<class T>
void DenseMatrix<T>::Identity(UINT Size)
{
Allocate(Size, Size);
Identity();
}
template<class T>
bool DenseMatrix<T>::Square() const
{
return (_RowCount == _ColCount);
}
template<class T>
bool DenseMatrix<T>::ElementsValid()
{
for(UINT Row = 0; Row < _RowCount; Row++)
{
for(UINT Col = 0; Col < _ColCount; Col++)
{
if(Cell(Row, Col) != Cell(Row, Col))
{
return false;
}
}
}
return true;
}
template<class T>
DenseMatrix<T> DenseMatrix<T>::Transpose()
{
DenseMatrix<T> Result;
Result.Allocate(_ColCount, _RowCount);
for(UINT i = 0; i < _RowCount; i++)
{
for(UINT i2 = 0; i2 < _ColCount; i2++)
{
Result.Cell(i2, i) = Cell(i, i2);
}
}
return Result;
}
/*ostream& operator << (ostream &os, const DenseMatrix<T>&m)
{
UINT n = m.RowCount();
//os << setprecision(8) << setiosflags(ios::right | ios::showpoint);
os << "{";
for(UINT i=0;i<n;i++)
{
os << "{";
for(UINT i2=0;i2<n;i2++)
{
os << m[i][i2];
if(i2 != n - 1) os << ", ";
}
os << "}";
if(i != n - 1) os << ", ";
os << endl;
}
os << "}";
return os;
}*/
template<class T>
ostream& operator << (ostream &os, const DenseMatrix<T>&m)
{
Assert(m.Square(), "Output not correct for non-square matrices.");
UINT n = m.RowCount();
os << setprecision(8) << setiosflags(ios::right | ios::showpoint);
for(UINT i = 0; i < n; i++)
{
for(UINT i2 = 0; i2 < n; i2++)
{
os << setw(12) << m[i][i2];
}
os << endl;
}
return os;
}
template<class T>
void DenseMatrix<T>::Multiply(Vector<T> &Result, const DenseMatrix<T>&Left, const Vector<T> &Right)
{
Assert(Left.ColCount() == Right.Length(), "Invalid dimensions in DenseMatrix<T>::Multiply");
Result.Allocate(Left.RowCount());
for(UINT Row = 0; Row < Result.Length(); Row++)
{
T Total = 0.0;
for(UINT Index = 0; Index < Left.ColCount(); Index++)
{
Total += Left.Cell(Row, Index) * Right[Index];
}
Result[Row] = Total;
}
}
template<class T>
void DenseMatrix<T>::Multiply(DenseMatrix<T>&Result, const DenseMatrix<T>&Left, const DenseMatrix<T>&Right)
{
Assert(Left.ColCount() == Right.RowCount(), "Invalid matrix dimensions on SetProduct");
const UINT RowCount = Left.RowCount();
const UINT ColCount = Right.ColCount();
Result.Allocate(RowCount, ColCount);
for(UINT RowIndex = 0; RowIndex < RowCount; RowIndex++)
{
for(UINT ColIndex = 0; ColIndex < ColCount; ColIndex++)
{
T Total = 0.0;
for(UINT InnerIndex = 0; InnerIndex < Left.ColCount(); InnerIndex++)
{
Total += Left.Cell(RowIndex, InnerIndex) * Right.Cell(InnerIndex, ColIndex);
}
Result[RowIndex][ColIndex] = Total;
}
}
}
/*void SparseMatrix::Multiply(SparseMatrix &A, const SparseMatrix &B, const SparseMatrix &C)
{
Assert(B.ColCount() == C.RowCount(), "Invalid matrix multiply dimensions.");
A.Allocate(B.RowCount(), C.ColCount());
for(UINT BRow = 0; BRow < B.RowCount(); BRow++)
{
UINT BRowLength = B.Rows()[BRow].Data.Length();
for(UINT BColIndex = 0; BColIndex < BRowLength; BColIndex++)
{
const SparseElement *BElement = &B.Rows()[BRow].Data[BColIndex];
UINT j = BElement->Col;
T BEntry = BElement->Entry;
UINT CRowLength = C.Rows()[j].Data.Length();
for(UINT CRowIndex = 0; CRowIndex < CRowLength; CRowIndex++)
{
const SparseElement *CElement = &C.Rows()[j].Data[CRowIndex];
UINT k = CElement->Col;
T CEntry = CElement->Entry;
A.PushElement(BRow, k, BEntry * CEntry);
}
}
}
}*/
template<class T>
void DenseMatrix<T>::Multiply(DenseMatrix<T>&Result, const SparseMatrix<T> &Left, const DenseMatrix<T> &Right)
{
Assert(Left.ColCount() == Right.RowCount(), "Invalid matrix dimensions");
const UINT RowCount = Left.RowCount();
const UINT ColCount = Right.ColCount();
const UINT InnerCount = Left.ColCount();
Result.Allocate(RowCount, ColCount);
Result.Clear(0.0);
for(UINT RowIndex = 0; RowIndex < RowCount; RowIndex++)
{
const Vector< SparseElement<T> > &LeftRowEntries = Left.Rows()[RowIndex].Data;
const UINT LeftRowEntryCount = LeftRowEntries.Length();
for(UINT LeftColIndex = 0; LeftColIndex < LeftRowEntryCount; LeftColIndex++)
{
const SparseElement<T> &CurLeftEntry = LeftRowEntries[LeftColIndex];
for(UINT RightColIndex = 0; RightColIndex < ColCount; RightColIndex++)
{
Result.Cell(RowIndex, ColCount) += CurLeftEntry.Entry * Right.Cell(CurLeftEntry.Col, RightColIndex);
}
}
}
}
template<class T>
void DenseMatrix<T>::Multiply(DenseMatrix<T>&Result, const DenseMatrix<T>&Left, const SparseMatrix<T> &Right)
{
Assert(Left.ColCount() == Right.RowCount(), "Invalid matrix dimensions");
const UINT RowCount = Left.RowCount();
const UINT ColCount = Right.ColCount();
const UINT InnerCount = Left.ColCount();
Result.Allocate(RowCount, ColCount);
Result.Clear(0.0);
for(UINT RowIndex = 0; RowIndex < RowCount; RowIndex++)
{
for(UINT LeftColIndex = 0; LeftColIndex < InnerCount; LeftColIndex++)
{
T LeftEntry = Left.Cell(RowIndex, LeftColIndex);
const Vector<SparseElement> &RightRowEntries = Right.Rows()[LeftColIndex].Data;
const UINT RightRowEntryCount = RightRowEntries.Length();
for(UINT RightRowIndex = 0; RightRowIndex < RightRowEntryCount; RightRowIndex++)
{
const SparseElement &CurRightEntry = RightRowEntries[RightRowIndex];
Result.Cell(RowIndex, CurRightEntry.Col) += LeftEntry * CurRightEntry.Entry;
}
}
}
}
template<class T>
void DenseMatrix<T>::MultiplyMMTranspose(DenseMatrix<T>&Result, const DenseMatrix<T>&M)
{
const UINT RowCount = M.RowCount();
const UINT ColCount = M.ColCount();
Result.Allocate(RowCount, RowCount);
for(UINT i = 0; i < RowCount; i++)
{
for(UINT i2 = 0; i2 < RowCount; i2++)
{
T Total = 0.0;
for(UINT i3 = 0; i3 < ColCount; i3++)
{
Total += M.Cell(i, i3) * M.Cell(i2, i3);
}
Result.Cell(i, i2) = Total;
}
}
}
template<class T>
void DenseMatrix<T>::MultiplyMMTranspose(DenseMatrix<T> &Result, const SparseMatrix<T> &M)
{
const UINT RowCount = M.RowCount();
const UINT ColCount = M.ColCount();
Result.Allocate(RowCount, RowCount);
for(UINT i = 0; i < RowCount; i++)
{
for(UINT i2 = 0; i2 < RowCount; i2++)
{
T Total = 0.0;
for(UINT i3 = 0; i3 < ColCount; i3++)
{
Total += M.GetElement(i, i3) * M.GetElement(i2, i3);
}
Result.Cell(i, i2) = Total;
}
}
}
template<class T>
void DenseMatrix<T>::MultiplyInPlace(DenseMatrix<T>&Result, T Right)
{
for(UINT Row = 0; Row < Result.RowCount(); Row++)
{
for(UINT Col = 0; Col < Result.ColCount(); Col++)
{
Result[Row][Col] *= Right;
}
}
}
template<class T>
DenseMatrix<T>operator * (const DenseMatrix<T>&Left, const DenseMatrix<T>&Right)
{
DenseMatrix<T>Result;
DenseMatrix<T>::Multiply(Result, Left, Right);
return Result;
}
template<class T>
DenseMatrix<T>operator * (const SparseMatrix<T> &Left, const DenseMatrix<T>&Right)
{
DenseMatrix<T>Result;
DenseMatrix<T>::Multiply(Result, Left, Right);
return Result;
}
template<class T>
DenseMatrix<T>operator * (const DenseMatrix<T>&Left, const SparseMatrix<T> &Right)
{
DenseMatrix<T>Result;
DenseMatrix<T>::Multiply(Result, Left, Right);
return Result;
}
template<class T>
DenseMatrix<T>operator * (const DenseMatrix<T>&Left, T Right)
{
DenseMatrix<T>Return(Left.RowCount(), Left.ColCount());
for(UINT Row = 0; Row < Left.RowCount(); Row++)
{
for(UINT Col = 0; Col < Left.ColCount(); Col++)
{
Return[Row][Col] = Left[Row][Col] * Right;
}
}
return Return;
}
template<class T>
DenseMatrix<T>operator * (T Right, const DenseMatrix<T>&Left)
{
DenseMatrix<T>Return(Left.RowCount(), Left.ColCount());
for(UINT Row = 0; Row < Left.RowCount(); Row++)
{
for(UINT Col = 0; Col < Left.ColCount(); Col++)
{
Return[Row][Col] = Left[Row][Col] * Right;
}
}
return Return;
}
template<class T>
DenseMatrix<T>operator + (const DenseMatrix<T>&Left, const DenseMatrix<T>&Right)
{
Assert(Left.RowCount() == Right.RowCount() && Left.ColCount() == Right.ColCount(), "Invalid dimensions on Matrix4 addition.");
DenseMatrix<T>Return(Left.RowCount(), Left.ColCount());
for(UINT Row = 0; Row < Left.RowCount(); Row++)
{
for(UINT Col = 0; Col < Left.ColCount(); Col++)
{
Return[Row][Col] = Left[Row][Col] + Right[Row][Col];
}
}
return Return;
}
template<class T>
DenseMatrix<T>operator - (const DenseMatrix<T>&Left, const DenseMatrix<T>&Right)
{
Assert(Left.RowCount() == Right.RowCount() && Left.ColCount() == Right.ColCount(), "Invalid dimensions on Matrix4 addition.");
DenseMatrix<T>Return(Left.RowCount(), Left.ColCount());
for(UINT Row = 0; Row < Left.RowCount(); Row++)
{
for(UINT Col = 0; Col < Left.ColCount(); Col++)
{
Return[Row][Col] = Left[Row][Col] - Right[Row][Col];
}
}
return Return;
}
namespace Math
{
__forceinline void ReorientBasis(Vec3f &_V1, const Vec3f &_V2, const Vec3f &_V3)
{
Vec3f V1 = Vec3f::Normalize(_V1);
Vec3f V2 = Vec3f::Normalize(_V2);
Vec3f V3 = Vec3f::Normalize(_V3);
DenseMatrix<float>M(3);
M[0][0] = V1.x;
M[1][0] = V1.y;
M[2][0] = V1.z;
M[0][1] = V2.x;
M[1][1] = V2.y;
M[2][1] = V2.z;
M[0][2] = V3.x;
M[1][2] = V3.y;
M[2][2] = V3.z;
if(M.Determinant() < 0.0f)
{
_V1 = -V1;
}
}
} | [
"zhaodongmpii@7e7f00ea-7cf8-66b5-cf80-f378872134d2"
]
| [
[
[
1,
1307
]
]
]
|
9a8f40926665223f4d57cf4d9a9cb85c8c85f182 | 672d939ad74ccb32afe7ec11b6b99a89c64a6020 | /FileSystem/fswizard/NewDiskWizard.h | 6c50c991cb3afd28a11bc0be3b6bf16367fa0b39 | []
| no_license | cloudlander/legacy | a073013c69e399744de09d649aaac012e17da325 | 89acf51531165a29b35e36f360220eeca3b0c1f6 | refs/heads/master | 2022-04-22T14:55:37.354762 | 2009-04-11T13:51:56 | 2009-04-11T13:51:56 | 256,939,313 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,338 | h | // NewDiskWizard.h : header file
//
// This class defines custom modal property sheet
// CNewDiskWizard.
#ifndef __NEWDISKWIZARD_H__
#define __NEWDISKWIZARD_H__
#include "MyPropertyPage1.h"
/////////////////////////////////////////////////////////////////////////////
// CNewDiskWizard
class CNewDiskWizard : public CPropertySheet
{
DECLARE_DYNAMIC(CNewDiskWizard)
// Construction
public:
CNewDiskWizard(CWnd* pWndParent = NULL);
// Attributes
public:
CNewFileName m_Page1;
CNewDiskSize m_Page2;
CNewBlockSize m_Page3;
CNewFinish m_Page4;
typedef struct Diskinfo{
char file[255]; // Disk File Name
int DiskSize; // Disk Size
int BlockSize; // Block Size
};
Diskinfo info;
// Operations
public:
int ChangeTag(int,char*); // Change Show
int Power(int); // get 2*2*....
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CNewDiskWizard)
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CNewDiskWizard();
// Generated message map functions
protected:
//{{AFX_MSG(CNewDiskWizard)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
#endif // __NEWDISKWIZARD_H__
| [
"xmzhang@5428276e-be0b-f542-9301-ee418ed919ad"
]
| [
[
[
1,
58
]
]
]
|
41268a3d750540090eade1659a3024341520d439 | bd89d3607e32d7ebb8898f5e2d3445d524010850 | /adaptationlayer/tsy/nokiatsy_dll/src/cmmphonebookoperationinit.cpp | 04d7f5bacf0035c200261b39f70dc6ec7058803c | []
| no_license | wannaphong/symbian-incubation-projects.fcl-modemadaptation | 9b9c61ba714ca8a786db01afda8f5a066420c0db | 0e6894da14b3b096cffe0182cedecc9b6dac7b8d | refs/heads/master | 2021-05-30T05:09:10.980036 | 2010-10-19T10:16:20 | 2010-10-19T10:16:20 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 65,018 | cpp | /*
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of the License "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description: ?Description
*
*/
// INCLUDE FILES
#include <etelmm.h>
#include <tisi.h>
#include <pn_const.h>
#include <ctsy/serviceapi/mmtsy_ipcdefs.h>
#include "cmmmessagerouter.h"
#include "cmmphonebookoperationinit.h"
#include "OstTraceDefinitions.h"
#ifdef OST_TRACE_COMPILER_IN_USE
#include "cmmphonebookoperationinitTraces.h"
#include "cmmphonebookoperationinit3G_adn.h"
#endif
// EXTERNAL DATA STRUCTURES
// None
// EXTERNAL FUNCTION PROTOTYPES
// None
// CONSTANTS
// MACROS
// None
// LOCAL CONSTANTS AND MACROS
// None
// MODULE DATA STRUCTURES
// None
// LOCAL FUNCTION PROTOTYPES
// None
// ==================== LOCAL FUNCTIONS =====================================
// None
// ================= MEMBER FUNCTIONS =======================================
// -----------------------------------------------------------------------------
// CMmPhoneBookOperationInit::CMmPhoneBookOperationInit
// C++ default constructor can NOT contain any code, that
// might leave.
// -----------------------------------------------------------------------------
CMmPhoneBookOperationInit::CMmPhoneBookOperationInit
(
// None
)
{
TFLOGSTRING("TSY: CmmPhonebookOperatorInit::CmmPhonebookOperatorInit");
OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT_CMMPHONEBOOKOPERATIONINIT_TD, "CMmPhoneBookOperationInit::CMmPhoneBookOperationInit" );
iTypeOfReading = EBasicEfRead;
}
// -----------------------------------------------------------------------------
// CMmPhoneBookOperationInit::~CMmPhoneBookOperationInit
// C++ destructor.
// -----------------------------------------------------------------------------
//
CMmPhoneBookOperationInit::~CMmPhoneBookOperationInit
(
// None
)
{
TFLOGSTRING("TSY: CMmPhoneBookOperationInit::~CMmPhoneBookOperationInit");
OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONINIT_CMMPHONEBOOKOPERATIONINIT_TD, "CMmPhoneBookOperationInit::~CMmPhoneBookOperationInit" );
delete iPBStoreInfoData;
}
// -----------------------------------------------------------------------------
// CmmPhonebookOperatorInit::NewL
// Two-phased constructor.
// Creates a new CmmPhonebookOperatorInit object instance.
// -----------------------------------------------------------------------------
CMmPhoneBookOperationInit* CMmPhoneBookOperationInit::NewL
(
CMmPhoneBookStoreMessHandler* aMmPhoneBookStoreMessHandler,
CMmUiccMessHandler* aUiccMessHandler,
const CMmDataPackage* aDataPackage // Data
)
{
TFLOGSTRING("TSY: CMmPhoneBookOperationInit::NewL");
OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT_NEWL_TD, "CMmPhoneBookOperationInit::NewL" );
TName phonebookTypeName;
CMmPhoneBookOperationInit* mmPhoneBookOperationInit =
new( ELeave ) CMmPhoneBookOperationInit();
CleanupStack::PushL( mmPhoneBookOperationInit );
const CPhoneBookDataPackage* phoneBookData =
static_cast<const CPhoneBookDataPackage*>( aDataPackage );
phoneBookData->GetPhoneBookName( phonebookTypeName );
//Store phonebook name
mmPhoneBookOperationInit->iPhoneBookTypeName = phonebookTypeName;
if( 0 == phonebookTypeName.CompareF( KInternalPhoneBookType ) )
{
mmPhoneBookOperationInit->iIniPhase = EPBIniPhase_Internal;
}
else // Full construction is not needed in case of internal initilization
{
mmPhoneBookOperationInit->ConstructL( );
}
mmPhoneBookOperationInit->iMmPhoneBookStoreMessHandler =
aMmPhoneBookStoreMessHandler;
mmPhoneBookOperationInit->iMmUiccMessHandler = aUiccMessHandler;
// set to false by default. Will be set as true once after
// initialization req has been generated.
mmPhoneBookOperationInit->iInternalInit = EFalse;
CleanupStack::Pop( mmPhoneBookOperationInit );
return mmPhoneBookOperationInit;
}
// -----------------------------------------------------------------------------
// CMmPhoneBookOperationInit::ConstructL
// Initialises object attributes.
// -----------------------------------------------------------------------------
//
void CMmPhoneBookOperationInit::ConstructL
(
)
{
TFLOGSTRING("TSY: CMmPhoneBookOperationInit::ConstructL");
OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT_CONSTRUCTL_TD, "CMmPhoneBookOperationInit::ConstructL" );
iPBStoreInfoData = new( ELeave ) CStorageInfoData();
iServiceType = 0;
iNumOfPBRRecords = 0;
iADNPbInitilized = EFalse;
}
// TRANSMIT
// -----------------------------------------------------------------------------
// CMmPhoneBookOperationInit::UICCCreateReq
// Create Request for Phonebook initialization for SIM
// -----------------------------------------------------------------------------
//
TInt CMmPhoneBookOperationInit::UICCCreateReq
(
TInt aIpc,
const CMmDataPackage* /*aDataPackage*/,
TUint8 aTransId
)
{
TFLOGSTRING("TSY: CMmPhoneBookOperationInit::UICCCreateReq");
OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT_UICCCREATEREQ_TD, "CMmPhoneBookOperationInit::UICCCreateReq" );
TInt ret( KErrNotSupported );
switch( aIpc )
{
case EMmTsyPhoneBookStoreInitIPC:
{
if( !iInternalInit )
{
// no internal init ongoing
if ( EPBIniPhase_Internal == iIniPhase )
{
// Initialization is starting. Turn the flag on.
iInternalInit = ETrue;
}
iServiceType = UICC_APPL_FILE_INFO;
// Start Initialization for 2G phonebooks
// Check for ADN Phonebook is available and activated
if(iMmUiccMessHandler->GetServiceStatus( ICC_ADN_SERVICE_NUM))
{
iIniPhase = EPBInitPhaseADN;
}
else
{
iIniPhase = GetNextAvailablePbIcc(ICC_ADN_SERVICE_NUM);
}
ret = UICCInitializeReq(aTransId);
}
else // else for if internalInit goign on
{
// Simultaneous initializations are not allowed.
ret = KErrInUse;
}
break;
}
default:
{
// Nothing to do here
TFLOGSTRING2("TSY: CMmPhoneBookOperationInit::UICCCreateReq - \
Unknown IPC: %d", aIpc);
OstTrace1( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONINIT_UICCCREATEREQ_TD, "CMmPhoneBookOperationInit::UICCCreateReq;Unknowns aIpc=%d", aIpc );
break;
}
} // switch-case ends
return ret;
}
// -----------------------------------------------------------------------------
// CmmPhonebookOperationInit::UICCInitializeReq
// Creates phonebook initialize request data for SIM
// -----------------------------------------------------------------------------
//
TInt CMmPhoneBookOperationInit::UICCInitializeReq( TUint8 aTransId )
{
TFLOGSTRING("TSY: CMmPhoneBookOperationInit::UICCInitializeReq");
OstTrace0( TRACE_FATAL, CMMPHONEBOOKOPERATIONINIT_UICCINITIALIZEREQ_TD, "CMmPhoneBookOperationInit::UICCInitializeReq" );
TInt ret( KErrNone );
TInt appFileID ( APPL_FILE_ID ); // Application File id for DFphonebook
TUiccReadLinearFixed cmdParams;
cmdParams.messHandlerPtr = static_cast<MUiccOperationBase*>(iMmPhoneBookStoreMessHandler);
cmdParams.trId = static_cast<TUiccTrId>( aTransId );
cmdParams.filePath.Append(static_cast<TUint8>( MF_FILE >> 8 ));
cmdParams.filePath.Append(static_cast<TUint8>( MF_FILE ));
switch( iIniPhase )
{
case EPBInitPhaseADN:
{
cmdParams.filePath.Append(static_cast<TUint8>( APPL_FILE_ID >> 8 ) );
cmdParams.filePath.Append(static_cast<TUint8>( APPL_FILE_ID ) );
// Create Data for ADN EF read
if( EBasicEfRead == iTypeOfReading )
{
TFLOGSTRING("TSY: CMmPhoneBookOperationInit::UICCInitializeReq - ADN Init for Fileinfo OR FileData");
OstTrace0( TRACE_FATAL, DUP1_CMMPHONEBOOKOPERATIONINIT_UICCINITIALIZEREQ_TD, "CMmPhoneBookOperationInit::UICCInitializeReq - ADN Init for Fileinfo OR FileData" );
// Send Request to read File Info or data from EFadn (depends upon iServiceType)
cmdParams.fileId = PB_ADN_FID;
cmdParams.serviceType = iServiceType;
cmdParams.record = 0;
}
else if( EExtensionRead == iTypeOfReading )
{
TFLOGSTRING("TSY: CMmPhoneBookOperationInit::UICCInitializeReq - ADN Phonebook Init Extension request");
OstTrace0( TRACE_FATAL, DUP2_CMMPHONEBOOKOPERATIONINIT_UICCINITIALIZEREQ_TD, "CMmPhoneBookOperationInit::UICCInitializeReq - ADN Phonebook Init Extension request" );
// Initialization for EXT1
cmdParams.fileId = PB_EXT1_FID;
cmdParams.serviceType = iServiceType;
cmdParams.record = 0;
}
break;
}
case EPBInitPhaseFDN:
{
cmdParams.filePath.Append(static_cast<TUint8>( APPL_FILE_ID >> 8 ) );
cmdParams.filePath.Append(static_cast<TUint8>( APPL_FILE_ID ) );
// Create Data for FDN EF read
if( EBasicEfRead == iTypeOfReading )
{
TFLOGSTRING("TSY: CMmPhoneBookOperationInit::UICCInitializeReq - FDN Init FileInfo OR FileData request");
OstTrace0( TRACE_FATAL, DUP3_CMMPHONEBOOKOPERATIONINIT_UICCINITIALIZEREQ_TD, "CMmPhoneBookOperationInit::UICCInitializeReq - FDN Init FileInfo OR FileData request" );
cmdParams.fileId = PB_FDN_FID;
cmdParams.serviceType = iServiceType;
cmdParams.record = 0;
}
else if( EExtensionRead == iTypeOfReading )
{
TFLOGSTRING("TSY: CMmPhoneBookOperationInit::UICCInitializeReq - FDN Init Extension request");
OstTrace0( TRACE_FATAL, DUP4_CMMPHONEBOOKOPERATIONINIT_UICCINITIALIZEREQ_TD, "CMmPhoneBookOperationInit::UICCInitializeReq - FDN Init Extension request" );
// Initialization for EXT2
cmdParams.fileId = PB_EXT2_FID;
cmdParams.serviceType = iServiceType;
cmdParams.record = 0;
}
break;
}
case EPBInitPhaseSDN:
{
cmdParams.filePath.Append(static_cast<TUint8>( APPL_FILE_ID >> 8 ) );
cmdParams.filePath.Append(static_cast<TUint8>( APPL_FILE_ID ) );
if( EBasicEfRead == iTypeOfReading )
{
TFLOGSTRING("TSY: CMmPhoneBookOperationInit::UICCInitializeReq - SDN Init FileInfo OR FileData request");
OstTrace0( TRACE_FATAL, DUP5_CMMPHONEBOOKOPERATIONINIT_UICCINITIALIZEREQ_TD, "CMmPhoneBookOperationInit::UICCInitializeReq - SDN Init FileInfo OR FileData request" );
cmdParams.fileId = PB_SDN_FID;
cmdParams.serviceType = iServiceType;
cmdParams.record = 0;
}
else if( EExtensionRead == iTypeOfReading )
{
TFLOGSTRING("TSY: CMmPhoneBookOperationInit::UICCInitializeReq - SDN Init Extension request");
OstTrace0( TRACE_FATAL, DUP6_CMMPHONEBOOKOPERATIONINIT_UICCINITIALIZEREQ_TD, "CMmPhoneBookOperationInit::UICCInitializeReq - SDN Init Extension request" );
// Initialization for EXT3
cmdParams.fileId = PB_EXT3_FID;
cmdParams.serviceType = iServiceType;
cmdParams.record = 0;
}
break;
}
case EPBInitPhaseMBDN:
{
cmdParams.filePath.Append( iMmUiccMessHandler->GetApplicationFileId() );
// Start with MBI reading
if( EBasicEfRead == iTypeOfReading )
{
TFLOGSTRING("TSY: CMmPhoneBookOperationInit::UICCInitializeReq - MBDN Init FileInfo OR FileData request");
OstTrace0( TRACE_FATAL, DUP7_CMMPHONEBOOKOPERATIONINIT_UICCINITIALIZEREQ_TD, "CMmPhoneBookOperationInit::UICCInitializeReq - MBDN Init FileInfo OR FileData request" );
cmdParams.fileId = PB_MBDN_FID;
cmdParams.serviceType = iServiceType;
cmdParams.record = 0;
}
else if( EExtensionRead == iTypeOfReading )
{
TFLOGSTRING("TSY: CMmPhoneBookOperationInit::UICCInitializeReq - MBDN Init Extension request");
OstTrace0( TRACE_FATAL, DUP8_CMMPHONEBOOKOPERATIONINIT_UICCINITIALIZEREQ_TD, "CMmPhoneBookOperationInit::UICCInitializeReq - MBDN Init Extension request" );
cmdParams.fileId = PB_EXT6_FID;
cmdParams.serviceType = iServiceType;
cmdParams.record = 0;
}
else if( EMailboxIdRead == iTypeOfReading )
{
TFLOGSTRING("TSY: CMmPhoneBookOperationInit::UICCInitializeReq - MBDN Init MBI request");
OstTrace0( TRACE_FATAL, DUP14_CMMPHONEBOOKOPERATIONINIT_UICCINITIALIZEREQ_TD, "CMmPhoneBookOperationInit::UICCInitializeReq - MBDN Init MBI request" );
cmdParams.fileId = PB_MBI_FID;
cmdParams.serviceType = iServiceType;
cmdParams.record = 0;
}
break;
}
case EPBInitPhaseMSISDN:
{
if( EBasicEfRead == iTypeOfReading )
{
TFLOGSTRING("TSY: CMmPhoneBookOperationInit::UICCInitializeReq - MSISDN Init FileInfo OR FileData request");
OstTrace0( TRACE_FATAL, DUP9_CMMPHONEBOOKOPERATIONINIT_UICCINITIALIZEREQ_TD, "CMmPhoneBookOperationInit::UICCInitializeReq - MSISDN Init FileInfo OR FileData request" );
cmdParams.filePath.Append(static_cast<TUint8>( APPL_FILE_ID >> 8 ) );
cmdParams.filePath.Append(static_cast<TUint8>( APPL_FILE_ID ) );
cmdParams.fileId = PB_MSISDN_FID;
cmdParams.serviceType = iServiceType;
cmdParams.record = 0;
}
else if( EExtensionRead == iTypeOfReading )
{
TFLOGSTRING("TSY: CMmPhoneBookOperationInit::UICCInitializeReq - MSISDN Init Extension request");
OstTrace0( TRACE_NORMAL, DUP10_CMMPHONEBOOKOPERATIONINIT_UICCINITIALIZEREQ_TD, "CMmPhoneBookOperationInit::UICCInitializeReq" );
cmdParams.filePath.Append( iMmUiccMessHandler->GetApplicationFileId() );
if ( UICC_CARD_TYPE_ICC ==
iMmUiccMessHandler->GetCardType() )
{
cmdParams.fileId = PB_EXT1_FID;
}
else if ( UICC_CARD_TYPE_UICC ==
iMmUiccMessHandler->GetCardType() )
{
cmdParams.fileId = PB_EXT5_FID;
}
cmdParams.serviceType = iServiceType;
cmdParams.record = 0;
}
break;
}
case EPBInitPhaseVMBX:
{
cmdParams.filePath.Append(static_cast<TUint8>( APPL_FILE_ID >> 8 ) );
cmdParams.filePath.Append(static_cast<TUint8>( APPL_FILE_ID ) );
if( EBasicEfRead == iTypeOfReading )
{
TFLOGSTRING("TSY: CMmPhoneBookOperationInit::UICCInitializeReq - VMBX Init FileInfo OR FileData request");
OstTrace0( TRACE_FATAL, DUP11_CMMPHONEBOOKOPERATIONINIT_UICCINITIALIZEREQ_TD, "CMmPhoneBookOperationInit::UICCInitializeReq - VMBX Init FileInfo OR FileData request" );
cmdParams.fileId = PB_VMBX_FID;
cmdParams.serviceType = iServiceType;
cmdParams.record = 0;
}
else if( EExtensionRead == iTypeOfReading )
{
TFLOGSTRING("TSY: CMmPhoneBookOperationInit::UICCInitializeReq - VMBX Init Extension request");
OstTrace0( TRACE_NORMAL, DUP13_CMMPHONEBOOKOPERATIONINIT_UICCINITIALIZEREQ_TD, "CMmPhoneBookOperationInit::UICCInitializeReq - VMBX Init Extension request" );
cmdParams.fileId = PB_EXT1_FID;
cmdParams.serviceType = iServiceType;
cmdParams.record = 0;
}
break;
}
default:
{
TFLOGSTRING("TSY: CMmPhoneBookOperationInit::UICCInitializeReq - PhoneBook not supported ");
OstTrace0( TRACE_NORMAL, DUP12_CMMPHONEBOOKOPERATIONINIT_UICCINITIALIZEREQ_TD, "CMmPhoneBookOperationInit::UICCInitializeReq - PhoneBook not supported" );
break;
}
}
// if intialization has not been completed till now then send the
// request for the correct phase
if( EPBIniPhase_PBInitialized != iIniPhase )
{
ret = iMmPhoneBookStoreMessHandler->UiccMessHandler()->CreateUiccApplCmdReq( cmdParams );
TFLOGSTRING2("TSY: CreateUiccApplCmdReq returns %d", ret);
}
return ret;
}
/// RECEPTION
// -----------------------------------------------------------------------------
// CMmPhoneBookOperationInit::HandleUICCPbResp
// Handle Response for SIM
// -----------------------------------------------------------------------------
//
TBool CMmPhoneBookOperationInit::HandleUICCPbRespL
(
TInt aStatus,
TUint8 /*aDetails*/,
const TDesC8 &aFileData,
TInt aTransId
)
{
TInt ret( KErrNone );
TBool complete( EFalse );
// break immediatelly in case of internal init
if ( iInternalInit )
{
TFLOGSTRING("TSY: CMmPhoneBookOperationInit::HandleUICCPbRespL. Internal Init->Break");
OstTrace0( TRACE_NORMAL, DUP2_CMMPHONEBOOKOPERATIONINIT_HANDLEUICCPBRESPL_TD, "CMmPhoneBookOperationInit::HandleUICCPbRespL, Internal Init->Break" );
iIniPhase = EPBIniPhase_Unknown;
// set flag to indicate that we can remove this operation from array
complete = ETrue;
iInternalInit = EFalse;
return KErrNone;
}
// Handle recponse from UICC server
ret = HandlePBRespL(aFileData,aStatus, aTransId);
// Complete, if phonebook initalization is complete or there is some error in UICC server
if (KErrNone != ret || EPBIniPhase_PBInitialized == iIniPhase )
{
CPhoneBookDataPackage phoneBookData;
phoneBookData.SetPhoneBookName( iPhoneBookTypeName );
phoneBookData.PackData( iPBStoreInfoData );
if ( KErrNone != ret )
{
ret = CMmStaticUtility::UICCCSCauseToEpocError( ret );
}
iMmPhoneBookStoreMessHandler->MessageRouter()->Complete(
EMmTsyPhoneBookStoreInitIPC,
&phoneBookData,
ret );
complete = ETrue;
}
return complete;
}
// -----------------------------------------------------------------------------
// CMmPhoneBookOperationInit::HandlePBRespL
// Further Handle Response for SIM
// -----------------------------------------------------------------------------
//
TInt CMmPhoneBookOperationInit::HandlePBRespL(const TDesC8& aFileData, TInt aStatus, TUint8 aTransId )
{
TFLOGSTRING("TSY: CMmPhoneBookOperationInit::HandlePBRespL");
OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT_HANDLEPBRESPL_TD, "CMmPhoneBookOperationInit::HandlePBRespL" );
TInt ret(KErrNone);
if( EBasicEfRead == iTypeOfReading )
{
ret = HandleFileResp(aFileData, aStatus);
}
else if( EExtensionRead == iTypeOfReading )
{
// For Extension File
ret = HandleEXTFileResp( aFileData, aStatus );
}
else
{
HandleMBIFileResp( aFileData, aStatus );
}
if(KErrNone == ret)
{
ret = UICCInitializeReq( aTransId );
}
return ret;
}
// -----------------------------------------------------------------------------
// CMmPhoneBookOperationInit::HandleFileResp
// Further Handle Response for phonebook EF Files
// -----------------------------------------------------------------------------
//
TInt CMmPhoneBookOperationInit::HandleFileResp(const TDesC8 &aFileData, TInt aStatus)
{
TFLOGSTRING("TSY: CMmPhoneBookOperationInit::HandleFileResp");
OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT_HANDLEFILERESP_TD, "CMmPhoneBookOperationInit::HandleFileResp" );
TInt ret(KErrNone);
TInt numOfEntries(0);
TInt textLength(0);
TInt numLength(0);
TInt recordLength(0);
if(UICC_STATUS_OK == aStatus)
{
if(UICC_APPL_FILE_INFO == iServiceType)
{
// get the record length and number of entries
TFci fci( aFileData );
recordLength = fci.GetRecordLength();
numOfEntries = fci.GetNumberOfRecords();
// get Text length
textLength = (recordLength - 14);
// To get the total length of number, need to read Ext2 file
// IF EXT2 is not present then only 20 BCD digits can be stored
numLength = UICC_NO_EXT_MAX_NUM_LEN;
}
}
switch(iIniPhase)
{
case EPBInitPhaseADN:
{
if( UICC_STATUS_OK == aStatus )
{
if(UICC_APPL_FILE_INFO == iServiceType)
{
TFLOGSTRING("TSY: CMmPhoneBookOperationInit::HandleFileResp - Handle File Info for ADN Phonebook");
OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONINIT_HANDLEFILERESP_TD, "CMmPhoneBookOperationInit::HandleFileResp - Handle File Info for ADN Phonebook" );
// Check for ADN phone book is incalidated by Fdn phonebook or not
TInt status(0);
TFci fci( aFileData );
status = fci.GetFileStatus();
// check for ADN is invalidated or not
if(!(status & 0x01))
{
// Check for ADN is updatable or not when ADN is invalidated
if( 0x04 == (status & 0x04))
{
iPBStoreInfoData->iADNNumOfEntries = numOfEntries;
iPBStoreInfoData->iADNNumberLengthMax = numLength;
iPBStoreInfoData->iADNTextLengthMax = textLength;
}
else // when ADN is not updatable
{
iServiceType = UICC_APPL_FILE_INFO;
iIniPhase = EPBInitPhaseFDN;
}
}
else // When ADN Phoenbook is not invalidated
{
iPBStoreInfoData->iADNNumOfEntries = numOfEntries;
iPBStoreInfoData->iADNNumberLengthMax = numLength;
iPBStoreInfoData->iADNTextLengthMax = textLength;
}
}
if( !iMmUiccMessHandler->GetServiceStatus( ICC_EXT1_SERVICE_NUM))
{
// Store ADN Phone book configuration in local array if EXT is not present
TPrimitiveInitInfo primConfAdn;
primConfAdn.iAlphaStringlength = iPBStoreInfoData->iADNTextLengthMax;
primConfAdn.iExtension = EFalse;
primConfAdn.iNumlength = iPBStoreInfoData->iADNNumberLengthMax;
primConfAdn.iNoOfRecords = iPBStoreInfoData->iADNNumOfEntries;
iMmPhoneBookStoreMessHandler->iPBStoreConf[EPhonebookTypeAdn] = primConfAdn;
iTypeOfReading = EBasicEfRead;
iIniPhase = GetNextAvailablePbIcc(ICC_ADN_SERVICE_NUM);
}
else
{
// When Service is available
iTypeOfReading = EExtensionRead;
}
// ADN Phonebook is initilized
iADNPbInitilized = ETrue;
}
else
{
// reset all the data is init is incomplete
iPBStoreInfoData->iADNNumOfEntries = -1;
iPBStoreInfoData->iADNNumberLengthMax = -1;
iPBStoreInfoData->iADNTextLengthMax = -1;
// Set ADN intialized flag to False
iADNPbInitilized = EFalse;
}
}
break;
case EPBInitPhaseFDN:
{
if( UICC_STATUS_OK == aStatus )
{
if(UICC_APPL_FILE_INFO == iServiceType)
{
TFLOGSTRING("TSY: CMmPhoneBookOperationInit::HandleFileResp - Handle File Info for FDN Phonebook");
OstTrace0( TRACE_NORMAL, DUP3_CMMPHONEBOOKOPERATIONINIT_HANDLEFILERESP_TD, "CMmPhoneBookOperationInit::HandleFileResp - Handle File Info for FDN Phonebook" );
iPBStoreInfoData->iFDNNumOfEntries = numOfEntries;
iPBStoreInfoData->iFDNNumberLengthMax = numLength;
iPBStoreInfoData->iFDNTextLengthMax = textLength;
}
if(UICC_CARD_TYPE_ICC == iMmUiccMessHandler->GetCardType())
{
// Check for Exension
// Check for EXT2 Service is present or not
if( !iMmUiccMessHandler->GetServiceStatus( ICC_EXT2_SERVICE_NUM ) )
{
// Store FDN Phone book configuration in local array if EXT is not present in ICC Card
TPrimitiveInitInfo primConfFdn;
primConfFdn.iAlphaStringlength = iPBStoreInfoData->iFDNTextLengthMax;
primConfFdn.iExtension = EFalse;
primConfFdn.iNumlength = iPBStoreInfoData->iFDNNumberLengthMax;
primConfFdn.iNoOfRecords = iPBStoreInfoData->iFDNNumOfEntries;
iMmPhoneBookStoreMessHandler->iPBStoreConf[EPhonebookTypeFdn] = primConfFdn;
iTypeOfReading = EBasicEfRead;
iIniPhase = GetNextAvailablePbIcc(ICC_FDN_SERVICE_NUM);
}
else
{
iTypeOfReading = EExtensionRead ;
}
}
else if(UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType())
{
// Chekc for Extension
// Check for EXT1 Service is present or not
if( !iMmUiccMessHandler->GetServiceStatus( UICC_EXT2_SERVICE_NUM ) )
{
// Store FDN Phone book configuration in local array if EXT is not present in UICC Card
TPrimitiveInitInfo primConfFdn;
primConfFdn.iAlphaStringlength = iPBStoreInfoData->iFDNTextLengthMax;
primConfFdn.iExtension = EFalse;
primConfFdn.iNumlength = iPBStoreInfoData->iFDNNumberLengthMax;
primConfFdn.iNoOfRecords = iPBStoreInfoData->iFDNNumOfEntries;
iMmPhoneBookStoreMessHandler->iPBStoreConf[EPhonebookTypeFdn] = primConfFdn;
iTypeOfReading = EBasicEfRead;
iIniPhase = GetNextAvailablePbUicc(UICC_FDN_SERVICE_NUM);
}
else
{
iTypeOfReading = EExtensionRead;
}
}
iServiceType = UICC_APPL_FILE_INFO;
}
else
{
// Reset all the Data if initilized incomplete
iPBStoreInfoData->iFDNNumOfEntries = -1;
iPBStoreInfoData->iFDNNumberLengthMax = -1;
iPBStoreInfoData->iFDNTextLengthMax = -1;
// Check for ADN Phonebook is Initilized or not
if(EFalse == iADNPbInitilized)
{
ret = KErrGeneral;
}
}
}
break;
case EPBInitPhaseSDN:
{
if( UICC_STATUS_OK == aStatus )
{
if(UICC_APPL_FILE_INFO == iServiceType)
{
TFLOGSTRING("TSY: CMmPhoneBookOperationInit::HandleFileResp - Handle File Info for SDN Phonebook");
OstTrace0( TRACE_NORMAL, DUP5_CMMPHONEBOOKOPERATIONINIT_HANDLEFILERESP_TD, "CMmPhoneBookOperationInit::HandleFileResp - Handle File Info for SDN Phonebook" );
iPBStoreInfoData->iSDNNumOfEntries = numOfEntries;
iPBStoreInfoData->iSDNNumberLengthMax = numLength;
iPBStoreInfoData->iSDNTextLengthMax = textLength;
}
if(UICC_CARD_TYPE_ICC == iMmUiccMessHandler->GetCardType())
{
// Check for Exension
// Check for EXT1 Service is present or not
if( !iMmUiccMessHandler->GetServiceStatus( ICC_EXT3_SERVICE_NUM ) )
{
// Store SDN Phone book configuration in local array if EXT is not present in UICC Card
TPrimitiveInitInfo primConfSdn;
primConfSdn.iAlphaStringlength = iPBStoreInfoData->iSDNTextLengthMax;
primConfSdn.iExtension = EFalse;
primConfSdn.iNumlength = iPBStoreInfoData->iSDNNumberLengthMax;
primConfSdn.iNoOfRecords = iPBStoreInfoData->iSDNNumOfEntries;
iMmPhoneBookStoreMessHandler->iPBStoreConf[EPhonebookTypeSdn] = primConfSdn;
iTypeOfReading = EBasicEfRead;
iIniPhase = GetNextAvailablePbIcc(ICC_SDN_SERVICE_NUM);
}
else
{
iTypeOfReading = EExtensionRead;
}
}
else if(UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType())
{
// Chekc for Extension
// Check for EXT3 Service is present or not
if( !iMmUiccMessHandler->GetServiceStatus( UICC_EXT3_SERVICE_NUM ) )
{
// Store SDN Phone book configuration in local array if EXT is not present in UICC Card
TPrimitiveInitInfo primConfSdn;
primConfSdn.iAlphaStringlength = iPBStoreInfoData->iSDNTextLengthMax;
primConfSdn.iExtension = EFalse;
primConfSdn.iNumlength = iPBStoreInfoData->iSDNNumberLengthMax;
primConfSdn.iNoOfRecords = iPBStoreInfoData->iSDNNumOfEntries;
iMmPhoneBookStoreMessHandler->iPBStoreConf[EPhonebookTypeSdn] = primConfSdn;
iTypeOfReading = EBasicEfRead;
iIniPhase = GetNextAvailablePbUicc(UICC_SDN_SERVICE_NUM);
}
else
{
iTypeOfReading = EExtensionRead;
}
}
iServiceType = UICC_APPL_FILE_INFO;
}
else
{
// Reset all the parameters if init incomplete
iPBStoreInfoData->iSDNNumOfEntries = -1;
iPBStoreInfoData->iSDNNumberLengthMax = -1;
iPBStoreInfoData->iSDNTextLengthMax = -1;
}
}
break;
case EPBInitPhaseMBDN:
{
if( UICC_STATUS_OK == aStatus )
{
if(UICC_APPL_FILE_INFO == iServiceType)
{
TFLOGSTRING("TSY: CMmPhoneBookOperationInit::HandleFileResp - Handle File Info for MBDN Phonebook");
OstTrace0( TRACE_NORMAL, DUP7_CMMPHONEBOOKOPERATIONINIT_HANDLEFILERESP_TD, "CMmPhoneBookOperationInit::HandleFileResp - Handle File Info for MBDN Phonebook" );
iPBStoreInfoData->iMBDNNumOfEntries = numOfEntries;
iPBStoreInfoData->iMBDNNumberLengthMax = numLength;
iPBStoreInfoData->iMBDNTextLengthMax = textLength;
}
iTypeOfReading = EExtensionRead;
iServiceType = UICC_APPL_FILE_INFO;
}
else
{
// reset all the paramenters if init ic incomplete
iPBStoreInfoData->iMBDNNumOfEntries = -1;
iPBStoreInfoData->iMBDNNumberLengthMax = -1;
iPBStoreInfoData->iMBDNTextLengthMax = -1;
}
}
break;
case EPBInitPhaseMSISDN:
{
if( UICC_STATUS_OK == aStatus )
{
TFLOGSTRING("TSY: CMmPhoneBookOperationInit::HandleFileResp - Handle File Info for MSISDN Phonebook");
OstTrace0( TRACE_NORMAL, DUP9_CMMPHONEBOOKOPERATIONINIT_HANDLEFILERESP_TD, "CMmPhoneBookOperationInit::HandleFileResp - Handle File Info for MSISDN Phonebook" );
if(UICC_APPL_FILE_INFO == iServiceType)
{
iPBStoreInfoData->iMSISDNNumOfEntries = numOfEntries;
iPBStoreInfoData->iMSISDNNumberLengthMax = numLength;
iPBStoreInfoData->iMSISDNTextLengthMax = textLength;
}
if(UICC_CARD_TYPE_ICC == iMmUiccMessHandler->GetCardType())
{
// Check for Exension
// Check for EXT1 Service is present or not
if( !iMmUiccMessHandler->GetServiceStatus( ICC_EXT1_SERVICE_NUM ) )
{
// Store MSISDN Phone book configuration in local array if EXT is not present in ICC Card
TPrimitiveInitInfo primConfMsisdn;
primConfMsisdn.iAlphaStringlength = iPBStoreInfoData->iMSISDNTextLengthMax;
primConfMsisdn.iExtension = EFalse;
primConfMsisdn.iNumlength = iPBStoreInfoData->iMSISDNNumberLengthMax;
primConfMsisdn.iNoOfRecords = iPBStoreInfoData->iMSISDNNumOfEntries;
iMmPhoneBookStoreMessHandler->iPBStoreConf[EPhonebookTypeMSISDN] = primConfMsisdn;
iTypeOfReading = EBasicEfRead;
iIniPhase = GetNextAvailablePbIcc(ICC_MSISDN_SERVICE_NUM);
}
else
{
iTypeOfReading = EExtensionRead;
}
}
else if(UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType())
{
// Chekc for Extension
// Check for EXT1 Service is present or not
if( !iMmUiccMessHandler->GetServiceStatus( UICC_EXT5_SERVICE_NUM ) )
{
// Store MSISDN Phone book configuration in local array if EXT is not present in UICC Card
TPrimitiveInitInfo primConfMsisdn;
primConfMsisdn.iAlphaStringlength = iPBStoreInfoData->iMSISDNTextLengthMax;
primConfMsisdn.iExtension = EFalse;
primConfMsisdn.iNumlength = iPBStoreInfoData->iMSISDNNumberLengthMax;
primConfMsisdn.iNoOfRecords = iPBStoreInfoData->iMSISDNNumOfEntries;
iMmPhoneBookStoreMessHandler->iPBStoreConf[EPhonebookTypeMSISDN] = primConfMsisdn;
iTypeOfReading = EBasicEfRead;
iIniPhase = GetNextAvailablePbUicc(UICC_MSISDN_SERVICE_NUM);
}
else
{
iTypeOfReading = EExtensionRead;
}
}
iServiceType = UICC_APPL_FILE_INFO;
}
else
{
// reste all the parameters if init is incomplete
iPBStoreInfoData->iMSISDNNumOfEntries = -1;
iPBStoreInfoData->iMSISDNNumberLengthMax = -1;
iPBStoreInfoData->iMSISDNTextLengthMax = -1;
}
}
break;
case EPBInitPhaseVMBX:
{
if( UICC_STATUS_OK == aStatus )
{
if(UICC_APPL_FILE_INFO == iServiceType)
{
TFLOGSTRING("TSY: CMmPhoneBookOperationInit::HandleFileResp - Handle File Info for VMBX Phonebook");
OstTrace0( TRACE_NORMAL, DUP13_CMMPHONEBOOKOPERATIONINIT_HANDLEFILERESP_TD, "CMmPhoneBookOperationInit::HandleFileResp - Handle File Info for VMBX Phonebook" );
// update Data in CommonTSY buffer
iPBStoreInfoData->iVMBXNumOfEntries = numOfEntries;
iPBStoreInfoData->iVMBXNumberLengthMax = numLength;
iPBStoreInfoData->iVMBXTextLengthMax = textLength;
}
// Check for Exension
// Check for EXT1 Service is present or not
if( !iMmUiccMessHandler->GetServiceStatus( ICC_EXT1_SERVICE_NUM))
{
// Store VMBX Phone book configuration in local array if EXT is not present
TPrimitiveInitInfo primConfVmbx;
primConfVmbx.iAlphaStringlength = iPBStoreInfoData->iVMBXTextLengthMax;
primConfVmbx.iExtension = EFalse;
primConfVmbx.iNumlength = iPBStoreInfoData->iVMBXNumberLengthMax;
primConfVmbx.iNoOfRecords = iPBStoreInfoData->iVMBXNumOfEntries;
iMmPhoneBookStoreMessHandler->iPBStoreConf[EPhonebookTypeVMBX] = primConfVmbx;
iTypeOfReading = EBasicEfRead;
iIniPhase = EPBIniPhase_PBInitialized;
}
else
{
iTypeOfReading = EExtensionRead;
}
iServiceType = UICC_APPL_FILE_INFO;
}
else
{
// Reset all the parameters if init incomplete
iPBStoreInfoData->iVMBXNumOfEntries = -1;
iPBStoreInfoData->iVMBXNumberLengthMax = -1;
iPBStoreInfoData->iVMBXTextLengthMax = -1;
}
}
break;
default:
{
TFLOGSTRING("TSY: CMmPhoneBookOperationInit::HandleFileResp - PhoneBook not supported");
OstTrace0( TRACE_NORMAL, DUP12_CMMPHONEBOOKOPERATIONINIT_HANDLEFILERESP_TD, "CMmPhoneBookOperationInit::HandleFileResp - PhoneBook not supported" );
}
break;
}
if( ( UICC_STATUS_OK != aStatus ) && ( KErrNone == ret ) )
{
iServiceType = UICC_APPL_FILE_INFO;
GetNextPhoneBookInitPhase(iIniPhase);
}
return ret;
}
// -----------------------------------------------------------------------------
// CmmPhonebookOperationInit::HandleEXTFileResp
// Further handles response for Phonebook EXT Files
// -----------------------------------------------------------------------------
//
TInt CMmPhoneBookOperationInit::HandleEXTFileResp( const TDesC8 &aFileData , TInt aStatus)
{
TFLOGSTRING("TSY: CMmPhoneBookOperationInit::HandleEXTFileResp");
OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT_HANDLEEXTFILERESP_TD, "CMmPhoneBookOperationInit::HandleEXTFileResp" );
TInt ret(KErrNone);
if(UICC_STATUS_OK == aStatus)
{
// no of records in EXT2 EF
TInt noOfRecords(0);
// get the no of records
TFci fci( aFileData );
noOfRecords = fci.GetNumberOfRecords();
// To get the total length of number
// Where multiply by 11 is the no of bytes in extension data and multiply by 2 is for BCD coding while
//storing data in EXT2 file
TInt numLength = UICC_NO_EXT_MAX_NUM_LEN + (11*noOfRecords*2);
// Change Extension present to read PhoneBook EF file info
iTypeOfReading = EBasicEfRead;
iServiceType = UICC_APPL_FILE_INFO;
switch(iIniPhase)
{
case EPBInitPhaseADN:
{
TFLOGSTRING("TSY: CMmPhoneBookOperationInit::HandleEXTFileResp - For ADN Phone book");
OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONINIT_HANDLEEXTFILERESP_TD, "CMmPhoneBookOperationInit::HandleEXTFileResp - For ADN Phone book" );
iPBStoreInfoData->iADNNumberLengthMax = numLength;
// Store ADN Phone book configuration in local array if EXT is present
TPrimitiveInitInfo primConfAdn;
primConfAdn.iAlphaStringlength = iPBStoreInfoData->iADNTextLengthMax;
primConfAdn.iExtension = ETrue;
primConfAdn.iNumlength = iPBStoreInfoData->iADNNumberLengthMax;
primConfAdn.iNoOfRecords = iPBStoreInfoData->iADNNumOfEntries;
primConfAdn.iExtNoOfRec = noOfRecords;
iMmPhoneBookStoreMessHandler->iPBStoreConf[EPhonebookTypeAdn] = primConfAdn;
// Change the Initialization Phase to next
// Get next available phonebook in UST table
iIniPhase = GetNextAvailablePbIcc(UICC_FDN_SERVICE_NUM);
}
break;
case EPBInitPhaseFDN:
{
TFLOGSTRING("TSY: CMmPhoneBookOperationInit::HandleEXTFileResp - For FDN PhoneBook");
OstTrace0( TRACE_NORMAL, DUP2_CMMPHONEBOOKOPERATIONINIT_HANDLEEXTFILERESP_TD, "CMmPhoneBookOperationInit::HandleEXTFileResp -For FDN PhoneBoo" );
iPBStoreInfoData->iFDNNumberLengthMax = numLength;
// Store FDN Phone book configuration in local array if EXT is present
TPrimitiveInitInfo primConfFdn;
primConfFdn.iAlphaStringlength = iPBStoreInfoData->iFDNTextLengthMax;
primConfFdn.iExtension = ETrue;
primConfFdn.iNumlength = iPBStoreInfoData->iFDNNumberLengthMax;
primConfFdn.iNoOfRecords = iPBStoreInfoData->iFDNNumOfEntries;
primConfFdn.iExtNoOfRec = noOfRecords;
iMmPhoneBookStoreMessHandler->iPBStoreConf[EPhonebookTypeFdn] = primConfFdn;
if(UICC_CARD_TYPE_ICC == iMmUiccMessHandler->GetCardType())
{
iIniPhase = GetNextAvailablePbIcc(ICC_FDN_SERVICE_NUM);
}
else if(UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType())
{
iIniPhase = GetNextAvailablePbUicc(UICC_FDN_SERVICE_NUM);
}
}
break;
case EPBInitPhaseSDN:
{
TFLOGSTRING("TSY: CMmPhoneBookOperationInit::HandleEXTFileResp - For SDN PhoneBook");
OstTrace0( TRACE_NORMAL, DUP3_CMMPHONEBOOKOPERATIONINIT_HANDLEEXTFILERESP_TD, "CMmPhoneBookOperationInit::HandleEXTFileResp - For SDN PhoneBook" );
iPBStoreInfoData->iSDNNumberLengthMax = numLength;
// Store SDN Phone book configuration in local array if EXT is present
TPrimitiveInitInfo primConfSdn;
primConfSdn.iAlphaStringlength = iPBStoreInfoData->iSDNTextLengthMax;
primConfSdn.iExtension = ETrue;
primConfSdn.iNumlength = iPBStoreInfoData->iSDNNumberLengthMax;
primConfSdn.iNoOfRecords = iPBStoreInfoData->iSDNNumOfEntries;
primConfSdn.iExtNoOfRec = noOfRecords;
iMmPhoneBookStoreMessHandler->iPBStoreConf[EPhonebookTypeSdn] = primConfSdn;
if(UICC_CARD_TYPE_ICC == iMmUiccMessHandler->GetCardType())
{
iIniPhase = GetNextAvailablePbIcc(ICC_SDN_SERVICE_NUM);
}
else if(UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType())
{
iIniPhase = GetNextAvailablePbUicc(UICC_SDN_SERVICE_NUM);
}
}
break;
case EPBInitPhaseMBDN:
{
TFLOGSTRING("TSY: CMmPhoneBookOperationInit::HandleEXTFileResp - for MBDN PhoneBook");
OstTrace0( TRACE_NORMAL, DUP4_CMMPHONEBOOKOPERATIONINIT_HANDLEEXTFILERESP_TD, "CMmPhoneBookOperationInit::HandleEXTFileResp - for MBDN PhoneBook" );
iPBStoreInfoData->iMBDNNumberLengthMax = numLength;
// Store MBDN Phone book configuration in local array if EXT is present
TPrimitiveInitInfo primConfMbdn;
primConfMbdn.iAlphaStringlength = iPBStoreInfoData->iMBDNTextLengthMax;
primConfMbdn.iExtension = ETrue;
primConfMbdn.iNumlength = iPBStoreInfoData->iMBDNNumberLengthMax;
primConfMbdn.iNoOfRecords = iPBStoreInfoData->iMBDNNumOfEntries;
primConfMbdn.iExtNoOfRec = noOfRecords;
primConfMbdn.iMbiRecLen = iMbiRecLen;
iMmPhoneBookStoreMessHandler->iPBStoreConf[EPhonebookTypeMBDN] = primConfMbdn;
if(UICC_CARD_TYPE_ICC == iMmUiccMessHandler->GetCardType())
{
iIniPhase = GetNextAvailablePbIcc(ICC_MBDN_SERVICE_NUM);
}
else if(UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType())
{
iIniPhase = GetNextAvailablePbUicc(UICC_MBDN_SERVICE_NUM);
}
}
break;
case EPBInitPhaseMSISDN:
{
TFLOGSTRING("TSY: CMmPhoneBookOperationInit::HandleEXTFileResp - for MSISDN Phonebook");
OstTrace0( TRACE_NORMAL, DUP5_CMMPHONEBOOKOPERATIONINIT_HANDLEEXTFILERESP_TD, "CMmPhoneBookOperationInit::HandleEXTFileResp - for MSISDN Phonebook" );
iPBStoreInfoData->iMSISDNNumberLengthMax = numLength;
// Store MSISDN Phone book configuration in local array if EXT is present
TPrimitiveInitInfo primConfMsisdn;
primConfMsisdn.iAlphaStringlength = iPBStoreInfoData->iMSISDNTextLengthMax;
primConfMsisdn.iExtension = ETrue;
primConfMsisdn.iNumlength = iPBStoreInfoData->iMSISDNNumberLengthMax;
primConfMsisdn.iNoOfRecords = iPBStoreInfoData->iMSISDNNumOfEntries;
primConfMsisdn.iExtNoOfRec = noOfRecords;
iMmPhoneBookStoreMessHandler->iPBStoreConf[EPhonebookTypeMSISDN] = primConfMsisdn;
if(UICC_CARD_TYPE_ICC == iMmUiccMessHandler->GetCardType())
{
iIniPhase = GetNextAvailablePbIcc(ICC_MSISDN_SERVICE_NUM);
}
else if(UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType())
{
iIniPhase = GetNextAvailablePbUicc(UICC_MSISDN_SERVICE_NUM);
}
}
break;
case EPBInitPhaseVMBX:
{
TFLOGSTRING("TSY: CMmPhoneBookOperationInit::HandleEXTFileResp - For VMBX PhoneBook");
OstTrace0( TRACE_NORMAL, DUP6_CMMPHONEBOOKOPERATIONINIT_HANDLEEXTFILERESP_TD, "CMmPhoneBookOperationInit::HandleEXTFileResp - For VMBX PhoneBook" );
iPBStoreInfoData->iVMBXNumberLengthMax = numLength;
// Store VMBX Phone book configuration in local array if EXT is present
TPrimitiveInitInfo primConfVmbx;
primConfVmbx.iAlphaStringlength = iPBStoreInfoData->iVMBXTextLengthMax;
primConfVmbx.iExtension = ETrue;
primConfVmbx.iNumlength = iPBStoreInfoData->iVMBXNumberLengthMax;
primConfVmbx.iNoOfRecords = iPBStoreInfoData->iVMBXNumOfEntries;
primConfVmbx.iExtNoOfRec = noOfRecords;
iMmPhoneBookStoreMessHandler->iPBStoreConf[EPhonebookTypeVMBX] = primConfVmbx;
iIniPhase = EPBIniPhase_PBInitialized;
}
break;
default:
{
TFLOGSTRING("TSY: CMmPhoneBookOperationInit::HandleEXTFileResp - PhoneBook not supported");
OstTrace0( TRACE_NORMAL, DUP7_CMMPHONEBOOKOPERATIONINIT_HANDLEEXTFILERESP_TD, "CMmPhoneBookOperationInit::HandleEXTFileResp - PhoneBook not supported" );
}
break;
}
}
else
{
iServiceType = UICC_APPL_FILE_INFO;
GetNextPhoneBookInitPhase(iIniPhase);
}
return ret;
}
// -----------------------------------------------------------------------------
// CMmPhoneBookOperationInit::HandleMBIFileResp
// Handle MBI File response
// by index
// -----------------------------------------------------------------------------
//
void CMmPhoneBookOperationInit::HandleMBIFileResp( const TDesC8 &aFileData , TInt aStatus )
{
TFLOGSTRING("TSY: CMmPhoneBookOperationInit::HandleMBIFileResp");
OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT_HANDLEMBIFILERESP_TD, "CMmPhoneBookOperationInit::HandleMBIFileResp" );
if(UICC_STATUS_OK == aStatus)
{
// get the no of records
TFci fci( aFileData );
iMbiRecLen = fci.GetRecordLength();
iTypeOfReading = EBasicEfRead;
}
else
{
iServiceType = UICC_APPL_FILE_INFO;
GetNextPhoneBookInitPhase(iIniPhase);
}
}
// -----------------------------------------------------------------------------
// CMmPhoneBookOperationInit::GetNextAvailablePbUicc
// Gets next phonebook to be initialized in SST Servicetable
// by index
// -----------------------------------------------------------------------------
//
TUint8 CMmPhoneBookOperationInit::GetNextAvailablePbIcc(TUint8 aPBook)
{
TFLOGSTRING("TSY: CMmPhoneBookOperationInit::GetNextAvailablePbIcc");
OstTrace0( TRACE_NORMAL, CMMPHONEBOOKOPERATIONINIT_GETNEXTAVAILABLEPBICC_TD, "CMmPhoneBookOperationInit::GetNextAvailablePbIcc" );
switch(aPBook)
{
case ICC_ADN_SERVICE_NUM:
{
if(iMmUiccMessHandler->GetServiceStatus( ICC_FDN_SERVICE_NUM))
{
aPBook = EPBInitPhaseFDN;
}
else if(iMmUiccMessHandler->GetServiceStatus( ICC_SDN_SERVICE_NUM))
{
aPBook = EPBInitPhaseSDN;
}
else if(iMmUiccMessHandler->GetServiceStatus( ICC_MBDN_SERVICE_NUM))
{
aPBook = EPBInitPhaseMBDN;
}
else if(iMmUiccMessHandler->GetServiceStatus( ICC_MSISDN_SERVICE_NUM))
{
aPBook = EPBInitPhaseMSISDN;
}
else if( iMmUiccMessHandler->GetCphsInformationStatus(ICC_MAILBOX_NUM)) // Service no need to be changed
{
aPBook = EPBInitPhaseVMBX;
}
else
{
aPBook = EPBIniPhase_PBInitialized;
}
// aPBook = EPBInitPhaseVMBX;
}
break;
case ICC_FDN_SERVICE_NUM:
{
if(iMmUiccMessHandler->GetServiceStatus( ICC_SDN_SERVICE_NUM))
{
aPBook = EPBInitPhaseSDN;
}
else if(iMmUiccMessHandler->GetServiceStatus( ICC_MBDN_SERVICE_NUM))
{
aPBook = EPBInitPhaseMBDN;
}
else if(iMmUiccMessHandler->GetServiceStatus( ICC_MSISDN_SERVICE_NUM))
{
aPBook = EPBInitPhaseMSISDN;
}
else if(iMmUiccMessHandler->GetCphsInformationStatus( ICC_MAILBOX_NUM )) // Service no need to changed
{
aPBook = EPBInitPhaseVMBX;
}
else
{
aPBook = EPBIniPhase_PBInitialized;
// aPBook = EPBInitPhaseVMBX;
}
}
break;
case ICC_SDN_SERVICE_NUM:
{
if(iMmUiccMessHandler->GetServiceStatus(ICC_MBDN_SERVICE_NUM))
{
aPBook = EPBInitPhaseMBDN;
}
else if(iMmUiccMessHandler->GetServiceStatus(ICC_MSISDN_SERVICE_NUM))
{
aPBook = EPBInitPhaseMSISDN;
}
else if( iMmUiccMessHandler->GetCphsInformationStatus( ICC_MAILBOX_NUM ))
{
aPBook = EPBInitPhaseVMBX;
}
else
{
aPBook = EPBIniPhase_PBInitialized;
//aPBook = EPBInitPhaseVMBX;
}
}
break;
case ICC_MBDN_SERVICE_NUM:
{
if(iMmUiccMessHandler->GetServiceStatus( ICC_MSISDN_SERVICE_NUM))
{
aPBook = EPBInitPhaseMSISDN;
}
else if( iMmUiccMessHandler->GetCphsInformationStatus( ICC_MAILBOX_NUM ))
{
aPBook = EPBInitPhaseVMBX;
}
else
{
aPBook = EPBIniPhase_PBInitialized;
//aPBook = EPBInitPhaseVMBX;
}
}
break;
case ICC_MSISDN_SERVICE_NUM:
// Check for CPHS flas to get the VMBX Phonebook configuration other wise complete the phonebook
// init for 2G card
if( iMmUiccMessHandler->GetCphsInformationStatus( ICC_MAILBOX_NUM ))
{
aPBook = EPBInitPhaseVMBX;
}
else
{
aPBook = EPBIniPhase_PBInitialized;
}
break;
default:
{
TFLOGSTRING("TSY: CMmPhoneBookOperationInit::GetNextAvailablePbIcc - Not Supported");
OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONINIT_GETNEXTAVAILABLEPBICC_TD, "CMmPhoneBookOperationInit::GetNextAvailablePbIcc - Not Supported" );
}
break;
}
if( EPBInitPhaseMBDN == aPBook )
{
iTypeOfReading = EMailboxIdRead;
}
return aPBook;
}
// -----------------------------------------------------------------------------
// CMmPhoneBookOperationInit::GetNextAvailablePbUicc
// Gets next phonebook to be initiilized from UST service table
// -----------------------------------------------------------------------------
//
TUint8 CMmPhoneBookOperationInit::GetNextAvailablePbUicc(TUint8 aPBook)
{
TFLOGSTRING("TSY: CMmPhoneBookOperationInit::GetNextAvailablePbUicc");
OstTrace0( TRACE_NORMAL, DUP1_CMMPHONEBOOKOPERATIONINIT_GETNEXTAVAILABLEPBUICC_TD, "CMmPhoneBookOperationInit::GetNextAvailablePbUicc" );
switch(aPBook)
{
case UICC_FDN_SERVICE_NUM:
{
if(iMmUiccMessHandler->GetServiceStatus( UICC_SDN_SERVICE_NUM))
{
aPBook = EPBInitPhaseSDN;
}
else if(iMmUiccMessHandler->GetServiceStatus( UICC_MBDN_SERVICE_NUM))
{
aPBook = EPBInitPhaseMBDN;
}
else if(iMmUiccMessHandler->GetServiceStatus( UICC_MSISDN_SERVICE_NUM))
{
aPBook = EPBInitPhaseMSISDN;
}
else
{
aPBook = EPBIniPhase_PBInitialized;
}
}
break;
case UICC_SDN_SERVICE_NUM:
{
if(iMmUiccMessHandler->GetServiceStatus(UICC_MBDN_SERVICE_NUM))
{
aPBook = EPBInitPhaseMBDN;
}
else if(iMmUiccMessHandler->GetServiceStatus(UICC_MSISDN_SERVICE_NUM))
{
aPBook = EPBInitPhaseMSISDN;
}
else
{
aPBook = EPBIniPhase_PBInitialized;
}
}
break;
case UICC_MBDN_SERVICE_NUM:
{
if(iMmUiccMessHandler->GetServiceStatus( UICC_MSISDN_SERVICE_NUM))
{
aPBook = EPBInitPhaseMSISDN;
}
else
{
aPBook = EPBIniPhase_PBInitialized;
}
}
break;
case UICC_MSISDN_SERVICE_NUM:
aPBook = EPBIniPhase_PBInitialized;
break;
default:
break;
}
if( EPBInitPhaseMBDN == aPBook )
{
iTypeOfReading = EMailboxIdRead;
}
return aPBook;
}
// -----------------------------------------------------------------------------
// CMmPhoneBookOperationInit3G_adn::GetNextPhoneBookInitPhase
// Get next Phonebook init phase if Init for one Phonebook fails
// -----------------------------------------------------------------------------
//
void CMmPhoneBookOperationInit::GetNextPhoneBookInitPhase(TUint8& aInitPhase)
{
if(UICC_CARD_TYPE_ICC == iMmUiccMessHandler->GetCardType())
{
switch(aInitPhase)
{
case EPBInitPhaseADN:
{
aInitPhase = GetNextAvailablePbIcc(ICC_ADN_SERVICE_NUM);
}
break;
case EPBInitPhaseFDN:
{
aInitPhase = GetNextAvailablePbIcc(ICC_FDN_SERVICE_NUM);
}
break;
case EPBInitPhaseSDN:
{
aInitPhase = GetNextAvailablePbIcc(ICC_SDN_SERVICE_NUM);
}
break;
case EPBInitPhaseMBDN:
{
aInitPhase = GetNextAvailablePbIcc(ICC_MBDN_SERVICE_NUM);
}
break;
case EPBInitPhaseMSISDN:
{
aInitPhase = GetNextAvailablePbIcc(ICC_MSISDN_SERVICE_NUM);
}
break;
default:
{
aInitPhase = EPBIniPhase_PBInitialized;
}
break;
}
}
else
{
if(UICC_CARD_TYPE_UICC == iMmUiccMessHandler->GetCardType())
{
switch(aInitPhase)
{
case EPBInitPhase_3GADN_PBR:
{
iServiceType = UICC_APPL_FILE_INFO;
aInitPhase = EPBIniPhase_3GADNDone;
}
break;
case EPBInitPhase_3GADN_Type1:
case EPBInitPhase_3GADN_Type2:
case EPBInitPhase_3GADN_Type3:
{
iServiceType = UICC_APPL_FILE_INFO;
}
break;
case EPBInitPhaseFDN:
{
aInitPhase = GetNextAvailablePbUicc(UICC_FDN_SERVICE_NUM);
}
break;
case EPBInitPhaseSDN:
{
aInitPhase = GetNextAvailablePbUicc(UICC_SDN_SERVICE_NUM);
}
break;
case EPBInitPhaseMBDN:
{
aInitPhase = GetNextAvailablePbUicc(UICC_MBDN_SERVICE_NUM);
}
break;
case EPBInitPhaseMSISDN:
{
aInitPhase = GetNextAvailablePbUicc(UICC_MSISDN_SERVICE_NUM);
}
break;
default:
{
aInitPhase = EPBIniPhase_PBInitialized;
}
break;
}
}
}
}
// End of file
| [
"dalarub@localhost",
"[email protected]",
"mikaruus@localhost"
]
| [
[
[
1,
1
],
[
3,
24
],
[
26,
26
],
[
28,
68
],
[
72,
84
],
[
86,
102
],
[
104,
116
],
[
118,
151
],
[
153,
175
],
[
178,
180
],
[
182,
207
],
[
209,
221
],
[
223,
234
],
[
236,
237
],
[
239,
243
],
[
246,
247
],
[
249,
253
],
[
256,
256
],
[
258,
259
],
[
261,
265
],
[
267,
268
],
[
270,
279
],
[
282,
282
],
[
284,
285
],
[
287,
291
],
[
293,
294
],
[
296,
305
],
[
309,
310
],
[
312,
316
],
[
318,
319
],
[
321,
330
],
[
334,
334
],
[
337,
341
],
[
343,
343
],
[
346,
350
],
[
360,
363
],
[
365,
365
],
[
368,
368
],
[
371,
374
],
[
376,
376
],
[
379,
379
],
[
391,
397
],
[
402,
402
],
[
405,
409
],
[
411,
411
],
[
414,
422
],
[
425,
434
],
[
436,
452
],
[
454,
455
],
[
457,
457
],
[
459,
461
],
[
463,
465
],
[
468,
471
],
[
473,
477
],
[
479,
484
],
[
486,
496
],
[
498,
498
],
[
500,
509
],
[
511,
512
],
[
514,
516
],
[
518,
520
],
[
522,
523
],
[
529,
532
],
[
534,
548
],
[
550,
561
],
[
567,
584
],
[
586,
587
],
[
590,
613
],
[
615,
615
],
[
622,
622
],
[
624,
624
],
[
632,
632
],
[
635,
642
],
[
644,
654
],
[
656,
660
],
[
662,
662
],
[
673,
673
],
[
680,
680
],
[
682,
682
],
[
689,
689
],
[
705,
706
],
[
708,
730
],
[
732,
736
],
[
738,
738
],
[
749,
749
],
[
756,
756
],
[
758,
758
],
[
765,
765
],
[
781,
782
],
[
784,
800
],
[
802,
806
],
[
809,
823
],
[
825,
835
],
[
837,
837
],
[
848,
849
],
[
854,
858
],
[
860,
860
],
[
871,
872
],
[
877,
895
],
[
897,
897
],
[
899,
902
],
[
906,
906
],
[
922,
922
],
[
924,
936
],
[
938,
962
],
[
964,
971
],
[
974,
980
],
[
982,
988
],
[
990,
991
],
[
1003,
1010
],
[
1012,
1014
],
[
1025,
1037
],
[
1039,
1041
],
[
1052,
1065
],
[
1067,
1069
],
[
1081,
1093
],
[
1095,
1096
],
[
1108,
1121
],
[
1123,
1124
],
[
1137,
1142
],
[
1144,
1158
],
[
1185,
1195
],
[
1197,
1306
],
[
1308,
1310
],
[
1316,
1331
],
[
1333,
1389
],
[
1396,
1496
]
],
[
[
2,
2
],
[
25,
25
],
[
27,
27
],
[
70,
71
],
[
117,
117
],
[
176,
177
],
[
208,
208
],
[
235,
235
],
[
244,
245
],
[
257,
257
],
[
266,
266
],
[
283,
283
],
[
292,
292
],
[
308,
308
],
[
317,
317
],
[
332,
333
],
[
335,
335
],
[
342,
342
],
[
344,
344
],
[
351,
353
],
[
355,
359
],
[
364,
364
],
[
366,
366
],
[
375,
375
],
[
377,
377
],
[
381,
387
],
[
389,
390
],
[
401,
401
],
[
403,
403
],
[
410,
410
],
[
412,
412
],
[
423,
423
],
[
435,
435
],
[
453,
453
],
[
456,
456
],
[
458,
458
],
[
462,
462
],
[
466,
466
],
[
472,
472
],
[
478,
478
],
[
485,
485
],
[
497,
497
],
[
499,
499
],
[
510,
510
],
[
517,
517
],
[
521,
521
],
[
524,
527
],
[
533,
533
],
[
562,
566
],
[
588,
589
],
[
614,
614
],
[
616,
621
],
[
623,
623
],
[
625,
631
],
[
633,
634
],
[
643,
643
],
[
661,
661
],
[
663,
672
],
[
674,
679
],
[
681,
681
],
[
683,
688
],
[
690,
704
],
[
707,
707
],
[
737,
737
],
[
739,
748
],
[
750,
755
],
[
757,
757
],
[
759,
764
],
[
766,
780
],
[
783,
783
],
[
807,
808
],
[
836,
836
],
[
838,
847
],
[
850,
853
],
[
859,
859
],
[
861,
870
],
[
873,
876
],
[
898,
898
],
[
903,
905
],
[
907,
921
],
[
923,
923
],
[
972,
973
],
[
981,
981
],
[
992,
1002
],
[
1015,
1024
],
[
1042,
1051
],
[
1070,
1080
],
[
1097,
1107
],
[
1125,
1136
],
[
1159,
1164
],
[
1166,
1168
],
[
1171,
1177
],
[
1184,
1184
],
[
1311,
1315
],
[
1390,
1395
]
],
[
[
69,
69
],
[
85,
85
],
[
103,
103
],
[
152,
152
],
[
181,
181
],
[
222,
222
],
[
238,
238
],
[
248,
248
],
[
254,
255
],
[
260,
260
],
[
269,
269
],
[
280,
281
],
[
286,
286
],
[
295,
295
],
[
306,
307
],
[
311,
311
],
[
320,
320
],
[
331,
331
],
[
336,
336
],
[
345,
345
],
[
354,
354
],
[
367,
367
],
[
369,
370
],
[
378,
378
],
[
380,
380
],
[
388,
388
],
[
398,
400
],
[
404,
404
],
[
413,
413
],
[
424,
424
],
[
467,
467
],
[
513,
513
],
[
528,
528
],
[
549,
549
],
[
585,
585
],
[
655,
655
],
[
731,
731
],
[
801,
801
],
[
824,
824
],
[
896,
896
],
[
937,
937
],
[
963,
963
],
[
989,
989
],
[
1011,
1011
],
[
1038,
1038
],
[
1066,
1066
],
[
1094,
1094
],
[
1122,
1122
],
[
1143,
1143
],
[
1165,
1165
],
[
1169,
1170
],
[
1178,
1183
],
[
1196,
1196
],
[
1307,
1307
],
[
1332,
1332
]
]
]
|
90ec087fcd6d41a7af92a08b85f20cee144145ec | b73f27ba54ad98fa4314a79f2afbaee638cf13f0 | /projects/MainUI/GuiLib1.5/GuiDocSpecial.cpp | 1d7d8597ea4c9a56401a0f71edd182cf18441ae4 | []
| no_license | weimingtom/httpcontentparser | 4d5ed678f2b38812e05328b01bc6b0c161690991 | 54554f163b16a7c56e8350a148b1bd29461300a0 | refs/heads/master | 2021-01-09T21:58:30.326476 | 2009-09-23T08:05:31 | 2009-09-23T08:05:31 | 48,733,304 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,852 | cpp | /****************************************************************************
* *
* GuiToolKit *
* (MFC extension) *
* Created by Francisco Campos G. www.beyondata.com [email protected] *
*--------------------------------------------------------------------------*
* *
* This program is free software;so you are free to use it any of your *
* applications (Freeware, Shareware, Commercial),but leave this header *
* intact. *
* *
* These files are provided "as is" without warranty of any kind. *
* *
* GuiToolKit is forever FREE CODE !!!!! *
* *
*--------------------------------------------------------------------------*
* Created by: Francisco Campos G. *
* Bug Fixes and improvements : (Add your name) *
* -Francisco Campos *
* *
****************************************************************************/
#include "stdafx.h"
#include "GuiDocSpecial.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
#define _countof(array) (sizeof(array)/sizeof(array[0]))
#define _AfxSetDlgCtrlID(hWnd, nID) SetWindowLong(hWnd, GWL_ID, nID)
#define _AfxGetDlgCtrlID(hWnd) ((UINT)(WORD)::GetDlgCtrlID(hWnd))
BEGIN_MESSAGE_MAP(CGuiDocSpecial,CDockBar)
//{{AFX_MSG_MAP(CGuiDocSpecial)
ON_WM_SIZE()
ON_WM_CREATE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
CGuiDocSpecial::CGuiDocSpecial()
{
}
CGuiDocSpecial::~CGuiDocSpecial()
{
}
CSize CGuiDocSpecial::CalcDynamicLayout(INT_PTR nLength,DWORD nMode)
{
CSize sz=CControlBar::CalcDynamicLayout(nLength,nMode);
// sz.cx+=1;
// sz.cy+=1;
return sz;
}
INT_PTR CGuiDocSpecial::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDockBar::OnCreate(lpCreateStruct) == -1)
return -1;
return 0;
}
void CGuiDocSpecial::OnNcPaint()
{
CRect rcWindow;
CRect rcClient;
INT_PTR m_iBorder=2;
CWindowDC dc(this);
GetWindowRect(&rcWindow);
GetClientRect(&rcClient);
CBrush cbr;
cbr.CreateSysColorBrush(GuiDrawLayer::GetRGBColorTabs());
rcClient.OffsetRect(-rcWindow.TopLeft());
rcWindow.OffsetRect(-rcWindow.TopLeft());
ScreenToClient(rcWindow);
rcClient.OffsetRect(-rcWindow.left,-rcWindow.top);
dc.ExcludeClipRect(rcClient);
rcWindow.OffsetRect(-rcWindow.left, -rcWindow.top);
INT_PTR ibotton=rcWindow.bottom;
rcWindow.top=rcWindow.bottom-m_iBorder;
dc.FillRect(rcWindow,&cbr);
rcWindow.top=0;
rcWindow.bottom+=3;
dc.FillRect(rcWindow,&cbr);
//un truco primitivo que evita el efecto estar a un nivel encima de la otra barra
dc.FillSolidRect(0,rcWindow.top,rcWindow.right+1,1,::GetSysColor(COLOR_BTNSHADOW));
dc.FillSolidRect(0,rcWindow.top+1,rcWindow.right+1,1,::GetSysColor(COLOR_BTNHIGHLIGHT));
}
void CGuiDocSpecial::OnSize(UINT nType,INT_PTR cx,INT_PTR cy)
{
CDockBar::OnSize(nType,cx,cy);
Invalidate();
}
/*
void CGuiDocSpecial::RecalTabs()
{
INT_PTR inumTabs=GetDockedCount();
if (inumTabs > 1)
{
for (INT_PTR i=0; i< inumTabs; i++)
{
//GetNumWnd(INT_PTR m_numtab)
CString m_caption;
CWnd* pParent=(CWnd*)m_arrBars[i];
ASSERT(pParent);
INT_PTR j=0;
BOOL bFound=FALSE;
while(j< m_tabwnd.GetCount())
{
if (m_tabwnd.GetNumWnd(j) == pParent)
{
bFound=TRUE;
break;
}
j++;
}
if (bFound == FALSE)
{
pParent->GetWindowText(m_caption);
m_tabwnd.Addtab(pParent,m_caption,i);
}
}
}
}
*/ | [
"[email protected]"
]
| [
[
[
1,
141
]
]
]
|
2ff2700444dae157bd3b2e2f9aa508f5bcb4d4e7 | fd3f2268460656e395652b11ae1a5b358bfe0a59 | /srchybrid/PPgXtreme2.h | ccc2a139f1adfd051754a4fd381fc4c7e095aa8f | []
| no_license | mikezhoubill/emule-gifc | e1cc6ff8b1bb63197bcfc7e67c57cfce0538ff60 | 46979cf32a313ad6d58603b275ec0b2150562166 | refs/heads/master | 2021-01-10T20:37:07.581465 | 2011-08-13T13:58:37 | 2011-08-13T13:58:37 | 32,465,033 | 4 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 937 | h | #pragma once
//#include "preferences.h"
//#include "afxwin.h"
// CPPgXtreme dialog
class CPPgXtreme2 : public CPropertyPage
{
DECLARE_DYNAMIC(CPPgXtreme2)
public:
CPPgXtreme2();
virtual ~CPPgXtreme2();
// Dialog Data
enum { IDD = IDD_PPG_Xtreme2 };
virtual BOOL OnApply();
virtual BOOL OnInitDialog();
void Localize();
protected:
void LoadSettings();
// Generated message map functions
afx_msg void OnSettingsChange() {SetModified();}
DECLARE_MESSAGE_MAP()
// for dialog data exchange and validation
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
public:
afx_msg void OnBnClickedAntiLeecher(); //Xman Anti-Leecher
afx_msg void OnBnClickedDlpreload(); //Xman DLP
/*
afx_msg void OnBnClickedHplink(); //Xman Xtreme Links
afx_msg void OnBnClickedForumlink(); //Xman Xtreme Links
afx_msg void OnBnClickedVotelink(); //Xman Xtreme Links
*/
};
| [
"Mike.Ken.S@dd569cc8-ff36-11de-bbca-1111db1fd05b"
]
| [
[
[
1,
43
]
]
]
|
756331ec9d8dd1ceffdb3788bfc975a72108ae62 | 2ca3ad74c1b5416b2748353d23710eed63539bb0 | /Pilot/Lokapala_Observe/Raptor/DataAdminFacade.h | 67fcb061380b64a03dcb90c61b2a4c09866dad6c | []
| no_license | sjp38/lokapala | 5ced19e534bd7067aeace0b38ee80b87dfc7faed | dfa51d28845815cfccd39941c802faaec9233a6e | refs/heads/master | 2021-01-15T16:10:23.884841 | 2009-06-03T14:56:50 | 2009-06-03T14:56:50 | 32,124,140 | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 1,042 | h | /**@file DataAdminFacade.h
* @brief DAM의 Facade 정의.
* @author siva
*/
#ifndef DATA_ADMIN_FACADE_H
#define DATA_ADMIN_FACADE_H
#include "DataAdminBI.h"
/**@ingroup GroupDAM
* @class CDataAdminFacade
* @brief DAM의 Facade.\n
* 실질적인 DAM으로의 입구. Button Interface를 상속하며, 내부 컴포넌트 내부 클래스들을 사용해 BI에서 정의된 인터페이스 함수들을 구현한다.
* @remarks SingleTon을 사용한다.
*/
class CDataAdminFacade : public CDataAdminBI
{
public :
/**@brief singleton을 생성, 반환한다.
* @return singleton
* @remarks static 함수이므로 어디서든 호출 할 수 있다.
*/
static CDataAdminFacade *Instance()
{
if(!m_instance)
{
m_instance = new CDataAdminFacade();
}
return m_instance;
}
void Read();
protected :
/**@brief 생성자 */
CDataAdminFacade(){}
/**@brief 소멸자 */
~CDataAdminFacade(){}
private :
/**@brief singleton */
static CDataAdminFacade *m_instance;
};
#endif | [
"nilakantha38@b9e76448-5c52-0410-ae0e-a5aea8c5d16c"
]
| [
[
[
1,
42
]
]
]
|
991975a2d980112bf9f34338dd706e734a339996 | 7af9fe205f0391d92ae2dad0364f0d2445f136f6 | /irc/IRCSocket.h | 324c215fbec99124978500f141c820b3b8639ed6 | []
| no_license | yujack12/Cpp | f3ea85baf9a4f64a17743dbba97b82996642e3f6 | 7c0a0197c5df2dc5b985cdc063f49e90fbe56b21 | refs/heads/master | 2021-01-20T23:32:46.830033 | 2011-12-08T11:38:40 | 2011-12-08T11:38:40 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 500 | h | /**
* IRC Socket
*
* Fredi Machado
* http://github.com/Fredi
*/
#ifndef _IRCSOCKET_H
#define _IRCSOCKET_H
#include <iostream>
#include <sstream>
#include "winsock2.h"
class IRCSocket
{
public:
bool Init();
bool Connect(char const* host, int port);
void Disconnect();
bool Connected() { return _connected; };
bool SendData(char const* data);
std::string ReceiveData();
private:
SOCKET _socket;
bool _connected;
};
#endif
| [
"[email protected]"
]
| [
[
[
1,
34
]
]
]
|
a00a4f2ec7a33ca578981434c72c91ad3bc7b1f6 | 19b54754215e9efeb4c4fb11e5bfc8fbba5cf78c | /game-bak/testcode/ScreenCharRecog/charactermap.h | b887f8221c80cb639ea45d019b4a11d4747d7bc4 | []
| no_license | ed2k/javamobilemapnavigator | aed8c29fc0584bf6c7507d770d82c4f8fead0537 | 7301357754f3a29628b4d4b2b50e07107a860945 | refs/heads/master | 2021-01-19T10:08:10.171374 | 2009-06-09T04:56:00 | 2009-06-09T04:56:00 | 32,221,364 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,332 | h | #ifndef __CHARACTER_MAP__
#define __CHARACTER_MAP__
#include "stddef.h" // #define NULL 0
//bool true false define in c++
#include <list>
typedef unsigned char byte;
typedef unsigned int word16;
class Point
{
public:
int x; int y;
Point():x(0),y(0){};
Point(int px, int py):x(px),y(py){};
void operator =(const Point& p){x=p.x;y=p.y;};
void Up(int d=1){y-=d;};
void Left(int d=1){x-=d;};
void Down(int d=1){y+=d;};
void Right(int d=1){x+=d;};
Point Up(int d=1) const{return Point(x,y-d);};
Point Left(int d=1) const{return Point(x-d,y);};
Point Down(int d=1) const{return Point(x,y+d);};
Point Right(int d=1) const{return Point(x+d,y);};
};
class Rect
{
public:
int lx,rx,ty,by;//left right top bottom
Rect():lx(0),rx(0),ty(0),by(0){};
Rect(int xl,int yt,int xr, int yb):lx(xl),rx(xr),ty(yt),by(yb){};
int GetWidth(){return (rx-lx);}
int GetHeight(){return (by-ty);}
};
class SpaceWeight
{
public:
enum {
UP=0,
DOWN=1,
WIDTH=3,
HEIGHT=2,
LEFT=0,
MIDDLE=1,
RIGHT=2
};
int Weight[2][3];
void Normalize(){
int sum=0;for(int x=0;x<WIDTH;++x)for(int y=0;y<HEIGHT;++y)sum+=Weight[y][x];
if(sum==0)sum=1;
for(int x=0;x<WIDTH;++x)for(int y=0;y<HEIGHT;++y)
Weight[y][x]=Weight[y][x]*100/sum;
};
bool IsMinEqMax()
{
std::list<int> a;
for(int x=0;x<WIDTH;++x)for(int y=0;y<HEIGHT;++y)a.push_back(Weight[y][x]);
a.sort();
return (a.back() == a.front());
}
bool IsZShape()
{
int map[6]={-1,-1,+1,
+1,-1,-1};
return MatchShape(map);
};
bool IsSShape(){
int map[6]={+1,-1,-1,
-1,-1,+1};
return MatchShape(map);
};
bool IsVShape(){
int map[6]={+1,-1,+1,
-1,+1,-1};
return MatchShape(map);
};
bool IsCShape(){
int map[6]={+1,-1,-1,
+1,-1,-1};
return MatchShape(map);
};
bool IsFShape(){
int map[6]={+1,+1,+1,
+1,+1,-1};
return MatchShape(map);
};
bool IsGShape(){
int map[6]={-1,-1,-1,
-1,-1,+1};
return MatchShape(map);
};
bool IsTShape(){
int map[6]={+1,+1,+1,
-1,+1,-1};
return MatchShape(map);
};
bool IsLShape(){
int map[6]={+1,-1,-1,
+1,+1,+1};
return MatchShape(map);
};
bool IsJShape(){
int map[6]={-1,+1,+1,
+1,+1,+1};
return MatchShape(map);
};
bool IsUShape(){
int map[6]={+1,-1,+1,
+1,+1,+1};
return MatchShape(map);
};
bool IsMShape(){
int map[6]={+1,+1,+1,
+1,-1,+1};
return MatchShape(map);
};
bool IsAShape(){
int map[6]={-1,+1,-1,
+1,-1,+1};
return MatchShape(map);
};
bool Is7Shape(){
int map[6]={+1,+1,+1,
-1,+1,+1};
return MatchShape(map);
};
private:
bool MatchShape(const int* const map)
{
std::list<int> a;
std::list<int> b;
for(int i=0;i<(WIDTH*HEIGHT);++i)
{
int x=(i%WIDTH);int y=(i/WIDTH);
int p=Weight[y][x];
if(1==*(map+i))a.push_back(p);
else b.push_back(p);
}
a.sort();b.sort();
if(b.back() <= a.front())return true;
else return false;
};
};
//typedef vector<byte>
class CharacterMap
{
public:
// use 32 as it is easy to manipulate a word32
enum {
MAX_WIDTH =32,
MAX_HEIGHT=32,
VSEPERATOR=100,
HSEPERATOR=200,
TARGET=0xff,
BACKGROUND=0
};
private:
int Width;
int Height;
byte VSeperator;
byte HSeperator;
byte Background;
byte Map[MAX_HEIGHT][MAX_HEIGHT];
std::list<Rect> Circles;
std::list<int> VLines;
std::list<int> HLines;
SpaceWeight Spwt;
word16 Result;
public:
CharacterMap(const byte* src, word16 width, word16 height);
~CharacterMap(){};
const byte* GetMap(){return (byte*)Map;};
int GetWidth(){return Width;};
int GetHeight(){return Height;};
word16 GetResult(){return Result;};
void ToString(char * str);
private:
// mark all non target pixel as background
void FlushBackground();
// mark all non centered the lines as background
void FlushNonCenteredLines();
//
void FloodFill(const Point& p,byte color);
// return a point has identified color
bool FindPoint(Point & p, byte color);
bool IsVLine(int x, byte color);
bool IsHLine(int y, byte color);
bool MeasureCircleShape(const Point p, byte color);
void MeasureLines();
};
/*
C number of circles, U up D down
F focus U up, Down, M middle, L left, R right
C ,F, VL,HL
A 1U, 121,222
B 2 , ,1
C - 321,321
D 1 211,211,1
E - 221,221,1, 2
F - 221,220,1, 1
G - 321,334,-
H - 212,212,2
I - ,121,121,1
J - ,012,112,
K - 211,211,1
L - ,210,211,1
M - ,222,212,2
N - , ,2
O 1
P 1U, 111,110
Q 1 , 111,122,1
R 1U ,1
S - 221,122
T - 121,010,1, 1
U - 101,111,2
V - 212,121,
W - 212,222
X -
Y - 111,010
Z - 112,211, ,2
a 1d,
b 1d, 100,222,1
c - 321,321
d 1d, 112,222,1
e 1u*, special ratio of circle
f - 132,131,1
g 1u, 222,122
h - 100,212,1
i - 120,121,1 with a dot
j - 122,122,1 with a dot
k - 100,211,1
l - 120,121,1
m - ,3
n - ,2
o 1
p 1u, 111,110,1
q 1u, 111,011,1
r - 222,110
s - 211,112
t -
u - 101,111
v - 212,121
w - 212,222
x - 212,212
y - 212,221
z - 122,221
0
1
2
3
4
5
6
7
8
9
*/
#endif //__CHARACTER_MAP__
| [
"[email protected]@428699cb-302e-0410-8e0a-9d9f0a128537"
]
| [
[
[
1,
275
]
]
]
|
9fa58aed53af1ef4c896991ab3b6e61e2827741b | 6c8c4728e608a4badd88de181910a294be56953a | /OgreRenderingModule/OgreSkeletonResource.cpp | 364d3e758d6dccfbeccbe25066fc21c9bb210e90 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
]
| permissive | caocao/naali | 29c544e121703221fe9c90b5c20b3480442875ef | 67c5aa85fa357f7aae9869215f840af4b0e58897 | refs/heads/master | 2021-01-21T00:25:27.447991 | 2010-03-22T15:04:19 | 2010-03-22T15:04:19 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,834 | cpp | // For conditions of distribution and use, see copyright notice in license.txt
#include "StableHeaders.h"
#include "OgreSkeletonResource.h"
#include "OgreRenderingModule.h"
#include <Ogre.h>
namespace OgreRenderer
{
OgreSkeletonResource::OgreSkeletonResource(const std::string& id) :
ResourceInterface(id)
{
}
OgreSkeletonResource::OgreSkeletonResource(const std::string& id, Foundation::AssetPtr source) :
ResourceInterface(id)
{
SetData(source);
}
OgreSkeletonResource::~OgreSkeletonResource()
{
RemoveSkeleton();
}
bool OgreSkeletonResource::SetData(Foundation::AssetPtr source)
{
if (!source)
{
OgreRenderingModule::LogError("Null source asset data pointer");
return false;
}
if (!source->GetSize())
{
OgreRenderingModule::LogError("Zero sized skeleton asset");
return false;
}
try
{
if (ogre_skeleton_.isNull())
{
ogre_skeleton_ = Ogre::SkeletonManager::getSingleton().create(
id_, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
if (ogre_skeleton_.isNull())
{
OgreRenderingModule::LogError("Failed to create skeleton " + id_);
return false;
}
}
Ogre::DataStreamPtr stream(new Ogre::MemoryDataStream((void*)source->GetData(), source->GetSize(), false));
Ogre::SkeletonSerializer serializer;
serializer.importSkeleton(stream, ogre_skeleton_.getPointer());
}
catch (Ogre::Exception &e)
{
OgreRenderingModule::LogError("Failed to create skeleton " + id_ + ": " + std::string(e.what()));
RemoveSkeleton();
return false;
}
OgreRenderingModule::LogDebug("Ogre skeleton " + id_ + " created");
return true;
}
static const std::string type_name("OgreSkeleton");
const std::string& OgreSkeletonResource::GetType() const
{
return type_name;
}
const std::string& OgreSkeletonResource::GetTypeStatic()
{
return type_name;
}
void OgreSkeletonResource::RemoveSkeleton()
{
if (!ogre_skeleton_.isNull())
{
std::string skeleton_name = ogre_skeleton_->getName();
ogre_skeleton_.setNull();
try
{
Ogre::SkeletonManager::getSingleton().remove(skeleton_name);
}
catch (...) {}
}
}
bool OgreSkeletonResource::IsValid() const
{
return (!ogre_skeleton_.isNull());
}
}
| [
"cadaver@5b2332b8-efa3-11de-8684-7d64432d61a3",
"jaakkoallander@5b2332b8-efa3-11de-8684-7d64432d61a3"
]
| [
[
[
1,
10
],
[
12,
15
],
[
17,
38
],
[
40,
69
],
[
71,
74
],
[
76,
78
],
[
81,
92
],
[
94,
94
],
[
96,
99
]
],
[
[
11,
11
],
[
16,
16
],
[
39,
39
],
[
70,
70
],
[
75,
75
],
[
79,
80
],
[
93,
93
],
[
95,
95
],
[
100,
100
]
]
]
|
983491e6ca1c77e53c72e0d02419c25b1e9286ad | 70bc06ce3c04267bcbd86b1eb012c273abb21232 | /src/game/server/sql.cpp | fd3562b4e2907c03e27bc7325b7163139cdebdf6 | [
"Zlib",
"LicenseRef-scancode-other-permissive"
]
| permissive | mKeRix/Buy-Mod | 286652519bd009530dec5dbff73081f6d3032ceb | d8458d8b7d73a089b94539f9074279e077e0b504 | refs/heads/master | 2021-01-23T12:05:19.921080 | 2011-11-04T18:00:45 | 2011-11-04T18:00:45 | 2,043,665 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 23,274 | cpp | /* SQL class by Sushi */
#include "gamecontext.hpp"
#include <engine/e_config.h>
#include <engine/e_server_interface.h>
static LOCK sql_lock = 0;
SQL::SQL()
{
if(sql_lock == 0)
sql_lock = lock_create();
// set database info
database = config.sv_sql_database;
prefix = config.sv_sql_prefix;
user = config.sv_sql_user;
pass = config.sv_sql_pw;
ip = config.sv_sql_ip;
port = config.sv_sql_port;
}
bool SQL::connect()
{
try
{
// Create connection
driver = get_driver_instance();
char buf[256];
str_format(buf, sizeof(buf), "tcp://%s:%d", ip, port);
connection = driver->connect(buf, user, pass);
// Create Statement
statement = connection->createStatement();
// Create database if not exists
str_format(buf, sizeof(buf), "CREATE DATABASE IF NOT EXISTS %s", database);
statement->execute(buf);
// Connect to specific database
connection->setSchema(database);
dbg_msg("SQL", "SQL connection established");
return true;
}
catch (sql::SQLException &e)
{
dbg_msg("SQL", "ERROR: SQL connection failed");
return false;
}
}
void SQL::disconnect()
{
try
{
delete connection;
dbg_msg("SQL", "SQL connection disconnected");
}
catch (sql::SQLException &e)
{
dbg_msg("SQL", "ERROR: No SQL connection");
}
}
// create tables... should be done only once
void SQL::create_tables()
{
// create connection
if(connect())
{
try
{
// create tables
char buf[2048];
str_format(buf, sizeof(buf), "CREATE TABLE IF NOT EXISTS %s_account (ID INT AUTO_INCREMENT PRIMARY KEY, Name VARCHAR(31) NOT NULL, Pass VARCHAR(32) NOT NULL, Kills BIGINT DEFAULT 0, Deaths BIGINT DEFAULT 0, Betrayals BIGINT DEFAULT 0, last_logged_in DATETIME NOT NULL, register_date DATETIME NOT NULL, Exp DOUBLE DEFAULT 0, Money BIGINT DEFAULT 0, Upgrade_0 INT DEFAULT 0, Upgrade_1 INT DEFAULT 0, Upgrade_2 INT DEFAULT 0, Upgrade_3 INT DEFAULT 0, Upgrade_4 INT DEFAULT 0, Upgrade_5 INT DEFAULT 0, Upgrade_6 INT DEFAULT 0, Upgrade_7 INT DEFAULT 0, Upgrade_8 INT DEFAULT 0, Upgrade_9 INT DEFAULT 0, Upgrade_10 INT DEFAULT 0, Upgrade_11 INT DEFAULT 0, Upgrade_12 INT DEFAULT 0, Upgrade_13 INT DEFAULT 0, Upgrade_14 INT DEFAULT 0, Upgrade_15 INT DEFAULT 0, Upgrade_16 INT DEFAULT 0, Upgrade_17 INT DEFAULT 0, Upgrade_18 INT DEFAULT 0, Upgrade_19 INT DEFAULT 0, Upgrade_20 INT DEFAULT 0, Upgrade_21 INT DEFAULT 0, Upgrade_22 INT DEFAULT 0, Upgrade_23 INT DEFAULT 0, Upgrade_24 INT DEFAULT 0, Upgrade_25 INT DEFAULT 0, Upgrade_26 INT DEFAULT 0, Upgrade_27 INT DEFAULT 0, Upgrade_28 INT DEFAULT 0, Upgrade_29 INT DEFAULT 0, Cup BIGINT DEFAULT 0, Rang BIGINT DEFAULT 0);", prefix);
statement->execute(buf);
dbg_msg("SQL", "Tables were created successfully");
// delete statement
delete statement;
}
catch (sql::SQLException &e)
{
dbg_msg("SQL", "ERROR: Tables were NOT created");
}
// disconnect from database
disconnect();
}
}
// create account
void static create_account_thread(void *user)
{
lock_wait(sql_lock);
SQL_DATA *data = (SQL_DATA *)user;
if(game.players[data->client_id] && !game.players[data->client_id]->logged_in)
{
// Connect to database
if(data->sql_data->connect())
{
try
{
// check if allready exists
char buf[512];
str_format(buf, sizeof(buf), "SELECT * FROM %s_account WHERE NAME='%s';", data->sql_data->prefix, data->name);
data->sql_data->results = data->sql_data->statement->executeQuery(buf);
if(data->sql_data->results->next())
{
// account found
dbg_msg("SQL", "Account '%s' allready exists", data->name);
game.send_chat_target(data->client_id, "This acoount allready exists!");
}
else
{
// create account \o/
str_format(buf, sizeof(buf), "INSERT IGNORE INTO %s_account(Name, Pass, register_date) VALUES ('%s', MD5('%s'), NOW());", data->sql_data->prefix, data->name, data->pass);
data->sql_data->statement->execute(buf);
dbg_msg("SQL", "Account '%s' was successfully created", data->name);
game.send_chat_target(data->client_id, "Acoount was created successfully.");
game.send_chat_target(data->client_id, "You may login now. (/login <user> <pass>)");
}
// delete statement
delete data->sql_data->statement;
delete data->sql_data->results;
}
catch (sql::SQLException &e)
{
dbg_msg("SQL", "ERROR: Could not create account");
}
// disconnect from database
data->sql_data->disconnect();
}
}
delete data;
lock_release(sql_lock);
}
void SQL::create_account(const char* name, const char* pass, int client_id)
{
SQL_DATA *tmp = new SQL_DATA();
str_copy(tmp->name, name, sizeof(tmp->name));
str_copy(tmp->pass, pass, sizeof(tmp->pass));
tmp->client_id = client_id;
tmp->sql_data = this;
void *register_thread = thread_create(create_account_thread, tmp);
#if defined(CONF_FAMILY_UNIX)
pthread_detach((pthread_t)register_thread);
#endif
}
// delete account
void static delete_account_name_thread(void *user)
{
lock_wait(sql_lock);
SQL_DATA *data = (SQL_DATA *)user;
// Connect to database
if(data->sql_data->connect())
{
try
{
// check if exists
char buf[512];
str_format(buf, sizeof(buf), "SELECT * FROM %s_account WHERE NAME='%s';", data->sql_data->prefix, data->name);
data->sql_data->results = data->sql_data->statement->executeQuery(buf);
if(data->sql_data->results->next())
{
// delete the account
str_format(buf, sizeof(buf), "DELETE FROM %s_account WHERE NAME='%s';", data->sql_data->prefix, data->name);
data->sql_data->statement->execute(buf);
dbg_msg("SQL", "Account '%s' was successfully deleted", data->name);
// tell it all
str_format(buf, sizeof(buf), "The account '%s' was deleted by admin", data->name);
game.send_chat(-1, GAMECONTEXT::CHAT_ALL, buf);
}
else
{
// account doesnt exist
dbg_msg("SQL", "Account '%s' does not exist", data->name);
}
// delete statement
delete data->sql_data->statement;
delete data->sql_data->results;
}
catch (sql::SQLException &e)
{
dbg_msg("SQL", "ERROR: Could not delete account");
}
// disconnect from database
data->sql_data->disconnect();
}
delete data;
lock_release(sql_lock);
}
void SQL::delete_account(const char* name)
{
SQL_DATA *tmp = new SQL_DATA();
str_copy(tmp->name, name, sizeof(tmp->name));
tmp->sql_data = this;
void *delete_name_thread = thread_create(delete_account_name_thread, tmp);
#if defined(CONF_FAMILY_UNIX)
pthread_detach((pthread_t)delete_name_thread);
#endif
}
void static delete_account_id_thread(void *user)
{
lock_wait(sql_lock);
SQL_DATA *data = (SQL_DATA *)user;
// Connect to database
if(data->sql_data->connect())
{
try
{
// check if exists
char buf[512];
str_format(buf, sizeof(buf), "SELECT * FROM %s_account WHERE ID='%d';", data->sql_data->prefix, data->account_id[data->client_id]);
data->sql_data->results = data->sql_data->statement->executeQuery(buf);
if(data->sql_data->results->next())
{
// get account name from database
str_format(buf, sizeof(buf), "SELECT name FROM %s_account WHERE ID='%d';", data->sql_data->prefix, data->account_id[data->client_id]);
// create results
data->sql_data->results = data->sql_data->statement->executeQuery(buf);
// jump to result
data->sql_data->results->next();
// finally the name is there \o/
char acc_name[32];
str_copy(acc_name, data->sql_data->results->getString("name").c_str(), sizeof(acc_name));
// delete the account
str_format(buf, sizeof(buf), "DELETE FROM %s_account WHERE ID='%d';", data->sql_data->prefix, data->account_id[data->client_id]);
data->sql_data->statement->execute(buf);
dbg_msg("SQL", "Account '%s' was successfully deleted", acc_name);
// tell it all
str_format(buf, sizeof(buf), "The account '%s' was deleted by admin", acc_name);
game.send_chat(-1, GAMECONTEXT::CHAT_ALL, buf);
}
else
{
// account doesnt exist
dbg_msg("SQL", "Account '%d' does not exist", data->account_id[data->client_id]);
}
// delete statement
delete data->sql_data->statement;
delete data->sql_data->results;
}
catch (sql::SQLException &e)
{
dbg_msg("SQL", "ERROR: Could not delete account");
}
// disconnect from database
data->sql_data->disconnect();
}
delete data;
lock_release(sql_lock);
}
void SQL::delete_account(int client_id)
{
if(game.players[client_id] && game.players[client_id]->logged_in)
{
SQL_DATA *tmp = new SQL_DATA();
tmp->client_id = client_id;
tmp->account_id[client_id] = game.players[client_id]->acc_data.id;
tmp->sql_data = this;
void *delete_id_thread = thread_create(delete_account_id_thread, tmp);
#if defined(CONF_FAMILY_UNIX)
pthread_detach((pthread_t)delete_id_thread);
#endif
}
else
dbg_msg("SQL", "Player '%d' is not logged in", client_id);
}
// change password
void static change_password_thread(void *user)
{
lock_wait(sql_lock);
SQL_DATA *data = (SQL_DATA *)user;
// Connect to database
if(data->sql_data->connect())
{
try
{
// Connect to database
data->sql_data->connect();
// check if account exists
char buf[512];
str_format(buf, sizeof(buf), "SELECT * FROM %s_account WHERE ID='%d';", data->sql_data->prefix, data->account_id[data->client_id]);
data->sql_data->results = data->sql_data->statement->executeQuery(buf);
if(data->sql_data->results->next())
{
// update account data
str_format(buf, sizeof(buf), "UPDATE %s_account SET Pass=MD5('%s') WHERE ID='%d'", data->sql_data->prefix, data->pass, data->account_id[data->client_id]);
data->sql_data->statement->execute(buf);
// get account name from database
str_format(buf, sizeof(buf), "SELECT name FROM %s_account WHERE ID='%d';", data->sql_data->prefix, data->account_id[data->client_id]);
// create results
data->sql_data->results = data->sql_data->statement->executeQuery(buf);
// jump to result
data->sql_data->results->next();
// finally the name is there \o/
char acc_name[32];
str_copy(acc_name, data->sql_data->results->getString("name").c_str(), sizeof(acc_name));
dbg_msg("SQL", "Account '%s' changed password.", acc_name);
// Success
str_format(buf, sizeof(buf), "Successfully changed your password to '%s'.", data->pass);
game.send_broadcast(buf, data->client_id);
game.send_chat_target(data->client_id, buf);
}
else
dbg_msg("SQL", "Account seems to be deleted");
// delete statement and results
delete data->sql_data->statement;
delete data->sql_data->results;
}
catch (sql::SQLException &e)
{
dbg_msg("SQL", "ERROR: Could not update account");
}
// disconnect from database
data->sql_data->disconnect();
}
delete data;
lock_release(sql_lock);
}
void SQL::change_password(int client_id, const char* new_pass)
{
SQL_DATA *tmp = new SQL_DATA();
tmp->client_id = client_id;
tmp->account_id[client_id] = game.players[client_id]->acc_data.id;
str_copy(tmp->pass, new_pass, sizeof(tmp->pass));
tmp->sql_data = this;
void *change_pw_thread = thread_create(change_password_thread, tmp);
#if defined(CONF_FAMILY_UNIX)
pthread_detach((pthread_t)change_pw_thread);
#endif
}
// login stuff
void static login_thread(void *user)
{
lock_wait(sql_lock);
SQL_DATA *data = (SQL_DATA *)user;
if(game.players[data->client_id] && !game.account_data->logged_in[data->client_id])
{
// Connect to database
if(data->sql_data->connect())
{
try
{
// check if account exists
char buf[1024];
str_format(buf, sizeof(buf), "SELECT * FROM %s_account WHERE Name='%s';", data->sql_data->prefix, data->name);
data->sql_data->results = data->sql_data->statement->executeQuery(buf);
if(data->sql_data->results->next())
{
// check for right pw and get data
str_format(buf, sizeof(buf), "SELECT ID, Kills, Deaths, Betrayals, Exp, Money, Upgrade_0, Upgrade_1, Upgrade_2, Upgrade_3, Upgrade_4, Upgrade_5, Upgrade_6, Upgrade_7, Upgrade_8, Upgrade_9, Upgrade_10, Upgrade_11, Upgrade_12, Upgrade_13, Upgrade_14, Upgrade_15, Upgrade_16, Upgrade_17, Upgrade_18, Upgrade_19, Upgrade_20, Upgrade_21, Upgrade_22, Upgrade_23, Upgrade_24, Upgrade_25, Upgrade_26, Upgrade_27, Upgrade_28, Upgrade_29, Cup, Rang FROM %s_account WHERE Name='%s' AND Pass=MD5('%s');", data->sql_data->prefix, data->name, data->pass);
// create results
data->sql_data->results = data->sql_data->statement->executeQuery(buf);
// if match jump to it
if(data->sql_data->results->next())
{
// never use player directly!
// finally save the result to account_data \o/
// check if account allready is logged in
for(int i = 0; i < MAX_CLIENTS; i++)
{
if(game.account_data->id[i] == data->sql_data->results->getInt("ID"))
{
dbg_msg("SQL", "Account '%s' allready is logged in", data->name);
game.send_chat_target(data->client_id, "This account is already logged in.");
// delete statement and results
delete data->sql_data->statement;
delete data->sql_data->results;
// disconnect from database
data->sql_data->disconnect();
// delete data
delete data;
// release lock
lock_release(sql_lock);
return;
}
}
game.account_data->id[data->client_id] = data->sql_data->results->getInt("ID");
game.account_data->kills[data->client_id] = data->sql_data->results->getInt("Kills");
game.account_data->deaths[data->client_id] = data->sql_data->results->getInt("Deaths");
game.account_data->betrayals[data->client_id] = data->sql_data->results->getInt("Betrayals");
game.account_data->exp[data->client_id] = (float)data->sql_data->results->getDouble("Exp");
game.account_data->money[data->client_id] = data->sql_data->results->getInt("Money");
game.account_data->cup[data->client_id] = data->sql_data->results->getInt("Cup");
for(int i = 0; i < 30; i++)
{
char buf[512];
str_format(buf, sizeof(buf), "Upgrade_%d", i);
game.account_data->upgrade[i][data->client_id] = data->sql_data->results->getInt(buf);
}
game.account_data->rang[data->client_id] = data->sql_data->results->getInt("Rang");
// login should be the last thing
game.account_data->logged_in[data->client_id] = true;
dbg_msg("SQL", "Account '%s' logged in sucessfully", data->name);
game.send_chat_target(data->client_id, "You are now logged in.");
char buf[512];
str_format(buf, sizeof(buf), "Welcome %s!", data->name);
game.send_broadcast(buf, data->client_id);
}
else
{
// wrong password
dbg_msg("SQL", "Account '%s' is not logged in due to wrong password", data->name);
game.send_chat_target(data->client_id, "The password you entered is wrong.");
}
}
else
{
// no account
dbg_msg("SQL", "Account '%s' does not exists", data->name);
game.send_chat_target(data->client_id, "This account does not exists.");
game.send_chat_target(data->client_id, "Please register first. (/register <user> <pass>)");
}
// delete statement and results
delete data->sql_data->statement;
delete data->sql_data->results;
}
catch (sql::SQLException &e)
{
dbg_msg("SQL", "ERROR: Could not login account");
}
// disconnect from database
data->sql_data->disconnect();
}
}
delete data;
lock_release(sql_lock);
}
void SQL::login(const char* name, const char* pass, int client_id)
{
SQL_DATA *tmp = new SQL_DATA();
str_copy(tmp->name, name, sizeof(tmp->name));
str_copy(tmp->pass, pass, sizeof(tmp->pass));
tmp->client_id = client_id;
tmp->sql_data = this;
void *login_account_thread = thread_create(login_thread, tmp);
#if defined(CONF_FAMILY_UNIX)
pthread_detach((pthread_t)login_account_thread);
#endif
}
// update stuff
void static update_thread(void *user)
{
lock_wait(sql_lock);
SQL_DATA *data = (SQL_DATA *)user;
// Connect to database
if(data->sql_data->connect())
{
try
{
// check if account exists
char buf[1024];
str_format(buf, sizeof(buf), "SELECT * FROM %s_account WHERE ID='%d';", data->sql_data->prefix, data->account_id[data->client_id]);
data->sql_data->results = data->sql_data->statement->executeQuery(buf);
if(data->sql_data->results->next())
{
// update account data
str_format(buf, sizeof(buf), "UPDATE %s_account SET Kills='%d', Deaths='%d', Betrayals='%d', last_logged_in=NOW(), Exp='%f', Money='%d', Upgrade_0='%d', Upgrade_1='%d', Upgrade_2='%d', Upgrade_3='%d', Upgrade_4='%d', Upgrade_5='%d', Upgrade_6='%d', Upgrade_7='%d', Upgrade_8='%d', Upgrade_9='%d', Upgrade_10='%d', Upgrade_11='%d', Upgrade_12='%d', Upgrade_13='%d', Upgrade_14='%d', Upgrade_15='%d', Upgrade_16='%d', Upgrade_17='%d', Upgrade_18='%d', Upgrade_19='%d', Upgrade_20='%d', Upgrade_21='%d', Upgrade_22='%d', Upgrade_23='%d', Upgrade_24='%d', Upgrade_25='%d', Upgrade_26='%d', Upgrade_27='%d', Upgrade_28='%d', Upgrade_29='%d', Cup='%d', Rang='%d' WHERE ID='%d';",
data->sql_data->prefix, data->account_kills[data->client_id], data->account_deaths[data->client_id],
data->account_betrayals[data->client_id], data->account_exp[data->client_id], data->account_money[data->client_id],
data->account_upgrade[0][data->client_id], data->account_upgrade[1][data->client_id],
data->account_upgrade[2][data->client_id], data->account_upgrade[3][data->client_id], data->account_upgrade[4][data->client_id],
data->account_upgrade[5][data->client_id], data->account_upgrade[6][data->client_id], data->account_upgrade[7][data->client_id],
data->account_upgrade[8][data->client_id], data->account_upgrade[9][data->client_id], data->account_upgrade[10][data->client_id],
data->account_upgrade[11][data->client_id], data->account_upgrade[12][data->client_id], data->account_upgrade[13][data->client_id],
data->account_upgrade[14][data->client_id], data->account_upgrade[15][data->client_id], data->account_upgrade[16][data->client_id],
data->account_upgrade[17][data->client_id], data->account_upgrade[18][data->client_id], data->account_upgrade[19][data->client_id],
data->account_upgrade[20][data->client_id], data->account_upgrade[21][data->client_id], data->account_upgrade[22][data->client_id],
data->account_upgrade[23][data->client_id], data->account_upgrade[24][data->client_id], data->account_upgrade[25][data->client_id],
data->account_upgrade[26][data->client_id], data->account_upgrade[27][data->client_id], data->account_upgrade[28][data->client_id],
data->account_upgrade[29][data->client_id], data->account_cup[data->client_id], data->account_rang[data->client_id], data->account_id[data->client_id]);
data->sql_data->statement->execute(buf);
// get account name from database
str_format(buf, sizeof(buf), "SELECT name FROM %s_account WHERE ID='%d';", data->sql_data->prefix, data->account_id[data->client_id]);
// create results
data->sql_data->results = data->sql_data->statement->executeQuery(buf);
// jump to result
data->sql_data->results->next();
// finally the nae is there \o/
char acc_name[32];
str_copy(acc_name, data->sql_data->results->getString("name").c_str(), sizeof(acc_name));
dbg_msg("SQL", "Account '%s' was saved successfully", acc_name);
}
else
dbg_msg("SQL", "Account seems to be deleted");
// delete statement and results
delete data->sql_data->statement;
delete data->sql_data->results;
}
catch (sql::SQLException &e)
{
dbg_msg("SQL", "ERROR: Could not update account");
}
// disconnect from database
data->sql_data->disconnect();
}
delete data;
lock_release(sql_lock);
}
void SQL::update(int client_id)
{
SQL_DATA *tmp = new SQL_DATA();
tmp->client_id = client_id;
tmp->account_id[client_id] = game.players[client_id]->acc_data.id;
tmp->account_kills[client_id] = game.players[client_id]->acc_data.kills;
tmp->account_deaths[client_id] = game.players[client_id]->acc_data.deaths;
tmp->account_betrayals[client_id] = game.players[client_id]->acc_data.betrayals;
tmp->account_exp[client_id] = game.players[client_id]->acc_data.exp;
tmp->account_money[client_id] = game.players[client_id]->acc_data.money;
tmp->account_cup[client_id] = game.players[client_id]->acc_data.cup;
for(int i = 0; i < 30; i++)
tmp->account_upgrade[i][client_id] = game.players[client_id]->acc_data.upgrade[i];
tmp->account_rang[client_id] = game.players[client_id]->acc_data.rang;
tmp->sql_data = this;
void *update_account_thread = thread_create(update_thread, tmp);
#if defined(CONF_FAMILY_UNIX)
pthread_detach((pthread_t)update_account_thread);
#endif
}
// update all
void SQL::update_all()
{
lock_wait(sql_lock);
// Connect to database
if(connect())
{
try
{
char buf[512];
char acc_name[32];
for(int i = 0; i < MAX_CLIENTS; i++)
{
if(!game.players[i])
continue;
if(!game.players[i]->logged_in)
continue;
// check if account exists
str_format(buf, sizeof(buf), "SELECT * FROM %s_account WHERE ID='%d';", prefix, game.players[i]->acc_data.id);
results = statement->executeQuery(buf);
if(results->next())
{
// update account data
str_format(buf, sizeof(buf), "UPDATE %s_account SET Kills='%d', Deaths='%d', Betrayals='%d', last_logged_in=NOW() WHERE ID='%d'", prefix, game.players[i]->acc_data.kills, game.players[i]->acc_data.deaths, game.players[i]->acc_data.betrayals, game.players[i]->acc_data.id);
statement->execute(buf);
// get account name from database
str_format(buf, sizeof(buf), "SELECT name FROM %s_account WHERE ID='%d';", prefix, game.players[i]->acc_data.id);
// create results
results = statement->executeQuery(buf);
// jump to result
results->next();
// finally the name is there \o/
str_copy(acc_name, results->getString("name").c_str(), sizeof(acc_name));
dbg_msg("SQL", "Account '%s' was saved successfully", acc_name);
}
else
dbg_msg("SQL", "Account seems to be deleted");
// delete results
delete results;
}
// delete statement
delete statement;
}
catch (sql::SQLException &e)
{
dbg_msg("SQL", "ERROR: Could not update account");
}
// disconnect from database
disconnect();
}
lock_release(sql_lock);
}
| [
"[email protected]"
]
| [
[
[
1,
672
]
]
]
|
4eba4d63cd68147e68856ea2fc8a99d946e41169 | 6e563096253fe45a51956dde69e96c73c5ed3c18 | /dhnetsdk/Demo/DeviceWorkState.cpp | a72232cea46e14687bd995c92adb62b1ae074e3a | []
| no_license | 15831944/phoebemail | 0931b76a5c52324669f902176c8477e3bd69f9b1 | e10140c36153aa00d0251f94bde576c16cab61bd | refs/heads/master | 2023-03-16T00:47:40.484758 | 2010-10-11T02:31:02 | 2010-10-11T02:31:02 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 7,882 | cpp | // DeviceWorkState.cpp : implementation file
//
#include "stdafx.h"
#include "netsdkdemo.h"
#include "DeviceWorkState.h"
#include "NetSDKDemoDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDeviceWorkState dialog
CDeviceWorkState::CDeviceWorkState(CWnd* pParent /*=NULL*/)
: CDialog(CDeviceWorkState::IDD, pParent)
{
m_dev = 0;
//{{AFX_DATA_INIT(CDeviceWorkState)
//}}AFX_DATA_INIT
memset(&m_almState, 0 , sizeof(NET_CLIENT_STATE));
memset(m_shltAlarm, 0, 16);
memset(m_recording, 0, 16);
memset(&m_diskState, 0 , sizeof(HARD_DISK_STATE));
}
void CDeviceWorkState::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDeviceWorkState)
DDX_Control(pDX, IDC_DISKSEL_COMBO, m_disksel);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDeviceWorkState, CDialog)
//{{AFX_MSG_MAP(CDeviceWorkState)
ON_CBN_SELCHANGE(IDC_DISKSEL_COMBO, OnSelchangeDiskselCombo)
ON_CBN_SELCHANGE(IDC_CHANSEL_COMBO, OnSelchangeChanselCombo)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDeviceWorkState message handlers
void CDeviceWorkState::SetDevice(DeviceNode *dev)
{
m_dev = dev;
}
BOOL CDeviceWorkState::OnInitDialog()
{
CDialog::OnInitDialog();
g_SetWndStaticText(this);
CString nStr, subStr;
if(!m_dev)
{
return TRUE;
}
int retlen = 0;
//get common alarm state
BOOL bRet = CLIENT_QueryDevState(m_dev->LoginID, DEVSTATE_COMM_ALARM,
(char*)&m_almState, sizeof(NET_CLIENT_STATE), &retlen, 1000);
if(!bRet || retlen != sizeof(NET_CLIENT_STATE))
{
((CNetSDKDemoDlg *)GetParent())->LastError();//Peng Dongfeng 06.11.24
return FALSE;
}
CString strDev;
CString strTmp;
CString strAlarm = ConvertString(MSG_CLIENTSTATE_ALARM);
for (int i=0; i<m_almState.alarminputcount; i++)
{
if (m_almState.alarm[i])
{
strTmp.Format(" %d", i+1);
strAlarm += strTmp;
}
}
CString strMD = ConvertString(MSG_CLIENTSTATE_MOTION);
CString strVideoLost = ConvertString(MSG_CLIENTSTATE_VIDEOLOST);
for (i=0; i<m_almState.channelcount; i++)
{
if (m_almState.motiondection[i])
{
strTmp.Format(" %d", i+1);
strMD += strTmp;
}
if (m_almState.videolost[i])
{
strTmp.Format(" %d", i+1);
strVideoLost += strTmp;
}
}
//get shelter alarm state
bRet = CLIENT_QueryDevState(m_dev->LoginID, DEVSTATE_SHELTER_ALARM,
(char*)&m_shltAlarm, 16, &retlen, 1000);
if(!bRet || retlen != 16)
{
// ((CNetSDKDemoDlg *)GetParent())->LastError();//Peng Dongfeng 06.11.24
// return FALSE;
}
CString strShelter = ConvertString(MSG_WORKSTATE_SHELTER);
for (i=0; i<16; i++)
{
if (m_shltAlarm[i])
{
strTmp.Format(" %d", i+1);
strShelter += strTmp;
}
}
//record state
bRet = CLIENT_QueryDevState(m_dev->LoginID, DEVSTATE_RECORDING,
(char*)&m_recording, 16, &retlen, 1000);
if(!bRet || retlen != 16)
{
((CNetSDKDemoDlg *)GetParent())->LastError();//Peng Dongfeng 06.11.24
return FALSE;
}
CString strRecord = ConvertString(MSG_WORKSTATE_RECORDING);
for (i=0; i<16; i++)
{
if (m_recording[i])
{
strTmp.Format(" %d", i+1);
strRecord += strTmp;
}
}
//资源状态查询
DWORD dwResource[3] = {0};
CString strResource = ConvertString("Resources: ");
bRet = CLIENT_QueryDevState(m_dev->LoginID, DEVSTATE_RESOURCE, (char *)dwResource, 3*sizeof(DWORD), &retlen);
if (!bRet || retlen != 3*sizeof(DWORD))
{
strTmp.Format(ConvertString("query error"));
strResource += strTmp;
((CNetSDKDemoDlg *)GetParent())->LastError();
}
else
{
strResource += ConvertString("System:");
if (0 == dwResource[0])
{
strResource += ConvertString("natural");
}
else
{
strResource += ConvertString("CPU occupy too high");
}
strResource += ",Local show";
if (0 == dwResource[1])
{
strResource += ConvertString("TV natural");
}
else
{
strResource += ConvertString("TV abnormality");
}
if (0 == dwResource[2])
{
strResource += ConvertString("VGA natural");
}
else
{
strResource += ConvertString("VGA abnormality");
}
}
//获取码流
const int channum = 3;
DWORD dwBitRate[channum] = {0};
CString strBitRate = ConvertString("BitRate : ");
bRet = CLIENT_QueryDevState(m_dev->LoginID, DEVSTATE_BITRATE, (char *)dwBitRate, channum*sizeof(DWORD), &retlen);
if (!bRet || retlen != channum*sizeof(DWORD))
{
strBitRate += ConvertString("query error");
((CNetSDKDemoDlg*)GetParent())->LastError();
}
else
{
for (int i = 0; i < channum; i++)
{
strTmp.Format("%d( %d ) ", i+1, dwBitRate[i]);
strBitRate += strTmp;
}
}
DWORD dwNetConn[11] = {0};
CString strNetConn = ConvertString("NetConn :");
bRet = CLIENT_QueryDevState(m_dev->LoginID, DEVSTATE_CONN, (char *)dwNetConn, 11*sizeof(DWORD), &retlen);
if (!bRet || retlen < sizeof(DWORD) || retlen > 11*sizeof(DWORD))
{
strNetConn += ConvertString("query error");
((CNetSDKDemoDlg*)GetParent())->LastError();
}
else
{
strTmp.Format("Num( %d ) ", dwNetConn[0]);
strNetConn += strTmp;
for (int i = 1; i <= dwNetConn[0]; i++)
{
strTmp.Format("Ip_%d( 0x%0x ) ", i, dwNetConn[i]);
strNetConn += strTmp;
}
}
bRet = CLIENT_QueryDevState(m_dev->LoginID, DEVSTATE_DISK,
(char*)&m_diskState, sizeof(HARD_DISK_STATE), &retlen, 1000);
if(!bRet || retlen != sizeof(HARD_DISK_STATE))
{
((CNetSDKDemoDlg *)GetParent())->LastError();//Peng Dongfeng 06.11.24
return FALSE;
}
CString strDsk;
#ifdef LANG_ENG
strDsk.Format(ConvertString("Disk num: %d"), m_diskState.dwDiskNum);
#else
strDsk.Format("硬盘数量: %d\n", m_diskState.dwDiskNum);
#endif
strDev = strAlarm + "\n" + strShelter + "\n" +
strMD + "\n" + strVideoLost + "\n" +
strRecord + "\n" + strResource + "\n" +
strBitRate + "\n" + strNetConn + "\n" + strDsk + "\n";
GetDlgItem(IDC_DEV_STATUS)->SetWindowText(strDev);
m_disksel.Clear();
CString strItem;
for (int k=0; k<m_diskState.dwDiskNum; k++)
{
strItem.Format(ConvertString("Disk %d"), k);
m_disksel.InsertString(k, strItem);
}
if (m_disksel.GetCount() > 0)
{
m_disksel.SetCurSel(0);
OnSelchangeDiskselCombo();
}
return TRUE;
}
void CDeviceWorkState::OnSelchangeDiskselCombo()
{
int dskIndex = m_disksel.GetCurSel();
CString strInfo = "";
#ifdef LANG_ENG
strInfo.Format(ConvertString("Size: %d, Remain: %d"),
m_diskState.stDisks[dskIndex].dwVolume,
m_diskState.stDisks[dskIndex].dwFreeSpace);
strInfo += "\n";
CString strDskSt = "";
switch(m_diskState.stDisks[dskIndex].dwStatus)
{
case 0:
strDskSt.Format(ConvertString("Work status: Sleeping"));
break;
case 1:
strDskSt.Format(ConvertString("Work status: Working"));
break;
case 2:
strDskSt.Format(ConvertString("Work status: Error"));
default:
break;
}
#else
strInfo.Format("总容量: %d, 剩余容量: %d\n",
m_diskState.stDisks[dskIndex].dwVolume,
m_diskState.stDisks[dskIndex].dwFreeSpace);
CString strDskSt = "";
switch(m_diskState.stDisks[dskIndex].dwStatus)
{
case 0:
strDskSt.Format("硬盘状态: 休眠\n");
break;
case 1:
strDskSt.Format("硬盘状态: 工作\n");
break;
case 2:
strDskSt.Format("硬盘状态: 故障\n");
default:
break;
}
#endif
strInfo += strDskSt;
GetDlgItem(IDC_DISK_STATUS)->SetWindowText(strInfo);
}
void CDeviceWorkState::OnSelchangeChanselCombo()
{
}
| [
"guoqiao@a83c37f4-16cc-5f24-7598-dca3a346d5dd"
]
| [
[
[
1,
307
]
]
]
|
e10eb22d41836b78d216643a1478d811c1ed796f | d1fd6f07f149aac37069b95326a97e4110b7166c | /CVDAW/CVDAW/AssemblyInfo.cpp | 862cb236efee6c5790e7de8de01d7ee14a51d89a | []
| no_license | JosephWu/programowaniedzwieku | 0b7324f8ff219cffcf2fad56aaad8fc06642cd18 | 3d1eef45b1efc4dfd2d39f105e71b5ceebdfda9e | refs/heads/master | 2016-08-12T19:59:03.205343 | 2009-12-04T11:13:53 | 2009-12-04T11:13:53 | 44,655,154 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,344 | cpp | #include "stdafx.h"
using namespace System;
using namespace System::Reflection;
using namespace System::Runtime::CompilerServices;
using namespace System::Runtime::InteropServices;
using namespace System::Security::Permissions;
//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly:AssemblyTitleAttribute("CVDAW")];
[assembly:AssemblyDescriptionAttribute("")];
[assembly:AssemblyConfigurationAttribute("")];
[assembly:AssemblyCompanyAttribute("Microsoft")];
[assembly:AssemblyProductAttribute("CVDAW")];
[assembly:AssemblyCopyrightAttribute("Copyright (c) Microsoft 2009")];
[assembly:AssemblyTrademarkAttribute("")];
[assembly:AssemblyCultureAttribute("")];
//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the value or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly:AssemblyVersionAttribute("1.0.*")];
[assembly:ComVisible(false)];
[assembly:CLSCompliantAttribute(true)];
[assembly:SecurityPermission(SecurityAction::RequestMinimum, UnmanagedCode = true)];
| [
"[email protected]"
]
| [
[
[
1,
40
]
]
]
|
82c5d0df84f3a5fedaa95ec268d4af4b4c11fa76 | e09dfcc817c731587fd756f7611aacb19b17018a | /src/AnaLogDoc.cpp | 748a65e22c98f9f79b5423ca50ba2b4a72c9b8ee | []
| no_license | jweitzen/analogqct | cb77f50f2682ee46325cafd738fcf1299d2710aa | 535bcf32fd615815d640b06c860cfec9acb7f983 | refs/heads/master | 2021-01-10T09:31:14.808743 | 2009-06-12T16:46:03 | 2009-06-12T16:46:03 | 50,674,838 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,265 | cpp | // AnaLogDoc.cpp : implementation of the CAnaLogDoc class
//
#include "stdafx.h"
#include "AnaLog.h"
#include <fstream.h>
#include "AnaLogDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAnaLogDoc
IMPLEMENT_DYNCREATE(CAnaLogDoc, CDocument)
BEGIN_MESSAGE_MAP(CAnaLogDoc, CDocument)
//{{AFX_MSG_MAP(CAnaLogDoc)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CAnaLogDoc construction/destruction
CAnaLogDoc::CAnaLogDoc()
{
//Define the day of expiry of the program
DayOfExpiry = "2009/06/21";
DisableProgram = false;
Today = CTime::GetCurrentTime(); //Get today's date
CString TodayString = Today.Format("%Y/%m/%d");
if (TodayString > DayOfExpiry)
{
DisableProgram = true; //Disale program if license expired
CString ExpiryNotice = "Hi,\n\nthis program has expired. If you intend to keep using it in\nthe future please contact me at:\n\[email protected]\n\nCiao,\nGiulio";
AfxMessageBox(ExpiryNotice);
PostQuitMessage(0);
}
//Use GetModuleFileName in prder to get the full path to this program
char modulename[_MAX_PATH] ;
GetModuleFileName(NULL, modulename, MAX_PATH) ;
ExecutablePath = modulename; //This is the full path to this program
ExecutablePath.Replace("AnaLogQCT.exe",""); //remove the program name so that only the path is left
PrefferedHTML = "Horizontal";
QCATVersion = "QCAT5";
FrameSplit = 65;
ShowConfirmMsg = "yes";
FilterFolder = "C:\\Program Files\\AnaLogQCT\\Filters";
//Read the use settings
char InString[StringLength];
ifstream InSettingsFile(ExecutablePath + "Settings.cfg",ios::nocreate);
if (InSettingsFile.is_open())
{
if(!InSettingsFile.eof())
{
InSettingsFile.getline(InString,StringLength);
PrefferedHTML = InString; //Defines if vertical or hirizontal frames are preferred
}
if(!InSettingsFile.eof())
{
InSettingsFile.getline(InString,StringLength);
QCATVersion = InString; //Defines the frame division between links and text
}
if(!InSettingsFile.eof())
{
InSettingsFile.getline(InString,StringLength);
FrameSplit = atoi(InString); //Defines the frame division between links and text
}
if(!InSettingsFile.eof())
{
InSettingsFile.getline(InString,StringLength);
ShowConfirmMsg = InString; //Defines whether to show the settings saving message
}
InSettingsFile.close();
}
CurrentFilePathName = "";
Extension = "";
}
CAnaLogDoc::~CAnaLogDoc()
{
}
BOOL CAnaLogDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: add reinitialization code here
// (SDI documents will reuse this document)
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CAnaLogDoc serialization
void CAnaLogDoc::Serialize(CArchive& ar)
{
//The serialize function is called if the program is opened with a right-click
//Read the command line to extract the arguments passed to the program
CCommandLineInfo cmdInfo;
AfxGetApp()->ParseCommandLine(cmdInfo);
CurrentFilePathName = cmdInfo.m_strFileName; //if program is opened with a right-click this is the full path to the log
Extension = CurrentFilePathName.Right(CurrentFilePathName.GetLength()-CurrentFilePathName.ReverseFind('.')-1); //Extract the extension in order to establish the type of log in use
Extension.MakeLower();
StartUp = true; //This is useful open the file in case of right-click opening
if (ar.IsStoring())
{
}
else
{
}
}
/////////////////////////////////////////////////////////////////////////////
// CAnaLogDoc diagnostics
#ifdef _DEBUG
void CAnaLogDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CAnaLogDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CAnaLogDoc commands
| [
"giulio.inbox@6d061dfa-575b-11de-9a1b-6103e4980ab8"
]
| [
[
[
1,
148
]
]
]
|
c93e55a3ca118dffd4ff44b9da8a1a635f784bde | be3d7c318d79cd33d306aba58a1159147cac91fd | /modules/wgd_models/src/collision.cpp | 36bd2fae8d5020bc2072360313e7cfab1ee7c4e3 | []
| no_license | knicos/Cadence | 827149b53bb3e92fe532b0ad4234b7d0de11ca43 | 7e1e1cf1bae664f77afce63407b61c7b2b0a4fff | refs/heads/master | 2020-05-29T13:19:07.595099 | 2011-10-31T13:05:48 | 2011-10-31T13:05:48 | 1,238,039 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,309 | cpp | //collision functions from "Real Time Collision Detection" book
#include <wgd/vector.h>
#include "collision.h"
using namespace wgd;
// Closest point of a triangle to a point, page 141/2
vector3d wgd::ClosectPointTriangle(const vector3d &p, const vector3d &a, const vector3d &b, const vector3d &c) {
// check if P in vertex region outside A
vector3d ab = b - a;
vector3d ac = c - a;
vector3d ap = p - a;
float d1 = ab.dot(ap);
float d2 = ac.dot(ap);
if(d1 <= 0.0f && d2 <= 0.0f) return a; //barycentric coordinates (1, 0, 0)
// check if P in vertex region outside B
vector3d bp = p - b;
float d3 = ab.dot(bp);
float d4 = ac.dot(bp);
if(d3 >= 0.0f && d4 <= d3) return b; //barycentric coordinates (0, 1, 0)
//Check if P in edge region of AB, if so, return projection of P onto AB
float vc = d1*d4 - d3*d2;
if(vc <= 0.0f && d1 >= 0.0f && d3 <= 0.0f) {
float v = d1 / (d1 - d3);
return a + ab * v; //barycentric coordinates (1-v, v, 0)
}
// check if P in vertex region outside C
vector3d cp = p - c;
float d5 = ab.dot(cp);
float d6 = ac.dot(cp);
if(d6 >= 0.0f && d5 <= d6) return c; //barycentric coordinates (0, 0, 1)
// check if P in edge region of AC, if so return projection of P onto AC
float vb = d5*d2 - d1*d6;
if(vb <= 0.0f && d2 >= 0.0f && d6 <= 0.0f) {
float w = d2 / (d2 - d6);
return a + ac * w; //barycentric coordinates (1-w, 0, w)
}
// check if P in edge region of BC, if so return projection of P onto BC
float va = d3*d6 - d5*d4;
if(va <= 0.0f && (d4-d3) >= 0.0f && (d5-d6) >= 0.0f) {
float w = (d4-d3) / ((d4-d3) + (d5-d6));
return a + (c-b) * w; //barycentric coordinates (0, 1-w, w)
}
// P inside face region. compute Q through its barycentric coordinates (u, v, w)
float denom = 1.0f / (va + vb + vc);
float v = vb * denom;
float w = vc * denom;
return a + ab * v + ac * w; // = u*a + v*b + w*c, u = va * denom = 1.0f - v - w
}
// line segment intersects triangle page 191/2 (modified to return actual point)
int wgd::intersectLineTriangle(const vector3d &p, const vector3d &q, const vector3d &a, const vector3d &b, const vector3d &c, vector3d &result, vector3d &normal) {
float t,u,v,w; // barycentric result
vector3d ab = b - a;
vector3d ac = c - a;
vector3d qp = p - q;
// Compute triangle normal
vector3d n = ab.cross(ac);
//compute denominator d. if d <= 0, line is parallel to or points away from triangle
float d = qp.dot(n);
if(d <= 0.0f) return 0;
// compute intersection t value of pq with plane of triangle
vector3d ap = p - a;
t = ap.dot(n);
if(t <= 0.0f) return 0; //intersection before line starts
if(t > d) return 0; //intersection after line ends, leave out for ray tests
// compute barycentric coordinate components and test if within bounds
vector3d e = qp.cross(ap);
v = ac.dot(e);
if(v < 0.0f || v > d) return 0;
w = -ab.dot(e);
if(w < 0.0f || v + w > d) return 0;
// segment/ray intersects triangle. perform delayed division and
// compute the last barycentric coordinate component
float ood = 1.0f / d;
t *= ood;
v *= ood;
w *= ood;
u = 1.0f - v - w;
// output stuff
normal = n;
result = a*u + b*v + c*w;
return 1;
}
//Line segment - AABB test - page 183/4
#define EPSILON 0.00001f;
int wgd::TestSegmentAABB(const wgd::vector3d &p0, const wgd::vector3d &p1, const wgd::vector3d &min, const wgd::vector3d &max) {
vector3d e = max - min; //box halflength (*2 to save time)
vector3d d = p1 - p0; //segment halflength (*2 to save time)
vector3d m = p0 + p1 - min - max; //segment midpoint translated to origin
//world coordinate as seperating axis
float adx = abs(d.x);
if(abs(m.x) > e.x + adx) return 0;
float ady = abs(d.y);
if(abs(m.y) > e.y + ady) return 0;
float adz = abs(d.z);
if(abs(m.z) > e.x + adz) return 0;
//add epsilon to fix errors when near parallel
adx+=EPSILON; ady+=EPSILON; adz+=EPSILON;
//cross products of segment direction vector with coordinate axes
if(abs(m.y*d.z - m.z * d.y) > e.y * adz + e.z * ady) return 0;
if(abs(m.y*d.z - m.z * d.y) > e.y * adz + e.z * ady) return 0;
if(abs(m.y*d.z - m.z * d.y) > e.y * adz + e.z * ady) return 0;
//no seperating axis found
return 1;
}
| [
"[email protected]"
]
| [
[
[
1,
128
]
]
]
|
70e33c2d45cf5b545c97a9a46ca0eb1786aa4cd6 | 1cc5720e245ca0d8083b0f12806a5c8b13b5cf98 | /v4/423/c.cpp | 12c28f6f922beb552425c7dacbaf1a9ccf4c1440 | []
| no_license | Emerson21/uva-problems | 399d82d93b563e3018921eaff12ca545415fd782 | 3079bdd1cd17087cf54b08c60e2d52dbd0118556 | refs/heads/master | 2021-01-18T09:12:23.069387 | 2010-12-15T00:38:34 | 2010-12-15T00:38:34 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,058 | cpp | #include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <ctype.h>
using namespace std;
long conectado[201][201];
int n;
void start() {
int i,j,k,m;
long l;
char c[30];
for(i=0;i!=n;i++) {
conectado[i][i] = 0;
for(j=0;j!=i;j++) {
scanf(" %s",c);
if(c[0]=='x') {
l = -1;
} else {
l = atol(c);
}
conectado[i][j] = l;
conectado[j][i] = l;
}
}
for(k=0;k!=n;k++) {
for(i=0;i!=n;i++) {
for(j=0;j!=n;j++) {
if(conectado[i][k]==-1 || conectado[k][j]==-1) continue;
if(conectado[i][j]==-1 || conectado[i][k] + conectado[k][j] < conectado[i][j]) {
conectado[i][j] = conectado[i][k]+conectado[k][j];
conectado[j][i] = conectado[i][k]+conectado[k][j];
}
}
}
}
l = -1;
for(i=0;i!=n;i++) {
if(conectado[0][i]>l) l = conectado[0][i];
// cout << conectado[0][i] << " ";
}
cout << l << endl;
}
int main() {
scanf(" %d",&n);
start();
return 0;
}
| [
"[email protected]"
]
| [
[
[
1,
59
]
]
]
|
d817b0eba67bf98011d951b4640fddb9137247eb | 580738f96494d426d6e5973c5b3493026caf8b6a | /Include/Vcl/ixedit.hpp | eac2838e3800bd33e1d0bc259645958fb3be3eec | []
| no_license | bravesoftdz/cbuilder-vcl | 6b460b4d535d17c309560352479b437d99383d4b | 7b91ef1602681e094a6a7769ebb65ffd6f291c59 | refs/heads/master | 2021-01-10T14:21:03.726693 | 2010-01-11T11:23:45 | 2010-01-11T11:23:45 | 48,485,606 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 3,187 | hpp | // Borland C++ Builder
// Copyright (c) 1995, 2002 by Borland Software Corporation
// All rights reserved
// (DO NOT EDIT: machine generated header) 'Ixedit.pas' rev: 6.00
#ifndef IxeditHPP
#define IxeditHPP
#pragma delphiheader begin
#pragma option push -w-
#pragma option push -Vx
#include <LibHelp.hpp> // Pascal unit
#include <DBTables.hpp> // Pascal unit
#include <StdCtrls.hpp> // Pascal unit
#include <Dialogs.hpp> // Pascal unit
#include <Forms.hpp> // Pascal unit
#include <Controls.hpp> // Pascal unit
#include <Graphics.hpp> // Pascal unit
#include <Classes.hpp> // Pascal unit
#include <Messages.hpp> // Pascal unit
#include <Windows.hpp> // Pascal unit
#include <SysUtils.hpp> // Pascal unit
#include <SysInit.hpp> // Pascal unit
#include <System.hpp> // Pascal unit
//-- user supplied -----------------------------------------------------------
namespace Ixedit
{
//-- type declarations -------------------------------------------------------
class DELPHICLASS TIndexFiles;
class PASCALIMPLEMENTATION TIndexFiles : public Forms::TForm
{
typedef Forms::TForm inherited;
__published:
Stdctrls::TGroupBox* GroupBox1;
Stdctrls::TListBox* ListBox1;
Stdctrls::TButton* Add;
Stdctrls::TButton* Delete;
Stdctrls::TButton* Ok;
Stdctrls::TButton* Cancel;
Stdctrls::TButton* Help;
Stdctrls::TButton* Clear;
Dialogs::TOpenDialog* OpenDialog;
void __fastcall ListBox1Click(System::TObject* Sender);
void __fastcall AddClick(System::TObject* Sender);
void __fastcall DeleteClick(System::TObject* Sender);
void __fastcall ClearClick(System::TObject* Sender);
void __fastcall FormCreate(System::TObject* Sender);
void __fastcall HelpClick(System::TObject* Sender);
private:
Dbtables::TTable* FTable;
bool FNoItems;
AnsiString FEmpty;
void __fastcall AddEmpty(void);
bool __fastcall IsDBaseTable(void);
void __fastcall RemoveEmpty(void);
void __fastcall SetButtons(void);
public:
__property Dbtables::TTable* Table = {read=FTable};
__property bool NoItems = {read=FNoItems, nodefault};
public:
#pragma option push -w-inl
/* TCustomForm.Create */ inline __fastcall virtual TIndexFiles(Classes::TComponent* AOwner) : Forms::TForm(AOwner) { }
#pragma option pop
#pragma option push -w-inl
/* TCustomForm.CreateNew */ inline __fastcall virtual TIndexFiles(Classes::TComponent* AOwner, int Dummy) : Forms::TForm(AOwner, Dummy) { }
#pragma option pop
#pragma option push -w-inl
/* TCustomForm.Destroy */ inline __fastcall virtual ~TIndexFiles(void) { }
#pragma option pop
public:
#pragma option push -w-inl
/* TWinControl.CreateParented */ inline __fastcall TIndexFiles(HWND ParentWindow) : Forms::TForm(ParentWindow) { }
#pragma option pop
};
//-- var, const, procedure ---------------------------------------------------
extern PACKAGE bool __fastcall EditIndexFiles(Dbtables::TTable* ATable, Classes::TStrings* List);
} /* namespace Ixedit */
using namespace Ixedit;
#pragma option pop // -w-
#pragma option pop // -Vx
#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif // Ixedit
| [
"bitscode@7bd08ab0-fa70-11de-930f-d36749347e7b"
]
| [
[
[
1,
95
]
]
]
|
fda96da20cd6d02d1f19332d709e043d9c858556 | f177993b13e97f9fecfc0e751602153824dfef7e | /ImProSln/GSD3DLib/GSDXShareFilter.h | 49db783ca897da94e0a2a79b1f2e0787fcdb41f3 | []
| no_license | svn2github/imtophooksln | 7bd7412947d6368ce394810f479ebab1557ef356 | bacd7f29002135806d0f5047ae47cbad4c03f90e | refs/heads/master | 2020-05-20T04:00:56.564124 | 2010-09-24T09:10:51 | 2010-09-24T09:10:51 | 11,787,598 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,559 | h | #pragma once
#include "dshow.h"
#include "Streams.h"
#include <initguid.h>
#include "combase.h"
#include <D3D11.h>
#include <D3DX11.h>
#include "GSD3DLib.h"
#include "GSD3DBaseClass.h"
// {7093A7B9-D31D-49b6-A43B-5D8300910390}
DEFINE_GUID(IID_IGSDXSharePin,
0x7093a7b9, 0xd31d, 0x49b6, 0xa4, 0x3b, 0x5d, 0x83, 0x0, 0x91, 0x3, 0x90);
// {581540A6-1FC5-4690-9F9A-9663BBFA8D94}
DEFINE_GUID(IID_IGSDXShareFilter,
0x581540a6, 0x1fc5, 0x4690, 0x9f, 0x9a, 0x96, 0x63, 0xbb, 0xfa, 0x8d, 0x94);
interface IGSDXShareFilter;
MIDL_INTERFACE("7093A7B9-D31D-49b6-A43B-5D8300910390")
IGSDXSharePin : public IUnknown
{
public:
virtual HRESULT SetConnectedPin(IGSDXSharePin* pPin) = 0;
virtual HRESULT GetD3DFilter(IGSDXShareFilter*& pFilter) = 0;
virtual HRESULT GetConnectedPin(IGSDXSharePin*& pPin) = 0;
virtual HRESULT QueryD3DDevice(ID3D11Device*& outDevice, ID3D11DeviceContext*& outDeviceContext, IDXGISwapChain*& outSwapChain) = 0;
virtual HRESULT QueryD3DDeviceCS(GSCritSec*& cs) = 0;
};
MIDL_INTERFACE("581540A6-1FC5-4690-9F9A-9663BBFA8D94")
IGSDXShareFilter : public IUnknown
{
public:
virtual HRESULT QueryD3DDeviceCS(IGSDXSharePin* pPin, GSCritSec*& cs) = 0;
virtual HRESULT QueryD3DDevice(IGSDXSharePin* pPin, ID3D11Device*& outDevice, ID3D11DeviceContext*& outDeviceContext, IDXGISwapChain*& outSwapChain) = 0;
};
class GSDXSharePin;
class GSD3DLIB_API GSDXShareFilter : public IGSDXShareFilter
{
public:
/////have to be overwrite by child class////////
//virtual HRESULT QueryD3DDeviceCS(IGSDXSharePin* pPin, CCritSec*& cs) = 0;
//virtual HRESULT QueryD3DDevice(IGSDXSharePin* pPin, ID3D11Device*& outDevice,
// ID3D11DeviceContext*& outDeviceContext, IDXGISwapChain*& outSwapChain) = 0;
};
class GSD3DLIB_API GSDXSharePin : public IGSDXSharePin
{
protected:
IGSDXSharePin* m_pConnectedPin;
public:
GSDXSharePin();
~GSDXSharePin();
virtual HRESULT SetConnectedPin(IGSDXSharePin* pPin);
virtual HRESULT GetConnectedPin(IGSDXSharePin*& pPin);
};
class GSD3DLIB_API GSDXShareOutputPin : public GSDXSharePin
{
public:
virtual HRESULT QueryD3DDevice(ID3D11Device*& outDevice, ID3D11DeviceContext*& outDeviceContext, IDXGISwapChain*& outSwapChain);
virtual HRESULT QueryD3DDeviceCS(GSCritSec*& cs);
};
class GSD3DLIB_API GSDXShareInputPin : public GSDXSharePin
{
public:
virtual HRESULT QueryD3DDevice(ID3D11Device*& outDevice, ID3D11DeviceContext*& outDeviceContext, IDXGISwapChain*& outSwapChain);
virtual HRESULT QueryD3DDeviceCS(GSCritSec*& cs);
}; | [
"ndhumuscle@fa729b96-8d43-11de-b54f-137c5e29c83a"
]
| [
[
[
1,
75
]
]
]
|
92a3a3e41a3f00654da95b07e7e04047f2ef7770 | 78d40fe09df2496088fd22859876eb6e7be954c0 | /preview.h | e6207a717d385f2890be71f06537a0b1cbe6e31a | []
| no_license | icedman/style7 | f1086f650b43784735542e6fac7df64197d0f00e | 6834d4d1021bd805631379dc4795427eae8d6893 | refs/heads/master | 2021-01-23T04:00:10.384380 | 2010-04-08T10:40:37 | 2010-04-08T10:40:37 | 35,222,984 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 238 | h | #pragma once
#include "style.h"
class Preview
{
public:
Preview(Style *style, bool aero);
QImage createDesktopPreview(QSize size);
QImage createFramePreview(QSize size, Frame *frame);
Style *style;
bool aero;
};
| [
"m4rvin2005@12bdf7b2-7090-17ef-321a-d85e0c66d2ab"
]
| [
[
[
1,
16
]
]
]
|
e38fbdc4733005c7ce64a02874bb59f6185805a9 | 59166d9d1eea9b034ac331d9c5590362ab942a8f | /DynamicGroupSize/DynamicGroupSize.h | 946c8187545d9c937606e1fd71f57e751a54c3f9 | []
| no_license | seafengl/osgtraining | 5915f7b3a3c78334b9029ee58e6c1cb54de5c220 | fbfb29e5ae8cab6fa13900e417b6cba3a8c559df | refs/heads/master | 2020-04-09T07:32:31.981473 | 2010-09-03T15:10:30 | 2010-09-03T15:10:30 | 40,032,354 | 0 | 3 | null | null | null | null | WINDOWS-1251 | C++ | false | false | 758 | h | #ifndef _DYNAMIC_GROUP_SIZE_H_
#define _DYNAMIC_GROUP_SIZE_H_
#include <osg/Group>
#include <osg/Geode>
#include <osg/Referenced>
#include <osg/ref_ptr>
#include <vector>
class DynamicGroupSize : public osg::Referenced
{
public:
DynamicGroupSize();
~DynamicGroupSize();
//вернуть узел содержащий геометрию
osg::ref_ptr< osg::Group > getRootNode() { return m_rootNode.get(); }
private:
//инициализировать корневой узел
void InitNode();
//добавить текстуру
void AddTexture();
//корневой узел
osg::ref_ptr< osg::Group > m_rootNode;
std::vector< osg::ref_ptr< osg::Geode > > m_vecGeode;
};
#endif //_DYNAMIC_GROUP_SIZE_H_ | [
"asmzx79@3290fc28-3049-11de-8daa-cfecb5f7ff5b"
]
| [
[
[
1,
34
]
]
]
|
ce84943eca8edc4a0143949de73082eb14998963 | 9f47c9b73588cbfaa9224ee172eb8ef7d49097d9 | /map/Map.cpp | fd451b73e4ae9ac09a2b0da561959f68a7a2825f | []
| no_license | haniayoub/nemala | 71f6f0e41c49112ea4fc006b30236aa0e4289978 | b2a20aaed00049545de56cac805bd4c3701417a0 | refs/heads/master | 2020-05-18T16:42:00.784106 | 2009-09-17T07:05:06 | 2009-09-17T07:05:06 | 32,520,238 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 21,105 | cpp | #include "Map.h"
/************************************************************************/
/* Map C'tor */
/************************************************************************/
Map::Map(int src_x, int src_y, int tgt_x, int tgt_y)
{
//Set src and tgt pts
this->src_x = src_x;
this->src_y = src_y;
this->tgt_x = tgt_x;
this->tgt_y = tgt_y;
init();
findAngles();
decomposite();
setStations();
setPath();
/*After the C'tor is called, the matrix is decomposited and the matrix
is divided by cells, each cell has a number, and stations which the
robot should follow is filled in stations matrix (can be taken calling
getNextStation(x, y) function. */
}
/************************************************************************/
/* Returns current station point */
/************************************************************************/
StationType Map::getNextStation(int &x, int &y, bool fill)
{
/*Keep returning the station position till there is no stations*/
currStation++;
for(int i(0); i<MAP_WIDTH; i++)
for(int j(0); j<MAP_HIGHT; j++)
if(stations[i][j] == currStation)
{
x=i;
y=j;
if(currStation == numOfStations)
return LAST;
else if(currStation == numOfStations-1)
return BEFORE_LAST;
else if(currStation == numOfStations-2)
return BEFORE_BEFORE_LAST;
else if(currStation == 2)
return FIRST;
else if(currStation == 1)
return BEFORE_FIRST;
else
return MIDDLE;
}
x=-1;
y=-1;
return NOT_STATION;
}
/************************************************************************/
/* get Station coordinates */
/************************************************************************/
void Map::getStationByNum(int stNum, int &x, int &y)
{
for(int i(0); i<MAP_WIDTH; i++)
for(int j(0); j<MAP_HIGHT; j++)
if(stations[i][j] == stNum)
{
x=i; y=j;
return;
}
x=-1; y=-1;
}
/************************************************************************/
/* Returns current station number */
/************************************************************************/
int Map::getCurrStation()
{
return currStation;
}
/************************************************************************/
/* Returns minimal distance obstacles and bounds from a point */
/************************************************************************/
int Map::getDistance(int x, int y)
{
/* In order to choose the relevant path when there are more than one
we calculate the distance of a point which is the minimal distance
from an obstacle or bound. The point with the minimal distance is
the desirable one.
When we have two paths?
+------------------------------------------+
| |
| |
| |
| |
| (x1,y1) -------------------> |
| | | |
| | | |
| | | |
| | | |
| |(path2) | (Path1) |
| | | |
| | | |
| | | |
| | | |
| V V |
| --------------------->(x2,y2) |
| |
| |
| |
| |
+------------------------------------------+
*/
int minX = min(MAP_WIDTH-x, x);
int minY = min(MAP_HIGHT-y, y);
for(int i(0); i<MAP_WIDTH; i++)
if(m[i][y] == -1)
minX = min(minX, abs(x-i));
for(int j(0); j<MAP_HIGHT; j++)
if(m[x][j] == -1)
minY = min(minY, abs(y-j));
return min(minX, minY);
}
/************************************************************************/
/* Given a point and orientation, returns 4 distances */
/************************************************************************/
void Map::getDistances(int x, int y, Orientation o,
int &northDist, int &southDist,
int &eastDist , int &westDist)
{
/*
In order to keep going in the same way, the robot needs to know its distance from
an obstacle in a given point with a given orientation, this function returns the
relevant distances. at first we calculates dist1, ... , dist4 as shows, then we fit
them for the given variables corresponding to the orientation.
+---------------------------+
| |
| |
| S(2) |
| |
| E(3) W(4) |
| |
| N(1) |
| |
| |
+---------------------------+
*/
int dist1=MAP_HIGHT-y, dist2=y, dist3=x, dist4=MAP_WIDTH-x;
for(int j(y); j<MAP_HIGHT; j++)
if(m[x][j] == -1)
dist1 = min(dist1, j-y); /*North*/
for(int j(0); j<y; j++)
if(m[x][j] == -1)
dist2 = min(dist2, y-j); /*South*/
for(int i(0); i<x; i++)
if(m[i][y] == -1)
dist3 = min(dist3, x-i); /*East*/
for(int i(x); i<MAP_WIDTH; i++)
if(m[i][y] == -1)
dist4 = min(dist4, i-x); /*West*/
if(o == NORTH)
{
northDist = dist1;
southDist = dist2;
eastDist = dist3;
westDist = dist4;
}
else if(o == WEST)
{
northDist = dist4;
southDist = dist3;
eastDist = dist1;
westDist = dist2;
}
else if(o == SOUTH)
{
northDist = dist2;
southDist = dist1;
eastDist = dist4;
westDist = dist3;
}
else if(o == EAST)
{
northDist = dist3;
southDist = dist4;
eastDist = dist2;
westDist = dist1;
}
else
{
throw "Bad Orientation.";
}
}
/************************************************************************/
/* Prints the map */
/************************************************************************/
void Map::print()
{
printMatrix(m);
}
/************************************************************************/
/* Prints angles matrix */
/************************************************************************/
void Map::printAngles()
{
printMatrix(angles);
}
/************************************************************************/
/* Prints stations matrix numbered */
/************************************************************************/
void Map::printStations()
{
cout << "======== Stations ========" << endl;
for(int j(0); j<MAP_HIGHT; j++)
for(int i(0); i<MAP_WIDTH; i++)
if(stations[i][j] != 0)
cout << "stations[" << i << "]" << "[" << j << "]" << "=" << stations[i][j] << endl;
cout << "==========================" << endl;
}
/************************************************************************/
/* Default D'tor */
/************************************************************************/
Map::~Map()
{
/*do nothing, since we don't new anything*/
};
/************************************************************************/
/* Init the map matrix with src, tgt and obstacles */
/************************************************************************/
void Map::init()
{
/* Zero everything */
currStation = 0;
for(int i(0); i<MAP_WIDTH; i++)
for(int j(0); j<MAP_HIGHT; j++)
{
m[i][j] = 0;
angles[i][j] = 0;
stations[i][j] = 0;
changing[j] = 0;
}
for(int i(0); i<OBSTACLE_WIDTH; i++)
for(int j(0); j<OBSTACLE_HIGHT; j++)
{
if(isSartEndPoint(OBS_1_X+i, OBS_1_Y+j) ||
isSartEndPoint(OBS_2_X+i, OBS_2_Y+j) ||
isSartEndPoint(OBS_3_X+i, OBS_3_Y+j) ||
isSartEndPoint(OBS_4_X+i, OBS_4_Y+j))
throw "Bad Obstacle, collision with Source/Target point";
m[OBS_1_X+i][OBS_1_Y+j] = -1;
m[OBS_2_X+i][OBS_2_Y+j] = -1;
m[OBS_3_X+i][OBS_3_Y+j] = -1;
m[OBS_4_X+i][OBS_4_Y+j] = -1;
}
}
/************************************************************************/
/* Sets stations matrix with numbers */
/************************************************************************/
void Map::setStations()
{
int firstCell = m[src_x][src_y];
int lastCell = m[tgt_x][tgt_y];
int mode; // 1 = move up
// -1 = move down
// 0 = both in same cell
int currXst, currYst, nextXst, nextYst;
if(firstCell < lastCell)
mode = 1;
else if (firstCell > lastCell)
mode = -1;
else
mode = 0;
int currSt(1), j;
currXst = src_x;
currYst = src_y;
stations[currXst][currYst] = currSt++;
if(mode == 0)
{
stations[tgt_x][tgt_y] = currSt;
numOfStations = --currSt;
}
else
{
for(int i(mode==1 ? 0 : MAP_HIGHT-1); i<MAP_HIGHT && i>=0; i+=mode)
{
if(changing[i] == 1)
{
j = getNextStation(i);
//station[j][i] is next station...
nextXst = j;
nextYst = i;
if( (currXst == nextXst) || (currYst == nextYst) )
{
stations[nextXst][nextYst] = currSt++;
}
else
{
int res = choosePath(currXst, currYst, nextXst, nextYst, currSt);
if(res == 1) /* _| */
{
stations[nextXst][currYst] = currSt++;
stations[nextXst][nextYst] = currSt++;
}
else /* |_ */
{
stations[currXst][nextYst] = currSt++;
stations[nextXst][nextYst] = currSt++;
}
}
currXst = nextXst;
currYst = nextYst;
}
}
nextXst = tgt_x;
nextYst = tgt_y;
if( (currXst == nextXst) || (currYst == nextYst) )
{
stations[nextXst][nextYst] = currSt++;
}
else
{
int res = choosePath(currXst, currYst, nextXst, nextYst, currSt);
if(res == 1) /* _| */
{
stations[nextXst][currYst] = currSt++;
stations[nextXst][nextYst] = currSt++;
}
else /* |_ */
{
stations[currXst][nextYst] = currSt++;
stations[nextXst][nextYst] = currSt++;
}
}
numOfStations = --currSt;
printStations();
return;
}
}
/************************************************************************/
/* determine path to take */
/************************************************************************/
int Map::choosePath(int x1, int y1, int x2, int y2, int currSt)
{
int distXaxis = getDistance(x2, y1),
distYaxis = getDistance(x1, y2);
if(distXaxis > distYaxis)
return 1; // x then y
else if(distXaxis < distYaxis)
return 0; // y then x
else //same distance => choose under the current orientation condition
{
if(currSt == 2)
{
return choosPathByFirstOrientation();
}
else
{
int temp_x1, temp_y1, temp_x2, temp_y2;
temp_x1 = x1;
temp_y1 = y1;
getStationByNum(currSt-1, temp_x2, temp_y2);
if(temp_x1 == temp_x2)
return 0;
else if(temp_y1 == temp_y2)
return 1;
}
}
throw "Exception in choose path";
}
int Map::choosPathByFirstOrientation()
{
return 1;
/*
if(src_x == POINT_1_X || src_x == POINT_3_X)
return 1;
else if(src_x == POINT_2_X || src_x == POINT_4_X)
return 0;
else
throw "Exception in choosing path...";
*/
}
/************************************************************************/
/* Set Path */
/************************************************************************/
void Map::setPath()
{
int curr_x, curr_y, next_x, next_y;
getNextStation(curr_x, curr_y);
while(getNextStation(next_x, next_y, false) != NOT_STATION)
{
if(curr_x == next_x)
fillYaxis(curr_y, next_y, curr_x, GREEN);
else if(curr_y == next_y)
fillXaxis(curr_x, next_x, curr_y, GREEN);
else
throw "Exception in setting path : path with Koo3";
curr_x = next_x;
curr_y = next_y;
}
currStation = 0;
}
void Map::fillYaxis(int y1, int y2, int x, char c)
{
int start = min(y1, y2);
int end = max(y1, y2);
for(int j(start); j<=end; j++)
m[x][j] = c;
}
void Map::fillXaxis(int x1, int x2, int y, char c)
{
int start = min(x1, x2);
int end = max(x1, x2);
for(int i(start); i<=end; i++)
m[i][y] = c;
}
/************************************************************************/
/* Recursive function which calculates next station X position given */
/* changing Y position. (changing Y position is Y axis on which we move */
/* from a station to another. */
/************************************************************************/
int Map::getNextStation(int i)
{
int first, last(MAP_WIDTH-1);
for(int j(0); j<MAP_WIDTH; j++)
if(m[j][i] != -1)
{
first = j;
break;
}
for(int j(0); j<MAP_WIDTH; j++)
if(m[j][i] != -1 && m[j+1][i] == -1 && j > first)
{
last = j;
break;
}
int diff = last - first;
if(diff == MAP_WIDTH-1)
return getNextStation(i-1);
return (first + diff/2 +1);
}
/************************************************************************/
/* De-composite the map with cell numbers. After this function call the */
/* map will be numbered by cells */
/************************************************************************/
void Map::decomposite()
{
int cellNum(1);
for(int i(0); i<MAP_HIGHT; i++)
{
if( (!isAngleInRow(i)) || (!isAngleInRow(i-1)) )
{
for(int j(0); j<MAP_WIDTH; j++)
if(m[j][i] == 0)
m[j][i] = cellNum;
}
else //isAngleInRow(i)=true && isAngleInRow(i-1)=true
{
changing[i] = 1;
cellNum++;
for(int j(0); j<MAP_WIDTH; j++)
if(m[j][i] == 0)
m[j][i] = cellNum;
}
}
}
/************************************************************************/
/* Check if a row has an angle of an obstacle */
/************************************************************************/
bool Map::isAngleInRow(int row)
{
for(int i(0); i<MAP_WIDTH; i++)
if(angles[i][row] == 1) return true;
return false;
}
/************************************************************************/
/* Fills the angles matrix */
/************************************************************************/
void Map::findAngles()
{
for(int i(0); i<MAP_WIDTH; i++)
for(int j(0); j<MAP_HIGHT; j++)
if(isAngle(i,j))
{
angles[i][j] = 1;
}
}
/************************************************************************/
/* Check if a point is an angle of an obstacle */
/************************************************************************/
bool Map::isAngle(int x, int y)
{
/*
Angle types:
+------- --------+
| | | |
| (1) | (2) (3) | (4) |
| | | |
+-------- -------+
How we know if a point is an angle?
We check all 9 cells 0 0 0
0 0 0
0 0 0 around the point
if we got 5 ones and 4 zeros or vice versa means
it's a point, otherwise, it's not.
*/
int zeros = 0, ones = 0;
Bound b;
b = isInBounds(x,y);
if(b == LEFT_BOUND && m[x][y] == 0 && (m[x][y+1] == -1 || m[x][y-1] == -1))
return true;
if(b == RIGHT_BOUND && m[x][y] == 0 && (m[x][y+1] == -1 || m[x][y-1] == -1))
return true;
if(b == TOP_BOUND && m[x][y] == 0 && (m[x+1][y] == -1 || m[x-1][y] == -1))
return true;
if(b == BUTTOM_BOUND && m[x][y] == 0 && (m[x+1][y] == -1 || m[x-1][y] == -1))
return true;
if(b == LEFT_BOUND || b == RIGHT_BOUND || b == TOP_BOUND || b == BUTTOM_BOUND || b == BASE_ANGLE)
return false;
if( m[x-1][y-1] == 0 ) zeros++;
if( m[x-1][y-1] == -1 ) ones++;
if( m[x-1][y] == 0 ) zeros++;
if( m[x-1][y] == -1 ) ones++;
if( m[x-1][y+1] == 0 ) zeros++;
if( m[x-1][y+1] == -1 ) ones++;
if( m[x][y-1] == 0 ) zeros++;
if( m[x][y-1] == -1 ) ones++;
if( m[x][y] == 0 ) zeros++;
if( m[x][y] == -1 ) ones++;
if( m[x][y+1] == 0 ) zeros++;
if( m[x][y+1] == -1 ) ones++;
if( m[x+1][y-1] == 0 ) zeros++;
if( m[x+1][y-1] == -1 ) ones++;
if( m[x+1][y] == 0 ) zeros++;
if( m[x+1][y] == -1 ) ones++;
if( m[x+1][y+1] == 0 ) zeros++;
if( m[x+1][y+1] == -1 ) ones++;
if( (zeros == 5 && ones == 4) ||
(zeros == 4 && ones == 5) )
return true;
return false;
}
/************************************************************************/
/* Check if a point is start or target points */
/************************************************************************/
bool Map::isSartEndPoint(int x, int y)
{
if( ( (x == src_x) && (y == src_y) ) ||
( (x == tgt_x) && (y == tgt_y) ) )
return true;
else
return false;
}
/************************************************************************/
/* Prints a given matrix */
/************************************************************************/
void Map::printMatrix(int M[MAP_WIDTH][MAP_HIGHT])
{
for(int i(0); i<MAP_HIGHT; i++)
{
for(int j(0); j<MAP_WIDTH; j++)
{
if(M[j][i] >=0 && M[j][i] <= 9)
{
cout << " " << M[j][i];
}
else
{
cout << M[j][i];
}
}
cout << endl;
}
}
/************************************************************************/
/* Returns bound type of a given point */
/************************************************************************/
Bound Map::isInBounds(int x, int y)
{
if(x == 0 && y != 0 && y != MAP_HIGHT-1) return LEFT_BOUND;
if(x == MAP_WIDTH-1 && y != 0 && y != MAP_HIGHT-1) return RIGHT_BOUND;
if(y == 0 && x != 0 && x != MAP_WIDTH-1) return TOP_BOUND;
if(y == MAP_HIGHT-1 && x != 0 && x != MAP_WIDTH-1) return BUTTOM_BOUND;
if( (x == 0 && y == 0) ||
(x == 0 && y == MAP_HIGHT-1) ||
(x == MAP_WIDTH-1 && y == 0) ||
(x == MAP_WIDTH-1 && y == MAP_HIGHT-1) )
return BASE_ANGLE;
return NOT_BOUND;
}
/************************************************************************/
/* */
/************************************************************************/
bool Map::updatePath(int newX, int newY)
{
int closestX, closestY, closestStation;
if(getClosestPoint(newX, newY, closestX, closestY) == false)
return false;
closestStation = getClosestStation(closestX, closestY);
clearStations(closestStation-1);
stations[closestX][closestY] = closestStation-1;
currStation = closestStation-2;
printStations();
return true;
}
/************************************************************************/
/* */
/************************************************************************/
bool Map::getClosestPoint(int x, int y, int &closestX, int &closestY)
{
for(int i(x); i>=0; i--)
{
if(m[i][y] == -1)
break;
if(m[i][y] == GREEN)
{
closestX = i;
closestY = y;
return true;
}
}
for(int i(x); i<MAP_WIDTH; i++)
{
if(m[i][y] == -1)
break;
if(m[i][y] == GREEN)
{
closestX = i;
closestY = y;
return true;
}
}
for(int j(y); j>=0; j--)
{
if(m[x][j] == -1)
break;
if(m[x][j] == GREEN)
{
closestX = x;
closestY = j;
return true;
}
}
for(int j(y); j<MAP_HIGHT; j++)
{
if(m[x][j] == -1)
break;
if(m[x][j] == GREEN)
{
closestX = x;
closestY = j;
return true;
}
}
return false;
}
/************************************************************************/
/* */
/************************************************************************/
void Map::clearStations(int to)
{
for(int i(0); i<MAP_WIDTH; i++)
for(int j(0); j<MAP_HIGHT; j++)
{
if(stations[i][j] <= to)
stations[i][j] = 0;
}
}
/************************************************************************/
/* */
/************************************************************************/
int Map::getClosestStation(int x, int y)
{
int minStationDist;
for(int stNum(currStation); stNum<=numOfStations; stNum++)
{
int stX, stY;
double minDist = calculateDistance(0,0, MAP_WIDTH, MAP_HIGHT);
getStationByNum(stNum, stX, stY);
if(stX == -1 || stY == -1)
{
throw "Bad Station: in getting closest station...";
}
if(minDist > calculateDistance(x, y, stX, stY))
{
minDist = calculateDistance(x, y, stX, stY);
minStationDist = stNum;
}
}
return minStationDist;
}
/************************************************************************/
/* */
/************************************************************************/
double Map::calculateDistance(int x1, int y1, int x2, int y2)
{
double xDiff = max(x1, x2) - min(x1, x2);
double yDiff = max(y1, y2) - min(y1, y2);
return sqrt ( xDiff*xDiff + yDiff*yDiff);
} | [
"hani.ayoub@95de29a2-506c-11de-abfa-2ff4457fb719",
"[email protected]@95de29a2-506c-11de-abfa-2ff4457fb719"
]
| [
[
[
1,
150
],
[
152,
752
]
],
[
[
151,
151
]
]
]
|
8c1cd16eec18468c3be83fd0751e8870a56aff60 | 7c93f9e101f6bba916bc1a967eb8e787afe9be92 | /7z920/CPP/7zip/Common/FileStreams.cpp | 935a119ec08972493ddc411fd67bd4786160eba7 | []
| no_license | ditupao/vx7zip | 95759f909368c14f5b8f9a3cbee18a54dc3eae78 | 13fa94305e8d3491f9d920351e5d1534957a1c06 | refs/heads/master | 2016-08-11T10:55:47.619762 | 2011-06-05T09:50:51 | 2011-06-05T09:50:51 | 47,533,061 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,925 | cpp | // FileStreams.cpp
#include "StdAfx.h"
#include <errno.h>
#ifndef _WIN32
#include <fcntl.h>
#include <unistd.h>
#else
#include <io.h>
#endif
#ifdef SUPPORT_DEVICE_FILE
#include "../../../C/Alloc.h"
#include "../../Common/Defs.h"
#endif
#include "FileStreams.h"
static inline HRESULT ConvertBoolToHRESULT(bool result)
{
#ifdef _MY_WIN32
if (result)
return S_OK;
DWORD lastError = ::GetLastError();
if (lastError == 0)
return E_FAIL;
return HRESULT_FROM_WIN32(lastError);
#else
return result ? S_OK: E_FAIL;
#endif
}
bool CInFileStream::Open(LPCTSTR fileName)
{
return File.Open(fileName);
}
#ifdef USE_WIN_FILE
#ifndef _UNICODE
bool CInFileStream::Open(LPCWSTR fileName)
{
return File.Open(fileName);
}
#endif
#endif
bool CInFileStream::OpenShared(LPCTSTR fileName, bool shareForWrite)
{
return File.OpenShared(fileName, shareForWrite);
}
#ifdef USE_WIN_FILE
#ifndef _UNICODE
bool CInFileStream::OpenShared(LPCWSTR fileName, bool shareForWrite)
{
return File.OpenShared(fileName, shareForWrite);
}
#endif
#endif
#ifdef SUPPORT_DEVICE_FILE
static const UInt32 kClusterSize = 1 << 18;
CInFileStream::CInFileStream():
VirtPos(0),
PhyPos(0),
Buffer(0),
BufferSize(0)
{
}
#endif
CInFileStream::~CInFileStream()
{
#ifdef SUPPORT_DEVICE_FILE
MidFree(Buffer);
#endif
}
STDMETHODIMP CInFileStream::Read(void *data, UInt32 size, UInt32 *processedSize)
{
#ifdef USE_WIN_FILE
#ifdef SUPPORT_DEVICE_FILE
if (processedSize != NULL)
*processedSize = 0;
if (size == 0)
return S_OK;
if (File.IsDeviceFile)
{
if (File.LengthDefined)
{
if (VirtPos >= File.Length)
return VirtPos == File.Length ? S_OK : E_FAIL;
UInt64 rem = File.Length - VirtPos;
if (size > rem)
size = (UInt32)rem;
}
for (;;)
{
const UInt32 mask = kClusterSize - 1;
UInt64 mask2 = ~(UInt64)mask;
UInt64 alignedPos = VirtPos & mask2;
if (BufferSize > 0 && BufferStartPos == alignedPos)
{
UInt32 pos = (UInt32)VirtPos & mask;
if (pos >= BufferSize)
return S_OK;
UInt32 rem = MyMin(BufferSize - pos, size);
memcpy(data, Buffer + pos, rem);
VirtPos += rem;
if (processedSize != NULL)
*processedSize += rem;
return S_OK;
}
bool useBuffer = false;
if ((VirtPos & mask) != 0 || ((ptrdiff_t)data & mask) != 0 )
useBuffer = true;
else
{
UInt64 end = VirtPos + size;
if ((end & mask) != 0)
{
end &= mask2;
if (end <= VirtPos)
useBuffer = true;
else
size = (UInt32)(end - VirtPos);
}
}
if (!useBuffer)
break;
if (alignedPos != PhyPos)
{
UInt64 realNewPosition;
bool result = File.Seek(alignedPos, FILE_BEGIN, realNewPosition);
if (!result)
return ConvertBoolToHRESULT(result);
PhyPos = realNewPosition;
}
BufferStartPos = alignedPos;
UInt32 readSize = kClusterSize;
if (File.LengthDefined)
readSize = (UInt32)MyMin(File.Length - PhyPos, (UInt64)kClusterSize);
if (Buffer == 0)
{
Buffer = (Byte *)MidAlloc(kClusterSize);
if (Buffer == 0)
return E_OUTOFMEMORY;
}
bool result = File.Read1(Buffer, readSize, BufferSize);
if (!result)
return ConvertBoolToHRESULT(result);
if (BufferSize == 0)
return S_OK;
PhyPos += BufferSize;
}
if (VirtPos != PhyPos)
{
UInt64 realNewPosition;
bool result = File.Seek(VirtPos, FILE_BEGIN, realNewPosition);
if (!result)
return ConvertBoolToHRESULT(result);
PhyPos = VirtPos = realNewPosition;
}
}
#endif
UInt32 realProcessedSize;
bool result = File.ReadPart(data, size, realProcessedSize);
if (processedSize != NULL)
*processedSize = realProcessedSize;
#ifdef SUPPORT_DEVICE_FILE
VirtPos += realProcessedSize;
PhyPos += realProcessedSize;
#endif
return ConvertBoolToHRESULT(result);
#else
if (processedSize != NULL)
*processedSize = 0;
long res = File.Read(data, (size_t)size);
if (res == -1)
return E_FAIL;
if (processedSize != NULL)
*processedSize = (UInt32)res;
return S_OK;
#endif
}
#ifdef UNDER_CE
STDMETHODIMP CStdInFileStream::Read(void *data, UInt32 size, UInt32 *processedSize)
{
size_t s2 = fread(data, 1, size, stdout);
if (processedSize != 0)
*processedSize = s2;
return (s2 = size) ? S_OK : E_FAIL;
}
#else
STDMETHODIMP CStdInFileStream::Read(void *data, UInt32 size, UInt32 *processedSize)
{
#ifdef _MY_WIN32
DWORD realProcessedSize;
UInt32 sizeTemp = (1 << 20);
if (sizeTemp > size)
sizeTemp = size;
BOOL res = ::ReadFile(GetStdHandle(STD_INPUT_HANDLE), data, sizeTemp, &realProcessedSize, NULL);
if (processedSize != NULL)
*processedSize = realProcessedSize;
if (res == FALSE && GetLastError() == ERROR_BROKEN_PIPE)
return S_OK;
return ConvertBoolToHRESULT(res != FALSE);
#else
if (processedSize != NULL)
*processedSize = 0;
long res;
do
{
res = read(0, (char *)data, (size_t)size);
}
while (res < 0 && (errno == EINTR));
if (res == -1)
return E_FAIL;
if (processedSize != NULL)
*processedSize = (UInt32)res;
return S_OK;
#endif
}
#endif
STDMETHODIMP CInFileStream::Seek(Int64 offset, UInt32 seekOrigin,
UInt64 *newPosition)
{
if (seekOrigin >= 3)
return STG_E_INVALIDFUNCTION;
#ifdef USE_WIN_FILE
#ifdef SUPPORT_DEVICE_FILE
if (File.IsDeviceFile)
{
UInt64 newVirtPos = offset;
switch(seekOrigin)
{
case STREAM_SEEK_SET: break;
case STREAM_SEEK_CUR: newVirtPos += VirtPos; break;
case STREAM_SEEK_END: newVirtPos += File.Length; break;
default: return STG_E_INVALIDFUNCTION;
}
VirtPos = newVirtPos;
if (newPosition)
*newPosition = newVirtPos;
return S_OK;
}
#endif
UInt64 realNewPosition;
bool result = File.Seek(offset, seekOrigin, realNewPosition);
#ifdef SUPPORT_DEVICE_FILE
PhyPos = VirtPos = realNewPosition;
#endif
if (newPosition != NULL)
*newPosition = realNewPosition;
return ConvertBoolToHRESULT(result);
#else
off_t res = File.Seek(offset, seekOrigin);
if (res == -1)
return E_FAIL;
if (newPosition != NULL)
*newPosition = (UInt64)res;
return S_OK;
#endif
}
STDMETHODIMP CInFileStream::GetSize(UInt64 *size)
{
return ConvertBoolToHRESULT(File.GetLength(*size));
}
//////////////////////////
// COutFileStream
HRESULT COutFileStream::Close()
{
return ConvertBoolToHRESULT(File.Close());
}
STDMETHODIMP COutFileStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
{
#ifdef USE_WIN_FILE
UInt32 realProcessedSize;
bool result = File.WritePart(data, size, realProcessedSize);
ProcessedSize += realProcessedSize;
if (processedSize != NULL)
*processedSize = realProcessedSize;
return ConvertBoolToHRESULT(result);
#else
if (processedSize != NULL)
*processedSize = 0;
long res = File.Write(data, (size_t)size);
if (res == -1)
return E_FAIL;
if (processedSize != NULL)
*processedSize = (UInt32)res;
ProcessedSize += res;
return S_OK;
#endif
}
STDMETHODIMP COutFileStream::Seek(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition)
{
if (seekOrigin >= 3)
return STG_E_INVALIDFUNCTION;
#ifdef USE_WIN_FILE
UInt64 realNewPosition;
bool result = File.Seek(offset, seekOrigin, realNewPosition);
if (newPosition != NULL)
*newPosition = realNewPosition;
return ConvertBoolToHRESULT(result);
#else
off_t res = File.Seek(offset, seekOrigin);
if (res == -1)
return E_FAIL;
if (newPosition != NULL)
*newPosition = (UInt64)res;
return S_OK;
#endif
}
STDMETHODIMP COutFileStream::SetSize(UInt64 newSize)
{
#ifdef USE_WIN_FILE
UInt64 currentPos;
if (!File.Seek(0, FILE_CURRENT, currentPos))
return E_FAIL;
bool result = File.SetLength(newSize);
UInt64 currentPos2;
result = result && File.Seek(currentPos, currentPos2);
return result ? S_OK : E_FAIL;
#else
return E_FAIL;
#endif
}
#ifdef UNDER_CE
STDMETHODIMP CStdOutFileStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
{
size_t s2 = fwrite(data, 1, size, stdout);
if (processedSize != 0)
*processedSize = s2;
return (s2 = size) ? S_OK : E_FAIL;
}
#else
STDMETHODIMP CStdOutFileStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
{
if (processedSize != NULL)
*processedSize = 0;
#ifdef _MY_WIN32
UInt32 realProcessedSize;
BOOL res = TRUE;
if (size > 0)
{
// Seems that Windows doesn't like big amounts writing to stdout.
// So we limit portions by 32KB.
UInt32 sizeTemp = (1 << 15);
if (sizeTemp > size)
sizeTemp = size;
res = ::WriteFile(GetStdHandle(STD_OUTPUT_HANDLE),
data, sizeTemp, (DWORD *)&realProcessedSize, NULL);
size -= realProcessedSize;
data = (const void *)((const Byte *)data + realProcessedSize);
if (processedSize != NULL)
*processedSize += realProcessedSize;
}
return ConvertBoolToHRESULT(res != FALSE);
#else
long res;
do
{
res = write(1, (char *)data, (size_t)size);
}
while (res < 0 && (errno == EINTR));
if (res == -1)
return E_FAIL;
if (processedSize != NULL)
*processedSize = (UInt32)res;
return S_OK;
return S_OK;
#endif
}
#endif
| [
"[email protected]"
]
| [
[
[
1,
426
]
]
]
|
62f87f44586e012ef8c170ffe1ea742039c0051b | 880e5a47c23523c8e5ba1602144ea1c48c8c8f9a | /CommonLibSrc/SmartPointers/CDeleteArrayPolicy.hpp | b95d4051de97af004bf3406c91df3dd4670d7291 | []
| no_license | kfazi/Engine | 050cb76826d5bb55595ecdce39df8ffb2d5547f8 | 0cedfb3e1a9a80fd49679142be33e17186322290 | refs/heads/master | 2020-05-20T10:02:29.050190 | 2010-02-11T17:45:42 | 2010-02-11T17:45:42 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 335 | hpp | #ifndef COMMON_DELETE_ARRAY_POLICY_HPP
#define COMMON_DELETE_ARRAY_POLICY_HPP
#include "../Internal.hpp"
namespace Common
{
class CDeleteArrayPolicy
{
public:
template<typename tType> static void Delete(tType *pData)
{
delete [] pData;
}
};
}
#endif /* COMMON_DELETE_ARRAY_POLICY_HPP */
/* EOF */
| [
"[email protected]"
]
| [
[
[
1,
22
]
]
]
|
00e0aca74efc6850b6ff8b06fa236926d8c4366a | b73f27ba54ad98fa4314a79f2afbaee638cf13f0 | /projects/MainUI/DlgSearchRule.cpp | 2abd343d8810c3645d07794bf46a87ce3d1d159e | []
| no_license | weimingtom/httpcontentparser | 4d5ed678f2b38812e05328b01bc6b0c161690991 | 54554f163b16a7c56e8350a148b1bd29461300a0 | refs/heads/master | 2021-01-09T21:58:30.326476 | 2009-09-23T08:05:31 | 2009-09-23T08:05:31 | 48,733,304 | 3 | 0 | null | null | null | null | GB18030 | C++ | false | false | 5,540 | cpp | // DlgSearchRule.cpp : 实现文件
//
#include "stdafx.h"
#include "MainUI.h"
#include "DlgSearchRule.h"
#include "globalvariable.h"
#include ".\dlgsearchrule.h"
#include <com\comutility.h>
#include <typeconvert.h>
#include <logger\logger.h>
// CDlgSearchRule 对话框
IMPLEMENT_DYNAMIC(CDlgSearchRule, CDialog)
CDlgSearchRule::CDlgSearchRule(CWnd* pParent /*=NULL*/)
: CBaseDlg(CDlgSearchRule::IDD, pParent)
, rules(this, this)
, m_bEnableSearchRule(TRUE)
, m_bChkGoogle(FALSE)
, m_bChkYahoo(FALSE)
, m_bChkBaidu(FALSE)
{
auther_name_ = ANOTHER_BSL;
}
CDlgSearchRule::~CDlgSearchRule()
{
}
std::string CDlgSearchRule::getHelpLink() const {
return "";
}
INT_PTR CDlgSearchRule::OnApply() {
rules.Apply();
UpdateData();
try {
AutoInitInScale _auto_com_init;
ISearchRule *seach_rule;
HRESULT hr = CoCreateInstance(CLSID_SearchRule, NULL, CLSCTX_LOCAL_SERVER, IID_ISearchRule, (LPVOID*)&seach_rule);
if (FAILED(hr)) {
__LERR__("Create SearchRule failed with HRESULT value "<<std::hex<<hr);
AfxMessageBox(IDS_COM_ERRO_COCREATE_FIALED, MB_OK | MB_ICONERROR);
return -1;
}
seach_rule->enableCheckSeachEngine(_bstr_t("google"), convert(m_bChkGoogle));
seach_rule->enableCheckSeachEngine(_bstr_t("yahoo"), convert(m_bChkYahoo));
seach_rule->enableCheckSeachEngine(_bstr_t("baidu"), convert(m_bChkBaidu));
SafeRelease(seach_rule);
return 0;
} catch (_com_error & e) {
__LERR__("CATCH(_com_error) with Description : "<< (const TCHAR*)e.Description());
AfxMessageBox(IDS_COM_ERRO_COCREATE_FIALED, MB_OK | MB_ICONERROR);
return -1;
}
}
void CDlgSearchRule::OnShow() {
ListBox.SetFocus();
ListBox.ShowWindow(SW_SHOW);
ListBox.UpdateWindow();
}
void CDlgSearchRule::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_SEARCH_LIST, ListBox);
DDX_Control(pDX, IDC_CHK_ENABLE_SEARCH, m_chkEnableSearchChk);
DDX_Check(pDX, IDC_CHK_ENABLE_SEARCH, m_bEnableSearchRule);
DDX_Check(pDX, IDC_CHK_GOOGLE, m_bChkGoogle);
DDX_Check(pDX, IDC_CHK_YAHOO, m_bChkYahoo);
DDX_Check(pDX, IDC_CHK_BAIDU, m_bChkBaidu);
}
void CDlgSearchRule::restoreSetting() {
rules.Reset();
ListBox.GetListCtrl()->DeleteAllItems();
try {
AutoInitInScale _auto_com_init;
ISearchRule *seach_rule;
HRESULT hr = CoCreateInstance(CLSID_SearchRule, NULL, CLSCTX_LOCAL_SERVER, IID_ISearchRule, (LPVOID*)&seach_rule);
if (FAILED(hr)) {
__LERR__("Create SearchRule failed with HRESULT vlaue "<<std::hex<<hr);
throw INT_PTR(SNOWMAN_ERROR_COM_INIT_FAILED);
}
BSTR cur, next;
seach_rule->getFirstSearchWord(&cur);
while (_bstr_t(cur).length() != 0) {
ListBox.AddItem((TCHAR*)_bstr_t(cur));
seach_rule->getNextSearchWord(cur, &next);
SysFreeString(cur);
cur = next;
}
VARIANT_BOOL isEnabled;
seach_rule->isSettingEnabled(_bstr_t(TEXT("google")), &isEnabled);
m_bChkGoogle = convert(isEnabled);
seach_rule->isSettingEnabled(_bstr_t(TEXT("yahoo")), &isEnabled);
m_bChkYahoo = convert(isEnabled);
seach_rule->isSettingEnabled(_bstr_t(TEXT("baidu")), &isEnabled);
m_bChkBaidu = convert(isEnabled);
UpdateData(FALSE);
} catch (...) {
__LERR__( "CATCH(...)");
throw INT_PTR(SNOWMAN_ERROR_COM_INIT_FAILED);
}
}
void CDlgSearchRule::OnAddItem(const CString &str) {
try {
AutoInitInScale _auto_com_init;
ISearchRule *seach_rule;
HRESULT hr = CoCreateInstance(CLSID_SearchRule, NULL, CLSCTX_LOCAL_SERVER, IID_ISearchRule, (LPVOID*)&seach_rule);
if (FAILED(hr)) {
__LERR__("Create searchRule faied with HRESULT value "<<std::hex<<hr);
AfxMessageBox(IDS_COM_ERRO_COCREATE_FIALED, MB_OK | MB_ICONERROR);
return;
}
seach_rule->addBlackSeachword(_bstr_t(str));
SafeRelease(seach_rule);
// 修改界面
SetModify(TRUE);
} catch(...) {
__LERR__("CATCH(...)");
}
}
void CDlgSearchRule::OnDelItem(const CString &str) {
try {
AutoInitInScale _auto_com_init;
ISearchRule *seach_rule;
HRESULT hr = CoCreateInstance(CLSID_SearchRule, NULL, CLSCTX_LOCAL_SERVER, IID_ISearchRule, (LPVOID*)&seach_rule);
if (FAILED(hr)) {
__LERR__("Create searchRule failed with HRESULT value "<<std::hex<<hr);
return;
}
seach_rule->removeBlackSeachWord(_bstr_t(str));
SafeRelease(seach_rule);
// 修改界面
SetModify(TRUE);
} catch (...) {
__LERR__("CATCH(...)");
}
}
bool CDlgSearchRule::ValidateItem(const CString & str, CString &output) {
output = str;
return true;
}
BEGIN_MESSAGE_MAP(CDlgSearchRule, CDialog)
ON_BN_CLICKED(IDC_CHK_ENABLE_SEARCH, OnBnClickedChkEnableSearch)
ON_BN_CLICKED(IDC_CHK_GOOGLE, OnBnClickedChkGoogle)
ON_BN_CLICKED(IDC_CHK_YAHOO, OnBnClickedChkYahoo)
ON_BN_CLICKED(IDC_CHK_BAIDU, OnBnClickedChkBaidu)
ON_WM_CTLCOLOR()
END_MESSAGE_MAP()
// CDlgSearchRule 消息处理程序
BOOL CDlgSearchRule::OnInitDialog()
{
CBaseDlg::OnInitDialog();
ListBox.setOnTextChanged(&rules);
Restore();
return TRUE; // return TRUE unless you set the focus to a control
}
void CDlgSearchRule::OnBnClickedChkEnableSearch()
{
SetModify(TRUE);
}
void CDlgSearchRule::OnBnClickedChkGoogle()
{
SetModify(TRUE);
}
void CDlgSearchRule::OnBnClickedChkYahoo()
{
SetModify(TRUE);
}
void CDlgSearchRule::OnBnClickedChkBaidu()
{
SetModify(TRUE);
}
HBRUSH CDlgSearchRule::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
return CBaseDlg::OnCtlColor(pDC, pWnd, nCtlColor);
}
| [
"ynkhpp@1a8edc88-4151-0410-b40c-1915dda2b29b",
"[email protected]"
]
| [
[
[
1,
7
],
[
12,
16
],
[
23,
23
],
[
25,
30
],
[
60,
73
],
[
78,
79
],
[
118,
118
],
[
163,
163
],
[
169,
172
]
],
[
[
8,
11
],
[
17,
22
],
[
24,
24
],
[
31,
59
],
[
74,
77
],
[
80,
117
],
[
119,
162
],
[
164,
168
],
[
173,
207
]
]
]
|
c7bba4b4ad7ee7b4ed7d086a9a6b92d8c3bde124 | c5534a6df16a89e0ae8f53bcd49a6417e8d44409 | /trunk/Dependencies/Xerces/include/xercesc/framework/XMLAttDef.hpp | 79c8432a9eceb832fba4303825d36d7512142354 | []
| no_license | svn2github/ngene | b2cddacf7ec035aa681d5b8989feab3383dac012 | 61850134a354816161859fe86c2907c8e73dc113 | refs/heads/master | 2023-09-03T12:34:18.944872 | 2011-07-27T19:26:04 | 2011-07-27T19:26:04 | 78,163,390 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 20,102 | hpp | /*
* Copyright 1999-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* $Id: XMLAttDef.hpp 191054 2005-06-17 02:56:35Z jberry $
*/
#if !defined(ATTDEF_HPP)
#define ATTDEF_HPP
#include <xercesc/util/PlatformUtils.hpp>
#include <xercesc/util/XMLString.hpp>
#include <xercesc/util/XMemory.hpp>
#include <xercesc/internal/XSerializable.hpp>
XERCES_CPP_NAMESPACE_BEGIN
class XMLAttr;
/** Represents the core information of an atribute definition
*
* This class defines the basic characteristics of an attribute, no matter
* what type of validator is used. If a particular schema associates more
* information with an attribute it will create a derivative of this class.
* So this class provides an abstract way to get basic information on
* attributes from any type of validator.
*
* This class supports keyed collection semantics on the fully qualified
* attribute name, by providing a getKey() method to extract the key string.
* getKey(), in this case, just calls the virtual method getFullName() to
* get the fully qualified name, as defined by the derived class.
*
* Note that the 'value' of an attribute type definition is the default or
* of fixed value given to it in its definition. If the attribute is of the
* enumerated or notation type, it will have an 'enumeration value' as well
* which is a space separated list of its possible vlaues.
*/
class XMLPARSER_EXPORT XMLAttDef : public XSerializable, public XMemory
{
public:
// -----------------------------------------------------------------------
// Class specific types
//
// AttTypes
// The list of possible types that an attribute can have, according
// to the XML 1.0 spec and schema.
//
// DefAttTypes
// The modifiers that an attribute decl can have, which indicates
// whether instances of that attributes are required, implied, etc..
//
// CreateReasons
// This type is used to store how an attribute declaration got into
// the elementdecl's attribute pool.
//
// -----------------------------------------------------------------------
enum AttTypes
{
CData = 0
, ID = 1
, IDRef = 2
, IDRefs = 3
, Entity = 4
, Entities = 5
, NmToken = 6
, NmTokens = 7
, Notation = 8
, Enumeration = 9
, Simple = 10
, Any_Any = 11
, Any_Other = 12
, Any_List = 13
, AttTypes_Count
, AttTypes_Min = 0
, AttTypes_Max = 13
, AttTypes_Unknown = -1
};
enum DefAttTypes
{
Default = 0
, Fixed = 1
, Required = 2
, Required_And_Fixed = 3
, Implied = 4
, ProcessContents_Skip = 5
, ProcessContents_Lax = 6
, ProcessContents_Strict = 7
, Prohibited = 8
, DefAttTypes_Count
, DefAttTypes_Min = 0
, DefAttTypes_Max = 8
, DefAttTypes_Unknown = -1
};
enum CreateReasons
{
NoReason
, JustFaultIn
};
// -----------------------------------------------------------------------
// Public static data members
// -----------------------------------------------------------------------
static const unsigned int fgInvalidAttrId;
// -----------------------------------------------------------------------
// Public, static methods
// -----------------------------------------------------------------------
/** @name Public, static methods */
//@{
/** Get a string representation of the passed attribute type enum
*
* This method allows you to get a textual representation of an attriubte
* type, mostly for debug or display.
*
* @param attrType The attribute type value to get the string for.
* @param manager The MemoryManager to use to allocate objects
* @return A const pointer to the static string that holds the text
* description of the passed type.
*/
static const XMLCh* getAttTypeString(const AttTypes attrType
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
/** Get a string representation of the passed def attribute type enum
*
* This method allows you to get a textual representation of an default
* attributetype, mostly for debug or display.
*
* @param attrType The default attribute type value to get the string for.
* @param manager The MemoryManager to use to allocate objects
* @return A const pointer to the static string that holds the text
* description of the passed default type.
*/
static const XMLCh* getDefAttTypeString(const DefAttTypes attrType
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
//@}
// -----------------------------------------------------------------------
// Destructor
// -----------------------------------------------------------------------
/** @name Destructor */
//@{
/**
* Destructor
*/
virtual ~XMLAttDef();
//@}
// -----------------------------------------------------------------------
// The virtual attribute def interface
// -----------------------------------------------------------------------
/** @name Virtual interface */
//@{
/** Get the full name of this attribute type
*
* The derived class should return a const pointer to the full name of
* this attribute. This will vary depending on the type of validator in
* use.
*
* @return A const pointer to the full name of this attribute type.
*/
virtual const XMLCh* getFullName() const = 0;
/**
* The derived class should implement any cleaning up required between
* each use of an instance of this class for validation
*/
virtual void reset() = 0;
//@}
// -----------------------------------------------------------------------
// Getter methods
// -----------------------------------------------------------------------
/** @name Getter methods */
//@{
/** Get the default type of this attribute type
*
* This method returns the 'default type' of the attribute. Default
* type in this case refers to the XML concept of a default type for
* an attribute, i.e. #FIXED, #IMPLIED, etc...
*
* @return The default type enum for this attribute type.
*/
DefAttTypes getDefaultType() const;
/** Get the enumeration value (if any) of this attribute type
*
* If the attribute is of an enumeration or notatin type, then this
* method will return a const reference to a string that contains the
* space separated values that can the attribute can have.
*
* @return A const pointer to a string that contains the space separated
* legal values for this attribute.
*/
const XMLCh* getEnumeration() const;
/** Get the pool id of this attribute type
*
* This method will return the id of this attribute in the validator's
* attribute pool. It was set by the validator when this attribute was
* created.
*
* @return The pool id of this attribute type.
*/
unsigned int getId() const;
/** Query whether the attribute was explicitly provided.
*
* When the scanner scans a start tag, it will ask the element decl
* object of the element type of that start tag to clear the 'provided'
* flag on all its attributes. As the scanner sees explicitly provided
* attributes, its turns on this flag to indicate that this attribute
* has been provided. In this way, the scanner can catch duplicated
* attributes and required attributes that aren't provided, and default
* in fixed/default valued attributes that are not explicitly provided.
*
* @return Returns a boolean value that indicates whether this attribute
* was explicitly provided.
* @deprecated
*/
bool getProvided() const;
/** Get the type of this attribute
*
* Gets the type of this attribute. This type is represented by an enum
* that convers the types of attributes allowed by XML, e.g. CDATA, NMTOKEN,
* NOTATION, etc...
*
* @return The attribute type enumeration value for this type of
* attribute.
*/
AttTypes getType() const;
/** Get the default/fixed value of this attribute (if any.)
*
* If the attribute defined a default/fixed value, then it is stored
* and this method will retrieve it. If it has non, then a null pointer
* is returned.
*
* @return A const pointer to the default/fixed value for this attribute
* type.
*/
const XMLCh* getValue() const;
/** Get the create reason for this attribute
*
* This method returns an enumeration which indicates why this attribute
* declaration exists.
*
* @return An enumerated value that indicates the reason why this attribute
* was added to the attribute table.
*/
CreateReasons getCreateReason() const;
/** Indicate whether this attribute has been declared externally
*
* This method returns a boolean that indicates whether this attribute
* has been declared externally.
*
* @return true if this attribute has been declared externally, else false.
*/
bool isExternal() const;
/** Get the plugged-in memory manager
*
* This method returns the plugged-in memory manager user for dynamic
* memory allocation/deallocation.
*
* @return the plugged-in memory manager
*/
MemoryManager* getMemoryManager() const;
/**
* @return the uri part of DOM Level 3 TypeInfo
* @deprecated
*/
virtual const XMLCh* getDOMTypeInfoUri() const = 0;
/**
* @return the name part of DOM Level 3 TypeInfo
* @deprecated
*/
virtual const XMLCh* getDOMTypeInfoName() const = 0;
//@}
// -----------------------------------------------------------------------
// Setter methods
// -----------------------------------------------------------------------
/** @name Setter methods */
//@{
/** Set the default attribute type
*
* This method sets the default attribute type for this attribute.
* This setting controls whether the attribute is required, fixed,
* implied, etc...
*
* @param newValue The new default attribute to set
*/
void setDefaultType(const XMLAttDef::DefAttTypes newValue);
/** Set the pool id for this attribute type.
*
* This method sets the pool id of this attribute type. This is usually
* called by the validator that creates the actual instance (which is of
* a derived type known only by the validator.)
*
* @param newId The new pool id to set.
*/
void setId(const unsigned int newId);
/** Set or clear the 'provided' flag.
*
* This method will set or clear the 'provided' flag. This is called
* by the scanner as it is scanning a start tag and marking off the
* attributes that have been explicitly provided.
*
* @param newValue The new provided state to set
* @deprecated
*/
void setProvided(const bool newValue);
/** Set the type of this attribute type.
*
* This method will set the type of the attribute. The type of an attribute
* controls how it is normalized and what kinds of characters it can hold.
*
* @param newValue The new attribute type to set
*/
void setType(const XMLAttDef::AttTypes newValue);
/** Set the default/fixed value of this attribute type.
*
* This method set the fixed/default value for the attribute. This value
* will be used when instances of this attribute type are faulted in. It
* <b>must</b> be a valid value for the type set by setType(). If the
* type is enumeration or notation, this must be one of the valid values
* set in the setEnumeration() call.
*
* @param newValue The new fixed/default value to set.
*/
void setValue(const XMLCh* const newValue);
/** Set the enumerated value of this attribute type.
*
* This method sets the enumerated/notation value list for this attribute
* type. It is a space separated set of possible values. These values must
* meet the constrains of the XML spec for such values of this type of
* attribute. This should only be set if the setType() method is used to
* set the type to the enumeration or notation types.
*
* @param newValue The new enumerated/notation value list to set.
*/
void setEnumeration(const XMLCh* const newValue);
/** Update the create reason for this attribute type.
*
* This method will update the 'create reason' field for this attribute
* decl object.
*
* @param newReason The new create reason.
*/
void setCreateReason(const CreateReasons newReason);
/**
* Set the attribute decl to indicate external declaration
*
* @param aValue The new value to indicate external declaration.
*/
void setExternalAttDeclaration(const bool aValue);
//@}
/***
* Support for Serialization/De-serialization
***/
DECL_XSERIALIZABLE(XMLAttDef)
protected :
// -----------------------------------------------------------------------
// Hidden constructors
// -----------------------------------------------------------------------
XMLAttDef
(
const AttTypes type = CData
, const DefAttTypes defType= Implied
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
);
XMLAttDef
(
const XMLCh* const attValue
, const AttTypes type
, const DefAttTypes defType
, const XMLCh* const enumValues = 0
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
);
private :
// -----------------------------------------------------------------------
// Unimplemented constructors and operators
// -----------------------------------------------------------------------
XMLAttDef(const XMLAttDef&);
XMLAttDef& operator=(const XMLAttDef&);
// -----------------------------------------------------------------------
// Private helper methods
// -----------------------------------------------------------------------
void cleanUp();
// -----------------------------------------------------------------------
// Private data members
//
// fDefaultType
// Indicates what, if any, default stuff this attribute has.
//
// fEnumeration
// If its an enumeration, this is the list of values as space
// separated values.
//
// fId
// This is the unique id of this attribute, given to it when its put
// into the validator's attribute decl pool. It defaults to the
// special value XMLAttrDef::fgInvalidAttrId.
//
// fProvided
// This field is really for use by the scanner. It is used to track
// which of the attributes of an element were provided. Any marked
// as not provided (after scanning the start tag) and having a
// default type of Required, is in error.
//
// fType
// The type of attribute, which is one of the AttTypes values.
//
// fValue
// This is the value of the attribute, which is the default value
// given in the attribute declaration.
//
// fCreateReason
// This flag tells us how this attribute got created. Sometimes even
// the attribute was not declared for the element, we want to fault
// fault it into the pool to avoid lots of redundant errors.
//
// fExternalAttribute
// This flag indicates whether or not the attribute was declared externally.
// -----------------------------------------------------------------------
DefAttTypes fDefaultType;
AttTypes fType;
CreateReasons fCreateReason;
bool fProvided;
bool fExternalAttribute;
unsigned int fId;
XMLCh* fValue;
XMLCh* fEnumeration;
MemoryManager* fMemoryManager;
};
// ---------------------------------------------------------------------------
// Getter methods
// ---------------------------------------------------------------------------
inline XMLAttDef::DefAttTypes XMLAttDef::getDefaultType() const
{
return fDefaultType;
}
inline const XMLCh* XMLAttDef::getEnumeration() const
{
return fEnumeration;
}
inline unsigned int XMLAttDef::getId() const
{
return fId;
}
inline bool XMLAttDef::getProvided() const
{
return fProvided;
}
inline XMLAttDef::AttTypes XMLAttDef::getType() const
{
return fType;
}
inline const XMLCh* XMLAttDef::getValue() const
{
return fValue;
}
inline XMLAttDef::CreateReasons XMLAttDef::getCreateReason() const
{
return fCreateReason;
}
inline bool XMLAttDef::isExternal() const
{
return fExternalAttribute;
}
inline MemoryManager* XMLAttDef::getMemoryManager() const
{
return fMemoryManager;
}
// ---------------------------------------------------------------------------
// XMLAttDef: Setter methods
// ---------------------------------------------------------------------------
inline void XMLAttDef::setDefaultType(const XMLAttDef::DefAttTypes newValue)
{
fDefaultType = newValue;
}
inline void XMLAttDef::setEnumeration(const XMLCh* const newValue)
{
if (fEnumeration)
fMemoryManager->deallocate(fEnumeration);
fEnumeration = XMLString::replicate(newValue, fMemoryManager);
}
inline void XMLAttDef::setId(const unsigned int newId)
{
fId = newId;
}
inline void XMLAttDef::setProvided(const bool newValue)
{
fProvided = newValue;
}
inline void XMLAttDef::setType(const XMLAttDef::AttTypes newValue)
{
fType = newValue;
}
inline void XMLAttDef::setValue(const XMLCh* const newValue)
{
if (fValue)
fMemoryManager->deallocate(fValue);
fValue = XMLString::replicate(newValue, fMemoryManager);
}
inline void
XMLAttDef::setCreateReason(const XMLAttDef::CreateReasons newReason)
{
fCreateReason = newReason;
}
inline void XMLAttDef::setExternalAttDeclaration(const bool aValue)
{
fExternalAttribute = aValue;
}
XERCES_CPP_NAMESPACE_END
#endif
| [
"Riddlemaster@fdc6060e-f348-4335-9a41-9933a8eecd57"
]
| [
[
[
1,
595
]
]
]
|
fa0d61e94c7f4a94140a3653794945150de14848 | 1193b8d2ab6bb40ce2adbf9ada5b3d1124f1abb3 | /branches/mapmodule/libsonetto/include/SonettoSavemap.h | 53f66eba99a28c00ae0e1339a8aae380fae9bbd8 | []
| no_license | sonetto/legacy | 46bb60ef8641af618d22c08ea198195fd597240b | e94a91950c309fc03f9f52e6bc3293007c3a0bd1 | refs/heads/master | 2021-01-01T16:45:02.531831 | 2009-09-10T21:50:42 | 2009-09-10T21:50:42 | 32,183,635 | 0 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 2,009 | h | /*-----------------------------------------------------------------------------
Copyright (c) 2009, Sonetto Project Developers
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the Sonetto Project nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-----------------------------------------------------------------------------*/
#ifndef SONETTO_SAVEMAP_H
#define SONETTO_SAVEMAP_H
#include "SonettoVariable.h"
namespace Sonetto
{
class Savemap
{
public:
Savemap() {}
~Savemap() {}
void load(const char *fname);
VariableMap variables;
};
} // namespace
#endif
| [
"[email protected]"
]
| [
[
[
1,
49
]
]
]
|
2f7744dd05cdb883ad97078d73cc8b9e4ba6ef1c | 11af1673bab82ca2329ef8b596d1f3d2f8b82481 | /source/game/sqlite3/Database.cpp | c42cf6df66482ca5c9b99fdaf1b96a75f13a75e9 | []
| no_license | legacyrp/legacyojp | 8b33ecf24fd973bee5e7adbd369748cfdd891202 | d918151e917ea06e8698f423bbe2cf6ab9d7f180 | refs/heads/master | 2021-01-10T20:09:55.748893 | 2011-04-18T21:07:13 | 2011-04-18T21:07:13 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,080 | cpp | /*
** Database.cpp
**
** Published / author: 2005-08-12 / [email protected]
**/
/*
Copyright (C) 2001-2006 Anders Hedstrom
This program is made available under the terms of the GNU GPL.
If you would like to use this program in a closed-source application,
a separate license agreement is available. For information about
the closed-source license agreement for this program, please
visit http://www.alhem.net/sqlwrapped/license.html and/or
email [email protected].
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdio.h>
#ifdef _WIN32
#pragma warning(disable:4786)
#endif
#include <string>
#include <map>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "sqlite3.h"
#include <stdarg.h>
#include "libsqlitewrapped.h"
#ifdef SQLITEW_NAMESPACE
namespace SQLITEW_NAMESPACE {
#endif
Database::Database(const std::string& d,IError *e)
:database(d)
,m_errhandler(e)
,m_embedded(true)
,m_mutex(m_mutex)
,m_b_use_mutex(false)
{
}
Database::Database(Mutex& m,const std::string& d,IError *e)
:database(d)
,m_errhandler(e)
,m_embedded(true)
,m_mutex(m)
,m_b_use_mutex(true)
{
}
Database::~Database()
{
for (opendb_v::iterator it = m_opendbs.begin(); it != m_opendbs.end(); it++)
{
OPENDB *p = *it;
sqlite3_close(p -> db);
}
while (m_opendbs.size())
{
opendb_v::iterator it = m_opendbs.begin();
OPENDB *p = *it;
if (p -> busy)
{
error("destroying Database object before Query object");
}
delete p;
m_opendbs.erase(it);
}
}
void Database::RegErrHandler(IError *p)
{
m_errhandler = p;
}
Database::OPENDB *Database::grabdb()
{
Lock lck(m_mutex, m_b_use_mutex);
OPENDB *odb = NULL;
for (opendb_v::iterator it = m_opendbs.begin(); it != m_opendbs.end(); it++)
{
odb = *it;
if (!odb -> busy)
{
break;
}
else
{
odb = NULL;
}
}
if (!odb)
{
odb = new OPENDB;
if (!odb)
{
error("grabdb: OPENDB struct couldn't be created");
return NULL;
}
int rc = sqlite3_open(database.c_str(), &odb -> db);
if (rc)
{
error("Can't open database: %s\n", sqlite3_errmsg(odb -> db));
sqlite3_close(odb -> db);
delete odb;
return NULL;
}
odb -> busy = true;
m_opendbs.push_back(odb);
}
else
{
odb -> busy = true;
}
return odb;
}
void Database::freedb(Database::OPENDB *odb)
{
Lock lck(m_mutex, m_b_use_mutex);
if (odb)
{
odb -> busy = false;
}
}
void Database::error(const char *format, ...)
{
if (m_errhandler)
{
va_list ap;
char errstr[5000];
va_start(ap, format);
#ifdef WIN32
vsprintf(errstr, format, ap);
#else
vsnprintf(errstr, 5000, format, ap);
#endif
va_end(ap);
m_errhandler -> error(*this, errstr);
}
}
void Database::error(Query& q,const char *format, ...)
{
if (m_errhandler)
{
va_list ap;
char errstr[5000];
va_start(ap, format);
#ifdef WIN32
vsprintf(errstr, format, ap);
#else
vsnprintf(errstr, 5000, format, ap);
#endif
va_end(ap);
m_errhandler -> error(*this, q, errstr);
}
}
void Database::error(Query& q,const std::string& msg)
{
if (m_errhandler)
{
m_errhandler -> error(*this, q, msg);
}
}
bool Database::Connected()
{
OPENDB *odb = grabdb();
if (!odb)
{
return false;
}
freedb(odb);
return true;
}
Database::Lock::Lock(Mutex& mutex,bool use) : m_mutex(mutex),m_b_use(use)
{
if (m_b_use)
{
m_mutex.Lock();
}
}
Database::Lock::~Lock()
{
if (m_b_use)
{
m_mutex.Unlock();
}
}
Database::Mutex::Mutex()
{
#ifdef _WIN32
m_mutex = ::CreateMutex(NULL, FALSE, NULL);
#else
pthread_mutex_init(&m_mutex, NULL);
#endif
}
Database::Mutex::~Mutex()
{
#ifdef _WIN32
::CloseHandle(m_mutex);
#else
pthread_mutex_destroy(&m_mutex);
#endif
}
void Database::Mutex::Lock()
{
#ifdef _WIN32
DWORD d = WaitForSingleObject(m_mutex, INFINITE);
// %! check 'd' for result
#else
pthread_mutex_lock(&m_mutex);
#endif
}
void Database::Mutex::Unlock()
{
#ifdef _WIN32
::ReleaseMutex(m_mutex);
#else
pthread_mutex_unlock(&m_mutex);
#endif
}
std::string Database::safestr(const std::string& str)
{
std::string str2;
for (size_t i = 0; i < str.size(); i++)
{
switch (str[i])
{
case '\'':
case '\\':
case 34:
str2 += '\'';
default:
str2 += str[i];
}
}
return str2;
}
std::string Database::xmlsafestr(const std::string& str)
{
std::string str2;
for (size_t i = 0; i < str.size(); i++)
{
switch (str[i])
{
case '&':
str2 += "&";
break;
case '<':
str2 += "<";
break;
case '>':
str2 += ">";
break;
case '"':
str2 += """;
break;
case '\'':
str2 += "'";
break;
default:
str2 += str[i];
}
}
return str2;
}
int64_t Database::a2bigint(const std::string& str)
{
int64_t val = 0;
bool sign = false;
size_t i = 0;
if (str[i] == '-')
{
sign = true;
i++;
}
for (; i < str.size(); i++)
{
val = val * 10 + (str[i] - 48);
}
return sign ? -val : val;
}
uint64_t Database::a2ubigint(const std::string& str)
{
uint64_t val = 0;
for (size_t i = 0; i < str.size(); i++)
{
val = val * 10 + (str[i] - 48);
}
return val;
}
#ifdef SQLITEW_NAMESPACE
} // namespace SQLITEW_NAMESPACE {
#endif
| [
"[email protected]@5776d9f2-9662-11de-ad41-3fcdc5e0e42d"
]
| [
[
[
1,
351
]
]
]
|
3a34089323228f0a8de1868910c3eec137c9e786 | 7f6f9788d020e97f729af85df4f6741260274bee | /test/gui_test/DockTest.cpp | 34eafedf3c40d248cdc2311e6c0c56f15f6292d8 | []
| no_license | cnsuhao/nyanco | 0fb88ed1cf2aa9390fa62f6723e8424ba9a42ed4 | ba199267a33d4c6d2e473ed4b777765057aaf844 | refs/heads/master | 2021-05-31T05:37:51.892873 | 2008-05-27T05:23:19 | 2008-05-27T05:23:19 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,989 | cpp | /*!
@file DockTest.cpp
@author dasyprocta
*/
#include "nyanco.h"
#include "gui/gui.h"
using namespace nyanco;
using namespace nyanco::gui;
// ============================================================================
class MyFrame : public Frame<MyFrame>
{
enum
{
DockLeftButtonId,
DockRightButtonId,
DockBottomButtonId,
DockTopButtonId,
CreateButtonId,
};
public:
MyFrame()
{
SplitPanel<2>::Ptr splitPanel = SplitPanel<2>::Create(-1);
splitPanel->get<0>()->attach(Button::Create(DockLeftButtonId, "Dock Left"));
splitPanel->get<0>()->attach(Button::Create(DockTopButtonId, "Dock Top"));
splitPanel->get<1>()->attach(Button::Create(DockRightButtonId, "Dock Right"));
splitPanel->get<1>()->attach(Button::Create(DockBottomButtonId, "Dock Bottom"));
attach(splitPanel);
attach(Button::Create(CreateButtonId, "Create"));
registerHandler(DockLeftButtonId, &MyFrame::onPushButton);
registerHandler(DockRightButtonId, &MyFrame::onPushButton);
registerHandler(DockTopButtonId, &MyFrame::onPushButton);
registerHandler(DockBottomButtonId, &MyFrame::onPushButton);
registerHandler(CreateButtonId, &MyFrame::onPushCreate);
}
void onPushButton(Event<Button> const& e)
{
WindowManager& manager = WindowManager::GetInterface();
Frame<>::Ptr this_ = boost::shared_static_cast< Frame<> >(shared_from_this());
if (this_->isDocked()) manager.undock(this_);
else
{
switch (e.getSenderId())
{
case DockLeftButtonId:
manager.dock(this_, Dock::Left);
break;
case DockRightButtonId:
manager.dock(this_, Dock::Right);
break;
case DockBottomButtonId:
manager.dock(this_, Dock::Bottom);
break;
case DockTopButtonId:
manager.dock(this_, Dock::Top);
break;
}
}
}
void onPushCreate(Event<Button> const& e)
{
WindowManager& manager = WindowManager::GetInterface();
manager.attach(MyFrame::Create(-1, Frame<>::Arg().caption("Test Dock").width(480)));
}
};
// ============================================================================
class MyApplication : public Application
{
void onInitialize()
{
WindowManager& manager = WindowManager::GetInterface();
Dock::Ptr dock = manager.dock(MyFrame::Create(-1, Frame<>::Arg().caption("Test Dock").width(280)), Dock::Left);
manager.dock(MyFrame::Create(-1, Frame<>::Arg().caption("Inner Dock").width(350)), Dock::Bottom, dock);
manager.dock(MyFrame::Create(-1, Frame<>::Arg().caption("Bottom Dock").width(240)), Dock::Bottom);
}
};
NYA_REGIST_APP(MyApplication)
| [
"dasyprocta@27943c09-b335-0410-ab52-7f3c671fdcc1"
]
| [
[
[
1,
86
]
]
]
|
dbca2c45a6abbd033a1201190fdbe55b9e42909f | 0813282678cb6bb52cd0001a760cfbc24663cfca | /SCBuildOrderGUIDoc.cpp | 1ec838f276bac904b52c3ccf9522f4b656978449 | []
| no_license | mannyzhou5/scbuildorder | e3850a86baaa33d1c549c7b89ddab7738b79b3c0 | 2396293ee483e40495590782b652320db8adf530 | refs/heads/master | 2020-04-29T01:01:04.504099 | 2011-04-12T10:00:54 | 2011-04-12T10:00:54 | 33,047,073 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,950 | cpp |
// SCBuildOrderGUIDoc.cpp : implementation of the CSCBuildOrderGUIDoc class
//
#include "stdafx.h"
// SHARED_HANDLERS can be defined in an ATL project implementing preview, thumbnail
// and search filter handlers and allows sharing of document code with that project.
#ifndef SHARED_HANDLERS
#include "SCBuildOrderGUI.h"
#endif
#include "SCBuildOrderGUIDoc.h"
#include <propkey.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CSCBuildOrderGUIDoc
IMPLEMENT_DYNCREATE(CSCBuildOrderGUIDoc, CDocument)
BEGIN_MESSAGE_MAP(CSCBuildOrderGUIDoc, CDocument)
END_MESSAGE_MAP()
// CSCBuildOrderGUIDoc construction/destruction
CSCBuildOrderGUIDoc::CSCBuildOrderGUIDoc()
{
// TODO: add one-time construction code here
}
CSCBuildOrderGUIDoc::~CSCBuildOrderGUIDoc()
{
}
BOOL CSCBuildOrderGUIDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: add reinitialization code here
// (SDI documents will reuse this document)
return TRUE;
}
// CSCBuildOrderGUIDoc serialization
void CSCBuildOrderGUIDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
// TODO: add storing code here
}
else
{
// TODO: add loading code here
}
}
#ifdef SHARED_HANDLERS
// Support for thumbnails
void CSCBuildOrderGUIDoc::OnDrawThumbnail(CDC& dc, LPRECT lprcBounds)
{
// Modify this code to draw the document's data
dc.FillSolidRect(lprcBounds, RGB(255, 255, 255));
CString strText = _T("TODO: implement thumbnail drawing here");
LOGFONT lf;
CFont* pDefaultGUIFont = CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT));
pDefaultGUIFont->GetLogFont(&lf);
lf.lfHeight = 36;
CFont fontDraw;
fontDraw.CreateFontIndirect(&lf);
CFont* pOldFont = dc.SelectObject(&fontDraw);
dc.DrawText(strText, lprcBounds, DT_CENTER | DT_WORDBREAK);
dc.SelectObject(pOldFont);
}
// Support for Search Handlers
void CSCBuildOrderGUIDoc::InitializeSearchContent()
{
CString strSearchContent;
// Set search contents from document's data.
// The content parts should be separated by ";"
// For example: strSearchContent = _T("point;rectangle;circle;ole object;");
SetSearchContent(strSearchContent);
}
void CSCBuildOrderGUIDoc::SetSearchContent(const CString& value)
{
if (value.IsEmpty())
{
RemoveChunk(PKEY_Search_Contents.fmtid, PKEY_Search_Contents.pid);
}
else
{
CMFCFilterChunkValueImpl *pChunk = NULL;
ATLTRY(pChunk = new CMFCFilterChunkValueImpl);
if (pChunk != NULL)
{
pChunk->SetTextValue(PKEY_Search_Contents, value, CHUNK_TEXT);
SetChunkValue(pChunk);
}
}
}
#endif // SHARED_HANDLERS
// CSCBuildOrderGUIDoc diagnostics
#ifdef _DEBUG
void CSCBuildOrderGUIDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CSCBuildOrderGUIDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
// CSCBuildOrderGUIDoc commands
| [
"[email protected]@a0245358-5b9e-171e-63e1-2316ddff5996"
]
| [
[
[
1,
137
]
]
]
|
d2555b8220e2f6a1bba86d8e27db88e641056562 | ab2777854d7040cc4029edcd1eccc6d48ca55b29 | /Algorithm/AutoFinder/NonCachedTextMgr/Misc.cpp | d6f3468865319fffbab2a68ac7447ea117af4830 | []
| no_license | adrix89/araltrans03 | f9c79f8e5e62a23bbbd41f1cdbcaf43b3124719b | 6aa944d1829006a59d0f7e4cf2fef83e3f256481 | refs/heads/master | 2021-01-10T19:56:34.730964 | 2009-12-21T16:21:45 | 2009-12-21T16:21:45 | 38,417,581 | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 2,368 | cpp |
#include "../stdafx.h"
#include "../AutoFinder.h"
#include "Misc.h"
BOOL IsJapaneseW(LPCWSTR wszJapaneseText, int nJapaneseLen)
{
BOOL bRet=FALSE;
int i;
if (nJapaneseLen < 0)
nJapaneseLen=lstrlenW(wszJapaneseText);
for(i=0; i<nJapaneseLen; i++)
{
if (
((0x2E80 <= wszJapaneseText[i]) && (wszJapaneseText[i] <= 0x2EFF)) || // 2E80 - 2EFF 한중일 부수 보충
//((0x3000 <= wszJapaneseText[i]) && (wszJapaneseText[i] <= 0x303F)) || // 3000 - 303F 한중일 기호 및 구두점
((0x31C0 <= wszJapaneseText[i]) && (wszJapaneseText[i] <= 0x31FF)) || // 31C0 - 31EF 한중일 한자 획
// // 31F0 - 31FF 가타카나 음성 확장
//((0x3200 <= wszJapaneseText[i]) && (wszJapaneseText[i] <= 0x32FF)) || // 3200 - 32FF 한중일 괄호 문자
((0x3300 <= wszJapaneseText[i]) && (wszJapaneseText[i] <= 0x4DBF)) || // 3300 - 33FF 한중일 호환용
// // 3400 - 4DBF 한중일 통합 한자 확장-A
((0x4E00 <= wszJapaneseText[i]) && (wszJapaneseText[i] <= 0x9FBF)) || // 4E00 - 9FBF 한중일 통합 한자
((0xF900 <= wszJapaneseText[i]) && (wszJapaneseText[i] <= 0xFAFF)) || // FA00 - FAFF 한중일 호환용 한자
((0xFE30 <= wszJapaneseText[i]) && (wszJapaneseText[i] <= 0xFE4F)) || // FE30 - FE4F 한중일 호환 글꼴
((0xFF66 <= wszJapaneseText[i]) && (wszJapaneseText[i] <= 0xFF9F)) // FF66 - FF9F 반각 가타카나
)
{
bRet=TRUE; // 일단 일어
}
else if ((0x3040 <= wszJapaneseText[i]) && (wszJapaneseText[i] <= 0x30FF)) // 3040 - 309F 히라가나
// // 30A0 - 30FF 가타카나
{
bRet=TRUE; // 확실히 일어
break;
}
else if ((0xAC00 <= wszJapaneseText[i]) && (wszJapaneseText[i] <= 0xD7AF)) // AC00 - D7AF 한글 글자
{
bRet=FALSE; // 확실히 한글
break;
}
}
/*
if (bRet) // debug
{
FILE *fp;
char szTemp[1024]={0, };
fp=fopen("c:\\noncached.txt", "a");
fprintf(fp, "[JAP] ");
MyWideCharToMultiByte(CP_UTF8, 0, wszJapaneseText, nJapaneseLen, szTemp, 1023, 0, 0);
fprintf(fp, "%s\n", szTemp);
if (i == nJapaneseLen)
{
fprintf(fp, "(len=%d) ", i);
for (i=0; i < nJapaneseLen; i++)
{
fprintf(fp, "%04X ", wszJapaneseText[i]);
}
fprintf(fp, "\n");
}
fclose(fp);
}
//*/
return bRet;
} | [
"arallab3@883913d8-bf2b-11de-8cd0-f941f5a20a08"
]
| [
[
[
1,
73
]
]
]
|
a866ed5359960cdf67fd9e287a1a3cfd4a12522e | cd0987589d3815de1dea8529a7705caac479e7e9 | /webkit/WebKitTools/DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp | a38bc8d563b2999bf6299fb6206a6565372b26d3 | []
| no_license | azrul2202/WebKit-Smartphone | 0aab1ff641d74f15c0623f00c56806dbc9b59fc1 | 023d6fe819445369134dee793b69de36748e71d7 | refs/heads/master | 2021-01-15T09:24:31.288774 | 2011-07-11T11:12:44 | 2011-07-11T11:12:44 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 14,519 | cpp | /*
* Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
* Copyright (C) 2008 Zan Dobersek <[email protected]>
* Copyright (C) 2009 Holger Hans Peter Freyther
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "PluginObject.h"
#include "PluginTest.h"
#include "npapi.h"
#include "npruntime.h"
#include "npfunctions.h"
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <X11/Xlib.h>
#include <string>
using namespace std;
extern "C" {
NPError NP_Initialize (NPNetscapeFuncs *aMozillaVTable, NPPluginFuncs *aPluginVTable);
NPError NP_Shutdown(void);
NPError NP_GetValue(void *future, NPPVariable variable, void *value);
char* NP_GetMIMEDescription(void);
}
static void executeScript(const PluginObject* obj, const char* script);
static NPError
webkit_test_plugin_new_instance(NPMIMEType /*mimetype*/,
NPP instance,
uint16_t /*mode*/,
int16_t argc,
char *argn[],
char *argv[],
NPSavedData* /*savedData*/)
{
if (browser->version >= 14) {
PluginObject* obj = (PluginObject*)browser->createobject(instance, getPluginClass());
instance->pdata = obj;
string testIdentifier;
for (int i = 0; i < argc; i++) {
if (strcasecmp(argn[i], "test") == 0)
testIdentifier = argv[i];
else if (strcasecmp(argn[i], "onstreamload") == 0 && !obj->onStreamLoad)
obj->onStreamLoad = strdup(argv[i]);
else if (strcasecmp(argn[i], "onStreamDestroy") == 0 && !obj->onStreamDestroy)
obj->onStreamDestroy = strdup(argv[i]);
else if (strcasecmp(argn[i], "onURLNotify") == 0 && !obj->onURLNotify)
obj->onURLNotify = strdup(argv[i]);
else if (strcasecmp(argn[i], "src") == 0 &&
strcasecmp(argv[i], "data:application/x-webkit-test-netscape,returnerrorfromnewstream") == 0)
obj->returnErrorFromNewStream = TRUE;
else if (strcasecmp(argn[i], "logfirstsetwindow") == 0)
obj->logSetWindow = TRUE;
else if (strcasecmp(argn[i], "testnpruntime") == 0)
testNPRuntime(instance);
else if (strcasecmp(argn[i], "logSrc") == 0) {
for (int i = 0; i < argc; i++)
if (strcasecmp(argn[i], "src") == 0)
pluginLog(instance, "src: %s", argv[i]);
} else if (strcasecmp(argn[i], "cleardocumentduringnew") == 0)
executeScript(obj, "document.body.innerHTML = ''");
else if (!strcasecmp(argn[i], "ondestroy"))
obj->onDestroy = strdup(argv[i]);
else if (strcasecmp(argn[i], "testwindowopen") == 0)
obj->testWindowOpen = TRUE;
else if (strcasecmp(argn[i], "onSetWindow") == 0 && !obj->onSetWindow)
obj->onSetWindow = strdup(argv[i]);
}
browser->getvalue(instance, NPNVprivateModeBool, (void *)&obj->cachedPrivateBrowsingMode);
obj->pluginTest = PluginTest::create(instance, testIdentifier);
}
return NPERR_NO_ERROR;
}
static NPError
webkit_test_plugin_destroy_instance(NPP instance, NPSavedData** /*save*/)
{
PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
if (obj) {
if (obj->onDestroy) {
executeScript(obj, obj->onDestroy);
free(obj->onDestroy);
}
if (obj->onStreamLoad)
free(obj->onStreamLoad);
if (obj->onStreamDestroy)
free(obj->onStreamDestroy);
if (obj->onURLNotify)
free(obj->onURLNotify);
if (obj->logDestroy)
pluginLog(instance, "NPP_Destroy");
if (obj->onSetWindow)
free(obj->onSetWindow);
browser->releaseobject(&obj->header);
}
return NPERR_NO_ERROR;
}
static NPError
webkit_test_plugin_set_window(NPP instance, NPWindow *window)
{
PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
if (obj) {
obj->lastWindow = *window;
if (obj->logSetWindow) {
pluginLog(instance, "NPP_SetWindow: %d %d", (int)window->width, (int)window->height);
obj->logSetWindow = false;
}
if (obj->onSetWindow)
executeScript(obj, obj->onSetWindow);
if (obj->testWindowOpen) {
testWindowOpen(instance);
obj->testWindowOpen = FALSE;
}
}
return NPERR_NO_ERROR;
}
static void executeScript(const PluginObject* obj, const char* script)
{
NPObject *windowScriptObject;
browser->getvalue(obj->npp, NPNVWindowNPObject, &windowScriptObject);
NPString npScript;
npScript.UTF8Characters = script;
npScript.UTF8Length = strlen(script);
NPVariant browserResult;
browser->evaluate(obj->npp, windowScriptObject, &npScript, &browserResult);
browser->releasevariantvalue(&browserResult);
}
static NPError
webkit_test_plugin_new_stream(NPP instance,
NPMIMEType /*type*/,
NPStream *stream,
NPBool /*seekable*/,
uint16_t* stype)
{
PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
obj->stream = stream;
*stype = NP_NORMAL;
if (obj->returnErrorFromNewStream)
return NPERR_GENERIC_ERROR;
if (browser->version >= NPVERS_HAS_RESPONSE_HEADERS)
notifyStream(obj, stream->url, stream->headers);
if (obj->onStreamLoad)
executeScript(obj, obj->onStreamLoad);
return NPERR_NO_ERROR;
}
static NPError
webkit_test_plugin_destroy_stream(NPP instance, NPStream* stream, NPError reason)
{
PluginObject* obj = (PluginObject*)instance->pdata;
if (obj->onStreamDestroy) {
NPObject* windowObject = 0;
NPError error = browser->getvalue(instance, NPNVWindowNPObject, &windowObject);
if (error == NPERR_NO_ERROR) {
NPVariant onStreamDestroyVariant;
if (browser->getproperty(instance, windowObject, browser->getstringidentifier(obj->onStreamDestroy), &onStreamDestroyVariant)) {
if (NPVARIANT_IS_OBJECT(onStreamDestroyVariant)) {
NPObject* onStreamDestroyFunction = NPVARIANT_TO_OBJECT(onStreamDestroyVariant);
NPVariant reasonVariant;
INT32_TO_NPVARIANT(reason, reasonVariant);
NPVariant result;
browser->invokeDefault(instance, onStreamDestroyFunction, &reasonVariant, 1, &result);
browser->releasevariantvalue(&result);
}
browser->releasevariantvalue(&onStreamDestroyVariant);
}
browser->releaseobject(windowObject);
}
}
return obj->pluginTest->NPP_DestroyStream(stream, reason);
}
static void
webkit_test_plugin_stream_as_file(NPP /*instance*/, NPStream* /*stream*/, const char* /*fname*/)
{
}
static int32_t
webkit_test_plugin_write_ready(NPP /*instance*/, NPStream* /*stream*/)
{
return 4096;
}
static int32_t
webkit_test_plugin_write(NPP instance,
NPStream* /*stream*/,
int32_t /*offset*/,
int32_t len,
void* /*buffer*/)
{
PluginObject* obj = (PluginObject*)instance->pdata;
if (obj->returnNegativeOneFromWrite)
return -1;
return len;
}
static void
webkit_test_plugin_print(NPP /*instance*/, NPPrint* /*platformPrint*/)
{
}
static int16_t
webkit_test_plugin_handle_event(NPP instance, void* event)
{
PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
if (!obj->eventLogging)
return 0;
XEvent* evt = static_cast<XEvent*>(event);
switch (evt->type) {
case ButtonRelease:
pluginLog(instance, "mouseUp at (%d, %d)", evt->xbutton.x, evt->xbutton.y);
break;
case ButtonPress:
pluginLog(instance, "mouseDown at (%d, %d)", evt->xbutton.x, evt->xbutton.y);
break;
case KeyRelease:
pluginLog(instance, "keyUp '%c'", evt->xkey.keycode);
break;
case KeyPress:
pluginLog(instance, "keyDown '%c'", evt->xkey.keycode);
break;
case MotionNotify:
case EnterNotify:
case LeaveNotify:
break;
case FocusIn:
pluginLog(instance, "getFocusEvent");
break;
case FocusOut:
pluginLog(instance, "loseFocusEvent");
break;
default:
pluginLog(instance, "event %d", evt->type);
}
return 0;
}
static void
webkit_test_plugin_url_notify(NPP instance, const char* url, NPReason reason, void* notifyData)
{
PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
if (obj->onURLNotify)
executeScript(obj, obj->onURLNotify);
handleCallback(obj, url, reason, notifyData);
}
static NPError
webkit_test_plugin_get_value(NPP instance, NPPVariable variable, void *value)
{
PluginObject* obj = 0;
if (instance)
obj = static_cast<PluginObject*>(instance->pdata);
// First, check if the PluginTest object supports getting this value.
if (obj && obj->pluginTest->NPP_GetValue(variable, value) == NPERR_NO_ERROR)
return NPERR_NO_ERROR;
NPError err = NPERR_NO_ERROR;
switch (variable) {
case NPPVpluginNameString:
*((char **)value) = const_cast<char*>("WebKit Test PlugIn");
break;
case NPPVpluginDescriptionString:
*((char **)value) = const_cast<char*>("Simple Netscape plug-in that handles test content for WebKit");
break;
case NPPVpluginNeedsXEmbed:
*((NPBool *)value) = TRUE;
break;
case NPPVpluginScriptableIID:
case NPPVpluginScriptableInstance:
case NPPVpluginScriptableNPObject:
err = NPERR_GENERIC_ERROR;
break;
default:
fprintf(stderr, "Unhandled variable\n");
err = NPERR_GENERIC_ERROR;
break;
}
if (variable == NPPVpluginScriptableNPObject) {
void **v = (void **)value;
browser->retainobject((NPObject *)obj);
*v = obj;
err = NPERR_NO_ERROR;
}
return err;
}
static NPError
webkit_test_plugin_set_value(NPP instance, NPNVariable variable, void* value)
{
PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
switch (variable) {
case NPNVprivateModeBool:
obj->cachedPrivateBrowsingMode = *(NPBool*)value;
return NPERR_NO_ERROR;
default:
return NPERR_GENERIC_ERROR;
}
}
char *
NP_GetMIMEDescription(void)
{
return const_cast<char*>("application/x-webkit-test-netscape:testnetscape:test netscape content");
}
NPError
NP_Initialize (NPNetscapeFuncs *aMozillaVTable, NPPluginFuncs *aPluginVTable)
{
if (aMozillaVTable == NULL || aPluginVTable == NULL)
return NPERR_INVALID_FUNCTABLE_ERROR;
if ((aMozillaVTable->version >> 8) > NP_VERSION_MAJOR)
return NPERR_INCOMPATIBLE_VERSION_ERROR;
if (aPluginVTable->size < sizeof (NPPluginFuncs))
return NPERR_INVALID_FUNCTABLE_ERROR;
browser = aMozillaVTable;
aPluginVTable->size = sizeof (NPPluginFuncs);
aPluginVTable->version = (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR;
aPluginVTable->newp = webkit_test_plugin_new_instance;
aPluginVTable->destroy = webkit_test_plugin_destroy_instance;
aPluginVTable->setwindow = webkit_test_plugin_set_window;
aPluginVTable->newstream = webkit_test_plugin_new_stream;
aPluginVTable->destroystream = webkit_test_plugin_destroy_stream;
aPluginVTable->asfile = webkit_test_plugin_stream_as_file;
aPluginVTable->writeready = webkit_test_plugin_write_ready;
aPluginVTable->write = webkit_test_plugin_write;
aPluginVTable->print = webkit_test_plugin_print;
aPluginVTable->event = webkit_test_plugin_handle_event;
aPluginVTable->urlnotify = webkit_test_plugin_url_notify;
aPluginVTable->javaClass = NULL;
aPluginVTable->getvalue = webkit_test_plugin_get_value;
aPluginVTable->setvalue = webkit_test_plugin_set_value;
return NPERR_NO_ERROR;
}
NPError
NP_Shutdown(void)
{
return NPERR_NO_ERROR;
}
NPError
NP_GetValue(void* /*future*/, NPPVariable variable, void *value)
{
return webkit_test_plugin_get_value(NULL, variable, value);
}
| [
"[email protected]"
]
| [
[
[
1,
420
]
]
]
|
142dc5083dd5987d5c7002dd9bd6f90d94754c53 | 4d317573a3f3f6d2c20dbea00c4c72944891dabc | /regionGrabber.cpp | b2ae2b1543911aa7fb3199c96e069080b4572f5b | []
| no_license | dongyeolkim/qt-screenshooter | 6cd52e8ab58882a7a2b2632e374f5e3e5ace464e | 7eba3bbc7474cd689fa37f68a8611d7bb80845a8 | refs/heads/master | 2021-01-17T08:36:37.080315 | 2011-06-08T16:45:19 | 2011-06-08T16:45:19 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,091 | cpp | /*
Copyright (C) 2009 seraph <[email protected]>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or ( at your option ) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "regionGrabber.h"
#include <QtGui>
#include <qapplication.h>
#include <qpainter.h>
#include <qpalette.h>
#include <qstyle.h>
#include <qtimer.h>
#include <qtooltip.h>
SizeTip::SizeTip( QWidget *parent, const char *name )
: QLabel()
{
setMargin( 2 );
setIndent( 0 );
setFrameStyle( QFrame::Plain | QFrame::Box );
setPalette( QToolTip::palette() );
}
void SizeTip::setTip( const QRect &rect )
{
QString tip = QString( "%1x%2" ).arg( rect.width() )
.arg( rect.height() );
setText( tip );
adjustSize();
positionTip( rect );
}
void SizeTip::positionTip( const QRect &rect )
{
QRect tipRect = geometry();
tipRect.moveTopLeft( QPoint( 0, 0 ) );
/*if ( rect.intersects( tipRect ) )
{
QRect deskR = KGlobalSettings::desktopGeometry( QPoint( 0, 0 ) );
tipRect.moveCenter( QPoint( deskR.width()/2, deskR.height()/2 ) );
if ( !rect.contains( tipRect, true ) && rect.intersects( tipRect ) )
tipRect.moveBottomRight( geometry().bottomRight() );
}*/
move( tipRect.topLeft() );
}
RegionGrabber::RegionGrabber()
: mouseDown( false ), sizeTip( 0L )
{
cursor = QCursor(Qt::CrossCursor);
setCursor(cursor);
sizeTip = new SizeTip((QWidget *) 0L);
tipTimer = new QTimer(this);
connect(tipTimer, SIGNAL(timeout() ), SLOT( updateSizeTip() ) );
QTimer::singleShot( 200, this, SLOT( initGrabber() ) );
}
RegionGrabber::~RegionGrabber()
{
delete sizeTip;
}
void RegionGrabber::initGrabber()
{
QDesktopWidget *desktop = QApplication::desktop();
QRect r = desktop->rect();
pixmap = QPixmap::grabWindow(desktop->winId(), r.x(), r.y(),
r.width(), r.height());
/*if ( desktopWidget.isVirtualDesktop() )
r = desktop->geometry();
else
r = desktop->screenGeometry();*/
QPalette palette;
palette.setBrush(backgroundRole(), QBrush(pixmap));
setPalette(palette);
resize(r.size());
move(0, 0);
showFullScreen();
//QApplication::setOverrideCursor( crossCursor );
}
void RegionGrabber::mousePressEvent( QMouseEvent *e )
{
if (e->button() == Qt::LeftButton ) {
mouseDown = true;
grabRect = QRect( e->pos(), e->pos() );
}
}
void RegionGrabber::mouseMoveEvent( QMouseEvent *e )
{
if ( mouseDown ) {
sizeTip->hide();
tipTimer->start( 250);
// drawRubber();
grabRect.setBottomRight( e->pos() );
// drawRubber();
update();
}
}
void RegionGrabber::mouseReleaseEvent( QMouseEvent *e )
{
mouseDown = false;
// drawRubber();
sizeTip->hide();
grabRect.setBottomRight( e->pos() );
QPixmap region = QPixmap::grabWindow(winId(), grabRect.x(), grabRect.y(),
grabRect.width(), grabRect.height());
//QApplication::restoreOverrideCursor();
emit regionGrabbed( region );
}
void RegionGrabber::keyPressEvent( QKeyEvent *e )
{
if ( e->key() == Qt::Key_Escape) {
QApplication::restoreOverrideCursor();
emit regionGrabbed( QPixmap() );
} else
e->ignore();
}
void RegionGrabber::updateSizeTip()
{
QRect rect = grabRect;
sizeTip->setTip( rect );
sizeTip->show();
}
void RegionGrabber::paintEvent(QPaintEvent *)
{
QPainter p(this);
p.drawRect(grabRect);
/*QPainter painter(this);
QStyleOptionFocusRect option;
option.initFrom(this);
option.rect = grabRect;
//option.backgroundColor = palette().color(QPalette::Background);
option.backgroundColor = QColor(Qt::red);
style()->drawPrimitive(QStyle::PE_FrameFocusRect, &option, &painter, this);
*/
}
void RegionGrabber::drawRubber()
{
QPainter p();
//p.begin(this);
//p.setPen(QPen());
//p.setBrush(Qt::NoBrush);
//p.drawRect(grabRect);
/*style().drawPrimitive( QStyle::PE_FocusRect, &p, grabRect, colorGroup(),
QStyle::Style_Default, QStyleOption( colorGroup().base() ) );*/
//p.end();
}
//#include "regiongrabber.moc"
| [
"[email protected]"
]
| [
[
[
1,
192
]
]
]
|
7ce13e97d5dfb7ed4a328460e8c79e021d1ba037 | a84b013cd995870071589cefe0ab060ff3105f35 | /webdriver/branches/iphone/jobbie/src/cpp/InternetExplorerDriver/org_openqa_selenium_ie_InternetExplorerDriver.cpp | fcad99c0c0a28540de72801982d12688a51bef73 | [
"Apache-2.0"
]
| permissive | vdt/selenium | 137bcad58b7184690b8785859d77da0cd9f745a0 | 30e5e122b068aadf31bcd010d00a58afd8075217 | refs/heads/master | 2020-12-27T21:35:06.461381 | 2009-08-18T15:56:32 | 2009-08-18T15:56:32 | 13,650,409 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 11,400 | cpp | /*
Copyright 2007-2009 WebDriver committers
Copyright 2007-2009 Google Inc.
Portions copyright 2007 ThoughtWorks, Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This is the main DLL file.
#include "stdafx.h"
#include "utils.h"
using namespace std;
#ifdef __cplusplus
extern "C" {
#endif
InternetExplorerDriver* g_pStillOpenedIE = NULL;
InternetExplorerDriver* createIE(JNIEnv *env, jobject& obj)
{
TRY
{
InternetExplorerDriver* wrapper = NULL;
wrapper = new InternetExplorerDriver();
g_pStillOpenedIE = wrapper;
jclass cls = env->GetObjectClass(obj);
jfieldID fid = env->GetFieldID(cls, "iePointer", "J");
env->SetLongField(obj, fid, (jlong) wrapper);
return wrapper;
}
END_TRY_CATCH_ANY
return NULL;
}
InternetExplorerDriver* getIe(JNIEnv *env, jobject obj)
{
TRY
{
jclass cls = env->GetObjectClass(obj);
jfieldID fid = env->GetFieldID(cls, "iePointer", "J");
jlong value = env->GetLongField(obj, fid);
return (InternetExplorerDriver *) value;
}
END_TRY_CATCH_ANY
return NULL;
}
JNIEXPORT jobject JNICALL Java_org_openqa_selenium_ie_InternetExplorerDriver_doExecuteScript
(JNIEnv *env, jobject obj, jstring script, jobjectArray args)
{
TRY
{
InternetExplorerDriver* wrapper = getIe(env, obj);
// Convert the args into something we can use elsewhere.
jclass numberClazz = env->FindClass("java/lang/Number");
jclass booleanClazz = env->FindClass("java/lang/Boolean");
jclass stringClazz = env->FindClass("java/lang/String");
jclass elementClazz = env->FindClass("org/openqa/selenium/ie/InternetExplorerElement");
jmethodID longValue = env->GetMethodID(numberClazz, "longValue", "()J");
jmethodID booleanValue = env->GetMethodID(booleanClazz, "booleanValue", "()Z");
jfieldID elementPointer = env->GetFieldID(elementClazz, "nodePointer", "J");
jsize length = env->GetArrayLength(args);
SAFEARRAYBOUND bounds;
bounds.cElements = length;
bounds.lLbound = 0;
SAFEARRAY* convertedItems = SafeArrayCreate(VT_VARIANT, 1, &bounds);
LONG index[1];
for (jsize i = 0; i < length; i++) {
index[0] = i;
CComVariant dest;
jobject arrayObject = env->GetObjectArrayElement(args, i);
jclass objClazz = env->GetObjectClass(arrayObject);
if (env->IsInstanceOf(arrayObject, numberClazz)) {
jlong value = env->CallLongMethod(arrayObject, longValue);
dest.vt = VT_I4;
dest.lVal = (LONG) value;
} else if (env->IsInstanceOf(arrayObject, stringClazz)) {
wchar_t *converted = (wchar_t *)env->GetStringChars((jstring) arrayObject, 0);
std::wstring value(converted);
env->ReleaseStringChars((jstring) arrayObject, (jchar*) converted);
dest.vt = VT_BSTR;
dest.bstrVal = SysAllocString(value.c_str());
} else if (env->IsInstanceOf(arrayObject, booleanClazz)) {
bool value = env->CallBooleanMethod(arrayObject, booleanValue) == JNI_TRUE;
dest.vt = VT_BOOL;
dest.boolVal = value;
} else if (env->IsInstanceOf(arrayObject, elementClazz)) {
ElementWrapper* element = (ElementWrapper*) env->GetLongField(arrayObject, elementPointer);
dest.vt = VT_DISPATCH;
dest.pdispVal = element->getWrappedElement();
}
SafeArrayPutElement(convertedItems, &i, &dest);
}
const wchar_t* converted = (wchar_t *)env->GetStringChars(script, 0);
CComVariant& result = wrapper->executeScript(converted, convertedItems);
env->ReleaseStringChars(script, (jchar*) converted);
// TODO (simon): Does this clear everything properly?
SafeArrayDestroy(convertedItems);
if (result.vt == VT_BSTR) {
return bstr2jstring(env, result.bstrVal);
} else if (result.vt == VT_DISPATCH) {
// Attempt to create a new webelement
IHTMLElement *node = (IHTMLElement*) result.pdispVal;
if (!node) {
cerr << L"Cannot convert response to element. Attempting to convert to string" << endl;
return lpcw2jstring(env, comvariant2cw(result));
}
ElementWrapper* element = new ElementWrapper(wrapper, node);
jclass clazz = env->FindClass("org/openqa/selenium/ie/InternetExplorerElement");
jmethodID cId = env->GetMethodID(clazz, "<init>", "(J)V");
return env->NewObject(clazz, cId, (jlong) element);
} else if (result.vt == VT_BOOL) {
jclass clazz = env->FindClass("java/lang/Boolean");
jmethodID cId = env->GetMethodID(clazz, "<init>", "(Z)V");
return env->NewObject(clazz, cId, (jboolean) (result.boolVal == VARIANT_TRUE));
} else if (result.vt == VT_I4) {
jclass clazz = env->FindClass("java/lang/Long");
jmethodID cId = env->GetMethodID(clazz, "<init>", "(J)V");
return env->NewObject(clazz, cId, (jlong) result.lVal);
} else if (result.vt == VT_I8) {
jclass clazz = env->FindClass("java/lang/Long");
jmethodID cId = env->GetMethodID(clazz, "<init>", "(J)V");
return env->NewObject(clazz, cId, (jlong) result.dblVal);
} else if (result.vt == VT_USERDEFINED) {
jclass newExcCls;
env->ExceptionDescribe();
env->ExceptionClear();
newExcCls = env->FindClass("java/lang/RuntimeException");
jmethodID cId = env->GetMethodID(newExcCls, "<init>", "(Ljava/lang/String;)V");
jstring message = bstr2jstring(env, result.bstrVal);
jobject exception;
if (message) {
exception = env->NewObject(newExcCls, cId, message);
} else {
cout << "Falling back" << endl;
exception = env->NewObject(newExcCls, cId, (jstring) "Cannot extract cause of error");
}
env->Throw((jthrowable) exception);
return NULL;
}
cerr << "Unknown variant type. Will attempt to coerce to string: " << result.vt << endl;
return lpcw2jstring(env, comvariant2cw(result));
}
END_TRY_CATCH_ANY
return NULL;
return NULL;
}
JNIEXPORT jstring JNICALL Java_org_openqa_selenium_ie_InternetExplorerDriver_getPageSource
(JNIEnv *env, jobject obj)
{
TRY
{
InternetExplorerDriver* wrapper = getIe(env, obj);
LPCWSTR text = wrapper->getPageSource();
return lpcw2jstring(env, text);
}
END_TRY_CATCH_ANY
return NULL;
}
JNIEXPORT jobject JNICALL Java_org_openqa_selenium_ie_InternetExplorerDriver_close
(JNIEnv *env, jobject obj)
{
TRY
{
InternetExplorerDriver* wrapper = getIe(env, obj);
wrapper->close();
g_pStillOpenedIE = NULL;
}
END_TRY_CATCH_ANY
return NULL;
}
JNIEXPORT void JNICALL Java_org_openqa_selenium_ie_InternetExplorerDriver_startComNatively
(JNIEnv *env, jobject obj)
{
TRY
{
}
END_TRY_CATCH_ANY
}
JNIEXPORT void JNICALL Java_org_openqa_selenium_ie_InternetExplorerDriver_openIe
(JNIEnv *env, jobject obj)
{
TRY
{
if(g_pStillOpenedIE)
{
g_pStillOpenedIE->close();
g_pStillOpenedIE = NULL;
}
createIE(env, obj);
}
END_TRY_CATCH_ANY
}
JNIEXPORT void JNICALL Java_org_openqa_selenium_ie_InternetExplorerDriver_setVisible
(JNIEnv *env, jobject obj, jboolean isVisible)
{
TRY
{
InternetExplorerDriver* ie = getIe(env, obj);
ie->setVisible(isVisible == JNI_TRUE);
}
END_TRY_CATCH_ANY
}
JNIEXPORT void JNICALL Java_org_openqa_selenium_ie_InternetExplorerDriver_waitForLoadToComplete
(JNIEnv *env, jobject obj)
{
TRY
{
InternetExplorerDriver* ie = getIe(env, obj);
ie->waitForNavigateToFinish();
}
END_TRY_CATCH_ANY
}
JNIEXPORT jstring JNICALL Java_org_openqa_selenium_ie_InternetExplorerDriver_getCurrentUrl
(JNIEnv *env, jobject obj)
{
TRY
{
InternetExplorerDriver* ie = getIe(env, obj);
LPCWSTR text = ie->getCurrentUrl();
return lpcw2jstring(env, text);
}
END_TRY_CATCH_ANY
return NULL;
}
JNIEXPORT void JNICALL Java_org_openqa_selenium_ie_InternetExplorerDriver_get
(JNIEnv *env, jobject obj, jstring url)
{
TRY
{
InternetExplorerDriver* ie = getIe(env, obj);
const wchar_t* converted = (wchar_t *)env->GetStringChars(url, 0);
ie->get(converted);
env->ReleaseStringChars(url, (jchar*) converted);
}
END_TRY_CATCH_ANY
}
JNIEXPORT jstring JNICALL Java_org_openqa_selenium_ie_InternetExplorerDriver_getTitle
(JNIEnv *env, jobject obj)
{
TRY
{
InternetExplorerDriver* ie = getIe(env, obj);
LPCWSTR text = ie->getTitle();
return lpcw2jstring(env, text);
}
END_TRY_CATCH_ANY
return NULL;
}
JNIEXPORT void JNICALL Java_org_openqa_selenium_ie_InternetExplorerDriver_deleteStoredObject
(JNIEnv *env, jobject obj)
{
TRY
{
InternetExplorerDriver* ie = getIe(env, obj);
if (ie)
{
delete ie;
}
}
END_TRY_CATCH_ANY
}
JNIEXPORT void JNICALL Java_org_openqa_selenium_ie_InternetExplorerDriver_setFrameIndex
(JNIEnv *env, jobject obj, jstring pathToFrame)
{
TRY
{
const wchar_t* path = (wchar_t *)env->GetStringChars(pathToFrame, 0);
InternetExplorerDriver* ie = getIe(env, obj);
if (!ie->switchToFrame(path)) {
std::wstring msg(L"Cannot locate frame using path: ");
msg += path;
throwNoSuchFrameException(env, msg.c_str());
}
env->ReleaseStringChars(pathToFrame, (jchar*) path);
}
END_TRY_CATCH_ANY
}
JNIEXPORT void JNICALL Java_org_openqa_selenium_ie_InternetExplorerDriver_goBack
(JNIEnv *env, jobject obj)
{
TRY
{
InternetExplorerDriver* ie = getIe(env, obj);
ie->goBack();
}
END_TRY_CATCH_ANY
}
JNIEXPORT void JNICALL Java_org_openqa_selenium_ie_InternetExplorerDriver_goForward
(JNIEnv *env, jobject obj)
{
TRY
{
InternetExplorerDriver* ie = getIe(env, obj);
ie->goForward();
}
END_TRY_CATCH_ANY
}
JNIEXPORT void JNICALL Java_org_openqa_selenium_ie_InternetExplorerDriver_doAddCookie
(JNIEnv *env, jobject obj, jstring cookieString)
{
TRY
{
InternetExplorerDriver* ie = getIe(env, obj);
const wchar_t* converted = (wchar_t *)env->GetStringChars(cookieString, 0);
ie->addCookie(converted);
env->ReleaseStringChars(cookieString, (jchar*) converted);
}
END_TRY_CATCH_ANY
}
JNIEXPORT jstring JNICALL Java_org_openqa_selenium_ie_InternetExplorerDriver_doGetCookies
(JNIEnv *env, jobject obj)
{
TRY
{
InternetExplorerDriver* ie = getIe(env, obj);
LPCWSTR text = ie->getCookies();
return lpcw2jstring(env, text);
}
END_TRY_CATCH_ANY
return NULL;
}
JNIEXPORT void JNICALL Java_org_openqa_selenium_ie_InternetExplorerDriver_doSetMouseSpeed
(JNIEnv *env, jobject obj, jint speed)
{
TRY
{
InternetExplorerDriver* ie = getIe(env, obj);
ie->setSpeed((int) speed);
}
END_TRY_CATCH_ANY
}
JNIEXPORT jobject JNICALL Java_org_openqa_selenium_ie_InternetExplorerDriver_doSwitchToActiveElement
(JNIEnv *env, jobject obj)
{
TRY
{
InternetExplorerDriver* ie = getIe(env, obj);
ElementWrapper* element = ie->getActiveElement();
if (!element)
return NULL;
jclass clazz = env->FindClass("org/openqa/selenium/ie/InternetExplorerElement");
jmethodID cId = env->GetMethodID(clazz, "<init>", "(J)V");
return env->NewObject(clazz, cId, (jlong) element);
}
END_TRY_CATCH_ANY
return NULL;
}
#ifdef __cplusplus
}
#endif
| [
"josephg@07704840-8298-11de-bf8c-fd130f914ac9"
]
| [
[
[
1,
418
]
]
]
|
d19d0f772b99ddc935e263b5bf8958c12a621a51 | 12732dc8a5dd518f35c8af3f2a805806f5e91e28 | /trunk/Plugin/clean_request.cpp | 3273b30ff93cb0da8ea766b3e32fe607e5151dc7 | []
| no_license | BackupTheBerlios/codelite-svn | 5acd9ac51fdd0663742f69084fc91a213b24ae5c | c9efd7873960706a8ce23cde31a701520bad8861 | refs/heads/master | 2020-05-20T13:22:34.635394 | 2007-08-02T21:35:35 | 2007-08-02T21:35:35 | 40,669,327 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 967 | cpp | #include "clean_request.h"
#include "buildmanager.h"
#include "wx/process.h"
CleanRequest::CleanRequest(wxEvtHandler *owner, const wxString &projectName)
: CompilerAction(owner)
, m_project(projectName)
{
}
CleanRequest::~CleanRequest()
{
//no need to delete the process, it will be deleted by the wx library
}
//do the actual cleanup
void CleanRequest::Process()
{
wxString cmd;
SetBusy(true);
//TODO:: make the builder name configurable
BuilderPtr builder = BuildManagerST::Get()->GetBuilder(wxT("GNU makefile for g++/gcc"));
cmd = builder->GetCleanCommand(m_project);
SendStartMsg();
m_proc = new clProcess(wxNewId(), cmd);
if(m_proc){
if(m_proc->Start() == 0){
SetBusy(false);
return;
}
Connect(wxEVT_TIMER, wxTimerEventHandler(CleanRequest::OnTimer), NULL, this);
m_proc->Connect(wxEVT_END_PROCESS, wxProcessEventHandler(CleanRequest::OnProcessEnd), NULL, this);
m_timer->Start(10);
}
}
| [
"eranif@b1f272c1-3a1e-0410-8d64-bdc0ffbdec4b"
]
| [
[
[
1,
40
]
]
]
|
98aea6a528390009ad56cc4a01b39bb4e05b0eb1 | 5a35fefb487ffc327c82fcdbeb33b490daa63b17 | /ruby/deps/xmlsig_wrap.cpp | ac0635969c0ec78205c817871c8f6a2cceb146bc | [
"Apache-2.0"
]
| permissive | tractis/xades_library | 6ef3b503b933497e344f60e271855f1d75dd5620 | 5bba1f262bca23774e5e55676e10b9738c0b880c | refs/heads/master | 2020-05-27T06:02:12.494139 | 2010-05-19T16:54:29 | 2010-05-19T16:54:29 | 662,343 | 7 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 418,043 | cpp | /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 1.3.31
*
* This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make
* changes to this file unless you know what you are doing--modify the SWIG
* interface file instead.
* ----------------------------------------------------------------------------- */
#define SWIGRUBY
#ifdef __cplusplus
template<class T> class SwigValueWrapper {
T *tt;
public:
SwigValueWrapper() : tt(0) { }
SwigValueWrapper(const SwigValueWrapper<T>& rhs) : tt(new T(*rhs.tt)) { }
SwigValueWrapper(const T& t) : tt(new T(t)) { }
~SwigValueWrapper() { delete tt; }
SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; }
operator T&() const { return *tt; }
T *operator&() { return tt; }
private:
SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
};
#endif
/* -----------------------------------------------------------------------------
* This section contains generic SWIG labels for method/variable
* declarations/attributes, and other compiler dependent labels.
* ----------------------------------------------------------------------------- */
/* template workaround for compilers that cannot correctly implement the C++ standard */
#ifndef SWIGTEMPLATEDISAMBIGUATOR
# if defined(__SUNPRO_CC)
# if (__SUNPRO_CC <= 0x560)
# define SWIGTEMPLATEDISAMBIGUATOR template
# else
# define SWIGTEMPLATEDISAMBIGUATOR
# endif
# else
# define SWIGTEMPLATEDISAMBIGUATOR
# endif
#endif
/* inline attribute */
#ifndef SWIGINLINE
# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
# define SWIGINLINE inline
# else
# define SWIGINLINE
# endif
#endif
/* attribute recognised by some compilers to avoid 'unused' warnings */
#ifndef SWIGUNUSED
# if defined(__GNUC__)
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
# define SWIGUNUSED __attribute__ ((__unused__))
# else
# define SWIGUNUSED
# endif
# elif defined(__ICC)
# define SWIGUNUSED __attribute__ ((__unused__))
# else
# define SWIGUNUSED
# endif
#endif
#ifndef SWIGUNUSEDPARM
# ifdef __cplusplus
# define SWIGUNUSEDPARM(p)
# else
# define SWIGUNUSEDPARM(p) p SWIGUNUSED
# endif
#endif
/* internal SWIG method */
#ifndef SWIGINTERN
# define SWIGINTERN static SWIGUNUSED
#endif
/* internal inline SWIG method */
#ifndef SWIGINTERNINLINE
# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
#endif
/* exporting methods */
#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
# ifndef GCC_HASCLASSVISIBILITY
# define GCC_HASCLASSVISIBILITY
# endif
#endif
#ifndef SWIGEXPORT
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
# if defined(STATIC_LINKED)
# define SWIGEXPORT
# else
# define SWIGEXPORT __declspec(dllexport)
# endif
# else
# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
# define SWIGEXPORT __attribute__ ((visibility("default")))
# else
# define SWIGEXPORT
# endif
# endif
#endif
/* calling conventions for Windows */
#ifndef SWIGSTDCALL
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
# define SWIGSTDCALL __stdcall
# else
# define SWIGSTDCALL
# endif
#endif
/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
# define _CRT_SECURE_NO_DEPRECATE
#endif
/* -----------------------------------------------------------------------------
* This section contains generic SWIG labels for method/variable
* declarations/attributes, and other compiler dependent labels.
* ----------------------------------------------------------------------------- */
/* template workaround for compilers that cannot correctly implement the C++ standard */
#ifndef SWIGTEMPLATEDISAMBIGUATOR
# if defined(__SUNPRO_CC)
# if (__SUNPRO_CC <= 0x560)
# define SWIGTEMPLATEDISAMBIGUATOR template
# else
# define SWIGTEMPLATEDISAMBIGUATOR
# endif
# else
# define SWIGTEMPLATEDISAMBIGUATOR
# endif
#endif
/* inline attribute */
#ifndef SWIGINLINE
# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
# define SWIGINLINE inline
# else
# define SWIGINLINE
# endif
#endif
/* attribute recognised by some compilers to avoid 'unused' warnings */
#ifndef SWIGUNUSED
# if defined(__GNUC__)
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
# define SWIGUNUSED __attribute__ ((__unused__))
# else
# define SWIGUNUSED
# endif
# elif defined(__ICC)
# define SWIGUNUSED __attribute__ ((__unused__))
# else
# define SWIGUNUSED
# endif
#endif
#ifndef SWIGUNUSEDPARM
# ifdef __cplusplus
# define SWIGUNUSEDPARM(p)
# else
# define SWIGUNUSEDPARM(p) p SWIGUNUSED
# endif
#endif
/* internal SWIG method */
#ifndef SWIGINTERN
# define SWIGINTERN static SWIGUNUSED
#endif
/* internal inline SWIG method */
#ifndef SWIGINTERNINLINE
# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
#endif
/* exporting methods */
#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
# ifndef GCC_HASCLASSVISIBILITY
# define GCC_HASCLASSVISIBILITY
# endif
#endif
#ifndef SWIGEXPORT
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
# if defined(STATIC_LINKED)
# define SWIGEXPORT
# else
# define SWIGEXPORT __declspec(dllexport)
# endif
# else
# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
# define SWIGEXPORT __attribute__ ((visibility("default")))
# else
# define SWIGEXPORT
# endif
# endif
#endif
/* calling conventions for Windows */
#ifndef SWIGSTDCALL
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
# define SWIGSTDCALL __stdcall
# else
# define SWIGSTDCALL
# endif
#endif
/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
# define _CRT_SECURE_NO_DEPRECATE
#endif
/* -----------------------------------------------------------------------------
* swigrun.swg
*
* This file contains generic CAPI SWIG runtime support for pointer
* type checking.
* ----------------------------------------------------------------------------- */
/* This should only be incremented when either the layout of swig_type_info changes,
or for whatever reason, the runtime changes incompatibly */
#define SWIG_RUNTIME_VERSION "3"
/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
#ifdef SWIG_TYPE_TABLE
# define SWIG_QUOTE_STRING(x) #x
# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
#else
# define SWIG_TYPE_TABLE_NAME
#endif
/*
You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
creating a static or dynamic library from the swig runtime code.
In 99.9% of the cases, swig just needs to declare them as 'static'.
But only do this if is strictly necessary, ie, if you have problems
with your compiler or so.
*/
#ifndef SWIGRUNTIME
# define SWIGRUNTIME SWIGINTERN
#endif
#ifndef SWIGRUNTIMEINLINE
# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
#endif
/* Generic buffer size */
#ifndef SWIG_BUFFER_SIZE
# define SWIG_BUFFER_SIZE 1024
#endif
/* Flags for pointer conversions */
#define SWIG_POINTER_DISOWN 0x1
/* Flags for new pointer objects */
#define SWIG_POINTER_OWN 0x1
/*
Flags/methods for returning states.
The swig conversion methods, as ConvertPtr, return and integer
that tells if the conversion was successful or not. And if not,
an error code can be returned (see swigerrors.swg for the codes).
Use the following macros/flags to set or process the returning
states.
In old swig versions, you usually write code as:
if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
// success code
} else {
//fail code
}
Now you can be more explicit as:
int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
if (SWIG_IsOK(res)) {
// success code
} else {
// fail code
}
that seems to be the same, but now you can also do
Type *ptr;
int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
if (SWIG_IsOK(res)) {
// success code
if (SWIG_IsNewObj(res) {
...
delete *ptr;
} else {
...
}
} else {
// fail code
}
I.e., now SWIG_ConvertPtr can return new objects and you can
identify the case and take care of the deallocation. Of course that
requires also to SWIG_ConvertPtr to return new result values, as
int SWIG_ConvertPtr(obj, ptr,...) {
if (<obj is ok>) {
if (<need new object>) {
*ptr = <ptr to new allocated object>;
return SWIG_NEWOBJ;
} else {
*ptr = <ptr to old object>;
return SWIG_OLDOBJ;
}
} else {
return SWIG_BADOBJ;
}
}
Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
swig errors code.
Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
allows to return the 'cast rank', for example, if you have this
int food(double)
int fooi(int);
and you call
food(1) // cast rank '1' (1 -> 1.0)
fooi(1) // cast rank '0'
just use the SWIG_AddCast()/SWIG_CheckState()
*/
#define SWIG_OK (0)
#define SWIG_ERROR (-1)
#define SWIG_IsOK(r) (r >= 0)
#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
/* The CastRankLimit says how many bits are used for the cast rank */
#define SWIG_CASTRANKLIMIT (1 << 8)
/* The NewMask denotes the object was created (using new/malloc) */
#define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
/* The TmpMask is for in/out typemaps that use temporal objects */
#define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
/* Simple returning values */
#define SWIG_BADOBJ (SWIG_ERROR)
#define SWIG_OLDOBJ (SWIG_OK)
#define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
#define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
/* Check, add and del mask methods */
#define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
#define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
#define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
#define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
#define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
#define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
/* Cast-Rank Mode */
#if defined(SWIG_CASTRANK_MODE)
# ifndef SWIG_TypeRank
# define SWIG_TypeRank unsigned long
# endif
# ifndef SWIG_MAXCASTRANK /* Default cast allowed */
# define SWIG_MAXCASTRANK (2)
# endif
# define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
# define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
SWIGINTERNINLINE int SWIG_AddCast(int r) {
return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
}
SWIGINTERNINLINE int SWIG_CheckState(int r) {
return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
}
#else /* no cast-rank mode */
# define SWIG_AddCast
# define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
#endif
#include <string.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef void *(*swig_converter_func)(void *);
typedef struct swig_type_info *(*swig_dycast_func)(void **);
/* Structure to store inforomation on one type */
typedef struct swig_type_info {
const char *name; /* mangled name of this type */
const char *str; /* human readable name of this type */
swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
struct swig_cast_info *cast; /* linked list of types that can cast into this type */
void *clientdata; /* language specific type data */
int owndata; /* flag if the structure owns the clientdata */
} swig_type_info;
/* Structure to store a type and conversion function used for casting */
typedef struct swig_cast_info {
swig_type_info *type; /* pointer to type that is equivalent to this type */
swig_converter_func converter; /* function to cast the void pointers */
struct swig_cast_info *next; /* pointer to next cast in linked list */
struct swig_cast_info *prev; /* pointer to the previous cast */
} swig_cast_info;
/* Structure used to store module information
* Each module generates one structure like this, and the runtime collects
* all of these structures and stores them in a circularly linked list.*/
typedef struct swig_module_info {
swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
size_t size; /* Number of types in this module */
struct swig_module_info *next; /* Pointer to next element in circularly linked list */
swig_type_info **type_initial; /* Array of initially generated type structures */
swig_cast_info **cast_initial; /* Array of initially generated casting structures */
void *clientdata; /* Language specific module data */
} swig_module_info;
/*
Compare two type names skipping the space characters, therefore
"char*" == "char *" and "Class<int>" == "Class<int >", etc.
Return 0 when the two name types are equivalent, as in
strncmp, but skipping ' '.
*/
SWIGRUNTIME int
SWIG_TypeNameComp(const char *f1, const char *l1,
const char *f2, const char *l2) {
for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
while ((*f1 == ' ') && (f1 != l1)) ++f1;
while ((*f2 == ' ') && (f2 != l2)) ++f2;
if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
}
return (l1 - f1) - (l2 - f2);
}
/*
Check type equivalence in a name list like <name1>|<name2>|...
Return 0 if not equal, 1 if equal
*/
SWIGRUNTIME int
SWIG_TypeEquiv(const char *nb, const char *tb) {
int equiv = 0;
const char* te = tb + strlen(tb);
const char* ne = nb;
while (!equiv && *ne) {
for (nb = ne; *ne; ++ne) {
if (*ne == '|') break;
}
equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
if (*ne) ++ne;
}
return equiv;
}
/*
Check type equivalence in a name list like <name1>|<name2>|...
Return 0 if equal, -1 if nb < tb, 1 if nb > tb
*/
SWIGRUNTIME int
SWIG_TypeCompare(const char *nb, const char *tb) {
int equiv = 0;
const char* te = tb + strlen(tb);
const char* ne = nb;
while (!equiv && *ne) {
for (nb = ne; *ne; ++ne) {
if (*ne == '|') break;
}
equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
if (*ne) ++ne;
}
return equiv;
}
/* think of this as a c++ template<> or a scheme macro */
#define SWIG_TypeCheck_Template(comparison, ty) \
if (ty) { \
swig_cast_info *iter = ty->cast; \
while (iter) { \
if (comparison) { \
if (iter == ty->cast) return iter; \
/* Move iter to the top of the linked list */ \
iter->prev->next = iter->next; \
if (iter->next) \
iter->next->prev = iter->prev; \
iter->next = ty->cast; \
iter->prev = 0; \
if (ty->cast) ty->cast->prev = iter; \
ty->cast = iter; \
return iter; \
} \
iter = iter->next; \
} \
} \
return 0
/*
Check the typename
*/
SWIGRUNTIME swig_cast_info *
SWIG_TypeCheck(const char *c, swig_type_info *ty) {
SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
}
/* Same as previous function, except strcmp is replaced with a pointer comparison */
SWIGRUNTIME swig_cast_info *
SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
SWIG_TypeCheck_Template(iter->type == from, into);
}
/*
Cast a pointer up an inheritance hierarchy
*/
SWIGRUNTIMEINLINE void *
SWIG_TypeCast(swig_cast_info *ty, void *ptr) {
return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr);
}
/*
Dynamic pointer casting. Down an inheritance hierarchy
*/
SWIGRUNTIME swig_type_info *
SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
swig_type_info *lastty = ty;
if (!ty || !ty->dcast) return ty;
while (ty && (ty->dcast)) {
ty = (*ty->dcast)(ptr);
if (ty) lastty = ty;
}
return lastty;
}
/*
Return the name associated with this type
*/
SWIGRUNTIMEINLINE const char *
SWIG_TypeName(const swig_type_info *ty) {
return ty->name;
}
/*
Return the pretty name associated with this type,
that is an unmangled type name in a form presentable to the user.
*/
SWIGRUNTIME const char *
SWIG_TypePrettyName(const swig_type_info *type) {
/* The "str" field contains the equivalent pretty names of the
type, separated by vertical-bar characters. We choose
to print the last name, as it is often (?) the most
specific. */
if (!type) return NULL;
if (type->str != NULL) {
const char *last_name = type->str;
const char *s;
for (s = type->str; *s; s++)
if (*s == '|') last_name = s+1;
return last_name;
}
else
return type->name;
}
/*
Set the clientdata field for a type
*/
SWIGRUNTIME void
SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
swig_cast_info *cast = ti->cast;
/* if (ti->clientdata == clientdata) return; */
ti->clientdata = clientdata;
while (cast) {
if (!cast->converter) {
swig_type_info *tc = cast->type;
if (!tc->clientdata) {
SWIG_TypeClientData(tc, clientdata);
}
}
cast = cast->next;
}
}
SWIGRUNTIME void
SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
SWIG_TypeClientData(ti, clientdata);
ti->owndata = 1;
}
/*
Search for a swig_type_info structure only by mangled name
Search is a O(log #types)
We start searching at module start, and finish searching when start == end.
Note: if start == end at the beginning of the function, we go all the way around
the circular list.
*/
SWIGRUNTIME swig_type_info *
SWIG_MangledTypeQueryModule(swig_module_info *start,
swig_module_info *end,
const char *name) {
swig_module_info *iter = start;
do {
if (iter->size) {
register size_t l = 0;
register size_t r = iter->size - 1;
do {
/* since l+r >= 0, we can (>> 1) instead (/ 2) */
register size_t i = (l + r) >> 1;
const char *iname = iter->types[i]->name;
if (iname) {
register int compare = strcmp(name, iname);
if (compare == 0) {
return iter->types[i];
} else if (compare < 0) {
if (i) {
r = i - 1;
} else {
break;
}
} else if (compare > 0) {
l = i + 1;
}
} else {
break; /* should never happen */
}
} while (l <= r);
}
iter = iter->next;
} while (iter != end);
return 0;
}
/*
Search for a swig_type_info structure for either a mangled name or a human readable name.
It first searches the mangled names of the types, which is a O(log #types)
If a type is not found it then searches the human readable names, which is O(#types).
We start searching at module start, and finish searching when start == end.
Note: if start == end at the beginning of the function, we go all the way around
the circular list.
*/
SWIGRUNTIME swig_type_info *
SWIG_TypeQueryModule(swig_module_info *start,
swig_module_info *end,
const char *name) {
/* STEP 1: Search the name field using binary search */
swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
if (ret) {
return ret;
} else {
/* STEP 2: If the type hasn't been found, do a complete search
of the str field (the human readable name) */
swig_module_info *iter = start;
do {
register size_t i = 0;
for (; i < iter->size; ++i) {
if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
return iter->types[i];
}
iter = iter->next;
} while (iter != end);
}
/* neither found a match */
return 0;
}
/*
Pack binary data into a string
*/
SWIGRUNTIME char *
SWIG_PackData(char *c, void *ptr, size_t sz) {
static const char hex[17] = "0123456789abcdef";
register const unsigned char *u = (unsigned char *) ptr;
register const unsigned char *eu = u + sz;
for (; u != eu; ++u) {
register unsigned char uu = *u;
*(c++) = hex[(uu & 0xf0) >> 4];
*(c++) = hex[uu & 0xf];
}
return c;
}
/*
Unpack binary data from a string
*/
SWIGRUNTIME const char *
SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
register unsigned char *u = (unsigned char *) ptr;
register const unsigned char *eu = u + sz;
for (; u != eu; ++u) {
register char d = *(c++);
register unsigned char uu;
if ((d >= '0') && (d <= '9'))
uu = ((d - '0') << 4);
else if ((d >= 'a') && (d <= 'f'))
uu = ((d - ('a'-10)) << 4);
else
return (char *) 0;
d = *(c++);
if ((d >= '0') && (d <= '9'))
uu |= (d - '0');
else if ((d >= 'a') && (d <= 'f'))
uu |= (d - ('a'-10));
else
return (char *) 0;
*u = uu;
}
return c;
}
/*
Pack 'void *' into a string buffer.
*/
SWIGRUNTIME char *
SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
char *r = buff;
if ((2*sizeof(void *) + 2) > bsz) return 0;
*(r++) = '_';
r = SWIG_PackData(r,&ptr,sizeof(void *));
if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
strcpy(r,name);
return buff;
}
SWIGRUNTIME const char *
SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
if (*c != '_') {
if (strcmp(c,"NULL") == 0) {
*ptr = (void *) 0;
return name;
} else {
return 0;
}
}
return SWIG_UnpackData(++c,ptr,sizeof(void *));
}
SWIGRUNTIME char *
SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
char *r = buff;
size_t lname = (name ? strlen(name) : 0);
if ((2*sz + 2 + lname) > bsz) return 0;
*(r++) = '_';
r = SWIG_PackData(r,ptr,sz);
if (lname) {
strncpy(r,name,lname+1);
} else {
*r = 0;
}
return buff;
}
SWIGRUNTIME const char *
SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
if (*c != '_') {
if (strcmp(c,"NULL") == 0) {
memset(ptr,0,sz);
return name;
} else {
return 0;
}
}
return SWIG_UnpackData(++c,ptr,sz);
}
#ifdef __cplusplus
}
#endif
/* Errors in SWIG */
#define SWIG_UnknownError -1
#define SWIG_IOError -2
#define SWIG_RuntimeError -3
#define SWIG_IndexError -4
#define SWIG_TypeError -5
#define SWIG_DivisionByZero -6
#define SWIG_OverflowError -7
#define SWIG_SyntaxError -8
#define SWIG_ValueError -9
#define SWIG_SystemError -10
#define SWIG_AttributeError -11
#define SWIG_MemoryError -12
#define SWIG_NullReferenceError -13
#include <ruby.h>
/* Ruby 1.7 defines NUM2LL(), LL2NUM() and ULL2NUM() macros */
#ifndef NUM2LL
#define NUM2LL(x) NUM2LONG((x))
#endif
#ifndef LL2NUM
#define LL2NUM(x) INT2NUM((long) (x))
#endif
#ifndef ULL2NUM
#define ULL2NUM(x) UINT2NUM((unsigned long) (x))
#endif
/* Ruby 1.7 doesn't (yet) define NUM2ULL() */
#ifndef NUM2ULL
#ifdef HAVE_LONG_LONG
#define NUM2ULL(x) rb_num2ull((x))
#else
#define NUM2ULL(x) NUM2ULONG(x)
#endif
#endif
/* RSTRING_LEN, etc are new in Ruby 1.9, but ->ptr and ->len no longer work */
/* Define these for older versions so we can just write code the new way */
#ifndef RSTRING_LEN
# define RSTRING_LEN(x) RSTRING(x)->len
#endif
#ifndef RSTRING_PTR
# define RSTRING_PTR(x) RSTRING(x)->ptr
#endif
#ifndef RARRAY_LEN
# define RARRAY_LEN(x) RARRAY(x)->len
#endif
#ifndef RARRAY_PTR
# define RARRAY_PTR(x) RARRAY(x)->ptr
#endif
/*
* Need to be very careful about how these macros are defined, especially
* when compiling C++ code or C code with an ANSI C compiler.
*
* VALUEFUNC(f) is a macro used to typecast a C function that implements
* a Ruby method so that it can be passed as an argument to API functions
* like rb_define_method() and rb_define_singleton_method().
*
* VOIDFUNC(f) is a macro used to typecast a C function that implements
* either the "mark" or "free" stuff for a Ruby Data object, so that it
* can be passed as an argument to API functions like Data_Wrap_Struct()
* and Data_Make_Struct().
*/
#ifdef __cplusplus
# ifndef RUBY_METHOD_FUNC /* These definitions should work for Ruby 1.4.6 */
# define PROTECTFUNC(f) ((VALUE (*)()) f)
# define VALUEFUNC(f) ((VALUE (*)()) f)
# define VOIDFUNC(f) ((void (*)()) f)
# else
# ifndef ANYARGS /* These definitions should work for Ruby 1.6 */
# define PROTECTFUNC(f) ((VALUE (*)()) f)
# define VALUEFUNC(f) ((VALUE (*)()) f)
# define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
# else /* These definitions should work for Ruby 1.7+ */
# define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f)
# define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f)
# define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
# endif
# endif
#else
# define VALUEFUNC(f) (f)
# define VOIDFUNC(f) (f)
#endif
/* Don't use for expressions have side effect */
#ifndef RB_STRING_VALUE
#define RB_STRING_VALUE(s) (TYPE(s) == T_STRING ? (s) : (*(volatile VALUE *)&(s) = rb_str_to_str(s)))
#endif
#ifndef StringValue
#define StringValue(s) RB_STRING_VALUE(s)
#endif
#ifndef StringValuePtr
#define StringValuePtr(s) RSTRING_PTR(RB_STRING_VALUE(s))
#endif
#ifndef StringValueLen
#define StringValueLen(s) RSTRING_LEN(RB_STRING_VALUE(s))
#endif
#ifndef SafeStringValue
#define SafeStringValue(v) do {\
StringValue(v);\
rb_check_safe_str(v);\
} while (0)
#endif
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
#define rb_define_alloc_func(klass, func) rb_define_singleton_method((klass), "new", VALUEFUNC((func)), -1)
#define rb_undef_alloc_func(klass) rb_undef_method(CLASS_OF((klass)), "new")
#endif
/* -----------------------------------------------------------------------------
* error manipulation
* ----------------------------------------------------------------------------- */
/* Define some additional error types */
#define SWIG_ObjectPreviouslyDeletedError -100
/* Define custom exceptions for errors that do not map to existing Ruby
exceptions. Note this only works for C++ since a global cannot be
initialized by a funtion in C. For C, fallback to rb_eRuntimeError.*/
SWIGINTERN VALUE
getNullReferenceError(void) {
static int init = 0;
static VALUE rb_eNullReferenceError ;
if (!init) {
init = 1;
rb_eNullReferenceError = rb_define_class("NullReferenceError", rb_eRuntimeError);
}
return rb_eNullReferenceError;
}
SWIGINTERN VALUE
getObjectPreviouslyDeletedError(void) {
static int init = 0;
static VALUE rb_eObjectPreviouslyDeleted ;
if (!init) {
init = 1;
rb_eObjectPreviouslyDeleted = rb_define_class("ObjectPreviouslyDeleted", rb_eRuntimeError);
}
return rb_eObjectPreviouslyDeleted;
}
SWIGINTERN VALUE
SWIG_Ruby_ErrorType(int SWIG_code) {
VALUE type;
switch (SWIG_code) {
case SWIG_MemoryError:
type = rb_eNoMemError;
break;
case SWIG_IOError:
type = rb_eIOError;
break;
case SWIG_RuntimeError:
type = rb_eRuntimeError;
break;
case SWIG_IndexError:
type = rb_eIndexError;
break;
case SWIG_TypeError:
type = rb_eTypeError;
break;
case SWIG_DivisionByZero:
type = rb_eZeroDivError;
break;
case SWIG_OverflowError:
type = rb_eRangeError;
break;
case SWIG_SyntaxError:
type = rb_eSyntaxError;
break;
case SWIG_ValueError:
type = rb_eArgError;
break;
case SWIG_SystemError:
type = rb_eFatal;
break;
case SWIG_AttributeError:
type = rb_eRuntimeError;
break;
case SWIG_NullReferenceError:
type = getNullReferenceError();
break;
case SWIG_ObjectPreviouslyDeletedError:
type = getObjectPreviouslyDeletedError();
break;
case SWIG_UnknownError:
type = rb_eRuntimeError;
break;
default:
type = rb_eRuntimeError;
}
return type;
}
/* -----------------------------------------------------------------------------
* See the LICENSE file for information on copyright, usage and redistribution
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
*
* rubytracking.swg
*
* This file contains support for tracking mappings from
* Ruby objects to C++ objects. This functionality is needed
* to implement mark functions for Ruby's mark and sweep
* garbage collector.
* ----------------------------------------------------------------------------- */
#ifdef __cplusplus
extern "C" {
#endif
/* Global Ruby hash table to store Trackings from C/C++
structs to Ruby Objects. */
static VALUE swig_ruby_trackings;
/* Global variable that stores a reference to the ruby
hash table delete function. */
static ID swig_ruby_hash_delete = 0;
/* Setup a Ruby hash table to store Trackings */
SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) {
/* Create a ruby hash table to store Trackings from C++
objects to Ruby objects. Also make sure to tell
the garabage collector about the hash table. */
swig_ruby_trackings = rb_hash_new();
rb_gc_register_address(&swig_ruby_trackings);
/* Now store a reference to the hash table delete function
so that we only have to look it up once.*/
swig_ruby_hash_delete = rb_intern("delete");
}
/* Get a Ruby number to reference a pointer */
SWIGRUNTIME VALUE SWIG_RubyPtrToReference(void* ptr) {
/* We cast the pointer to an unsigned long
and then store a reference to it using
a Ruby number object. */
/* Convert the pointer to a Ruby number */
unsigned long value = (unsigned long) ptr;
return LONG2NUM(value);
}
/* Get a Ruby number to reference an object */
SWIGRUNTIME VALUE SWIG_RubyObjectToReference(VALUE object) {
/* We cast the object to an unsigned long
and then store a reference to it using
a Ruby number object. */
/* Convert the Object to a Ruby number */
unsigned long value = (unsigned long) object;
return LONG2NUM(value);
}
/* Get a Ruby object from a previously stored reference */
SWIGRUNTIME VALUE SWIG_RubyReferenceToObject(VALUE reference) {
/* The provided Ruby number object is a reference
to the Ruby object we want.*/
/* First convert the Ruby number to a C number */
unsigned long value = NUM2LONG(reference);
return (VALUE) value;
}
/* Add a Tracking from a C/C++ struct to a Ruby object */
SWIGRUNTIME void SWIG_RubyAddTracking(void* ptr, VALUE object) {
/* In a Ruby hash table we store the pointer and
the associated Ruby object. The trick here is
that we cannot store the Ruby object directly - if
we do then it cannot be garbage collected. So
instead we typecast it as a unsigned long and
convert it to a Ruby number object.*/
/* Get a reference to the pointer as a Ruby number */
VALUE key = SWIG_RubyPtrToReference(ptr);
/* Get a reference to the Ruby object as a Ruby number */
VALUE value = SWIG_RubyObjectToReference(object);
/* Store the mapping to the global hash table. */
rb_hash_aset(swig_ruby_trackings, key, value);
}
/* Get the Ruby object that owns the specified C/C++ struct */
SWIGRUNTIME VALUE SWIG_RubyInstanceFor(void* ptr) {
/* Get a reference to the pointer as a Ruby number */
VALUE key = SWIG_RubyPtrToReference(ptr);
/* Now lookup the value stored in the global hash table */
VALUE value = rb_hash_aref(swig_ruby_trackings, key);
if (value == Qnil) {
/* No object exists - return nil. */
return Qnil;
}
else {
/* Convert this value to Ruby object */
return SWIG_RubyReferenceToObject(value);
}
}
/* Remove a Tracking from a C/C++ struct to a Ruby object. It
is very important to remove objects once they are destroyed
since the same memory address may be reused later to create
a new object. */
SWIGRUNTIME void SWIG_RubyRemoveTracking(void* ptr) {
/* Get a reference to the pointer as a Ruby number */
VALUE key = SWIG_RubyPtrToReference(ptr);
/* Delete the object from the hash table by calling Ruby's
do this we need to call the Hash.delete method.*/
rb_funcall(swig_ruby_trackings, swig_ruby_hash_delete, 1, key);
}
/* This is a helper method that unlinks a Ruby object from its
underlying C++ object. This is needed if the lifetime of the
Ruby object is longer than the C++ object */
SWIGRUNTIME void SWIG_RubyUnlinkObjects(void* ptr) {
VALUE object = SWIG_RubyInstanceFor(ptr);
if (object != Qnil) {
DATA_PTR(object) = 0;
}
}
#ifdef __cplusplus
}
#endif
/* -----------------------------------------------------------------------------
* Ruby API portion that goes into the runtime
* ----------------------------------------------------------------------------- */
#ifdef __cplusplus
extern "C" {
#endif
SWIGINTERN VALUE
SWIG_Ruby_AppendOutput(VALUE target, VALUE o) {
if (NIL_P(target)) {
target = o;
} else {
if (TYPE(target) != T_ARRAY) {
VALUE o2 = target;
target = rb_ary_new();
rb_ary_push(target, o2);
}
rb_ary_push(target, o);
}
return target;
}
#ifdef __cplusplus
}
#endif
/* -----------------------------------------------------------------------------
* See the LICENSE file for information on copyright, usage and redistribution
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
*
* rubyrun.swg
*
* This file contains the runtime support for Ruby modules
* and includes code for managing global variables and pointer
* type checking.
* ----------------------------------------------------------------------------- */
/* For backward compatibility only */
#define SWIG_POINTER_EXCEPTION 0
/* for raw pointers */
#define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, own)
#define SWIG_NewPointerObj(ptr, type, flags) SWIG_Ruby_NewPointerObj(ptr, type, flags)
#define SWIG_AcquirePtr(ptr, own) SWIG_Ruby_AcquirePtr(ptr, own)
#define swig_owntype ruby_owntype
/* for raw packed data */
#define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty, flags)
#define SWIG_NewPackedObj(ptr, sz, type) SWIG_Ruby_NewPackedObj(ptr, sz, type)
/* for class or struct pointers */
#define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags)
#define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags)
/* for C or C++ function pointers */
#define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_ConvertPtr(obj, pptr, type, 0)
#define SWIG_NewFunctionPtrObj(ptr, type) SWIG_NewPointerObj(ptr, type, 0)
/* for C++ member pointers, ie, member methods */
#define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty)
#define SWIG_NewMemberObj(ptr, sz, type) SWIG_Ruby_NewPackedObj(ptr, sz, type)
/* Runtime API */
#define SWIG_GetModule(clientdata) SWIG_Ruby_GetModule()
#define SWIG_SetModule(clientdata, pointer) SWIG_Ruby_SetModule(pointer)
/* Error manipulation */
#define SWIG_ErrorType(code) SWIG_Ruby_ErrorType(code)
#define SWIG_Error(code, msg) rb_raise(SWIG_Ruby_ErrorType(code), msg)
#define SWIG_fail goto fail
/* Ruby-specific SWIG API */
#define SWIG_InitRuntime() SWIG_Ruby_InitRuntime()
#define SWIG_define_class(ty) SWIG_Ruby_define_class(ty)
#define SWIG_NewClassInstance(value, ty) SWIG_Ruby_NewClassInstance(value, ty)
#define SWIG_MangleStr(value) SWIG_Ruby_MangleStr(value)
#define SWIG_CheckConvert(value, ty) SWIG_Ruby_CheckConvert(value, ty)
/* -----------------------------------------------------------------------------
* pointers/data manipulation
* ----------------------------------------------------------------------------- */
#ifdef __cplusplus
extern "C" {
#if 0
} /* cc-mode */
#endif
#endif
typedef struct {
VALUE klass;
VALUE mImpl;
void (*mark)(void *);
void (*destroy)(void *);
int trackObjects;
} swig_class;
static VALUE _mSWIG = Qnil;
static VALUE _cSWIG_Pointer = Qnil;
static VALUE swig_runtime_data_type_pointer = Qnil;
SWIGRUNTIME VALUE
getExceptionClass(void) {
static int init = 0;
static VALUE rubyExceptionClass ;
if (!init) {
init = 1;
rubyExceptionClass = rb_const_get(_mSWIG, rb_intern("Exception"));
}
return rubyExceptionClass;
}
/* This code checks to see if the Ruby object being raised as part
of an exception inherits from the Ruby class Exception. If so,
the object is simply returned. If not, then a new Ruby exception
object is created and that will be returned to Ruby.*/
SWIGRUNTIME VALUE
SWIG_Ruby_ExceptionType(swig_type_info *desc, VALUE obj) {
VALUE exceptionClass = getExceptionClass();
if (rb_obj_is_kind_of(obj, exceptionClass)) {
return obj;
} else {
return rb_exc_new3(rb_eRuntimeError, rb_obj_as_string(obj));
}
}
/* Initialize Ruby runtime support */
SWIGRUNTIME void
SWIG_Ruby_InitRuntime(void)
{
if (_mSWIG == Qnil) {
_mSWIG = rb_define_module("SWIG");
}
}
/* Define Ruby class for C type */
SWIGRUNTIME void
SWIG_Ruby_define_class(swig_type_info *type)
{
VALUE klass;
char *klass_name = (char *) malloc(4 + strlen(type->name) + 1);
sprintf(klass_name, "TYPE%s", type->name);
if (NIL_P(_cSWIG_Pointer)) {
_cSWIG_Pointer = rb_define_class_under(_mSWIG, "Pointer", rb_cObject);
rb_undef_method(CLASS_OF(_cSWIG_Pointer), "new");
}
klass = rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer);
free((void *) klass_name);
}
/* Create a new pointer object */
SWIGRUNTIME VALUE
SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags)
{
int own = flags & SWIG_POINTER_OWN;
char *klass_name;
swig_class *sklass;
VALUE klass;
VALUE obj;
if (!ptr)
return Qnil;
if (type->clientdata) {
sklass = (swig_class *) type->clientdata;
/* Are we tracking this class and have we already returned this Ruby object? */
if (sklass->trackObjects) {
obj = SWIG_RubyInstanceFor(ptr);
/* Check the object's type and make sure it has the correct type.
It might not in cases where methods do things like
downcast methods. */
if (obj != Qnil) {
VALUE value = rb_iv_get(obj, "__swigtype__");
char* type_name = RSTRING_PTR(value);
if (strcmp(type->name, type_name) == 0) {
return obj;
}
}
}
/* Create a new Ruby object */
obj = Data_Wrap_Struct(sklass->klass, VOIDFUNC(sklass->mark), (own ? VOIDFUNC(sklass->destroy) : 0), ptr);
/* If tracking is on for this class then track this object. */
if (sklass->trackObjects) {
SWIG_RubyAddTracking(ptr, obj);
}
} else {
klass_name = (char *) malloc(4 + strlen(type->name) + 1);
sprintf(klass_name, "TYPE%s", type->name);
klass = rb_const_get(_mSWIG, rb_intern(klass_name));
free((void *) klass_name);
obj = Data_Wrap_Struct(klass, 0, 0, ptr);
}
rb_iv_set(obj, "__swigtype__", rb_str_new2(type->name));
return obj;
}
/* Create a new class instance (always owned) */
SWIGRUNTIME VALUE
SWIG_Ruby_NewClassInstance(VALUE klass, swig_type_info *type)
{
VALUE obj;
swig_class *sklass = (swig_class *) type->clientdata;
obj = Data_Wrap_Struct(klass, VOIDFUNC(sklass->mark), VOIDFUNC(sklass->destroy), 0);
rb_iv_set(obj, "__swigtype__", rb_str_new2(type->name));
return obj;
}
/* Get type mangle from class name */
SWIGRUNTIMEINLINE char *
SWIG_Ruby_MangleStr(VALUE obj)
{
VALUE stype = rb_iv_get(obj, "__swigtype__");
return StringValuePtr(stype);
}
/* Acquire a pointer value */
typedef void (*ruby_owntype)(void*);
SWIGRUNTIME ruby_owntype
SWIG_Ruby_AcquirePtr(VALUE obj, ruby_owntype own) {
if (obj) {
ruby_owntype oldown = RDATA(obj)->dfree;
RDATA(obj)->dfree = own;
return oldown;
} else {
return 0;
}
}
/* Convert a pointer value */
SWIGRUNTIME int
SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, ruby_owntype *own)
{
char *c;
swig_cast_info *tc;
void *vptr = 0;
/* Grab the pointer */
if (NIL_P(obj)) {
*ptr = 0;
return SWIG_OK;
} else {
if (TYPE(obj) != T_DATA) {
return SWIG_ERROR;
}
Data_Get_Struct(obj, void, vptr);
}
if (own) *own = RDATA(obj)->dfree;
/* Check to see if the input object is giving up ownership
of the underlying C struct or C++ object. If so then we
need to reset the destructor since the Ruby object no
longer owns the underlying C++ object.*/
if (flags & SWIG_POINTER_DISOWN) {
/* Is tracking on for this class? */
int track = 0;
if (ty && ty->clientdata) {
swig_class *sklass = (swig_class *) ty->clientdata;
track = sklass->trackObjects;
}
if (track) {
/* We are tracking objects for this class. Thus we change the destructor
* to SWIG_RubyRemoveTracking. This allows us to
* remove the mapping from the C++ to Ruby object
* when the Ruby object is garbage collected. If we don't
* do this, then it is possible we will return a reference
* to a Ruby object that no longer exists thereby crashing Ruby. */
RDATA(obj)->dfree = SWIG_RubyRemoveTracking;
} else {
RDATA(obj)->dfree = 0;
}
}
/* Do type-checking if type info was provided */
if (ty) {
if (ty->clientdata) {
if (rb_obj_is_kind_of(obj, ((swig_class *) (ty->clientdata))->klass)) {
if (vptr == 0) {
/* The object has already been deleted */
return SWIG_ObjectPreviouslyDeletedError;
}
*ptr = vptr;
return SWIG_OK;
}
}
if ((c = SWIG_MangleStr(obj)) == NULL) {
return SWIG_ERROR;
}
tc = SWIG_TypeCheck(c, ty);
if (!tc) {
return SWIG_ERROR;
}
*ptr = SWIG_TypeCast(tc, vptr);
} else {
*ptr = vptr;
}
return SWIG_OK;
}
/* Check convert */
SWIGRUNTIMEINLINE int
SWIG_Ruby_CheckConvert(VALUE obj, swig_type_info *ty)
{
char *c = SWIG_MangleStr(obj);
if (!c) return 0;
return SWIG_TypeCheck(c,ty) != 0;
}
SWIGRUNTIME VALUE
SWIG_Ruby_NewPackedObj(void *ptr, int sz, swig_type_info *type) {
char result[1024];
char *r = result;
if ((2*sz + 1 + strlen(type->name)) > 1000) return 0;
*(r++) = '_';
r = SWIG_PackData(r, ptr, sz);
strcpy(r, type->name);
return rb_str_new2(result);
}
/* Convert a packed value value */
SWIGRUNTIME int
SWIG_Ruby_ConvertPacked(VALUE obj, void *ptr, int sz, swig_type_info *ty) {
swig_cast_info *tc;
const char *c;
if (TYPE(obj) != T_STRING) goto type_error;
c = StringValuePtr(obj);
/* Pointer values must start with leading underscore */
if (*c != '_') goto type_error;
c++;
c = SWIG_UnpackData(c, ptr, sz);
if (ty) {
tc = SWIG_TypeCheck(c, ty);
if (!tc) goto type_error;
}
return SWIG_OK;
type_error:
return SWIG_ERROR;
}
SWIGRUNTIME swig_module_info *
SWIG_Ruby_GetModule(void)
{
VALUE pointer;
swig_module_info *ret = 0;
VALUE verbose = rb_gv_get("VERBOSE");
/* temporarily disable warnings, since the pointer check causes warnings with 'ruby -w' */
rb_gv_set("VERBOSE", Qfalse);
/* first check if pointer already created */
pointer = rb_gv_get("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
if (pointer != Qnil) {
Data_Get_Struct(pointer, swig_module_info, ret);
}
/* reinstate warnings */
rb_gv_set("VERBOSE", verbose);
return ret;
}
SWIGRUNTIME void
SWIG_Ruby_SetModule(swig_module_info *pointer)
{
/* register a new class */
VALUE cl = rb_define_class("swig_runtime_data", rb_cObject);
/* create and store the structure pointer to a global variable */
swig_runtime_data_type_pointer = Data_Wrap_Struct(cl, 0, 0, pointer);
rb_define_readonly_variable("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, &swig_runtime_data_type_pointer);
}
#ifdef __cplusplus
#if 0
{ /* cc-mode */
#endif
}
#endif
#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0)
#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else
#define SWIG_exception(code, msg) do { SWIG_Error(code, msg);; } while(0)
/* -------- TYPES TABLE (BEGIN) -------- */
#define SWIGTYPE_p_CountPtrToTKeyStore_t swig_types[0]
#define SWIGTYPE_p_CountPtrToTKey_t swig_types[1]
#define SWIGTYPE_p_CountPtrToTX509Certificate_t swig_types[2]
#define SWIGTYPE_p_CountPtrToTXPath_t swig_types[3]
#define SWIGTYPE_p_CountPtrToTXmlDoc_t swig_types[4]
#define SWIGTYPE_p_CountPtrToTXmlElement_t swig_types[5]
#define SWIGTYPE_p_DocError swig_types[6]
#define SWIGTYPE_p_DsigException swig_types[7]
#define SWIGTYPE_p_IOError swig_types[8]
#define SWIGTYPE_p_Key swig_types[9]
#define SWIGTYPE_p_KeyError swig_types[10]
#define SWIGTYPE_p_KeyStore swig_types[11]
#define SWIGTYPE_p_LibError swig_types[12]
#define SWIGTYPE_p_MemoryError swig_types[13]
#define SWIGTYPE_p_Signer swig_types[14]
#define SWIGTYPE_p_SimpleTrustVerifier swig_types[15]
#define SWIGTYPE_p_TrustVerificationError swig_types[16]
#define SWIGTYPE_p_TrustVerifier swig_types[17]
#define SWIGTYPE_p_ValueError swig_types[18]
#define SWIGTYPE_p_Verifier swig_types[19]
#define SWIGTYPE_p_X509Certificate swig_types[20]
#define SWIGTYPE_p_X509TrustVerifier swig_types[21]
#define SWIGTYPE_p_XMLError swig_types[22]
#define SWIGTYPE_p_XPath swig_types[23]
#define SWIGTYPE_p_XPathError swig_types[24]
#define SWIGTYPE_p_XmlDoc swig_types[25]
#define SWIGTYPE_p_XmlElement swig_types[26]
#define SWIGTYPE_p_char swig_types[27]
#define SWIGTYPE_p_std__out_of_range swig_types[28]
#define SWIGTYPE_p_std__vectorTCountPtrToTKey_t_t swig_types[29]
#define SWIGTYPE_p_std__vectorTCountPtrToTX509Certificate_t_t swig_types[30]
#define SWIGTYPE_p_std__vectorTCountPtrToTXmlElement_t_t swig_types[31]
#define SWIGTYPE_p_vectorTCountPtrToTX509Certificate_t_t swig_types[32]
#define SWIGTYPE_p_xmlNodePtr swig_types[33]
static swig_type_info *swig_types[35];
static swig_module_info swig_module = {swig_types, 34, 0, 0, 0, 0};
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
/* -------- TYPES TABLE (END) -------- */
#define SWIG_init Init_xmlsig
#define SWIG_name "Xmlsig"
static VALUE mXmlsig;
#define SWIGVERSION 0x010331
#define SWIG_VERSION SWIGVERSION
#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a))
#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a))
#include <stdexcept>
#include <string>
#include <stdexcept>
#include <string>
#define SWIG_FLOAT_P(x) ((TYPE(x) == T_FLOAT) || FIXNUM_P(x))
bool SWIG_BOOL_P(VALUE) {
// dummy test, RTEST should take care of everything
return true;
}
bool SWIG_RB2BOOL(VALUE x) {
return RTEST(x);
}
VALUE SWIG_BOOL2RB(bool b) {
return b ? Qtrue : Qfalse;
}
double SWIG_NUM2DBL(VALUE x) {
return (FIXNUM_P(x) ? FIX2INT(x) : NUM2DBL(x));
}
bool SWIG_STRING_P(VALUE x) {
return TYPE(x) == T_STRING;
}
std::string SWIG_RB2STR(VALUE x) {
return std::string(RSTRING_PTR(x), RSTRING_LEN(x));
}
VALUE SWIG_STR2RB(const std::string& s) {
return rb_str_new(s.data(), s.size());
}
#include <vector>
#include <algorithm>
#include <stdexcept>
#include "DSig.h"
#include "Signer.h"
#include "Key.h"
#include "XmlDoc.h"
#include "Verifier.h"
#include "KeyStore.h"
#include "TrustVerifier.h"
#include <libxml/tree.h>
#include <limits.h>
#ifndef LLONG_MIN
# define LLONG_MIN LONG_LONG_MIN
#endif
#ifndef LLONG_MAX
# define LLONG_MAX LONG_LONG_MAX
#endif
#ifndef ULLONG_MAX
# define ULLONG_MAX ULONG_LONG_MAX
#endif
#define SWIG_From_long LONG2NUM
SWIGINTERNINLINE VALUE
SWIG_From_int (int value)
{
return SWIG_From_long (value);
}
#include "Exceptions.h"
SWIGINTERN swig_type_info*
SWIG_pchar_descriptor(void)
{
static int init = 0;
static swig_type_info* info = 0;
if (!init) {
info = SWIG_TypeQuery("_p_char");
init = 1;
}
return info;
}
SWIGINTERNINLINE VALUE
SWIG_FromCharPtrAndSize(const char* carray, size_t size)
{
if (carray) {
if (size > LONG_MAX) {
swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
return pchar_descriptor ?
SWIG_NewPointerObj(const_cast< char * >(carray), pchar_descriptor, 0) : Qnil;
} else {
return rb_str_new(carray, static_cast< long >(size));
}
} else {
return Qnil;
}
}
SWIGINTERNINLINE VALUE
SWIG_FromCharPtr(const char *cptr)
{
return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
}
SWIGINTERN int
SWIG_AsCharPtrAndSize(VALUE obj, char** cptr, size_t* psize, int *alloc)
{
if (TYPE(obj) == T_STRING) {
char *cstr = STR2CSTR(obj);
size_t size = RSTRING_LEN(obj) + 1;
if (cptr) {
if (alloc) {
if (*alloc == SWIG_NEWOBJ) {
*cptr = reinterpret_cast< char* >(memcpy((new char[size]), cstr, sizeof(char)*(size)));
} else {
*cptr = cstr;
*alloc = SWIG_OLDOBJ;
}
}
}
if (psize) *psize = size;
return SWIG_OK;
} else {
swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
if (pchar_descriptor) {
void* vptr = 0;
if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
if (cptr) *cptr = (char *)vptr;
if (psize) *psize = vptr ? (strlen((char*)vptr) + 1) : 0;
if (alloc) *alloc = SWIG_OLDOBJ;
return SWIG_OK;
}
}
}
return SWIG_TypeError;
}
SWIGINTERN int
SWIG_AsPtr_std_string (VALUE obj, std::string **val)
{
char* buf = 0 ; size_t size = 0; int alloc = SWIG_OLDOBJ;
if (SWIG_IsOK((SWIG_AsCharPtrAndSize(obj, &buf, &size, &alloc)))) {
if (buf) {
if (val) *val = new std::string(buf, size - 1);
if (alloc == SWIG_NEWOBJ) delete[] buf;
return SWIG_NEWOBJ;
} else {
if (val) *val = 0;
return SWIG_OLDOBJ;
}
} else {
static int init = 0;
static swig_type_info* descriptor = 0;
if (!init) {
descriptor = SWIG_TypeQuery("std::string" " *");
init = 1;
}
if (descriptor) {
std::string *vptr;
int res = SWIG_ConvertPtr(obj, (void**)&vptr, descriptor, 0);
if (SWIG_IsOK(res) && val) *val = vptr;
return res;
}
}
return SWIG_ERROR;
}
SWIGINTERNINLINE VALUE
SWIG_From_std_string (const std::string& s)
{
if (s.size()) {
return SWIG_FromCharPtrAndSize(s.data(), s.size());
} else {
return SWIG_FromCharPtrAndSize(s.c_str(), 0);
}
}
SWIGINTERN CountPtrTo<X509Certificate > *new_CountPtrTo_Sl_X509Certificate_Sg___SWIG_0(){
return new CountPtrTo<X509Certificate>(new X509Certificate());
}
SWIGINTERN CountPtrTo<X509Certificate > *new_CountPtrTo_Sl_X509Certificate_Sg___SWIG_1(CountPtrTo<X509Certificate > const &cert){
return new CountPtrTo<X509Certificate>(new X509Certificate(*cert));
}
SWIGINTERN VALUE
SWIG_ruby_failed(void)
{
return Qnil;
}
/*@SWIG:%ruby_aux_method@*/
SWIGINTERN VALUE SWIG_AUX_NUM2ULONG(VALUE *args)
{
VALUE obj = args[0];
VALUE type = TYPE(obj);
unsigned long *res = (unsigned long *)(args[1]);
*res = type == T_FIXNUM ? NUM2ULONG(obj) : rb_big2ulong(obj);
return obj;
}
/*@SWIG@*/
SWIGINTERN int
SWIG_AsVal_unsigned_SS_long (VALUE obj, unsigned long *val)
{
VALUE type = TYPE(obj);
if ((type == T_FIXNUM) || (type == T_BIGNUM)) {
unsigned long v;
VALUE a[2];
a[0] = obj;
a[1] = (VALUE)(&v);
if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2ULONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
if (val) *val = v;
return SWIG_OK;
}
}
return SWIG_TypeError;
}
SWIGINTERN int
SWIG_AsVal_unsigned_SS_int (VALUE obj, unsigned int *val)
{
unsigned long v;
int res = SWIG_AsVal_unsigned_SS_long (obj, &v);
if (SWIG_IsOK(res)) {
if ((v > UINT_MAX)) {
return SWIG_OverflowError;
} else {
if (val) *val = static_cast< unsigned int >(v);
}
}
return res;
}
SWIGINTERNINLINE VALUE
SWIG_From_unsigned_SS_long (unsigned long value)
{
return ULONG2NUM(value);
}
SWIGINTERNINLINE VALUE
SWIG_From_unsigned_SS_int (unsigned int value)
{
return SWIG_From_unsigned_SS_long (value);
}
SWIGINTERNINLINE VALUE
SWIG_From_bool (bool value)
{
return value ? Qtrue : Qfalse;
}
SWIGINTERN CountPtrTo<X509Certificate > std_vector_Sl_X509CertificatePtr_Sg__pop(std::vector<X509CertificatePtr > *self){
if (self->size() == 0)
throw std::out_of_range("pop from empty vector");
CountPtrTo<X509Certificate > x = self->back();
self->pop_back();
return x;
}
/*@SWIG:%ruby_aux_method@*/
SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args)
{
VALUE obj = args[0];
VALUE type = TYPE(obj);
long *res = (long *)(args[1]);
*res = type == T_FIXNUM ? NUM2LONG(obj) : rb_big2long(obj);
return obj;
}
/*@SWIG@*/
SWIGINTERN int
SWIG_AsVal_long (VALUE obj, long* val)
{
VALUE type = TYPE(obj);
if ((type == T_FIXNUM) || (type == T_BIGNUM)) {
long v;
VALUE a[2];
a[0] = obj;
a[1] = (VALUE)(&v);
if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2LONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
if (val) *val = v;
return SWIG_OK;
}
}
return SWIG_TypeError;
}
SWIGINTERN int
SWIG_AsVal_int (VALUE obj, int *val)
{
long v;
int res = SWIG_AsVal_long (obj, &v);
if (SWIG_IsOK(res)) {
if ((v < INT_MIN || v > INT_MAX)) {
return SWIG_OverflowError;
} else {
if (val) *val = static_cast< int >(v);
}
}
return res;
}
SWIGINTERN CountPtrTo<X509Certificate > &std_vector_Sl_X509CertificatePtr_Sg____getitem__(std::vector<X509CertificatePtr > *self,int i){
int size = int(self->size());
if (i<0) i += size;
if (i>=0 && i<size)
return (*self)[i];
else
throw std::out_of_range("vector index out of range");
}
SWIGINTERN void std_vector_Sl_X509CertificatePtr_Sg____setitem__(std::vector<X509CertificatePtr > *self,int i,CountPtrTo<X509Certificate > const &x){
int size = int(self->size());
if (i<0) i+= size;
if (i>=0 && i<size)
(*self)[i] = x;
else
throw std::out_of_range("vector index out of range");
}
SWIGINTERN void std_vector_Sl_X509CertificatePtr_Sg__each(std::vector<X509CertificatePtr > *self){
for (unsigned int i=0; i<self->size(); i++) {
CountPtrTo<X509Certificate >* x = &((*self)[i]);
rb_yield(SWIG_NewPointerObj((void *) x,
SWIGTYPE_p_CountPtrToTX509Certificate_t, 0));
}
}
SWIGINTERN CountPtrTo<Key > *new_CountPtrTo_Sl_Key_Sg___SWIG_0(){
return new CountPtrTo<Key>(new Key());
}
SWIGINTERN CountPtrTo<Key > *new_CountPtrTo_Sl_Key_Sg___SWIG_1(CountPtrTo<Key > const &key){
return new CountPtrTo<Key>(new Key(*key));
}
SWIGINTERN CountPtrTo<Key > *new_CountPtrTo_Sl_Key_Sg___SWIG_2(X509CertificatePtr cert){
return new CountPtrTo<Key>(new Key(cert));
}
SWIGINTERN CountPtrTo<Key > *new_CountPtrTo_Sl_Key_Sg___SWIG_3(std::vector<X509CertificatePtr > certs){
return new CountPtrTo<Key>(new Key(certs));
}
SWIGINTERN CountPtrTo<Key > std_vector_Sl_KeyPtr_Sg__pop(std::vector<KeyPtr > *self){
if (self->size() == 0)
throw std::out_of_range("pop from empty vector");
CountPtrTo<Key > x = self->back();
self->pop_back();
return x;
}
SWIGINTERN CountPtrTo<Key > &std_vector_Sl_KeyPtr_Sg____getitem__(std::vector<KeyPtr > *self,int i){
int size = int(self->size());
if (i<0) i += size;
if (i>=0 && i<size)
return (*self)[i];
else
throw std::out_of_range("vector index out of range");
}
SWIGINTERN void std_vector_Sl_KeyPtr_Sg____setitem__(std::vector<KeyPtr > *self,int i,CountPtrTo<Key > const &x){
int size = int(self->size());
if (i<0) i+= size;
if (i>=0 && i<size)
(*self)[i] = x;
else
throw std::out_of_range("vector index out of range");
}
SWIGINTERN void std_vector_Sl_KeyPtr_Sg__each(std::vector<KeyPtr > *self){
for (unsigned int i=0; i<self->size(); i++) {
CountPtrTo<Key >* x = &((*self)[i]);
rb_yield(SWIG_NewPointerObj((void *) x,
SWIGTYPE_p_CountPtrToTKey_t, 0));
}
}
SWIGINTERN CountPtrTo<KeyStore > *new_CountPtrTo_Sl_KeyStore_Sg_(){
return new CountPtrTo<KeyStore>(new KeyStore());
}
SWIGINTERN CountPtrTo<XmlDoc > *new_CountPtrTo_Sl_XmlDoc_Sg___SWIG_0(){
return new CountPtrTo<XmlDoc>(new XmlDoc());
}
SWIGINTERN CountPtrTo<XmlDoc > *new_CountPtrTo_Sl_XmlDoc_Sg___SWIG_1(CountPtrTo<XmlDoc > const &doc){
return new CountPtrTo<XmlDoc>(new XmlDoc(*doc));
}
SWIGINTERN CountPtrTo<XPath > *new_CountPtrTo_Sl_XPath_Sg___SWIG_0(){
return new CountPtrTo<XPath>(new XPath());
}
SWIGINTERN CountPtrTo<XPath > *new_CountPtrTo_Sl_XPath_Sg___SWIG_1(CountPtrTo<XPath > const &xpath){
return new CountPtrTo<XPath>(new XPath(*xpath));
}
SWIGINTERN CountPtrTo<XPath > *new_CountPtrTo_Sl_XPath_Sg___SWIG_2(std::string expr){
return new CountPtrTo<XPath>(new XPath(expr));
}
SWIGINTERN CountPtrTo<XmlElement > *new_CountPtrTo_Sl_XmlElement_Sg_(){
return new CountPtrTo<XmlElement>(new XmlElement());
}
SWIGINTERN CountPtrTo<XmlElement > std_vector_Sl_XmlElementPtr_Sg__pop(std::vector<XmlElementPtr > *self){
if (self->size() == 0)
throw std::out_of_range("pop from empty vector");
CountPtrTo<XmlElement > x = self->back();
self->pop_back();
return x;
}
SWIGINTERN CountPtrTo<XmlElement > &std_vector_Sl_XmlElementPtr_Sg____getitem__(std::vector<XmlElementPtr > *self,int i){
int size = int(self->size());
if (i<0) i += size;
if (i>=0 && i<size)
return (*self)[i];
else
throw std::out_of_range("vector index out of range");
}
SWIGINTERN void std_vector_Sl_XmlElementPtr_Sg____setitem__(std::vector<XmlElementPtr > *self,int i,CountPtrTo<XmlElement > const &x){
int size = int(self->size());
if (i<0) i+= size;
if (i>=0 && i<size)
(*self)[i] = x;
else
throw std::out_of_range("vector index out of range");
}
SWIGINTERN void std_vector_Sl_XmlElementPtr_Sg__each(std::vector<XmlElementPtr > *self){
for (unsigned int i=0; i<self->size(); i++) {
CountPtrTo<XmlElement >* x = &((*self)[i]);
rb_yield(SWIG_NewPointerObj((void *) x,
SWIGTYPE_p_CountPtrToTXmlElement_t, 0));
}
}
SWIGINTERN int
SWIG_AsVal_bool (VALUE obj, bool *val)
{
if (obj == Qtrue) {
if (val) *val = true;
return SWIG_OK;
} else if (obj == Qfalse) {
if (val) *val = false;
return SWIG_OK;
} else {
int res = 0;
if (SWIG_AsVal_int (obj, &res) == SWIG_OK) {
if (val) *val = res ? true : false;
return SWIG_OK;
}
}
return SWIG_TypeError;
}
SWIGINTERN VALUE
_wrap_dsigInit(int argc, VALUE *argv, VALUE self) {
int result;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
try {
result = (int)dsigInit();
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_dsigShutdown(int argc, VALUE *argv, VALUE self) {
int result;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
result = (int)dsigShutdown();
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
swig_class cDsigException;
#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_DsigException_allocate(VALUE self) {
#else
SWIGINTERN VALUE
_wrap_DsigException_allocate(int argc, VALUE *argv, VALUE self) {
#endif
VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_DsigException);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
rb_obj_call_init(vresult, argc, argv);
#endif
return vresult;
}
SWIGINTERN VALUE
_wrap_new_DsigException(int argc, VALUE *argv, VALUE self) {
DsigException *result = 0 ;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
result = (DsigException *)new DsigException();DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
return self;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_DsigException_what(int argc, VALUE *argv, VALUE self) {
DsigException *arg1 = (DsigException *) 0 ;
char *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_DsigException, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "what" "', argument " "1"" of type '" "DsigException const *""'");
}
arg1 = reinterpret_cast< DsigException * >(argp1);
result = (char *)((DsigException const *)arg1)->what();
vresult = SWIG_FromCharPtr((const char *)result);
return vresult;
fail:
return Qnil;
}
SWIGINTERN void
free_DsigException(DsigException *arg1) {
SWIG_RubyRemoveTracking(arg1);
delete arg1;
}
swig_class cIOError;
#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_IOError_allocate(VALUE self) {
#else
SWIGINTERN VALUE
_wrap_IOError_allocate(int argc, VALUE *argv, VALUE self) {
#endif
VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_IOError);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
rb_obj_call_init(vresult, argc, argv);
#endif
return vresult;
}
SWIGINTERN VALUE
_wrap_new_IOError(int argc, VALUE *argv, VALUE self) {
IOError *result = 0 ;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
{
try
{
result = (IOError *)new IOError();DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
SWIGINTERN void
free_IOError(IOError *arg1) {
SWIG_RubyRemoveTracking(arg1);
delete arg1;
}
swig_class cMemoryError;
#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_MemoryError_allocate(VALUE self) {
#else
SWIGINTERN VALUE
_wrap_MemoryError_allocate(int argc, VALUE *argv, VALUE self) {
#endif
VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_MemoryError);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
rb_obj_call_init(vresult, argc, argv);
#endif
return vresult;
}
SWIGINTERN VALUE
_wrap_new_MemoryError(int argc, VALUE *argv, VALUE self) {
MemoryError *result = 0 ;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
{
try
{
result = (MemoryError *)new MemoryError();DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
SWIGINTERN void
free_MemoryError(MemoryError *arg1) {
SWIG_RubyRemoveTracking(arg1);
delete arg1;
}
swig_class cValueError;
#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_ValueError_allocate(VALUE self) {
#else
SWIGINTERN VALUE
_wrap_ValueError_allocate(int argc, VALUE *argv, VALUE self) {
#endif
VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_ValueError);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
rb_obj_call_init(vresult, argc, argv);
#endif
return vresult;
}
SWIGINTERN VALUE
_wrap_new_ValueError(int argc, VALUE *argv, VALUE self) {
ValueError *result = 0 ;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
{
try
{
result = (ValueError *)new ValueError();DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
SWIGINTERN void
free_ValueError(ValueError *arg1) {
SWIG_RubyRemoveTracking(arg1);
delete arg1;
}
swig_class cXMLError;
#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_XMLError_allocate(VALUE self) {
#else
SWIGINTERN VALUE
_wrap_XMLError_allocate(int argc, VALUE *argv, VALUE self) {
#endif
VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_XMLError);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
rb_obj_call_init(vresult, argc, argv);
#endif
return vresult;
}
SWIGINTERN VALUE
_wrap_new_XMLError(int argc, VALUE *argv, VALUE self) {
XMLError *result = 0 ;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
{
try
{
result = (XMLError *)new XMLError();DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
SWIGINTERN void
free_XMLError(XMLError *arg1) {
SWIG_RubyRemoveTracking(arg1);
delete arg1;
}
swig_class cKeyError;
#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_KeyError_allocate(VALUE self) {
#else
SWIGINTERN VALUE
_wrap_KeyError_allocate(int argc, VALUE *argv, VALUE self) {
#endif
VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_KeyError);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
rb_obj_call_init(vresult, argc, argv);
#endif
return vresult;
}
SWIGINTERN VALUE
_wrap_new_KeyError(int argc, VALUE *argv, VALUE self) {
KeyError *result = 0 ;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
{
try
{
result = (KeyError *)new KeyError();DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
SWIGINTERN void
free_KeyError(KeyError *arg1) {
SWIG_RubyRemoveTracking(arg1);
delete arg1;
}
swig_class cDocError;
#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_DocError_allocate(VALUE self) {
#else
SWIGINTERN VALUE
_wrap_DocError_allocate(int argc, VALUE *argv, VALUE self) {
#endif
VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_DocError);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
rb_obj_call_init(vresult, argc, argv);
#endif
return vresult;
}
SWIGINTERN VALUE
_wrap_new_DocError(int argc, VALUE *argv, VALUE self) {
DocError *result = 0 ;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
{
try
{
result = (DocError *)new DocError();DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
SWIGINTERN void
free_DocError(DocError *arg1) {
SWIG_RubyRemoveTracking(arg1);
delete arg1;
}
swig_class cXPathError;
#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_XPathError_allocate(VALUE self) {
#else
SWIGINTERN VALUE
_wrap_XPathError_allocate(int argc, VALUE *argv, VALUE self) {
#endif
VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_XPathError);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
rb_obj_call_init(vresult, argc, argv);
#endif
return vresult;
}
SWIGINTERN VALUE
_wrap_new_XPathError(int argc, VALUE *argv, VALUE self) {
XPathError *result = 0 ;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
{
try
{
result = (XPathError *)new XPathError();DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
SWIGINTERN void
free_XPathError(XPathError *arg1) {
SWIG_RubyRemoveTracking(arg1);
delete arg1;
}
swig_class cTrustVerificationError;
#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_TrustVerificationError_allocate(VALUE self) {
#else
SWIGINTERN VALUE
_wrap_TrustVerificationError_allocate(int argc, VALUE *argv, VALUE self) {
#endif
VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_TrustVerificationError);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
rb_obj_call_init(vresult, argc, argv);
#endif
return vresult;
}
SWIGINTERN VALUE
_wrap_new_TrustVerificationError(int argc, VALUE *argv, VALUE self) {
TrustVerificationError *result = 0 ;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
{
try
{
result = (TrustVerificationError *)new TrustVerificationError();DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
SWIGINTERN void
free_TrustVerificationError(TrustVerificationError *arg1) {
SWIG_RubyRemoveTracking(arg1);
delete arg1;
}
swig_class cLibError;
SWIGINTERN VALUE
_wrap_LibError_clearErrorLogs(int argc, VALUE *argv, VALUE self) {
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
LibError::clearErrorLogs();
return Qnil;
fail:
return Qnil;
}
#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_LibError_allocate(VALUE self) {
#else
SWIGINTERN VALUE
_wrap_LibError_allocate(int argc, VALUE *argv, VALUE self) {
#endif
VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_LibError);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
rb_obj_call_init(vresult, argc, argv);
#endif
return vresult;
}
SWIGINTERN VALUE
_wrap_new_LibError(int argc, VALUE *argv, VALUE self) {
LibError *result = 0 ;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
{
try
{
result = (LibError *)new LibError();DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
SWIGINTERN void
free_LibError(LibError *arg1) {
SWIG_RubyRemoveTracking(arg1);
delete arg1;
}
swig_class cX509CertificateBase;
SWIGINTERN VALUE
_wrap_new_X509CertificateBase__SWIG_0(int argc, VALUE *argv, VALUE self) {
X509Certificate *result = 0 ;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
{
try
{
result = (X509Certificate *)new X509Certificate();DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_X509CertificateBase_allocate(VALUE self) {
#else
SWIGINTERN VALUE
_wrap_X509CertificateBase_allocate(int argc, VALUE *argv, VALUE self) {
#endif
VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_X509Certificate);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
rb_obj_call_init(vresult, argc, argv);
#endif
return vresult;
}
SWIGINTERN VALUE
_wrap_new_X509CertificateBase__SWIG_1(int argc, VALUE *argv, VALUE self) {
X509Certificate *arg1 = 0 ;
X509Certificate *result = 0 ;
void *argp1 ;
int res1 = 0 ;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0], &argp1, SWIGTYPE_p_X509Certificate, 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "X509Certificate" "', argument " "1"" of type '" "X509Certificate const &""'");
}
if (!argp1) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "X509Certificate" "', argument " "1"" of type '" "X509Certificate const &""'");
}
arg1 = reinterpret_cast< X509Certificate * >(argp1);
{
try
{
try {
result = (X509Certificate *)new X509Certificate((X509Certificate const &)*arg1);DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch(MemoryError &_e) {
SWIG_exception(SWIG_MemoryError, (&_e)->what());
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
SWIGINTERN VALUE _wrap_new_X509CertificateBase(int nargs, VALUE *args, VALUE self) {
int argc;
VALUE argv[1];
int ii;
argc = nargs;
if (argc > 1) SWIG_fail;
for (ii = 0; (ii < argc); ii++) {
argv[ii] = args[ii];
}
if (argc == 0) {
return _wrap_new_X509CertificateBase__SWIG_0(nargs, args, self);
}
if (argc == 1) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_X509Certificate, 0);
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_new_X509CertificateBase__SWIG_1(nargs, args, self);
}
}
fail:
rb_raise(rb_eArgError, "No matching function for overloaded 'new_X509CertificateBase'");
return Qnil;
}
SWIGINTERN void
free_X509Certificate(X509Certificate *arg1) {
SWIG_RubyRemoveTracking(arg1);
delete arg1;
}
SWIGINTERN VALUE
_wrap_X509CertificateBase_loadFromFile(int argc, VALUE *argv, VALUE self) {
X509Certificate *arg1 = (X509Certificate *) 0 ;
std::string arg2 ;
std::string arg3 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 2) || (argc > 2)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_X509Certificate, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "loadFromFile" "', argument " "1"" of type '" "X509Certificate *""'");
}
arg1 = reinterpret_cast< X509Certificate * >(argp1);
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "loadFromFile" "', argument " "2"" of type '" "std::string""'");
}
arg2 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[1], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "loadFromFile" "', argument " "3"" of type '" "std::string""'");
}
arg3 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
try
{
try {
result = (int)(arg1)->loadFromFile(arg2,arg3);
}
catch(IOError &_e) {
SWIG_exception(SWIG_IOError, (&_e)->what());
}
catch(KeyError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_KeyError, SWIG_NewPointerObj((new KeyError(static_cast< const KeyError& >(_e))),SWIGTYPE_p_KeyError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_X509CertificateBase_getSubjectDN(int argc, VALUE *argv, VALUE self) {
X509Certificate *arg1 = (X509Certificate *) 0 ;
std::string result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_X509Certificate, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getSubjectDN" "', argument " "1"" of type '" "X509Certificate *""'");
}
arg1 = reinterpret_cast< X509Certificate * >(argp1);
{
try
{
result = (arg1)->getSubjectDN();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_std_string(static_cast< std::string >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_X509CertificateBase_getIssuerDN(int argc, VALUE *argv, VALUE self) {
X509Certificate *arg1 = (X509Certificate *) 0 ;
std::string result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_X509Certificate, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getIssuerDN" "', argument " "1"" of type '" "X509Certificate *""'");
}
arg1 = reinterpret_cast< X509Certificate * >(argp1);
{
try
{
result = (arg1)->getIssuerDN();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_std_string(static_cast< std::string >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_X509CertificateBase_getVersion(int argc, VALUE *argv, VALUE self) {
X509Certificate *arg1 = (X509Certificate *) 0 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_X509Certificate, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getVersion" "', argument " "1"" of type '" "X509Certificate *""'");
}
arg1 = reinterpret_cast< X509Certificate * >(argp1);
{
try
{
result = (int)(arg1)->getVersion();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_X509CertificateBase_isValid(int argc, VALUE *argv, VALUE self) {
X509Certificate *arg1 = (X509Certificate *) 0 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_X509Certificate, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "isValid" "', argument " "1"" of type '" "X509Certificate *""'");
}
arg1 = reinterpret_cast< X509Certificate * >(argp1);
{
try
{
result = (int)(arg1)->isValid();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_X509CertificateBase_getBasicConstraints(int argc, VALUE *argv, VALUE self) {
X509Certificate *arg1 = (X509Certificate *) 0 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_X509Certificate, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getBasicConstraints" "', argument " "1"" of type '" "X509Certificate *""'");
}
arg1 = reinterpret_cast< X509Certificate * >(argp1);
{
try
{
result = (int)(arg1)->getBasicConstraints();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_X509CertificateBase_getKey(int argc, VALUE *argv, VALUE self) {
X509Certificate *arg1 = (X509Certificate *) 0 ;
SwigValueWrapper<CountPtrTo<Key > > result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_X509Certificate, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getKey" "', argument " "1"" of type '" "X509Certificate const *""'");
}
arg1 = reinterpret_cast< X509Certificate * >(argp1);
{
try
{
result = ((X509Certificate const *)arg1)->getKey();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_NewPointerObj((new KeyPtr(static_cast< const KeyPtr& >(result))), SWIGTYPE_p_CountPtrToTKey_t, SWIG_POINTER_OWN | 0 );
return vresult;
fail:
return Qnil;
}
swig_class cX509Certificate;
SWIGINTERN void
free_CountPtrTo_Sl_X509Certificate_Sg_(CountPtrTo<X509Certificate > *arg1) {
SWIG_RubyRemoveTracking(arg1);
delete arg1;
}
SWIGINTERN VALUE
_wrap_X509Certificate___deref__(int argc, VALUE *argv, VALUE self) {
CountPtrTo<X509Certificate > *arg1 = (CountPtrTo<X509Certificate > *) 0 ;
X509Certificate *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTX509Certificate_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "operator ->" "', argument " "1"" of type '" "CountPtrTo<X509Certificate > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<X509Certificate > * >(argp1);
{
try
{
result = (X509Certificate *)(arg1)->operator ->();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_X509Certificate, 0 | 0 );
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_new_X509Certificate__SWIG_0(int argc, VALUE *argv, VALUE self) {
CountPtrTo<X509Certificate > *result = 0 ;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
{
try
{
result = (CountPtrTo<X509Certificate > *)new_CountPtrTo_Sl_X509Certificate_Sg___SWIG_0();DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_X509Certificate_allocate(VALUE self) {
#else
SWIGINTERN VALUE
_wrap_X509Certificate_allocate(int argc, VALUE *argv, VALUE self) {
#endif
VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_CountPtrToTX509Certificate_t);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
rb_obj_call_init(vresult, argc, argv);
#endif
return vresult;
}
SWIGINTERN VALUE
_wrap_new_X509Certificate__SWIG_1(int argc, VALUE *argv, VALUE self) {
CountPtrTo<X509Certificate > *arg1 = 0 ;
CountPtrTo<X509Certificate > *result = 0 ;
void *argp1 ;
int res1 = 0 ;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0], &argp1, SWIGTYPE_p_CountPtrToTX509Certificate_t, 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CountPtrTo<(X509Certificate)>" "', argument " "1"" of type '" "CountPtrTo<X509Certificate > const &""'");
}
if (!argp1) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CountPtrTo<(X509Certificate)>" "', argument " "1"" of type '" "CountPtrTo<X509Certificate > const &""'");
}
arg1 = reinterpret_cast< CountPtrTo<X509Certificate > * >(argp1);
{
try
{
try {
result = (CountPtrTo<X509Certificate > *)new_CountPtrTo_Sl_X509Certificate_Sg___SWIG_1((CountPtrTo<X509Certificate > const &)*arg1);DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch(MemoryError &_e) {
SWIG_exception(SWIG_MemoryError, (&_e)->what());
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
SWIGINTERN VALUE _wrap_new_X509Certificate(int nargs, VALUE *args, VALUE self) {
int argc;
VALUE argv[1];
int ii;
argc = nargs;
if (argc > 1) SWIG_fail;
for (ii = 0; (ii < argc); ii++) {
argv[ii] = args[ii];
}
if (argc == 0) {
return _wrap_new_X509Certificate__SWIG_0(nargs, args, self);
}
if (argc == 1) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CountPtrToTX509Certificate_t, 0);
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_new_X509Certificate__SWIG_1(nargs, args, self);
}
}
fail:
rb_raise(rb_eArgError, "No matching function for overloaded 'new_X509Certificate'");
return Qnil;
}
SWIGINTERN VALUE
_wrap_X509Certificate_loadFromFile(int argc, VALUE *argv, VALUE self) {
CountPtrTo<X509Certificate > *arg1 = (CountPtrTo<X509Certificate > *) 0 ;
std::string arg2 ;
std::string arg3 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 2) || (argc > 2)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTX509Certificate_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "loadFromFile" "', argument " "1"" of type '" "CountPtrTo<X509Certificate > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<X509Certificate > * >(argp1);
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "loadFromFile" "', argument " "2"" of type '" "std::string""'");
}
arg2 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[1], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "loadFromFile" "', argument " "3"" of type '" "std::string""'");
}
arg3 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
try
{
try {
result = (int)(*arg1)->loadFromFile(arg2,arg3);
}
catch(IOError &_e) {
SWIG_exception(SWIG_IOError, (&_e)->what());
}
catch(KeyError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_KeyError, SWIG_NewPointerObj((new KeyError(static_cast< const KeyError& >(_e))),SWIGTYPE_p_KeyError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_X509Certificate_getSubjectDN(int argc, VALUE *argv, VALUE self) {
CountPtrTo<X509Certificate > *arg1 = (CountPtrTo<X509Certificate > *) 0 ;
std::string result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTX509Certificate_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getSubjectDN" "', argument " "1"" of type '" "CountPtrTo<X509Certificate > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<X509Certificate > * >(argp1);
{
try
{
result = (*arg1)->getSubjectDN();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_std_string(static_cast< std::string >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_X509Certificate_getIssuerDN(int argc, VALUE *argv, VALUE self) {
CountPtrTo<X509Certificate > *arg1 = (CountPtrTo<X509Certificate > *) 0 ;
std::string result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTX509Certificate_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getIssuerDN" "', argument " "1"" of type '" "CountPtrTo<X509Certificate > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<X509Certificate > * >(argp1);
{
try
{
result = (*arg1)->getIssuerDN();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_std_string(static_cast< std::string >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_X509Certificate_getVersion(int argc, VALUE *argv, VALUE self) {
CountPtrTo<X509Certificate > *arg1 = (CountPtrTo<X509Certificate > *) 0 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTX509Certificate_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getVersion" "', argument " "1"" of type '" "CountPtrTo<X509Certificate > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<X509Certificate > * >(argp1);
{
try
{
result = (int)(*arg1)->getVersion();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_X509Certificate_isValid(int argc, VALUE *argv, VALUE self) {
CountPtrTo<X509Certificate > *arg1 = (CountPtrTo<X509Certificate > *) 0 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTX509Certificate_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "isValid" "', argument " "1"" of type '" "CountPtrTo<X509Certificate > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<X509Certificate > * >(argp1);
{
try
{
result = (int)(*arg1)->isValid();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_X509Certificate_getBasicConstraints(int argc, VALUE *argv, VALUE self) {
CountPtrTo<X509Certificate > *arg1 = (CountPtrTo<X509Certificate > *) 0 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTX509Certificate_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getBasicConstraints" "', argument " "1"" of type '" "CountPtrTo<X509Certificate > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<X509Certificate > * >(argp1);
{
try
{
result = (int)(*arg1)->getBasicConstraints();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_X509Certificate_getKey(int argc, VALUE *argv, VALUE self) {
CountPtrTo<X509Certificate > *arg1 = (CountPtrTo<X509Certificate > *) 0 ;
SwigValueWrapper<CountPtrTo<Key > > result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTX509Certificate_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getKey" "', argument " "1"" of type '" "CountPtrTo<X509Certificate > const *""'");
}
arg1 = reinterpret_cast< CountPtrTo<X509Certificate > * >(argp1);
{
try
{
result = (*arg1)->getKey();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_NewPointerObj((new KeyPtr(static_cast< const KeyPtr& >(result))), SWIGTYPE_p_CountPtrToTKey_t, SWIG_POINTER_OWN | 0 );
return vresult;
fail:
return Qnil;
}
swig_class cX509CertificateVector;
SWIGINTERN VALUE
_wrap_new_X509CertificateVector__SWIG_0(int argc, VALUE *argv, VALUE self) {
std::vector<X509CertificatePtr > *result = 0 ;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
{
try
{
result = (std::vector<X509CertificatePtr > *)new std::vector<X509CertificatePtr >();DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_new_X509CertificateVector__SWIG_1(int argc, VALUE *argv, VALUE self) {
unsigned int arg1 ;
std::vector<X509CertificatePtr > *result = 0 ;
unsigned int val1 ;
int ecode1 = 0 ;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
ecode1 = SWIG_AsVal_unsigned_SS_int(argv[0], &val1);
if (!SWIG_IsOK(ecode1)) {
SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "std::vector<(X509CertificatePtr)>" "', argument " "1"" of type '" "unsigned int""'");
}
arg1 = static_cast< unsigned int >(val1);
{
try
{
result = (std::vector<X509CertificatePtr > *)new std::vector<X509CertificatePtr >(arg1);DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_new_X509CertificateVector__SWIG_2(int argc, VALUE *argv, VALUE self) {
unsigned int arg1 ;
CountPtrTo<X509Certificate > *arg2 = 0 ;
std::vector<X509CertificatePtr > *result = 0 ;
unsigned int val1 ;
int ecode1 = 0 ;
void *argp2 ;
int res2 = 0 ;
if ((argc < 2) || (argc > 2)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
}
ecode1 = SWIG_AsVal_unsigned_SS_int(argv[0], &val1);
if (!SWIG_IsOK(ecode1)) {
SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "std::vector<(X509CertificatePtr)>" "', argument " "1"" of type '" "unsigned int""'");
}
arg1 = static_cast< unsigned int >(val1);
res2 = SWIG_ConvertPtr(argv[1], &argp2, SWIGTYPE_p_CountPtrToTX509Certificate_t, 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "std::vector<(X509CertificatePtr)>" "', argument " "2"" of type '" "CountPtrTo<X509Certificate > const &""'");
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "std::vector<(X509CertificatePtr)>" "', argument " "2"" of type '" "CountPtrTo<X509Certificate > const &""'");
}
arg2 = reinterpret_cast< CountPtrTo<X509Certificate > * >(argp2);
{
try
{
result = (std::vector<X509CertificatePtr > *)new std::vector<X509CertificatePtr >(arg1,(CountPtrTo<X509Certificate > const &)*arg2);DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_X509CertificateVector_allocate(VALUE self) {
#else
SWIGINTERN VALUE
_wrap_X509CertificateVector_allocate(int argc, VALUE *argv, VALUE self) {
#endif
VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_std__vectorTCountPtrToTX509Certificate_t_t);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
rb_obj_call_init(vresult, argc, argv);
#endif
return vresult;
}
SWIGINTERN VALUE
_wrap_new_X509CertificateVector__SWIG_3(int argc, VALUE *argv, VALUE self) {
std::vector<CountPtrTo<X509Certificate > > *arg1 = 0 ;
std::vector<X509CertificatePtr > *result = 0 ;
std::vector<CountPtrTo<X509Certificate > > temp1 ;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
{
if (rb_obj_is_kind_of(argv[0],rb_cArray)) {
unsigned int size = RARRAY_LEN(argv[0]);
arg1 = &temp1;
for (unsigned int i=0; i<size; i++) {
VALUE o = RARRAY_PTR(argv[0])[i];
CountPtrTo<X509Certificate >* x;
SWIG_ConvertPtr(o, (void **) &x, SWIGTYPE_p_CountPtrToTX509Certificate_t, 1);
temp1.push_back(*x);
}
} else {
SWIG_ConvertPtr(argv[0], (void **) &arg1, SWIGTYPE_p_std__vectorTCountPtrToTX509Certificate_t_t, 1);
}
}
{
try
{
result = (std::vector<X509CertificatePtr > *)new std::vector<X509CertificatePtr >((std::vector<CountPtrTo<X509Certificate > > const &)*arg1);DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
SWIGINTERN VALUE _wrap_new_X509CertificateVector(int nargs, VALUE *args, VALUE self) {
int argc;
VALUE argv[2];
int ii;
argc = nargs;
if (argc > 2) SWIG_fail;
for (ii = 0; (ii < argc); ii++) {
argv[ii] = args[ii];
}
if (argc == 0) {
return _wrap_new_X509CertificateVector__SWIG_0(nargs, args, self);
}
if (argc == 1) {
int _v;
{
int res = SWIG_AsVal_unsigned_SS_int(argv[0], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
return _wrap_new_X509CertificateVector__SWIG_1(nargs, args, self);
}
}
if (argc == 1) {
int _v;
{
/* native sequence? */
if (rb_obj_is_kind_of(argv[0],rb_cArray)) {
unsigned int size = RARRAY_LEN(argv[0]);
if (size == 0) {
/* an empty sequence can be of any type */
_v = 1;
} else {
/* check the first element only */
CountPtrTo<X509Certificate >* x;
VALUE o = RARRAY_PTR(argv[0])[0];
if ((SWIG_ConvertPtr(o,(void **) &x,
SWIGTYPE_p_CountPtrToTX509Certificate_t,0)) != -1)
_v = 1;
else
_v = 0;
}
} else {
/* wrapped vector? */
std::vector<CountPtrTo<X509Certificate > >* v;
if (SWIG_ConvertPtr(argv[0],(void **) &v,
SWIGTYPE_p_std__vectorTCountPtrToTX509Certificate_t_t,0) != -1)
_v = 1;
else
_v = 0;
}
}
if (_v) {
return _wrap_new_X509CertificateVector__SWIG_3(nargs, args, self);
}
}
if (argc == 2) {
int _v;
{
int res = SWIG_AsVal_unsigned_SS_int(argv[0], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_CountPtrToTX509Certificate_t, 0);
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_new_X509CertificateVector__SWIG_2(nargs, args, self);
}
}
}
fail:
rb_raise(rb_eArgError, "No matching function for overloaded 'new_X509CertificateVector'");
return Qnil;
}
SWIGINTERN VALUE
_wrap_X509CertificateVector___len__(int argc, VALUE *argv, VALUE self) {
std::vector<X509CertificatePtr > *arg1 = (std::vector<X509CertificatePtr > *) 0 ;
unsigned int result;
std::vector<CountPtrTo<X509Certificate > > temp1 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
{
if (rb_obj_is_kind_of(self,rb_cArray)) {
unsigned int size = RARRAY_LEN(self);
arg1 = &temp1;
for (unsigned int i=0; i<size; i++) {
VALUE o = RARRAY_PTR(self)[i];
CountPtrTo<X509Certificate >* x;
SWIG_ConvertPtr(o, (void **) &x, SWIGTYPE_p_CountPtrToTX509Certificate_t, 1);
temp1.push_back(*x);
}
} else {
SWIG_ConvertPtr(self, (void **) &arg1, SWIGTYPE_p_std__vectorTCountPtrToTX509Certificate_t_t, 1);
}
}
{
try
{
result = (unsigned int)((std::vector<X509CertificatePtr > const *)arg1)->size();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_X509CertificateVector_emptyq___(int argc, VALUE *argv, VALUE self) {
std::vector<X509CertificatePtr > *arg1 = (std::vector<X509CertificatePtr > *) 0 ;
bool result;
std::vector<CountPtrTo<X509Certificate > > temp1 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
{
if (rb_obj_is_kind_of(self,rb_cArray)) {
unsigned int size = RARRAY_LEN(self);
arg1 = &temp1;
for (unsigned int i=0; i<size; i++) {
VALUE o = RARRAY_PTR(self)[i];
CountPtrTo<X509Certificate >* x;
SWIG_ConvertPtr(o, (void **) &x, SWIGTYPE_p_CountPtrToTX509Certificate_t, 1);
temp1.push_back(*x);
}
} else {
SWIG_ConvertPtr(self, (void **) &arg1, SWIGTYPE_p_std__vectorTCountPtrToTX509Certificate_t_t, 1);
}
}
{
try
{
result = (bool)((std::vector<X509CertificatePtr > const *)arg1)->empty();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_bool(static_cast< bool >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_X509CertificateVector_clear(int argc, VALUE *argv, VALUE self) {
std::vector<X509CertificatePtr > *arg1 = (std::vector<X509CertificatePtr > *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorTCountPtrToTX509Certificate_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "clear" "', argument " "1"" of type '" "std::vector<X509CertificatePtr > *""'");
}
arg1 = reinterpret_cast< std::vector<X509CertificatePtr > * >(argp1);
{
try
{
(arg1)->clear();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return Qnil;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_X509CertificateVector_push(int argc, VALUE *argv, VALUE self) {
std::vector<X509CertificatePtr > *arg1 = (std::vector<X509CertificatePtr > *) 0 ;
CountPtrTo<X509Certificate > *arg2 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 ;
int res2 = 0 ;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorTCountPtrToTX509Certificate_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "push_back" "', argument " "1"" of type '" "std::vector<X509CertificatePtr > *""'");
}
arg1 = reinterpret_cast< std::vector<X509CertificatePtr > * >(argp1);
res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_CountPtrToTX509Certificate_t, 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "push_back" "', argument " "2"" of type '" "CountPtrTo<X509Certificate > const &""'");
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "push_back" "', argument " "2"" of type '" "CountPtrTo<X509Certificate > const &""'");
}
arg2 = reinterpret_cast< CountPtrTo<X509Certificate > * >(argp2);
{
try
{
(arg1)->push_back((CountPtrTo<X509Certificate > const &)*arg2);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return Qnil;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_X509CertificateVector_pop(int argc, VALUE *argv, VALUE self) {
std::vector<X509CertificatePtr > *arg1 = (std::vector<X509CertificatePtr > *) 0 ;
SwigValueWrapper<CountPtrTo<X509Certificate > > result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorTCountPtrToTX509Certificate_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pop" "', argument " "1"" of type '" "std::vector<X509CertificatePtr > *""'");
}
arg1 = reinterpret_cast< std::vector<X509CertificatePtr > * >(argp1);
{
try
{
try {
result = std_vector_Sl_X509CertificatePtr_Sg__pop(arg1);
}
catch(std::out_of_range &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_std__out_of_range, SWIG_NewPointerObj((new std::out_of_range(static_cast< const std::out_of_range& >(_e))),SWIGTYPE_p_std__out_of_range,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_NewPointerObj((new CountPtrTo<X509Certificate >(static_cast< const CountPtrTo<X509Certificate >& >(result))), SWIGTYPE_p_CountPtrToTX509Certificate_t, SWIG_POINTER_OWN | 0 );
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_X509CertificateVector___getitem__(int argc, VALUE *argv, VALUE self) {
std::vector<X509CertificatePtr > *arg1 = (std::vector<X509CertificatePtr > *) 0 ;
int arg2 ;
CountPtrTo<X509Certificate > *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int val2 ;
int ecode2 = 0 ;
VALUE vresult = Qnil;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorTCountPtrToTX509Certificate_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "__getitem__" "', argument " "1"" of type '" "std::vector<X509CertificatePtr > *""'");
}
arg1 = reinterpret_cast< std::vector<X509CertificatePtr > * >(argp1);
ecode2 = SWIG_AsVal_int(argv[0], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "__getitem__" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
{
try
{
try {
{
CountPtrTo<X509Certificate > &_result_ref = std_vector_Sl_X509CertificatePtr_Sg____getitem__(arg1,arg2);
result = (CountPtrTo<X509Certificate > *) &_result_ref;
}
}
catch(std::out_of_range &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_std__out_of_range, SWIG_NewPointerObj((new std::out_of_range(static_cast< const std::out_of_range& >(_e))),SWIGTYPE_p_std__out_of_range,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CountPtrToTX509Certificate_t, 0 | 0 );
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_X509CertificateVector___setitem__(int argc, VALUE *argv, VALUE self) {
std::vector<X509CertificatePtr > *arg1 = (std::vector<X509CertificatePtr > *) 0 ;
int arg2 ;
CountPtrTo<X509Certificate > *arg3 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int val2 ;
int ecode2 = 0 ;
void *argp3 ;
int res3 = 0 ;
if ((argc < 2) || (argc > 2)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorTCountPtrToTX509Certificate_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "__setitem__" "', argument " "1"" of type '" "std::vector<X509CertificatePtr > *""'");
}
arg1 = reinterpret_cast< std::vector<X509CertificatePtr > * >(argp1);
ecode2 = SWIG_AsVal_int(argv[0], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "__setitem__" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
res3 = SWIG_ConvertPtr(argv[1], &argp3, SWIGTYPE_p_CountPtrToTX509Certificate_t, 0 );
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "__setitem__" "', argument " "3"" of type '" "CountPtrTo<X509Certificate > const &""'");
}
if (!argp3) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "__setitem__" "', argument " "3"" of type '" "CountPtrTo<X509Certificate > const &""'");
}
arg3 = reinterpret_cast< CountPtrTo<X509Certificate > * >(argp3);
{
try
{
try {
std_vector_Sl_X509CertificatePtr_Sg____setitem__(arg1,arg2,(CountPtrTo<X509Certificate > const &)*arg3);
}
catch(std::out_of_range &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_std__out_of_range, SWIG_NewPointerObj((new std::out_of_range(static_cast< const std::out_of_range& >(_e))),SWIGTYPE_p_std__out_of_range,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return Qnil;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_X509CertificateVector_each(int argc, VALUE *argv, VALUE self) {
std::vector<X509CertificatePtr > *arg1 = (std::vector<X509CertificatePtr > *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorTCountPtrToTX509Certificate_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "each" "', argument " "1"" of type '" "std::vector<X509CertificatePtr > *""'");
}
arg1 = reinterpret_cast< std::vector<X509CertificatePtr > * >(argp1);
{
try
{
std_vector_Sl_X509CertificatePtr_Sg__each(arg1);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return Qnil;
fail:
return Qnil;
}
SWIGINTERN void
free_std_vector_Sl_X509CertificatePtr_Sg_(std::vector<X509CertificatePtr > *arg1) {
SWIG_RubyRemoveTracking(arg1);
delete arg1;
}
swig_class cKeyBase;
SWIGINTERN VALUE
_wrap_new_KeyBase__SWIG_0(int argc, VALUE *argv, VALUE self) {
Key *result = 0 ;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
{
try
{
result = (Key *)new Key();DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_new_KeyBase__SWIG_1(int argc, VALUE *argv, VALUE self) {
SwigValueWrapper<CountPtrTo<X509Certificate > > arg1 ;
Key *result = 0 ;
void *argp1 ;
int res1 = 0 ;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
{
res1 = SWIG_ConvertPtr(argv[0], &argp1, SWIGTYPE_p_CountPtrToTX509Certificate_t, 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Key" "', argument " "1"" of type '" "X509CertificatePtr""'");
}
if (!argp1) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Key" "', argument " "1"" of type '" "X509CertificatePtr""'");
} else {
arg1 = *(reinterpret_cast< X509CertificatePtr * >(argp1));
}
}
{
try
{
try {
result = (Key *)new Key(arg1);DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_KeyBase_allocate(VALUE self) {
#else
SWIGINTERN VALUE
_wrap_KeyBase_allocate(int argc, VALUE *argv, VALUE self) {
#endif
VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Key);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
rb_obj_call_init(vresult, argc, argv);
#endif
return vresult;
}
SWIGINTERN VALUE
_wrap_new_KeyBase__SWIG_2(int argc, VALUE *argv, VALUE self) {
std::vector<X509CertificatePtr > arg1 ;
Key *result = 0 ;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
{
if (rb_obj_is_kind_of(argv[0],rb_cArray)) {
unsigned int size = RARRAY_LEN(argv[0]);
arg1;
for (unsigned int i=0; i<size; i++) {
VALUE o = RARRAY_PTR(argv[0])[i];
CountPtrTo<X509Certificate >* x;
SWIG_ConvertPtr(o, (void **) &x, SWIGTYPE_p_CountPtrToTX509Certificate_t, 1);
(&arg1)->push_back(*x);
}
} else {
void *ptr;
SWIG_ConvertPtr(argv[0], &ptr, SWIGTYPE_p_std__vectorTCountPtrToTX509Certificate_t_t, 1);
arg1 = *((std::vector<X509CertificatePtr > *) ptr);
}
}
{
try
{
try {
result = (Key *)new Key(arg1);DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch(MemoryError &_e) {
SWIG_exception(SWIG_MemoryError, (&_e)->what());
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(ValueError &_e) {
SWIG_exception(SWIG_ValueError, (&_e)->what());
}
catch(KeyError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_KeyError, SWIG_NewPointerObj((new KeyError(static_cast< const KeyError& >(_e))),SWIGTYPE_p_KeyError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
SWIGINTERN VALUE _wrap_new_KeyBase(int nargs, VALUE *args, VALUE self) {
int argc;
VALUE argv[1];
int ii;
argc = nargs;
if (argc > 1) SWIG_fail;
for (ii = 0; (ii < argc); ii++) {
argv[ii] = args[ii];
}
if (argc == 0) {
return _wrap_new_KeyBase__SWIG_0(nargs, args, self);
}
if (argc == 1) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CountPtrToTX509Certificate_t, 0);
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_new_KeyBase__SWIG_1(nargs, args, self);
}
}
if (argc == 1) {
int _v;
{
/* native sequence? */
if (rb_obj_is_kind_of(argv[0],rb_cArray)) {
unsigned int size = RARRAY_LEN(argv[0]);
if (size == 0) {
/* an empty sequence can be of any type */
_v = 1;
} else {
/* check the first element only */
CountPtrTo<X509Certificate >* x;
VALUE o = RARRAY_PTR(argv[0])[0];
if ((SWIG_ConvertPtr(o,(void **) &x,
SWIGTYPE_p_CountPtrToTX509Certificate_t,0)) != -1)
_v = 1;
else
_v = 0;
}
} else {
/* wrapped vector? */
std::vector<CountPtrTo<X509Certificate > >* v;
if (SWIG_ConvertPtr(argv[0],(void **) &v,
SWIGTYPE_p_std__vectorTCountPtrToTX509Certificate_t_t,0) != -1)
_v = 1;
else
_v = 0;
}
}
if (_v) {
return _wrap_new_KeyBase__SWIG_2(nargs, args, self);
}
}
fail:
rb_raise(rb_eArgError, "No matching function for overloaded 'new_KeyBase'");
return Qnil;
}
SWIGINTERN void
free_Key(Key *arg1) {
SWIG_RubyRemoveTracking(arg1);
delete arg1;
}
SWIGINTERN VALUE
_wrap_KeyBase_loadFromFile(int argc, VALUE *argv, VALUE self) {
Key *arg1 = (Key *) 0 ;
std::string arg2 ;
std::string arg3 ;
std::string arg4 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 3) || (argc > 3)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Key, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "loadFromFile" "', argument " "1"" of type '" "Key *""'");
}
arg1 = reinterpret_cast< Key * >(argp1);
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "loadFromFile" "', argument " "2"" of type '" "std::string""'");
}
arg2 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[1], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "loadFromFile" "', argument " "3"" of type '" "std::string""'");
}
arg3 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[2], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "loadFromFile" "', argument " "4"" of type '" "std::string""'");
}
arg4 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
try
{
try {
result = (int)(arg1)->loadFromFile(arg2,arg3,arg4);
}
catch(IOError &_e) {
SWIG_exception(SWIG_IOError, (&_e)->what());
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_KeyBase_loadFromKeyInfoFile(int argc, VALUE *argv, VALUE self) {
Key *arg1 = (Key *) 0 ;
std::string arg2 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Key, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "loadFromKeyInfoFile" "', argument " "1"" of type '" "Key *""'");
}
arg1 = reinterpret_cast< Key * >(argp1);
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "loadFromKeyInfoFile" "', argument " "2"" of type '" "std::string""'");
}
arg2 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
try
{
try {
result = (int)(arg1)->loadFromKeyInfoFile(arg2);
}
catch(MemoryError &_e) {
SWIG_exception(SWIG_MemoryError, (&_e)->what());
}
catch(IOError &_e) {
SWIG_exception(SWIG_IOError, (&_e)->what());
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(XMLError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_XMLError, SWIG_NewPointerObj((new XMLError(static_cast< const XMLError& >(_e))),SWIGTYPE_p_XMLError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_KeyBase_loadHMACFromString(int argc, VALUE *argv, VALUE self) {
Key *arg1 = (Key *) 0 ;
std::string arg2 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Key, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "loadHMACFromString" "', argument " "1"" of type '" "Key *""'");
}
arg1 = reinterpret_cast< Key * >(argp1);
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "loadHMACFromString" "', argument " "2"" of type '" "std::string""'");
}
arg2 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
try
{
try {
result = (int)(arg1)->loadHMACFromString(arg2);
}
catch(MemoryError &_e) {
SWIG_exception(SWIG_MemoryError, (&_e)->what());
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(KeyError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_KeyError, SWIG_NewPointerObj((new KeyError(static_cast< const KeyError& >(_e))),SWIGTYPE_p_KeyError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_KeyBase_setName(int argc, VALUE *argv, VALUE self) {
Key *arg1 = (Key *) 0 ;
std::string arg2 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Key, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "setName" "', argument " "1"" of type '" "Key *""'");
}
arg1 = reinterpret_cast< Key * >(argp1);
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "setName" "', argument " "2"" of type '" "std::string""'");
}
arg2 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
try
{
try {
result = (int)(arg1)->setName(arg2);
}
catch(KeyError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_KeyError, SWIG_NewPointerObj((new KeyError(static_cast< const KeyError& >(_e))),SWIGTYPE_p_KeyError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_KeyBase_getName(int argc, VALUE *argv, VALUE self) {
Key *arg1 = (Key *) 0 ;
std::string result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Key, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getName" "', argument " "1"" of type '" "Key *""'");
}
arg1 = reinterpret_cast< Key * >(argp1);
{
try
{
result = (arg1)->getName();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_std_string(static_cast< std::string >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_KeyBase_isValid(int argc, VALUE *argv, VALUE self) {
Key *arg1 = (Key *) 0 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Key, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "isValid" "', argument " "1"" of type '" "Key *""'");
}
arg1 = reinterpret_cast< Key * >(argp1);
{
try
{
result = (int)(arg1)->isValid();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_KeyBase_getCertificate(int argc, VALUE *argv, VALUE self) {
Key *arg1 = (Key *) 0 ;
SwigValueWrapper<CountPtrTo<X509Certificate > > result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Key, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getCertificate" "', argument " "1"" of type '" "Key *""'");
}
arg1 = reinterpret_cast< Key * >(argp1);
{
try
{
try {
result = (arg1)->getCertificate();
}
catch(KeyError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_KeyError, SWIG_NewPointerObj((new KeyError(static_cast< const KeyError& >(_e))),SWIGTYPE_p_KeyError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_NewPointerObj((new X509CertificatePtr(static_cast< const X509CertificatePtr& >(result))), SWIGTYPE_p_CountPtrToTX509Certificate_t, SWIG_POINTER_OWN | 0 );
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_KeyBase_getCertificateChain(int argc, VALUE *argv, VALUE self) {
Key *arg1 = (Key *) 0 ;
SwigValueWrapper<vector<CountPtrTo<X509Certificate > > > result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Key, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getCertificateChain" "', argument " "1"" of type '" "Key *""'");
}
arg1 = reinterpret_cast< Key * >(argp1);
{
try
{
result = (arg1)->getCertificateChain();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_NewPointerObj((new vector<X509CertificatePtr >(static_cast< const vector<X509CertificatePtr >& >(result))), SWIGTYPE_p_vectorTCountPtrToTX509Certificate_t_t, SWIG_POINTER_OWN | 0 );
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_KeyBase_dump(int argc, VALUE *argv, VALUE self) {
Key *arg1 = (Key *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Key, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dump" "', argument " "1"" of type '" "Key *""'");
}
arg1 = reinterpret_cast< Key * >(argp1);
{
try
{
(arg1)->dump();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return Qnil;
fail:
return Qnil;
}
swig_class cKey;
SWIGINTERN void
free_CountPtrTo_Sl_Key_Sg_(CountPtrTo<Key > *arg1) {
SWIG_RubyRemoveTracking(arg1);
delete arg1;
}
SWIGINTERN VALUE
_wrap_Key___deref__(int argc, VALUE *argv, VALUE self) {
CountPtrTo<Key > *arg1 = (CountPtrTo<Key > *) 0 ;
Key *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTKey_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "operator ->" "', argument " "1"" of type '" "CountPtrTo<Key > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<Key > * >(argp1);
{
try
{
result = (Key *)(arg1)->operator ->();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Key, 0 | 0 );
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_new_Key__SWIG_0(int argc, VALUE *argv, VALUE self) {
CountPtrTo<Key > *result = 0 ;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
{
try
{
result = (CountPtrTo<Key > *)new_CountPtrTo_Sl_Key_Sg___SWIG_0();DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_new_Key__SWIG_1(int argc, VALUE *argv, VALUE self) {
CountPtrTo<Key > *arg1 = 0 ;
CountPtrTo<Key > *result = 0 ;
void *argp1 ;
int res1 = 0 ;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0], &argp1, SWIGTYPE_p_CountPtrToTKey_t, 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CountPtrTo<(Key)>" "', argument " "1"" of type '" "CountPtrTo<Key > const &""'");
}
if (!argp1) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CountPtrTo<(Key)>" "', argument " "1"" of type '" "CountPtrTo<Key > const &""'");
}
arg1 = reinterpret_cast< CountPtrTo<Key > * >(argp1);
{
try
{
result = (CountPtrTo<Key > *)new_CountPtrTo_Sl_Key_Sg___SWIG_1((CountPtrTo<Key > const &)*arg1);DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_new_Key__SWIG_2(int argc, VALUE *argv, VALUE self) {
SwigValueWrapper<CountPtrTo<X509Certificate > > arg1 ;
CountPtrTo<Key > *result = 0 ;
void *argp1 ;
int res1 = 0 ;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
{
res1 = SWIG_ConvertPtr(argv[0], &argp1, SWIGTYPE_p_CountPtrToTX509Certificate_t, 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CountPtrTo<(Key)>" "', argument " "1"" of type '" "X509CertificatePtr""'");
}
if (!argp1) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CountPtrTo<(Key)>" "', argument " "1"" of type '" "X509CertificatePtr""'");
} else {
arg1 = *(reinterpret_cast< X509CertificatePtr * >(argp1));
}
}
{
try
{
result = (CountPtrTo<Key > *)new_CountPtrTo_Sl_Key_Sg___SWIG_2(arg1);DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_Key_allocate(VALUE self) {
#else
SWIGINTERN VALUE
_wrap_Key_allocate(int argc, VALUE *argv, VALUE self) {
#endif
VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_CountPtrToTKey_t);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
rb_obj_call_init(vresult, argc, argv);
#endif
return vresult;
}
SWIGINTERN VALUE
_wrap_new_Key__SWIG_3(int argc, VALUE *argv, VALUE self) {
std::vector<X509CertificatePtr > arg1 ;
CountPtrTo<Key > *result = 0 ;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
{
if (rb_obj_is_kind_of(argv[0],rb_cArray)) {
unsigned int size = RARRAY_LEN(argv[0]);
arg1;
for (unsigned int i=0; i<size; i++) {
VALUE o = RARRAY_PTR(argv[0])[i];
CountPtrTo<X509Certificate >* x;
SWIG_ConvertPtr(o, (void **) &x, SWIGTYPE_p_CountPtrToTX509Certificate_t, 1);
(&arg1)->push_back(*x);
}
} else {
void *ptr;
SWIG_ConvertPtr(argv[0], &ptr, SWIGTYPE_p_std__vectorTCountPtrToTX509Certificate_t_t, 1);
arg1 = *((std::vector<X509CertificatePtr > *) ptr);
}
}
{
try
{
result = (CountPtrTo<Key > *)new_CountPtrTo_Sl_Key_Sg___SWIG_3(arg1);DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
SWIGINTERN VALUE _wrap_new_Key(int nargs, VALUE *args, VALUE self) {
int argc;
VALUE argv[1];
int ii;
argc = nargs;
if (argc > 1) SWIG_fail;
for (ii = 0; (ii < argc); ii++) {
argv[ii] = args[ii];
}
if (argc == 0) {
return _wrap_new_Key__SWIG_0(nargs, args, self);
}
if (argc == 1) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CountPtrToTKey_t, 0);
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_new_Key__SWIG_1(nargs, args, self);
}
}
if (argc == 1) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CountPtrToTX509Certificate_t, 0);
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_new_Key__SWIG_2(nargs, args, self);
}
}
if (argc == 1) {
int _v;
{
/* native sequence? */
if (rb_obj_is_kind_of(argv[0],rb_cArray)) {
unsigned int size = RARRAY_LEN(argv[0]);
if (size == 0) {
/* an empty sequence can be of any type */
_v = 1;
} else {
/* check the first element only */
CountPtrTo<X509Certificate >* x;
VALUE o = RARRAY_PTR(argv[0])[0];
if ((SWIG_ConvertPtr(o,(void **) &x,
SWIGTYPE_p_CountPtrToTX509Certificate_t,0)) != -1)
_v = 1;
else
_v = 0;
}
} else {
/* wrapped vector? */
std::vector<CountPtrTo<X509Certificate > >* v;
if (SWIG_ConvertPtr(argv[0],(void **) &v,
SWIGTYPE_p_std__vectorTCountPtrToTX509Certificate_t_t,0) != -1)
_v = 1;
else
_v = 0;
}
}
if (_v) {
return _wrap_new_Key__SWIG_3(nargs, args, self);
}
}
fail:
rb_raise(rb_eArgError, "No matching function for overloaded 'new_Key'");
return Qnil;
}
SWIGINTERN VALUE
_wrap_Key_loadFromFile(int argc, VALUE *argv, VALUE self) {
CountPtrTo<Key > *arg1 = (CountPtrTo<Key > *) 0 ;
std::string arg2 ;
std::string arg3 ;
std::string arg4 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 3) || (argc > 3)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTKey_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "loadFromFile" "', argument " "1"" of type '" "CountPtrTo<Key > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<Key > * >(argp1);
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "loadFromFile" "', argument " "2"" of type '" "std::string""'");
}
arg2 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[1], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "loadFromFile" "', argument " "3"" of type '" "std::string""'");
}
arg3 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[2], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "loadFromFile" "', argument " "4"" of type '" "std::string""'");
}
arg4 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
try
{
try {
result = (int)(*arg1)->loadFromFile(arg2,arg3,arg4);
}
catch(IOError &_e) {
SWIG_exception(SWIG_IOError, (&_e)->what());
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_Key_loadFromKeyInfoFile(int argc, VALUE *argv, VALUE self) {
CountPtrTo<Key > *arg1 = (CountPtrTo<Key > *) 0 ;
std::string arg2 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTKey_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "loadFromKeyInfoFile" "', argument " "1"" of type '" "CountPtrTo<Key > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<Key > * >(argp1);
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "loadFromKeyInfoFile" "', argument " "2"" of type '" "std::string""'");
}
arg2 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
try
{
try {
result = (int)(*arg1)->loadFromKeyInfoFile(arg2);
}
catch(MemoryError &_e) {
SWIG_exception(SWIG_MemoryError, (&_e)->what());
}
catch(IOError &_e) {
SWIG_exception(SWIG_IOError, (&_e)->what());
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(XMLError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_XMLError, SWIG_NewPointerObj((new XMLError(static_cast< const XMLError& >(_e))),SWIGTYPE_p_XMLError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_Key_loadHMACFromString(int argc, VALUE *argv, VALUE self) {
CountPtrTo<Key > *arg1 = (CountPtrTo<Key > *) 0 ;
std::string arg2 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTKey_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "loadHMACFromString" "', argument " "1"" of type '" "CountPtrTo<Key > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<Key > * >(argp1);
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "loadHMACFromString" "', argument " "2"" of type '" "std::string""'");
}
arg2 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
try
{
try {
result = (int)(*arg1)->loadHMACFromString(arg2);
}
catch(MemoryError &_e) {
SWIG_exception(SWIG_MemoryError, (&_e)->what());
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(KeyError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_KeyError, SWIG_NewPointerObj((new KeyError(static_cast< const KeyError& >(_e))),SWIGTYPE_p_KeyError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_Key_setName(int argc, VALUE *argv, VALUE self) {
CountPtrTo<Key > *arg1 = (CountPtrTo<Key > *) 0 ;
std::string arg2 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTKey_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "setName" "', argument " "1"" of type '" "CountPtrTo<Key > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<Key > * >(argp1);
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "setName" "', argument " "2"" of type '" "std::string""'");
}
arg2 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
try
{
try {
result = (int)(*arg1)->setName(arg2);
}
catch(KeyError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_KeyError, SWIG_NewPointerObj((new KeyError(static_cast< const KeyError& >(_e))),SWIGTYPE_p_KeyError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_Key_getName(int argc, VALUE *argv, VALUE self) {
CountPtrTo<Key > *arg1 = (CountPtrTo<Key > *) 0 ;
std::string result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTKey_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getName" "', argument " "1"" of type '" "CountPtrTo<Key > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<Key > * >(argp1);
{
try
{
result = (*arg1)->getName();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_std_string(static_cast< std::string >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_Key_isValid(int argc, VALUE *argv, VALUE self) {
CountPtrTo<Key > *arg1 = (CountPtrTo<Key > *) 0 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTKey_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "isValid" "', argument " "1"" of type '" "CountPtrTo<Key > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<Key > * >(argp1);
{
try
{
result = (int)(*arg1)->isValid();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_Key_getCertificate(int argc, VALUE *argv, VALUE self) {
CountPtrTo<Key > *arg1 = (CountPtrTo<Key > *) 0 ;
SwigValueWrapper<CountPtrTo<X509Certificate > > result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTKey_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getCertificate" "', argument " "1"" of type '" "CountPtrTo<Key > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<Key > * >(argp1);
{
try
{
try {
result = (*arg1)->getCertificate();
}
catch(KeyError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_KeyError, SWIG_NewPointerObj((new KeyError(static_cast< const KeyError& >(_e))),SWIGTYPE_p_KeyError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_NewPointerObj((new X509CertificatePtr(static_cast< const X509CertificatePtr& >(result))), SWIGTYPE_p_CountPtrToTX509Certificate_t, SWIG_POINTER_OWN | 0 );
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_Key_getCertificateChain(int argc, VALUE *argv, VALUE self) {
CountPtrTo<Key > *arg1 = (CountPtrTo<Key > *) 0 ;
SwigValueWrapper<vector<CountPtrTo<X509Certificate > > > result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTKey_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getCertificateChain" "', argument " "1"" of type '" "CountPtrTo<Key > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<Key > * >(argp1);
{
try
{
result = (*arg1)->getCertificateChain();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_NewPointerObj((new vector<X509CertificatePtr >(static_cast< const vector<X509CertificatePtr >& >(result))), SWIGTYPE_p_vectorTCountPtrToTX509Certificate_t_t, SWIG_POINTER_OWN | 0 );
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_Key_dump(int argc, VALUE *argv, VALUE self) {
CountPtrTo<Key > *arg1 = (CountPtrTo<Key > *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTKey_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dump" "', argument " "1"" of type '" "CountPtrTo<Key > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<Key > * >(argp1);
{
try
{
(*arg1)->dump();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return Qnil;
fail:
return Qnil;
}
swig_class cKeyVector;
SWIGINTERN VALUE
_wrap_new_KeyVector__SWIG_0(int argc, VALUE *argv, VALUE self) {
std::vector<KeyPtr > *result = 0 ;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
{
try
{
result = (std::vector<KeyPtr > *)new std::vector<KeyPtr >();DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_new_KeyVector__SWIG_1(int argc, VALUE *argv, VALUE self) {
unsigned int arg1 ;
std::vector<KeyPtr > *result = 0 ;
unsigned int val1 ;
int ecode1 = 0 ;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
ecode1 = SWIG_AsVal_unsigned_SS_int(argv[0], &val1);
if (!SWIG_IsOK(ecode1)) {
SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "std::vector<(KeyPtr)>" "', argument " "1"" of type '" "unsigned int""'");
}
arg1 = static_cast< unsigned int >(val1);
{
try
{
result = (std::vector<KeyPtr > *)new std::vector<KeyPtr >(arg1);DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_new_KeyVector__SWIG_2(int argc, VALUE *argv, VALUE self) {
unsigned int arg1 ;
CountPtrTo<Key > *arg2 = 0 ;
std::vector<KeyPtr > *result = 0 ;
unsigned int val1 ;
int ecode1 = 0 ;
void *argp2 ;
int res2 = 0 ;
if ((argc < 2) || (argc > 2)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
}
ecode1 = SWIG_AsVal_unsigned_SS_int(argv[0], &val1);
if (!SWIG_IsOK(ecode1)) {
SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "std::vector<(KeyPtr)>" "', argument " "1"" of type '" "unsigned int""'");
}
arg1 = static_cast< unsigned int >(val1);
res2 = SWIG_ConvertPtr(argv[1], &argp2, SWIGTYPE_p_CountPtrToTKey_t, 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "std::vector<(KeyPtr)>" "', argument " "2"" of type '" "CountPtrTo<Key > const &""'");
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "std::vector<(KeyPtr)>" "', argument " "2"" of type '" "CountPtrTo<Key > const &""'");
}
arg2 = reinterpret_cast< CountPtrTo<Key > * >(argp2);
{
try
{
result = (std::vector<KeyPtr > *)new std::vector<KeyPtr >(arg1,(CountPtrTo<Key > const &)*arg2);DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_KeyVector_allocate(VALUE self) {
#else
SWIGINTERN VALUE
_wrap_KeyVector_allocate(int argc, VALUE *argv, VALUE self) {
#endif
VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_std__vectorTCountPtrToTKey_t_t);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
rb_obj_call_init(vresult, argc, argv);
#endif
return vresult;
}
SWIGINTERN VALUE
_wrap_new_KeyVector__SWIG_3(int argc, VALUE *argv, VALUE self) {
std::vector<CountPtrTo<Key > > *arg1 = 0 ;
std::vector<KeyPtr > *result = 0 ;
std::vector<CountPtrTo<Key > > temp1 ;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
{
if (rb_obj_is_kind_of(argv[0],rb_cArray)) {
unsigned int size = RARRAY_LEN(argv[0]);
arg1 = &temp1;
for (unsigned int i=0; i<size; i++) {
VALUE o = RARRAY_PTR(argv[0])[i];
CountPtrTo<Key >* x;
SWIG_ConvertPtr(o, (void **) &x, SWIGTYPE_p_CountPtrToTKey_t, 1);
temp1.push_back(*x);
}
} else {
SWIG_ConvertPtr(argv[0], (void **) &arg1, SWIGTYPE_p_std__vectorTCountPtrToTKey_t_t, 1);
}
}
{
try
{
result = (std::vector<KeyPtr > *)new std::vector<KeyPtr >((std::vector<CountPtrTo<Key > > const &)*arg1);DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
SWIGINTERN VALUE _wrap_new_KeyVector(int nargs, VALUE *args, VALUE self) {
int argc;
VALUE argv[2];
int ii;
argc = nargs;
if (argc > 2) SWIG_fail;
for (ii = 0; (ii < argc); ii++) {
argv[ii] = args[ii];
}
if (argc == 0) {
return _wrap_new_KeyVector__SWIG_0(nargs, args, self);
}
if (argc == 1) {
int _v;
{
int res = SWIG_AsVal_unsigned_SS_int(argv[0], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
return _wrap_new_KeyVector__SWIG_1(nargs, args, self);
}
}
if (argc == 1) {
int _v;
{
/* native sequence? */
if (rb_obj_is_kind_of(argv[0],rb_cArray)) {
unsigned int size = RARRAY_LEN(argv[0]);
if (size == 0) {
/* an empty sequence can be of any type */
_v = 1;
} else {
/* check the first element only */
CountPtrTo<Key >* x;
VALUE o = RARRAY_PTR(argv[0])[0];
if ((SWIG_ConvertPtr(o,(void **) &x,
SWIGTYPE_p_CountPtrToTKey_t,0)) != -1)
_v = 1;
else
_v = 0;
}
} else {
/* wrapped vector? */
std::vector<CountPtrTo<Key > >* v;
if (SWIG_ConvertPtr(argv[0],(void **) &v,
SWIGTYPE_p_std__vectorTCountPtrToTKey_t_t,0) != -1)
_v = 1;
else
_v = 0;
}
}
if (_v) {
return _wrap_new_KeyVector__SWIG_3(nargs, args, self);
}
}
if (argc == 2) {
int _v;
{
int res = SWIG_AsVal_unsigned_SS_int(argv[0], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_CountPtrToTKey_t, 0);
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_new_KeyVector__SWIG_2(nargs, args, self);
}
}
}
fail:
rb_raise(rb_eArgError, "No matching function for overloaded 'new_KeyVector'");
return Qnil;
}
SWIGINTERN VALUE
_wrap_KeyVector___len__(int argc, VALUE *argv, VALUE self) {
std::vector<KeyPtr > *arg1 = (std::vector<KeyPtr > *) 0 ;
unsigned int result;
std::vector<CountPtrTo<Key > > temp1 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
{
if (rb_obj_is_kind_of(self,rb_cArray)) {
unsigned int size = RARRAY_LEN(self);
arg1 = &temp1;
for (unsigned int i=0; i<size; i++) {
VALUE o = RARRAY_PTR(self)[i];
CountPtrTo<Key >* x;
SWIG_ConvertPtr(o, (void **) &x, SWIGTYPE_p_CountPtrToTKey_t, 1);
temp1.push_back(*x);
}
} else {
SWIG_ConvertPtr(self, (void **) &arg1, SWIGTYPE_p_std__vectorTCountPtrToTKey_t_t, 1);
}
}
{
try
{
result = (unsigned int)((std::vector<KeyPtr > const *)arg1)->size();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_KeyVector_emptyq___(int argc, VALUE *argv, VALUE self) {
std::vector<KeyPtr > *arg1 = (std::vector<KeyPtr > *) 0 ;
bool result;
std::vector<CountPtrTo<Key > > temp1 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
{
if (rb_obj_is_kind_of(self,rb_cArray)) {
unsigned int size = RARRAY_LEN(self);
arg1 = &temp1;
for (unsigned int i=0; i<size; i++) {
VALUE o = RARRAY_PTR(self)[i];
CountPtrTo<Key >* x;
SWIG_ConvertPtr(o, (void **) &x, SWIGTYPE_p_CountPtrToTKey_t, 1);
temp1.push_back(*x);
}
} else {
SWIG_ConvertPtr(self, (void **) &arg1, SWIGTYPE_p_std__vectorTCountPtrToTKey_t_t, 1);
}
}
{
try
{
result = (bool)((std::vector<KeyPtr > const *)arg1)->empty();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_bool(static_cast< bool >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_KeyVector_clear(int argc, VALUE *argv, VALUE self) {
std::vector<KeyPtr > *arg1 = (std::vector<KeyPtr > *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorTCountPtrToTKey_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "clear" "', argument " "1"" of type '" "std::vector<KeyPtr > *""'");
}
arg1 = reinterpret_cast< std::vector<KeyPtr > * >(argp1);
{
try
{
(arg1)->clear();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return Qnil;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_KeyVector_push(int argc, VALUE *argv, VALUE self) {
std::vector<KeyPtr > *arg1 = (std::vector<KeyPtr > *) 0 ;
CountPtrTo<Key > *arg2 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 ;
int res2 = 0 ;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorTCountPtrToTKey_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "push_back" "', argument " "1"" of type '" "std::vector<KeyPtr > *""'");
}
arg1 = reinterpret_cast< std::vector<KeyPtr > * >(argp1);
res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_CountPtrToTKey_t, 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "push_back" "', argument " "2"" of type '" "CountPtrTo<Key > const &""'");
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "push_back" "', argument " "2"" of type '" "CountPtrTo<Key > const &""'");
}
arg2 = reinterpret_cast< CountPtrTo<Key > * >(argp2);
{
try
{
(arg1)->push_back((CountPtrTo<Key > const &)*arg2);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return Qnil;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_KeyVector_pop(int argc, VALUE *argv, VALUE self) {
std::vector<KeyPtr > *arg1 = (std::vector<KeyPtr > *) 0 ;
SwigValueWrapper<CountPtrTo<Key > > result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorTCountPtrToTKey_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pop" "', argument " "1"" of type '" "std::vector<KeyPtr > *""'");
}
arg1 = reinterpret_cast< std::vector<KeyPtr > * >(argp1);
{
try
{
try {
result = std_vector_Sl_KeyPtr_Sg__pop(arg1);
}
catch(std::out_of_range &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_std__out_of_range, SWIG_NewPointerObj((new std::out_of_range(static_cast< const std::out_of_range& >(_e))),SWIGTYPE_p_std__out_of_range,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_NewPointerObj((new CountPtrTo<Key >(static_cast< const CountPtrTo<Key >& >(result))), SWIGTYPE_p_CountPtrToTKey_t, SWIG_POINTER_OWN | 0 );
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_KeyVector___getitem__(int argc, VALUE *argv, VALUE self) {
std::vector<KeyPtr > *arg1 = (std::vector<KeyPtr > *) 0 ;
int arg2 ;
CountPtrTo<Key > *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int val2 ;
int ecode2 = 0 ;
VALUE vresult = Qnil;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorTCountPtrToTKey_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "__getitem__" "', argument " "1"" of type '" "std::vector<KeyPtr > *""'");
}
arg1 = reinterpret_cast< std::vector<KeyPtr > * >(argp1);
ecode2 = SWIG_AsVal_int(argv[0], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "__getitem__" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
{
try
{
try {
{
CountPtrTo<Key > &_result_ref = std_vector_Sl_KeyPtr_Sg____getitem__(arg1,arg2);
result = (CountPtrTo<Key > *) &_result_ref;
}
}
catch(std::out_of_range &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_std__out_of_range, SWIG_NewPointerObj((new std::out_of_range(static_cast< const std::out_of_range& >(_e))),SWIGTYPE_p_std__out_of_range,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CountPtrToTKey_t, 0 | 0 );
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_KeyVector___setitem__(int argc, VALUE *argv, VALUE self) {
std::vector<KeyPtr > *arg1 = (std::vector<KeyPtr > *) 0 ;
int arg2 ;
CountPtrTo<Key > *arg3 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int val2 ;
int ecode2 = 0 ;
void *argp3 ;
int res3 = 0 ;
if ((argc < 2) || (argc > 2)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorTCountPtrToTKey_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "__setitem__" "', argument " "1"" of type '" "std::vector<KeyPtr > *""'");
}
arg1 = reinterpret_cast< std::vector<KeyPtr > * >(argp1);
ecode2 = SWIG_AsVal_int(argv[0], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "__setitem__" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
res3 = SWIG_ConvertPtr(argv[1], &argp3, SWIGTYPE_p_CountPtrToTKey_t, 0 );
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "__setitem__" "', argument " "3"" of type '" "CountPtrTo<Key > const &""'");
}
if (!argp3) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "__setitem__" "', argument " "3"" of type '" "CountPtrTo<Key > const &""'");
}
arg3 = reinterpret_cast< CountPtrTo<Key > * >(argp3);
{
try
{
try {
std_vector_Sl_KeyPtr_Sg____setitem__(arg1,arg2,(CountPtrTo<Key > const &)*arg3);
}
catch(std::out_of_range &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_std__out_of_range, SWIG_NewPointerObj((new std::out_of_range(static_cast< const std::out_of_range& >(_e))),SWIGTYPE_p_std__out_of_range,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return Qnil;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_KeyVector_each(int argc, VALUE *argv, VALUE self) {
std::vector<KeyPtr > *arg1 = (std::vector<KeyPtr > *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorTCountPtrToTKey_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "each" "', argument " "1"" of type '" "std::vector<KeyPtr > *""'");
}
arg1 = reinterpret_cast< std::vector<KeyPtr > * >(argp1);
{
try
{
std_vector_Sl_KeyPtr_Sg__each(arg1);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return Qnil;
fail:
return Qnil;
}
SWIGINTERN void
free_std_vector_Sl_KeyPtr_Sg_(std::vector<KeyPtr > *arg1) {
SWIG_RubyRemoveTracking(arg1);
delete arg1;
}
swig_class cKeyStoreBase;
#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_KeyStoreBase_allocate(VALUE self) {
#else
SWIGINTERN VALUE
_wrap_KeyStoreBase_allocate(int argc, VALUE *argv, VALUE self) {
#endif
VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_KeyStore);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
rb_obj_call_init(vresult, argc, argv);
#endif
return vresult;
}
SWIGINTERN VALUE
_wrap_new_KeyStoreBase(int argc, VALUE *argv, VALUE self) {
KeyStore *result = 0 ;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
{
try
{
try {
result = (KeyStore *)new KeyStore();DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch(MemoryError &_e) {
SWIG_exception(SWIG_MemoryError, (&_e)->what());
}
catch(KeyError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_KeyError, SWIG_NewPointerObj((new KeyError(static_cast< const KeyError& >(_e))),SWIGTYPE_p_KeyError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
SWIGINTERN void
free_KeyStore(KeyStore *arg1) {
SWIG_RubyRemoveTracking(arg1);
delete arg1;
}
SWIGINTERN VALUE
_wrap_KeyStoreBase_addTrustedCert(int argc, VALUE *argv, VALUE self) {
KeyStore *arg1 = (KeyStore *) 0 ;
SwigValueWrapper<CountPtrTo<X509Certificate > > arg2 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 ;
int res2 = 0 ;
VALUE vresult = Qnil;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_KeyStore, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "addTrustedCert" "', argument " "1"" of type '" "KeyStore *""'");
}
arg1 = reinterpret_cast< KeyStore * >(argp1);
{
res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_CountPtrToTX509Certificate_t, 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "addTrustedCert" "', argument " "2"" of type '" "X509CertificatePtr""'");
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "addTrustedCert" "', argument " "2"" of type '" "X509CertificatePtr""'");
} else {
arg2 = *(reinterpret_cast< X509CertificatePtr * >(argp2));
}
}
{
try
{
try {
result = (int)(arg1)->addTrustedCert(arg2);
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_KeyStoreBase_addUntrustedCert(int argc, VALUE *argv, VALUE self) {
KeyStore *arg1 = (KeyStore *) 0 ;
SwigValueWrapper<CountPtrTo<X509Certificate > > arg2 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 ;
int res2 = 0 ;
VALUE vresult = Qnil;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_KeyStore, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "addUntrustedCert" "', argument " "1"" of type '" "KeyStore *""'");
}
arg1 = reinterpret_cast< KeyStore * >(argp1);
{
res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_CountPtrToTX509Certificate_t, 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "addUntrustedCert" "', argument " "2"" of type '" "X509CertificatePtr""'");
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "addUntrustedCert" "', argument " "2"" of type '" "X509CertificatePtr""'");
} else {
arg2 = *(reinterpret_cast< X509CertificatePtr * >(argp2));
}
}
{
try
{
try {
result = (int)(arg1)->addUntrustedCert(arg2);
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_KeyStoreBase_addTrustedCertFromFile(int argc, VALUE *argv, VALUE self) {
KeyStore *arg1 = (KeyStore *) 0 ;
std::string arg2 ;
std::string arg3 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 2) || (argc > 2)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_KeyStore, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "addTrustedCertFromFile" "', argument " "1"" of type '" "KeyStore *""'");
}
arg1 = reinterpret_cast< KeyStore * >(argp1);
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "addTrustedCertFromFile" "', argument " "2"" of type '" "std::string""'");
}
arg2 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[1], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "addTrustedCertFromFile" "', argument " "3"" of type '" "std::string""'");
}
arg3 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
try
{
try {
result = (int)(arg1)->addTrustedCertFromFile(arg2,arg3);
}
catch(IOError &_e) {
SWIG_exception(SWIG_IOError, (&_e)->what());
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_KeyStoreBase_addUntrustedCertFromFile(int argc, VALUE *argv, VALUE self) {
KeyStore *arg1 = (KeyStore *) 0 ;
std::string arg2 ;
std::string arg3 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 2) || (argc > 2)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_KeyStore, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "addUntrustedCertFromFile" "', argument " "1"" of type '" "KeyStore *""'");
}
arg1 = reinterpret_cast< KeyStore * >(argp1);
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "addUntrustedCertFromFile" "', argument " "2"" of type '" "std::string""'");
}
arg2 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[1], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "addUntrustedCertFromFile" "', argument " "3"" of type '" "std::string""'");
}
arg3 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
try
{
try {
result = (int)(arg1)->addUntrustedCertFromFile(arg2,arg3);
}
catch(IOError &_e) {
SWIG_exception(SWIG_IOError, (&_e)->what());
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_KeyStoreBase_addKey(int argc, VALUE *argv, VALUE self) {
KeyStore *arg1 = (KeyStore *) 0 ;
SwigValueWrapper<CountPtrTo<Key > > arg2 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 ;
int res2 = 0 ;
VALUE vresult = Qnil;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_KeyStore, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "addKey" "', argument " "1"" of type '" "KeyStore *""'");
}
arg1 = reinterpret_cast< KeyStore * >(argp1);
{
res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_CountPtrToTKey_t, 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "addKey" "', argument " "2"" of type '" "KeyPtr""'");
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "addKey" "', argument " "2"" of type '" "KeyPtr""'");
} else {
arg2 = *(reinterpret_cast< KeyPtr * >(argp2));
}
}
{
try
{
try {
result = (int)(arg1)->addKey(arg2);
}
catch(IOError &_e) {
SWIG_exception(SWIG_IOError, (&_e)->what());
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(MemoryError &_e) {
SWIG_exception(SWIG_MemoryError, (&_e)->what());
}
catch(KeyError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_KeyError, SWIG_NewPointerObj((new KeyError(static_cast< const KeyError& >(_e))),SWIGTYPE_p_KeyError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_KeyStoreBase_addKeyFromFile__SWIG_0(int argc, VALUE *argv, VALUE self) {
KeyStore *arg1 = (KeyStore *) 0 ;
std::string arg2 ;
std::string arg3 ;
std::string arg4 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 3) || (argc > 3)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_KeyStore, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "addKeyFromFile" "', argument " "1"" of type '" "KeyStore *""'");
}
arg1 = reinterpret_cast< KeyStore * >(argp1);
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "addKeyFromFile" "', argument " "2"" of type '" "std::string""'");
}
arg2 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[1], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "addKeyFromFile" "', argument " "3"" of type '" "std::string""'");
}
arg3 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[2], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "addKeyFromFile" "', argument " "4"" of type '" "std::string""'");
}
arg4 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
try
{
try {
result = (int)(arg1)->addKeyFromFile(arg2,arg3,arg4);
}
catch(IOError &_e) {
SWIG_exception(SWIG_IOError, (&_e)->what());
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(MemoryError &_e) {
SWIG_exception(SWIG_MemoryError, (&_e)->what());
}
catch(KeyError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_KeyError, SWIG_NewPointerObj((new KeyError(static_cast< const KeyError& >(_e))),SWIGTYPE_p_KeyError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_KeyStoreBase_addKeyFromFile__SWIG_1(int argc, VALUE *argv, VALUE self) {
KeyStore *arg1 = (KeyStore *) 0 ;
std::string arg2 ;
std::string arg3 ;
std::string arg4 ;
std::string arg5 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 4) || (argc > 4)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 4)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_KeyStore, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "addKeyFromFile" "', argument " "1"" of type '" "KeyStore *""'");
}
arg1 = reinterpret_cast< KeyStore * >(argp1);
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "addKeyFromFile" "', argument " "2"" of type '" "std::string""'");
}
arg2 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[1], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "addKeyFromFile" "', argument " "3"" of type '" "std::string""'");
}
arg3 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[2], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "addKeyFromFile" "', argument " "4"" of type '" "std::string""'");
}
arg4 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[3], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "addKeyFromFile" "', argument " "5"" of type '" "std::string""'");
}
arg5 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
try
{
try {
result = (int)(arg1)->addKeyFromFile(arg2,arg3,arg4,arg5);
}
catch(IOError &_e) {
SWIG_exception(SWIG_IOError, (&_e)->what());
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(MemoryError &_e) {
SWIG_exception(SWIG_MemoryError, (&_e)->what());
}
catch(KeyError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_KeyError, SWIG_NewPointerObj((new KeyError(static_cast< const KeyError& >(_e))),SWIGTYPE_p_KeyError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE _wrap_KeyStoreBase_addKeyFromFile(int nargs, VALUE *args, VALUE self) {
int argc;
VALUE argv[6];
int ii;
argc = nargs + 1;
argv[0] = self;
if (argc > 6) SWIG_fail;
for (ii = 1; (ii < argc); ii++) {
argv[ii] = args[ii-1];
}
if (argc == 4) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_KeyStore, 0);
_v = SWIG_CheckState(res);
if (_v) {
int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
_v = SWIG_CheckState(res);
if (_v) {
int res = SWIG_AsPtr_std_string(argv[2], (std::string**)(0));
_v = SWIG_CheckState(res);
if (_v) {
int res = SWIG_AsPtr_std_string(argv[3], (std::string**)(0));
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_KeyStoreBase_addKeyFromFile__SWIG_0(nargs, args, self);
}
}
}
}
}
if (argc == 5) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_KeyStore, 0);
_v = SWIG_CheckState(res);
if (_v) {
int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
_v = SWIG_CheckState(res);
if (_v) {
int res = SWIG_AsPtr_std_string(argv[2], (std::string**)(0));
_v = SWIG_CheckState(res);
if (_v) {
int res = SWIG_AsPtr_std_string(argv[3], (std::string**)(0));
_v = SWIG_CheckState(res);
if (_v) {
int res = SWIG_AsPtr_std_string(argv[4], (std::string**)(0));
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_KeyStoreBase_addKeyFromFile__SWIG_1(nargs, args, self);
}
}
}
}
}
}
fail:
rb_raise(rb_eArgError, "No matching function for overloaded 'KeyStoreBase_addKeyFromFile'");
return Qnil;
}
SWIGINTERN VALUE
_wrap_KeyStoreBase_saveToFile(int argc, VALUE *argv, VALUE self) {
KeyStore *arg1 = (KeyStore *) 0 ;
std::string arg2 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_KeyStore, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "saveToFile" "', argument " "1"" of type '" "KeyStore *""'");
}
arg1 = reinterpret_cast< KeyStore * >(argp1);
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "saveToFile" "', argument " "2"" of type '" "std::string""'");
}
arg2 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
try
{
try {
result = (int)(arg1)->saveToFile(arg2);
}
catch(IOError &_e) {
SWIG_exception(SWIG_IOError, (&_e)->what());
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_KeyStoreBase_loadFromFile(int argc, VALUE *argv, VALUE self) {
KeyStore *arg1 = (KeyStore *) 0 ;
std::string arg2 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_KeyStore, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "loadFromFile" "', argument " "1"" of type '" "KeyStore *""'");
}
arg1 = reinterpret_cast< KeyStore * >(argp1);
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "loadFromFile" "', argument " "2"" of type '" "std::string""'");
}
arg2 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
try
{
try {
result = (int)(arg1)->loadFromFile(arg2);
}
catch(IOError &_e) {
SWIG_exception(SWIG_IOError, (&_e)->what());
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
swig_class cKeyStore;
SWIGINTERN void
free_CountPtrTo_Sl_KeyStore_Sg_(CountPtrTo<KeyStore > *arg1) {
SWIG_RubyRemoveTracking(arg1);
delete arg1;
}
SWIGINTERN VALUE
_wrap_KeyStore___deref__(int argc, VALUE *argv, VALUE self) {
CountPtrTo<KeyStore > *arg1 = (CountPtrTo<KeyStore > *) 0 ;
KeyStore *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTKeyStore_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "operator ->" "', argument " "1"" of type '" "CountPtrTo<KeyStore > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<KeyStore > * >(argp1);
{
try
{
result = (KeyStore *)(arg1)->operator ->();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_KeyStore, 0 | 0 );
return vresult;
fail:
return Qnil;
}
#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_KeyStore_allocate(VALUE self) {
#else
SWIGINTERN VALUE
_wrap_KeyStore_allocate(int argc, VALUE *argv, VALUE self) {
#endif
VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_CountPtrToTKeyStore_t);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
rb_obj_call_init(vresult, argc, argv);
#endif
return vresult;
}
SWIGINTERN VALUE
_wrap_new_KeyStore(int argc, VALUE *argv, VALUE self) {
CountPtrTo<KeyStore > *result = 0 ;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
{
try
{
result = (CountPtrTo<KeyStore > *)new_CountPtrTo_Sl_KeyStore_Sg_();DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_KeyStore_addTrustedCert(int argc, VALUE *argv, VALUE self) {
CountPtrTo<KeyStore > *arg1 = (CountPtrTo<KeyStore > *) 0 ;
SwigValueWrapper<CountPtrTo<X509Certificate > > arg2 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 ;
int res2 = 0 ;
VALUE vresult = Qnil;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTKeyStore_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "addTrustedCert" "', argument " "1"" of type '" "CountPtrTo<KeyStore > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<KeyStore > * >(argp1);
{
res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_CountPtrToTX509Certificate_t, 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "addTrustedCert" "', argument " "2"" of type '" "X509CertificatePtr""'");
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "addTrustedCert" "', argument " "2"" of type '" "X509CertificatePtr""'");
} else {
arg2 = *(reinterpret_cast< X509CertificatePtr * >(argp2));
}
}
{
try
{
try {
result = (int)(*arg1)->addTrustedCert(arg2);
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_KeyStore_addUntrustedCert(int argc, VALUE *argv, VALUE self) {
CountPtrTo<KeyStore > *arg1 = (CountPtrTo<KeyStore > *) 0 ;
SwigValueWrapper<CountPtrTo<X509Certificate > > arg2 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 ;
int res2 = 0 ;
VALUE vresult = Qnil;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTKeyStore_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "addUntrustedCert" "', argument " "1"" of type '" "CountPtrTo<KeyStore > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<KeyStore > * >(argp1);
{
res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_CountPtrToTX509Certificate_t, 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "addUntrustedCert" "', argument " "2"" of type '" "X509CertificatePtr""'");
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "addUntrustedCert" "', argument " "2"" of type '" "X509CertificatePtr""'");
} else {
arg2 = *(reinterpret_cast< X509CertificatePtr * >(argp2));
}
}
{
try
{
try {
result = (int)(*arg1)->addUntrustedCert(arg2);
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_KeyStore_addTrustedCertFromFile(int argc, VALUE *argv, VALUE self) {
CountPtrTo<KeyStore > *arg1 = (CountPtrTo<KeyStore > *) 0 ;
std::string arg2 ;
std::string arg3 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 2) || (argc > 2)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTKeyStore_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "addTrustedCertFromFile" "', argument " "1"" of type '" "CountPtrTo<KeyStore > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<KeyStore > * >(argp1);
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "addTrustedCertFromFile" "', argument " "2"" of type '" "std::string""'");
}
arg2 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[1], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "addTrustedCertFromFile" "', argument " "3"" of type '" "std::string""'");
}
arg3 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
try
{
try {
result = (int)(*arg1)->addTrustedCertFromFile(arg2,arg3);
}
catch(IOError &_e) {
SWIG_exception(SWIG_IOError, (&_e)->what());
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_KeyStore_addUntrustedCertFromFile(int argc, VALUE *argv, VALUE self) {
CountPtrTo<KeyStore > *arg1 = (CountPtrTo<KeyStore > *) 0 ;
std::string arg2 ;
std::string arg3 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 2) || (argc > 2)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTKeyStore_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "addUntrustedCertFromFile" "', argument " "1"" of type '" "CountPtrTo<KeyStore > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<KeyStore > * >(argp1);
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "addUntrustedCertFromFile" "', argument " "2"" of type '" "std::string""'");
}
arg2 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[1], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "addUntrustedCertFromFile" "', argument " "3"" of type '" "std::string""'");
}
arg3 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
try
{
try {
result = (int)(*arg1)->addUntrustedCertFromFile(arg2,arg3);
}
catch(IOError &_e) {
SWIG_exception(SWIG_IOError, (&_e)->what());
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_KeyStore_addKey(int argc, VALUE *argv, VALUE self) {
CountPtrTo<KeyStore > *arg1 = (CountPtrTo<KeyStore > *) 0 ;
SwigValueWrapper<CountPtrTo<Key > > arg2 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 ;
int res2 = 0 ;
VALUE vresult = Qnil;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTKeyStore_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "addKey" "', argument " "1"" of type '" "CountPtrTo<KeyStore > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<KeyStore > * >(argp1);
{
res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_CountPtrToTKey_t, 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "addKey" "', argument " "2"" of type '" "KeyPtr""'");
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "addKey" "', argument " "2"" of type '" "KeyPtr""'");
} else {
arg2 = *(reinterpret_cast< KeyPtr * >(argp2));
}
}
{
try
{
try {
result = (int)(*arg1)->addKey(arg2);
}
catch(IOError &_e) {
SWIG_exception(SWIG_IOError, (&_e)->what());
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(MemoryError &_e) {
SWIG_exception(SWIG_MemoryError, (&_e)->what());
}
catch(KeyError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_KeyError, SWIG_NewPointerObj((new KeyError(static_cast< const KeyError& >(_e))),SWIGTYPE_p_KeyError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_KeyStore_addKeyFromFile__SWIG_0(int argc, VALUE *argv, VALUE self) {
CountPtrTo<KeyStore > *arg1 = (CountPtrTo<KeyStore > *) 0 ;
std::string arg2 ;
std::string arg3 ;
std::string arg4 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 3) || (argc > 3)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTKeyStore_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "addKeyFromFile" "', argument " "1"" of type '" "CountPtrTo<KeyStore > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<KeyStore > * >(argp1);
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "addKeyFromFile" "', argument " "2"" of type '" "std::string""'");
}
arg2 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[1], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "addKeyFromFile" "', argument " "3"" of type '" "std::string""'");
}
arg3 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[2], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "addKeyFromFile" "', argument " "4"" of type '" "std::string""'");
}
arg4 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
try
{
try {
result = (int)(*arg1)->addKeyFromFile(arg2,arg3,arg4);
}
catch(IOError &_e) {
SWIG_exception(SWIG_IOError, (&_e)->what());
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(MemoryError &_e) {
SWIG_exception(SWIG_MemoryError, (&_e)->what());
}
catch(KeyError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_KeyError, SWIG_NewPointerObj((new KeyError(static_cast< const KeyError& >(_e))),SWIGTYPE_p_KeyError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_KeyStore_addKeyFromFile__SWIG_1(int argc, VALUE *argv, VALUE self) {
CountPtrTo<KeyStore > *arg1 = (CountPtrTo<KeyStore > *) 0 ;
std::string arg2 ;
std::string arg3 ;
std::string arg4 ;
std::string arg5 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 4) || (argc > 4)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 4)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTKeyStore_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "addKeyFromFile" "', argument " "1"" of type '" "CountPtrTo<KeyStore > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<KeyStore > * >(argp1);
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "addKeyFromFile" "', argument " "2"" of type '" "std::string""'");
}
arg2 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[1], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "addKeyFromFile" "', argument " "3"" of type '" "std::string""'");
}
arg3 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[2], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "addKeyFromFile" "', argument " "4"" of type '" "std::string""'");
}
arg4 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[3], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "addKeyFromFile" "', argument " "5"" of type '" "std::string""'");
}
arg5 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
try
{
try {
result = (int)(*arg1)->addKeyFromFile(arg2,arg3,arg4,arg5);
}
catch(IOError &_e) {
SWIG_exception(SWIG_IOError, (&_e)->what());
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(MemoryError &_e) {
SWIG_exception(SWIG_MemoryError, (&_e)->what());
}
catch(KeyError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_KeyError, SWIG_NewPointerObj((new KeyError(static_cast< const KeyError& >(_e))),SWIGTYPE_p_KeyError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE _wrap_KeyStore_addKeyFromFile(int nargs, VALUE *args, VALUE self) {
int argc;
VALUE argv[6];
int ii;
argc = nargs + 1;
argv[0] = self;
if (argc > 6) SWIG_fail;
for (ii = 1; (ii < argc); ii++) {
argv[ii] = args[ii-1];
}
if (argc == 4) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CountPtrToTKeyStore_t, 0);
_v = SWIG_CheckState(res);
if (_v) {
int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
_v = SWIG_CheckState(res);
if (_v) {
int res = SWIG_AsPtr_std_string(argv[2], (std::string**)(0));
_v = SWIG_CheckState(res);
if (_v) {
int res = SWIG_AsPtr_std_string(argv[3], (std::string**)(0));
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_KeyStore_addKeyFromFile__SWIG_0(nargs, args, self);
}
}
}
}
}
if (argc == 5) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CountPtrToTKeyStore_t, 0);
_v = SWIG_CheckState(res);
if (_v) {
int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
_v = SWIG_CheckState(res);
if (_v) {
int res = SWIG_AsPtr_std_string(argv[2], (std::string**)(0));
_v = SWIG_CheckState(res);
if (_v) {
int res = SWIG_AsPtr_std_string(argv[3], (std::string**)(0));
_v = SWIG_CheckState(res);
if (_v) {
int res = SWIG_AsPtr_std_string(argv[4], (std::string**)(0));
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_KeyStore_addKeyFromFile__SWIG_1(nargs, args, self);
}
}
}
}
}
}
fail:
rb_raise(rb_eArgError, "No matching function for overloaded 'KeyStore_addKeyFromFile'");
return Qnil;
}
SWIGINTERN VALUE
_wrap_KeyStore_saveToFile(int argc, VALUE *argv, VALUE self) {
CountPtrTo<KeyStore > *arg1 = (CountPtrTo<KeyStore > *) 0 ;
std::string arg2 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTKeyStore_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "saveToFile" "', argument " "1"" of type '" "CountPtrTo<KeyStore > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<KeyStore > * >(argp1);
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "saveToFile" "', argument " "2"" of type '" "std::string""'");
}
arg2 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
try
{
try {
result = (int)(*arg1)->saveToFile(arg2);
}
catch(IOError &_e) {
SWIG_exception(SWIG_IOError, (&_e)->what());
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_KeyStore_loadFromFile(int argc, VALUE *argv, VALUE self) {
CountPtrTo<KeyStore > *arg1 = (CountPtrTo<KeyStore > *) 0 ;
std::string arg2 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTKeyStore_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "loadFromFile" "', argument " "1"" of type '" "CountPtrTo<KeyStore > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<KeyStore > * >(argp1);
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "loadFromFile" "', argument " "2"" of type '" "std::string""'");
}
arg2 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
try
{
try {
result = (int)(*arg1)->loadFromFile(arg2);
}
catch(IOError &_e) {
SWIG_exception(SWIG_IOError, (&_e)->what());
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
swig_class cXmlDocBase;
#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_XmlDocBase_allocate(VALUE self) {
#else
SWIGINTERN VALUE
_wrap_XmlDocBase_allocate(int argc, VALUE *argv, VALUE self) {
#endif
VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_XmlDoc);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
rb_obj_call_init(vresult, argc, argv);
#endif
return vresult;
}
SWIGINTERN VALUE
_wrap_new_XmlDocBase(int argc, VALUE *argv, VALUE self) {
XmlDoc *result = 0 ;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
{
try
{
result = (XmlDoc *)new XmlDoc();DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
SWIGINTERN void
free_XmlDoc(XmlDoc *arg1) {
SWIG_RubyRemoveTracking(arg1);
delete arg1;
}
SWIGINTERN VALUE
_wrap_XmlDocBase_loadFromString(int argc, VALUE *argv, VALUE self) {
XmlDoc *arg1 = (XmlDoc *) 0 ;
std::string arg2 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_XmlDoc, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "loadFromString" "', argument " "1"" of type '" "XmlDoc *""'");
}
arg1 = reinterpret_cast< XmlDoc * >(argp1);
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "loadFromString" "', argument " "2"" of type '" "std::string""'");
}
arg2 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
try
{
try {
result = (int)(arg1)->loadFromString(arg2);
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_XmlDocBase_loadFromFile(int argc, VALUE *argv, VALUE self) {
XmlDoc *arg1 = (XmlDoc *) 0 ;
std::string arg2 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_XmlDoc, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "loadFromFile" "', argument " "1"" of type '" "XmlDoc *""'");
}
arg1 = reinterpret_cast< XmlDoc * >(argp1);
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "loadFromFile" "', argument " "2"" of type '" "std::string""'");
}
arg2 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
try
{
try {
result = (int)(arg1)->loadFromFile(arg2);
}
catch(IOError &_e) {
SWIG_exception(SWIG_IOError, (&_e)->what());
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_XmlDocBase_toString(int argc, VALUE *argv, VALUE self) {
XmlDoc *arg1 = (XmlDoc *) 0 ;
std::string result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_XmlDoc, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "toString" "', argument " "1"" of type '" "XmlDoc *""'");
}
arg1 = reinterpret_cast< XmlDoc * >(argp1);
{
try
{
result = (arg1)->toString();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_std_string(static_cast< std::string >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_XmlDocBase_toFile(int argc, VALUE *argv, VALUE self) {
XmlDoc *arg1 = (XmlDoc *) 0 ;
std::string arg2 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_XmlDoc, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "toFile" "', argument " "1"" of type '" "XmlDoc *""'");
}
arg1 = reinterpret_cast< XmlDoc * >(argp1);
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "toFile" "', argument " "2"" of type '" "std::string""'");
}
arg2 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
try
{
try {
result = (int)(arg1)->toFile(arg2);
}
catch(IOError &_e) {
SWIG_exception(SWIG_IOError, (&_e)->what());
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_XmlDocBase_dump(int argc, VALUE *argv, VALUE self) {
XmlDoc *arg1 = (XmlDoc *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_XmlDoc, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dump" "', argument " "1"" of type '" "XmlDoc *""'");
}
arg1 = reinterpret_cast< XmlDoc * >(argp1);
{
try
{
(arg1)->dump();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return Qnil;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_XmlDocBase_addIdAttr(int argc, VALUE *argv, VALUE self) {
XmlDoc *arg1 = (XmlDoc *) 0 ;
std::string arg2 ;
std::string arg3 ;
std::string arg4 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 3) || (argc > 3)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_XmlDoc, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "addIdAttr" "', argument " "1"" of type '" "XmlDoc *""'");
}
arg1 = reinterpret_cast< XmlDoc * >(argp1);
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "addIdAttr" "', argument " "2"" of type '" "std::string""'");
}
arg2 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[1], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "addIdAttr" "', argument " "3"" of type '" "std::string""'");
}
arg3 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[2], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "addIdAttr" "', argument " "4"" of type '" "std::string""'");
}
arg4 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
try
{
try {
result = (int)(arg1)->addIdAttr(arg2,arg3,arg4);
}
catch(ValueError &_e) {
SWIG_exception(SWIG_ValueError, (&_e)->what());
}
catch(XMLError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_XMLError, SWIG_NewPointerObj((new XMLError(static_cast< const XMLError& >(_e))),SWIGTYPE_p_XMLError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
swig_class cXmlDoc;
SWIGINTERN void
free_CountPtrTo_Sl_XmlDoc_Sg_(CountPtrTo<XmlDoc > *arg1) {
SWIG_RubyRemoveTracking(arg1);
delete arg1;
}
SWIGINTERN VALUE
_wrap_XmlDoc___deref__(int argc, VALUE *argv, VALUE self) {
CountPtrTo<XmlDoc > *arg1 = (CountPtrTo<XmlDoc > *) 0 ;
XmlDoc *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTXmlDoc_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "operator ->" "', argument " "1"" of type '" "CountPtrTo<XmlDoc > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<XmlDoc > * >(argp1);
{
try
{
result = (XmlDoc *)(arg1)->operator ->();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XmlDoc, 0 | 0 );
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_new_XmlDoc__SWIG_0(int argc, VALUE *argv, VALUE self) {
CountPtrTo<XmlDoc > *result = 0 ;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
{
try
{
result = (CountPtrTo<XmlDoc > *)new_CountPtrTo_Sl_XmlDoc_Sg___SWIG_0();DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_XmlDoc_allocate(VALUE self) {
#else
SWIGINTERN VALUE
_wrap_XmlDoc_allocate(int argc, VALUE *argv, VALUE self) {
#endif
VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_CountPtrToTXmlDoc_t);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
rb_obj_call_init(vresult, argc, argv);
#endif
return vresult;
}
SWIGINTERN VALUE
_wrap_new_XmlDoc__SWIG_1(int argc, VALUE *argv, VALUE self) {
CountPtrTo<XmlDoc > *arg1 = 0 ;
CountPtrTo<XmlDoc > *result = 0 ;
void *argp1 ;
int res1 = 0 ;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0], &argp1, SWIGTYPE_p_CountPtrToTXmlDoc_t, 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CountPtrTo<(XmlDoc)>" "', argument " "1"" of type '" "CountPtrTo<XmlDoc > const &""'");
}
if (!argp1) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CountPtrTo<(XmlDoc)>" "', argument " "1"" of type '" "CountPtrTo<XmlDoc > const &""'");
}
arg1 = reinterpret_cast< CountPtrTo<XmlDoc > * >(argp1);
{
try
{
result = (CountPtrTo<XmlDoc > *)new_CountPtrTo_Sl_XmlDoc_Sg___SWIG_1((CountPtrTo<XmlDoc > const &)*arg1);DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
SWIGINTERN VALUE _wrap_new_XmlDoc(int nargs, VALUE *args, VALUE self) {
int argc;
VALUE argv[1];
int ii;
argc = nargs;
if (argc > 1) SWIG_fail;
for (ii = 0; (ii < argc); ii++) {
argv[ii] = args[ii];
}
if (argc == 0) {
return _wrap_new_XmlDoc__SWIG_0(nargs, args, self);
}
if (argc == 1) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CountPtrToTXmlDoc_t, 0);
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_new_XmlDoc__SWIG_1(nargs, args, self);
}
}
fail:
rb_raise(rb_eArgError, "No matching function for overloaded 'new_XmlDoc'");
return Qnil;
}
SWIGINTERN VALUE
_wrap_XmlDoc_loadFromString(int argc, VALUE *argv, VALUE self) {
CountPtrTo<XmlDoc > *arg1 = (CountPtrTo<XmlDoc > *) 0 ;
std::string arg2 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTXmlDoc_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "loadFromString" "', argument " "1"" of type '" "CountPtrTo<XmlDoc > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<XmlDoc > * >(argp1);
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "loadFromString" "', argument " "2"" of type '" "std::string""'");
}
arg2 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
try
{
try {
result = (int)(*arg1)->loadFromString(arg2);
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_XmlDoc_loadFromFile(int argc, VALUE *argv, VALUE self) {
CountPtrTo<XmlDoc > *arg1 = (CountPtrTo<XmlDoc > *) 0 ;
std::string arg2 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTXmlDoc_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "loadFromFile" "', argument " "1"" of type '" "CountPtrTo<XmlDoc > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<XmlDoc > * >(argp1);
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "loadFromFile" "', argument " "2"" of type '" "std::string""'");
}
arg2 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
try
{
try {
result = (int)(*arg1)->loadFromFile(arg2);
}
catch(IOError &_e) {
SWIG_exception(SWIG_IOError, (&_e)->what());
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_XmlDoc_toString(int argc, VALUE *argv, VALUE self) {
CountPtrTo<XmlDoc > *arg1 = (CountPtrTo<XmlDoc > *) 0 ;
std::string result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTXmlDoc_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "toString" "', argument " "1"" of type '" "CountPtrTo<XmlDoc > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<XmlDoc > * >(argp1);
{
try
{
result = (*arg1)->toString();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_std_string(static_cast< std::string >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_XmlDoc_toFile(int argc, VALUE *argv, VALUE self) {
CountPtrTo<XmlDoc > *arg1 = (CountPtrTo<XmlDoc > *) 0 ;
std::string arg2 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTXmlDoc_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "toFile" "', argument " "1"" of type '" "CountPtrTo<XmlDoc > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<XmlDoc > * >(argp1);
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "toFile" "', argument " "2"" of type '" "std::string""'");
}
arg2 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
try
{
try {
result = (int)(*arg1)->toFile(arg2);
}
catch(IOError &_e) {
SWIG_exception(SWIG_IOError, (&_e)->what());
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_XmlDoc_dump(int argc, VALUE *argv, VALUE self) {
CountPtrTo<XmlDoc > *arg1 = (CountPtrTo<XmlDoc > *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTXmlDoc_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dump" "', argument " "1"" of type '" "CountPtrTo<XmlDoc > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<XmlDoc > * >(argp1);
{
try
{
(*arg1)->dump();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return Qnil;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_XmlDoc_addIdAttr(int argc, VALUE *argv, VALUE self) {
CountPtrTo<XmlDoc > *arg1 = (CountPtrTo<XmlDoc > *) 0 ;
std::string arg2 ;
std::string arg3 ;
std::string arg4 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 3) || (argc > 3)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTXmlDoc_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "addIdAttr" "', argument " "1"" of type '" "CountPtrTo<XmlDoc > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<XmlDoc > * >(argp1);
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "addIdAttr" "', argument " "2"" of type '" "std::string""'");
}
arg2 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[1], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "addIdAttr" "', argument " "3"" of type '" "std::string""'");
}
arg3 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[2], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "addIdAttr" "', argument " "4"" of type '" "std::string""'");
}
arg4 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
try
{
try {
result = (int)(*arg1)->addIdAttr(arg2,arg3,arg4);
}
catch(ValueError &_e) {
SWIG_exception(SWIG_ValueError, (&_e)->what());
}
catch(XMLError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_XMLError, SWIG_NewPointerObj((new XMLError(static_cast< const XMLError& >(_e))),SWIGTYPE_p_XMLError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
swig_class cXPathBase;
SWIGINTERN VALUE
_wrap_new_XPathBase__SWIG_0(int argc, VALUE *argv, VALUE self) {
XPath *result = 0 ;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
{
try
{
result = (XPath *)new XPath();DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_XPathBase_allocate(VALUE self) {
#else
SWIGINTERN VALUE
_wrap_XPathBase_allocate(int argc, VALUE *argv, VALUE self) {
#endif
VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_XPath);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
rb_obj_call_init(vresult, argc, argv);
#endif
return vresult;
}
SWIGINTERN VALUE
_wrap_new_XPathBase__SWIG_1(int argc, VALUE *argv, VALUE self) {
std::string arg1 ;
XPath *result = 0 ;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "XPath" "', argument " "1"" of type '" "std::string""'");
}
arg1 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
try
{
result = (XPath *)new XPath(arg1);DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
SWIGINTERN VALUE _wrap_new_XPathBase(int nargs, VALUE *args, VALUE self) {
int argc;
VALUE argv[1];
int ii;
argc = nargs;
if (argc > 1) SWIG_fail;
for (ii = 0; (ii < argc); ii++) {
argv[ii] = args[ii];
}
if (argc == 0) {
return _wrap_new_XPathBase__SWIG_0(nargs, args, self);
}
if (argc == 1) {
int _v;
int res = SWIG_AsPtr_std_string(argv[0], (std::string**)(0));
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_new_XPathBase__SWIG_1(nargs, args, self);
}
}
fail:
rb_raise(rb_eArgError, "No matching function for overloaded 'new_XPathBase'");
return Qnil;
}
SWIGINTERN void
free_XPath(XPath *arg1) {
SWIG_RubyRemoveTracking(arg1);
delete arg1;
}
SWIGINTERN VALUE
_wrap_XPathBase_addNamespace(int argc, VALUE *argv, VALUE self) {
XPath *arg1 = (XPath *) 0 ;
std::string arg2 ;
std::string arg3 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 2) || (argc > 2)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_XPath, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "addNamespace" "', argument " "1"" of type '" "XPath *""'");
}
arg1 = reinterpret_cast< XPath * >(argp1);
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "addNamespace" "', argument " "2"" of type '" "std::string""'");
}
arg2 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[1], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "addNamespace" "', argument " "3"" of type '" "std::string""'");
}
arg3 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
try
{
result = (int)(arg1)->addNamespace(arg2,arg3);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_XPathBase_getXPath(int argc, VALUE *argv, VALUE self) {
XPath *arg1 = (XPath *) 0 ;
std::string result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_XPath, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getXPath" "', argument " "1"" of type '" "XPath *""'");
}
arg1 = reinterpret_cast< XPath * >(argp1);
{
try
{
result = (arg1)->getXPath();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_std_string(static_cast< std::string >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_XPathBase_setXPath(int argc, VALUE *argv, VALUE self) {
XPath *arg1 = (XPath *) 0 ;
std::string arg2 ;
void *argp1 = 0 ;
int res1 = 0 ;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_XPath, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "setXPath" "', argument " "1"" of type '" "XPath *""'");
}
arg1 = reinterpret_cast< XPath * >(argp1);
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "setXPath" "', argument " "2"" of type '" "std::string""'");
}
arg2 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
try
{
(arg1)->setXPath(arg2);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return Qnil;
fail:
return Qnil;
}
swig_class cXPath;
SWIGINTERN void
free_CountPtrTo_Sl_XPath_Sg_(CountPtrTo<XPath > *arg1) {
SWIG_RubyRemoveTracking(arg1);
delete arg1;
}
SWIGINTERN VALUE
_wrap_XPath___deref__(int argc, VALUE *argv, VALUE self) {
CountPtrTo<XPath > *arg1 = (CountPtrTo<XPath > *) 0 ;
XPath *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTXPath_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "operator ->" "', argument " "1"" of type '" "CountPtrTo<XPath > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<XPath > * >(argp1);
{
try
{
result = (XPath *)(arg1)->operator ->();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XPath, 0 | 0 );
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_new_XPath__SWIG_0(int argc, VALUE *argv, VALUE self) {
CountPtrTo<XPath > *result = 0 ;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
{
try
{
result = (CountPtrTo<XPath > *)new_CountPtrTo_Sl_XPath_Sg___SWIG_0();DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_new_XPath__SWIG_1(int argc, VALUE *argv, VALUE self) {
CountPtrTo<XPath > *arg1 = 0 ;
CountPtrTo<XPath > *result = 0 ;
void *argp1 ;
int res1 = 0 ;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(argv[0], &argp1, SWIGTYPE_p_CountPtrToTXPath_t, 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CountPtrTo<(XPath)>" "', argument " "1"" of type '" "CountPtrTo<XPath > const &""'");
}
if (!argp1) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CountPtrTo<(XPath)>" "', argument " "1"" of type '" "CountPtrTo<XPath > const &""'");
}
arg1 = reinterpret_cast< CountPtrTo<XPath > * >(argp1);
{
try
{
result = (CountPtrTo<XPath > *)new_CountPtrTo_Sl_XPath_Sg___SWIG_1((CountPtrTo<XPath > const &)*arg1);DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_XPath_allocate(VALUE self) {
#else
SWIGINTERN VALUE
_wrap_XPath_allocate(int argc, VALUE *argv, VALUE self) {
#endif
VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_CountPtrToTXPath_t);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
rb_obj_call_init(vresult, argc, argv);
#endif
return vresult;
}
SWIGINTERN VALUE
_wrap_new_XPath__SWIG_2(int argc, VALUE *argv, VALUE self) {
std::string arg1 ;
CountPtrTo<XPath > *result = 0 ;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "CountPtrTo<(XPath)>" "', argument " "1"" of type '" "std::string""'");
}
arg1 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
try
{
result = (CountPtrTo<XPath > *)new_CountPtrTo_Sl_XPath_Sg___SWIG_2(arg1);DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
SWIGINTERN VALUE _wrap_new_XPath(int nargs, VALUE *args, VALUE self) {
int argc;
VALUE argv[1];
int ii;
argc = nargs;
if (argc > 1) SWIG_fail;
for (ii = 0; (ii < argc); ii++) {
argv[ii] = args[ii];
}
if (argc == 0) {
return _wrap_new_XPath__SWIG_0(nargs, args, self);
}
if (argc == 1) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CountPtrToTXPath_t, 0);
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_new_XPath__SWIG_1(nargs, args, self);
}
}
if (argc == 1) {
int _v;
int res = SWIG_AsPtr_std_string(argv[0], (std::string**)(0));
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_new_XPath__SWIG_2(nargs, args, self);
}
}
fail:
rb_raise(rb_eArgError, "No matching function for overloaded 'new_XPath'");
return Qnil;
}
SWIGINTERN VALUE
_wrap_XPath_addNamespace(int argc, VALUE *argv, VALUE self) {
CountPtrTo<XPath > *arg1 = (CountPtrTo<XPath > *) 0 ;
std::string arg2 ;
std::string arg3 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 2) || (argc > 2)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTXPath_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "addNamespace" "', argument " "1"" of type '" "CountPtrTo<XPath > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<XPath > * >(argp1);
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "addNamespace" "', argument " "2"" of type '" "std::string""'");
}
arg2 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[1], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "addNamespace" "', argument " "3"" of type '" "std::string""'");
}
arg3 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
try
{
result = (int)(*arg1)->addNamespace(arg2,arg3);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_XPath_getXPath(int argc, VALUE *argv, VALUE self) {
CountPtrTo<XPath > *arg1 = (CountPtrTo<XPath > *) 0 ;
std::string result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTXPath_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getXPath" "', argument " "1"" of type '" "CountPtrTo<XPath > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<XPath > * >(argp1);
{
try
{
result = (*arg1)->getXPath();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_std_string(static_cast< std::string >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_XPath_setXPath(int argc, VALUE *argv, VALUE self) {
CountPtrTo<XPath > *arg1 = (CountPtrTo<XPath > *) 0 ;
std::string arg2 ;
void *argp1 = 0 ;
int res1 = 0 ;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTXPath_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "setXPath" "', argument " "1"" of type '" "CountPtrTo<XPath > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<XPath > * >(argp1);
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "setXPath" "', argument " "2"" of type '" "std::string""'");
}
arg2 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
try
{
(*arg1)->setXPath(arg2);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return Qnil;
fail:
return Qnil;
}
swig_class cXmlElementBase;
#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_XmlElementBase_allocate(VALUE self) {
#else
SWIGINTERN VALUE
_wrap_XmlElementBase_allocate(int argc, VALUE *argv, VALUE self) {
#endif
VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_XmlElement);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
rb_obj_call_init(vresult, argc, argv);
#endif
return vresult;
}
SWIGINTERN VALUE
_wrap_new_XmlElementBase(int argc, VALUE *argv, VALUE self) {
XmlElement *result = 0 ;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
{
try
{
result = (XmlElement *)new XmlElement();DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
SWIGINTERN void
free_XmlElement(XmlElement *arg1) {
SWIG_RubyRemoveTracking(arg1);
delete arg1;
}
SWIGINTERN VALUE
_wrap_XmlElementBase_getNode(int argc, VALUE *argv, VALUE self) {
XmlElement *arg1 = (XmlElement *) 0 ;
xmlNodePtr result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_XmlElement, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getNode" "', argument " "1"" of type '" "XmlElement *""'");
}
arg1 = reinterpret_cast< XmlElement * >(argp1);
{
try
{
result = (arg1)->getNode();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_NewPointerObj((new xmlNodePtr(static_cast< const xmlNodePtr& >(result))), SWIGTYPE_p_xmlNodePtr, SWIG_POINTER_OWN | 0 );
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_XmlElementBase_getTagName(int argc, VALUE *argv, VALUE self) {
XmlElement *arg1 = (XmlElement *) 0 ;
std::string result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_XmlElement, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getTagName" "', argument " "1"" of type '" "XmlElement *""'");
}
arg1 = reinterpret_cast< XmlElement * >(argp1);
{
try
{
result = (arg1)->getTagName();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_std_string(static_cast< std::string >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_XmlElementBase_getAttribute__SWIG_0(int argc, VALUE *argv, VALUE self) {
XmlElement *arg1 = (XmlElement *) 0 ;
std::string arg2 ;
std::string result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_XmlElement, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getAttribute" "', argument " "1"" of type '" "XmlElement *""'");
}
arg1 = reinterpret_cast< XmlElement * >(argp1);
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "getAttribute" "', argument " "2"" of type '" "std::string""'");
}
arg2 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
try
{
result = (arg1)->getAttribute(arg2);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_std_string(static_cast< std::string >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_XmlElementBase_getAttribute__SWIG_1(int argc, VALUE *argv, VALUE self) {
XmlElement *arg1 = (XmlElement *) 0 ;
std::string arg2 ;
std::string arg3 ;
std::string result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 2) || (argc > 2)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_XmlElement, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getAttribute" "', argument " "1"" of type '" "XmlElement *""'");
}
arg1 = reinterpret_cast< XmlElement * >(argp1);
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "getAttribute" "', argument " "2"" of type '" "std::string""'");
}
arg2 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[1], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "getAttribute" "', argument " "3"" of type '" "std::string""'");
}
arg3 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
try
{
result = (arg1)->getAttribute(arg2,arg3);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_std_string(static_cast< std::string >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE _wrap_XmlElementBase_getAttribute(int nargs, VALUE *args, VALUE self) {
int argc;
VALUE argv[4];
int ii;
argc = nargs + 1;
argv[0] = self;
if (argc > 4) SWIG_fail;
for (ii = 1; (ii < argc); ii++) {
argv[ii] = args[ii-1];
}
if (argc == 2) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_XmlElement, 0);
_v = SWIG_CheckState(res);
if (_v) {
int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_XmlElementBase_getAttribute__SWIG_0(nargs, args, self);
}
}
}
if (argc == 3) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_XmlElement, 0);
_v = SWIG_CheckState(res);
if (_v) {
int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
_v = SWIG_CheckState(res);
if (_v) {
int res = SWIG_AsPtr_std_string(argv[2], (std::string**)(0));
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_XmlElementBase_getAttribute__SWIG_1(nargs, args, self);
}
}
}
}
fail:
rb_raise(rb_eArgError, "No matching function for overloaded 'XmlElementBase_getAttribute'");
return Qnil;
}
SWIGINTERN VALUE
_wrap_XmlElementBase_getNodePath(int argc, VALUE *argv, VALUE self) {
XmlElement *arg1 = (XmlElement *) 0 ;
std::string result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_XmlElement, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getNodePath" "', argument " "1"" of type '" "XmlElement *""'");
}
arg1 = reinterpret_cast< XmlElement * >(argp1);
{
try
{
result = (arg1)->getNodePath();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_std_string(static_cast< std::string >(result));
return vresult;
fail:
return Qnil;
}
swig_class cXmlElement;
SWIGINTERN void
free_CountPtrTo_Sl_XmlElement_Sg_(CountPtrTo<XmlElement > *arg1) {
SWIG_RubyRemoveTracking(arg1);
delete arg1;
}
SWIGINTERN VALUE
_wrap_XmlElement___deref__(int argc, VALUE *argv, VALUE self) {
CountPtrTo<XmlElement > *arg1 = (CountPtrTo<XmlElement > *) 0 ;
XmlElement *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTXmlElement_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "operator ->" "', argument " "1"" of type '" "CountPtrTo<XmlElement > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<XmlElement > * >(argp1);
{
try
{
result = (XmlElement *)(arg1)->operator ->();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XmlElement, 0 | 0 );
return vresult;
fail:
return Qnil;
}
#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_XmlElement_allocate(VALUE self) {
#else
SWIGINTERN VALUE
_wrap_XmlElement_allocate(int argc, VALUE *argv, VALUE self) {
#endif
VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_CountPtrToTXmlElement_t);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
rb_obj_call_init(vresult, argc, argv);
#endif
return vresult;
}
SWIGINTERN VALUE
_wrap_new_XmlElement(int argc, VALUE *argv, VALUE self) {
CountPtrTo<XmlElement > *result = 0 ;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
{
try
{
result = (CountPtrTo<XmlElement > *)new_CountPtrTo_Sl_XmlElement_Sg_();DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_XmlElement_getNode(int argc, VALUE *argv, VALUE self) {
CountPtrTo<XmlElement > *arg1 = (CountPtrTo<XmlElement > *) 0 ;
xmlNodePtr result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTXmlElement_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getNode" "', argument " "1"" of type '" "CountPtrTo<XmlElement > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<XmlElement > * >(argp1);
{
try
{
result = (*arg1)->getNode();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_NewPointerObj((new xmlNodePtr(static_cast< const xmlNodePtr& >(result))), SWIGTYPE_p_xmlNodePtr, SWIG_POINTER_OWN | 0 );
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_XmlElement_getTagName(int argc, VALUE *argv, VALUE self) {
CountPtrTo<XmlElement > *arg1 = (CountPtrTo<XmlElement > *) 0 ;
std::string result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTXmlElement_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getTagName" "', argument " "1"" of type '" "CountPtrTo<XmlElement > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<XmlElement > * >(argp1);
{
try
{
result = (*arg1)->getTagName();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_std_string(static_cast< std::string >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_XmlElement_getAttribute__SWIG_0(int argc, VALUE *argv, VALUE self) {
CountPtrTo<XmlElement > *arg1 = (CountPtrTo<XmlElement > *) 0 ;
std::string arg2 ;
std::string result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTXmlElement_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getAttribute" "', argument " "1"" of type '" "CountPtrTo<XmlElement > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<XmlElement > * >(argp1);
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "getAttribute" "', argument " "2"" of type '" "std::string""'");
}
arg2 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
try
{
result = (*arg1)->getAttribute(arg2);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_std_string(static_cast< std::string >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_XmlElement_getAttribute__SWIG_1(int argc, VALUE *argv, VALUE self) {
CountPtrTo<XmlElement > *arg1 = (CountPtrTo<XmlElement > *) 0 ;
std::string arg2 ;
std::string arg3 ;
std::string result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 2) || (argc > 2)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTXmlElement_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getAttribute" "', argument " "1"" of type '" "CountPtrTo<XmlElement > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<XmlElement > * >(argp1);
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "getAttribute" "', argument " "2"" of type '" "std::string""'");
}
arg2 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[1], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "getAttribute" "', argument " "3"" of type '" "std::string""'");
}
arg3 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
try
{
result = (*arg1)->getAttribute(arg2,arg3);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_std_string(static_cast< std::string >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE _wrap_XmlElement_getAttribute(int nargs, VALUE *args, VALUE self) {
int argc;
VALUE argv[4];
int ii;
argc = nargs + 1;
argv[0] = self;
if (argc > 4) SWIG_fail;
for (ii = 1; (ii < argc); ii++) {
argv[ii] = args[ii-1];
}
if (argc == 2) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CountPtrToTXmlElement_t, 0);
_v = SWIG_CheckState(res);
if (_v) {
int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_XmlElement_getAttribute__SWIG_0(nargs, args, self);
}
}
}
if (argc == 3) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CountPtrToTXmlElement_t, 0);
_v = SWIG_CheckState(res);
if (_v) {
int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
_v = SWIG_CheckState(res);
if (_v) {
int res = SWIG_AsPtr_std_string(argv[2], (std::string**)(0));
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_XmlElement_getAttribute__SWIG_1(nargs, args, self);
}
}
}
}
fail:
rb_raise(rb_eArgError, "No matching function for overloaded 'XmlElement_getAttribute'");
return Qnil;
}
SWIGINTERN VALUE
_wrap_XmlElement_getNodePath(int argc, VALUE *argv, VALUE self) {
CountPtrTo<XmlElement > *arg1 = (CountPtrTo<XmlElement > *) 0 ;
std::string result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_CountPtrToTXmlElement_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getNodePath" "', argument " "1"" of type '" "CountPtrTo<XmlElement > *""'");
}
arg1 = reinterpret_cast< CountPtrTo<XmlElement > * >(argp1);
{
try
{
result = (*arg1)->getNodePath();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_std_string(static_cast< std::string >(result));
return vresult;
fail:
return Qnil;
}
swig_class cXmlElementVector;
SWIGINTERN VALUE
_wrap_new_XmlElementVector__SWIG_0(int argc, VALUE *argv, VALUE self) {
std::vector<XmlElementPtr > *result = 0 ;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
{
try
{
result = (std::vector<XmlElementPtr > *)new std::vector<XmlElementPtr >();DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_new_XmlElementVector__SWIG_1(int argc, VALUE *argv, VALUE self) {
unsigned int arg1 ;
std::vector<XmlElementPtr > *result = 0 ;
unsigned int val1 ;
int ecode1 = 0 ;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
ecode1 = SWIG_AsVal_unsigned_SS_int(argv[0], &val1);
if (!SWIG_IsOK(ecode1)) {
SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "std::vector<(XmlElementPtr)>" "', argument " "1"" of type '" "unsigned int""'");
}
arg1 = static_cast< unsigned int >(val1);
{
try
{
result = (std::vector<XmlElementPtr > *)new std::vector<XmlElementPtr >(arg1);DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_new_XmlElementVector__SWIG_2(int argc, VALUE *argv, VALUE self) {
unsigned int arg1 ;
CountPtrTo<XmlElement > *arg2 = 0 ;
std::vector<XmlElementPtr > *result = 0 ;
unsigned int val1 ;
int ecode1 = 0 ;
void *argp2 ;
int res2 = 0 ;
if ((argc < 2) || (argc > 2)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
}
ecode1 = SWIG_AsVal_unsigned_SS_int(argv[0], &val1);
if (!SWIG_IsOK(ecode1)) {
SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "std::vector<(XmlElementPtr)>" "', argument " "1"" of type '" "unsigned int""'");
}
arg1 = static_cast< unsigned int >(val1);
res2 = SWIG_ConvertPtr(argv[1], &argp2, SWIGTYPE_p_CountPtrToTXmlElement_t, 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "std::vector<(XmlElementPtr)>" "', argument " "2"" of type '" "CountPtrTo<XmlElement > const &""'");
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "std::vector<(XmlElementPtr)>" "', argument " "2"" of type '" "CountPtrTo<XmlElement > const &""'");
}
arg2 = reinterpret_cast< CountPtrTo<XmlElement > * >(argp2);
{
try
{
result = (std::vector<XmlElementPtr > *)new std::vector<XmlElementPtr >(arg1,(CountPtrTo<XmlElement > const &)*arg2);DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_XmlElementVector_allocate(VALUE self) {
#else
SWIGINTERN VALUE
_wrap_XmlElementVector_allocate(int argc, VALUE *argv, VALUE self) {
#endif
VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_std__vectorTCountPtrToTXmlElement_t_t);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
rb_obj_call_init(vresult, argc, argv);
#endif
return vresult;
}
SWIGINTERN VALUE
_wrap_new_XmlElementVector__SWIG_3(int argc, VALUE *argv, VALUE self) {
std::vector<CountPtrTo<XmlElement > > *arg1 = 0 ;
std::vector<XmlElementPtr > *result = 0 ;
std::vector<CountPtrTo<XmlElement > > temp1 ;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
{
if (rb_obj_is_kind_of(argv[0],rb_cArray)) {
unsigned int size = RARRAY_LEN(argv[0]);
arg1 = &temp1;
for (unsigned int i=0; i<size; i++) {
VALUE o = RARRAY_PTR(argv[0])[i];
CountPtrTo<XmlElement >* x;
SWIG_ConvertPtr(o, (void **) &x, SWIGTYPE_p_CountPtrToTXmlElement_t, 1);
temp1.push_back(*x);
}
} else {
SWIG_ConvertPtr(argv[0], (void **) &arg1, SWIGTYPE_p_std__vectorTCountPtrToTXmlElement_t_t, 1);
}
}
{
try
{
result = (std::vector<XmlElementPtr > *)new std::vector<XmlElementPtr >((std::vector<CountPtrTo<XmlElement > > const &)*arg1);DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
SWIGINTERN VALUE _wrap_new_XmlElementVector(int nargs, VALUE *args, VALUE self) {
int argc;
VALUE argv[2];
int ii;
argc = nargs;
if (argc > 2) SWIG_fail;
for (ii = 0; (ii < argc); ii++) {
argv[ii] = args[ii];
}
if (argc == 0) {
return _wrap_new_XmlElementVector__SWIG_0(nargs, args, self);
}
if (argc == 1) {
int _v;
{
int res = SWIG_AsVal_unsigned_SS_int(argv[0], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
return _wrap_new_XmlElementVector__SWIG_1(nargs, args, self);
}
}
if (argc == 1) {
int _v;
{
/* native sequence? */
if (rb_obj_is_kind_of(argv[0],rb_cArray)) {
unsigned int size = RARRAY_LEN(argv[0]);
if (size == 0) {
/* an empty sequence can be of any type */
_v = 1;
} else {
/* check the first element only */
CountPtrTo<XmlElement >* x;
VALUE o = RARRAY_PTR(argv[0])[0];
if ((SWIG_ConvertPtr(o,(void **) &x,
SWIGTYPE_p_CountPtrToTXmlElement_t,0)) != -1)
_v = 1;
else
_v = 0;
}
} else {
/* wrapped vector? */
std::vector<CountPtrTo<XmlElement > >* v;
if (SWIG_ConvertPtr(argv[0],(void **) &v,
SWIGTYPE_p_std__vectorTCountPtrToTXmlElement_t_t,0) != -1)
_v = 1;
else
_v = 0;
}
}
if (_v) {
return _wrap_new_XmlElementVector__SWIG_3(nargs, args, self);
}
}
if (argc == 2) {
int _v;
{
int res = SWIG_AsVal_unsigned_SS_int(argv[0], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_CountPtrToTXmlElement_t, 0);
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_new_XmlElementVector__SWIG_2(nargs, args, self);
}
}
}
fail:
rb_raise(rb_eArgError, "No matching function for overloaded 'new_XmlElementVector'");
return Qnil;
}
SWIGINTERN VALUE
_wrap_XmlElementVector___len__(int argc, VALUE *argv, VALUE self) {
std::vector<XmlElementPtr > *arg1 = (std::vector<XmlElementPtr > *) 0 ;
unsigned int result;
std::vector<CountPtrTo<XmlElement > > temp1 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
{
if (rb_obj_is_kind_of(self,rb_cArray)) {
unsigned int size = RARRAY_LEN(self);
arg1 = &temp1;
for (unsigned int i=0; i<size; i++) {
VALUE o = RARRAY_PTR(self)[i];
CountPtrTo<XmlElement >* x;
SWIG_ConvertPtr(o, (void **) &x, SWIGTYPE_p_CountPtrToTXmlElement_t, 1);
temp1.push_back(*x);
}
} else {
SWIG_ConvertPtr(self, (void **) &arg1, SWIGTYPE_p_std__vectorTCountPtrToTXmlElement_t_t, 1);
}
}
{
try
{
result = (unsigned int)((std::vector<XmlElementPtr > const *)arg1)->size();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_XmlElementVector_emptyq___(int argc, VALUE *argv, VALUE self) {
std::vector<XmlElementPtr > *arg1 = (std::vector<XmlElementPtr > *) 0 ;
bool result;
std::vector<CountPtrTo<XmlElement > > temp1 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
{
if (rb_obj_is_kind_of(self,rb_cArray)) {
unsigned int size = RARRAY_LEN(self);
arg1 = &temp1;
for (unsigned int i=0; i<size; i++) {
VALUE o = RARRAY_PTR(self)[i];
CountPtrTo<XmlElement >* x;
SWIG_ConvertPtr(o, (void **) &x, SWIGTYPE_p_CountPtrToTXmlElement_t, 1);
temp1.push_back(*x);
}
} else {
SWIG_ConvertPtr(self, (void **) &arg1, SWIGTYPE_p_std__vectorTCountPtrToTXmlElement_t_t, 1);
}
}
{
try
{
result = (bool)((std::vector<XmlElementPtr > const *)arg1)->empty();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_bool(static_cast< bool >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_XmlElementVector_clear(int argc, VALUE *argv, VALUE self) {
std::vector<XmlElementPtr > *arg1 = (std::vector<XmlElementPtr > *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorTCountPtrToTXmlElement_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "clear" "', argument " "1"" of type '" "std::vector<XmlElementPtr > *""'");
}
arg1 = reinterpret_cast< std::vector<XmlElementPtr > * >(argp1);
{
try
{
(arg1)->clear();
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return Qnil;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_XmlElementVector_push(int argc, VALUE *argv, VALUE self) {
std::vector<XmlElementPtr > *arg1 = (std::vector<XmlElementPtr > *) 0 ;
CountPtrTo<XmlElement > *arg2 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 ;
int res2 = 0 ;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorTCountPtrToTXmlElement_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "push_back" "', argument " "1"" of type '" "std::vector<XmlElementPtr > *""'");
}
arg1 = reinterpret_cast< std::vector<XmlElementPtr > * >(argp1);
res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_CountPtrToTXmlElement_t, 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "push_back" "', argument " "2"" of type '" "CountPtrTo<XmlElement > const &""'");
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "push_back" "', argument " "2"" of type '" "CountPtrTo<XmlElement > const &""'");
}
arg2 = reinterpret_cast< CountPtrTo<XmlElement > * >(argp2);
{
try
{
(arg1)->push_back((CountPtrTo<XmlElement > const &)*arg2);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return Qnil;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_XmlElementVector_pop(int argc, VALUE *argv, VALUE self) {
std::vector<XmlElementPtr > *arg1 = (std::vector<XmlElementPtr > *) 0 ;
SwigValueWrapper<CountPtrTo<XmlElement > > result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorTCountPtrToTXmlElement_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pop" "', argument " "1"" of type '" "std::vector<XmlElementPtr > *""'");
}
arg1 = reinterpret_cast< std::vector<XmlElementPtr > * >(argp1);
{
try
{
try {
result = std_vector_Sl_XmlElementPtr_Sg__pop(arg1);
}
catch(std::out_of_range &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_std__out_of_range, SWIG_NewPointerObj((new std::out_of_range(static_cast< const std::out_of_range& >(_e))),SWIGTYPE_p_std__out_of_range,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_NewPointerObj((new CountPtrTo<XmlElement >(static_cast< const CountPtrTo<XmlElement >& >(result))), SWIGTYPE_p_CountPtrToTXmlElement_t, SWIG_POINTER_OWN | 0 );
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_XmlElementVector___getitem__(int argc, VALUE *argv, VALUE self) {
std::vector<XmlElementPtr > *arg1 = (std::vector<XmlElementPtr > *) 0 ;
int arg2 ;
CountPtrTo<XmlElement > *result = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int val2 ;
int ecode2 = 0 ;
VALUE vresult = Qnil;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorTCountPtrToTXmlElement_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "__getitem__" "', argument " "1"" of type '" "std::vector<XmlElementPtr > *""'");
}
arg1 = reinterpret_cast< std::vector<XmlElementPtr > * >(argp1);
ecode2 = SWIG_AsVal_int(argv[0], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "__getitem__" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
{
try
{
try {
{
CountPtrTo<XmlElement > &_result_ref = std_vector_Sl_XmlElementPtr_Sg____getitem__(arg1,arg2);
result = (CountPtrTo<XmlElement > *) &_result_ref;
}
}
catch(std::out_of_range &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_std__out_of_range, SWIG_NewPointerObj((new std::out_of_range(static_cast< const std::out_of_range& >(_e))),SWIGTYPE_p_std__out_of_range,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_CountPtrToTXmlElement_t, 0 | 0 );
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_XmlElementVector___setitem__(int argc, VALUE *argv, VALUE self) {
std::vector<XmlElementPtr > *arg1 = (std::vector<XmlElementPtr > *) 0 ;
int arg2 ;
CountPtrTo<XmlElement > *arg3 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int val2 ;
int ecode2 = 0 ;
void *argp3 ;
int res3 = 0 ;
if ((argc < 2) || (argc > 2)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorTCountPtrToTXmlElement_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "__setitem__" "', argument " "1"" of type '" "std::vector<XmlElementPtr > *""'");
}
arg1 = reinterpret_cast< std::vector<XmlElementPtr > * >(argp1);
ecode2 = SWIG_AsVal_int(argv[0], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "__setitem__" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
res3 = SWIG_ConvertPtr(argv[1], &argp3, SWIGTYPE_p_CountPtrToTXmlElement_t, 0 );
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "__setitem__" "', argument " "3"" of type '" "CountPtrTo<XmlElement > const &""'");
}
if (!argp3) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "__setitem__" "', argument " "3"" of type '" "CountPtrTo<XmlElement > const &""'");
}
arg3 = reinterpret_cast< CountPtrTo<XmlElement > * >(argp3);
{
try
{
try {
std_vector_Sl_XmlElementPtr_Sg____setitem__(arg1,arg2,(CountPtrTo<XmlElement > const &)*arg3);
}
catch(std::out_of_range &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_std__out_of_range, SWIG_NewPointerObj((new std::out_of_range(static_cast< const std::out_of_range& >(_e))),SWIGTYPE_p_std__out_of_range,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return Qnil;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_XmlElementVector_each(int argc, VALUE *argv, VALUE self) {
std::vector<XmlElementPtr > *arg1 = (std::vector<XmlElementPtr > *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_std__vectorTCountPtrToTXmlElement_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "each" "', argument " "1"" of type '" "std::vector<XmlElementPtr > *""'");
}
arg1 = reinterpret_cast< std::vector<XmlElementPtr > * >(argp1);
{
try
{
std_vector_Sl_XmlElementPtr_Sg__each(arg1);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return Qnil;
fail:
return Qnil;
}
SWIGINTERN void
free_std_vector_Sl_XmlElementPtr_Sg_(std::vector<XmlElementPtr > *arg1) {
SWIG_RubyRemoveTracking(arg1);
delete arg1;
}
swig_class cSigner;
SWIGINTERN VALUE
_wrap_new_Signer__SWIG_0(int argc, VALUE *argv, VALUE self) {
SwigValueWrapper<CountPtrTo<XmlDoc > > arg1 ;
SwigValueWrapper<CountPtrTo<Key > > arg2 ;
Signer *result = 0 ;
void *argp1 ;
int res1 = 0 ;
void *argp2 ;
int res2 = 0 ;
if ((argc < 2) || (argc > 2)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
}
{
res1 = SWIG_ConvertPtr(argv[0], &argp1, SWIGTYPE_p_CountPtrToTXmlDoc_t, 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Signer" "', argument " "1"" of type '" "XmlDocClassPtr""'");
}
if (!argp1) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Signer" "', argument " "1"" of type '" "XmlDocClassPtr""'");
} else {
arg1 = *(reinterpret_cast< XmlDocClassPtr * >(argp1));
}
}
{
res2 = SWIG_ConvertPtr(argv[1], &argp2, SWIGTYPE_p_CountPtrToTKey_t, 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Signer" "', argument " "2"" of type '" "KeyPtr""'");
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Signer" "', argument " "2"" of type '" "KeyPtr""'");
} else {
arg2 = *(reinterpret_cast< KeyPtr * >(argp2));
}
}
{
try
{
result = (Signer *)new Signer(arg1,arg2);DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_new_Signer__SWIG_1(int argc, VALUE *argv, VALUE self) {
SwigValueWrapper<CountPtrTo<XmlDoc > > arg1 ;
SwigValueWrapper<CountPtrTo<Key > > arg2 ;
SwigValueWrapper<CountPtrTo<Key > > arg3 ;
Signer *result = 0 ;
void *argp1 ;
int res1 = 0 ;
void *argp2 ;
int res2 = 0 ;
void *argp3 ;
int res3 = 0 ;
if ((argc < 3) || (argc > 3)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
}
{
res1 = SWIG_ConvertPtr(argv[0], &argp1, SWIGTYPE_p_CountPtrToTXmlDoc_t, 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Signer" "', argument " "1"" of type '" "XmlDocClassPtr""'");
}
if (!argp1) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Signer" "', argument " "1"" of type '" "XmlDocClassPtr""'");
} else {
arg1 = *(reinterpret_cast< XmlDocClassPtr * >(argp1));
}
}
{
res2 = SWIG_ConvertPtr(argv[1], &argp2, SWIGTYPE_p_CountPtrToTKey_t, 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Signer" "', argument " "2"" of type '" "KeyPtr""'");
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Signer" "', argument " "2"" of type '" "KeyPtr""'");
} else {
arg2 = *(reinterpret_cast< KeyPtr * >(argp2));
}
}
{
res3 = SWIG_ConvertPtr(argv[2], &argp3, SWIGTYPE_p_CountPtrToTKey_t, 0 );
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Signer" "', argument " "3"" of type '" "KeyPtr""'");
}
if (!argp3) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Signer" "', argument " "3"" of type '" "KeyPtr""'");
} else {
arg3 = *(reinterpret_cast< KeyPtr * >(argp3));
}
}
{
try
{
result = (Signer *)new Signer(arg1,arg2,arg3);DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_new_Signer__SWIG_2(int argc, VALUE *argv, VALUE self) {
SwigValueWrapper<CountPtrTo<XmlDoc > > arg1 ;
SwigValueWrapper<CountPtrTo<Key > > arg2 ;
SwigValueWrapper<CountPtrTo<X509Certificate > > arg3 ;
Signer *result = 0 ;
void *argp1 ;
int res1 = 0 ;
void *argp2 ;
int res2 = 0 ;
void *argp3 ;
int res3 = 0 ;
if ((argc < 3) || (argc > 3)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
}
{
res1 = SWIG_ConvertPtr(argv[0], &argp1, SWIGTYPE_p_CountPtrToTXmlDoc_t, 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Signer" "', argument " "1"" of type '" "XmlDocClassPtr""'");
}
if (!argp1) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Signer" "', argument " "1"" of type '" "XmlDocClassPtr""'");
} else {
arg1 = *(reinterpret_cast< XmlDocClassPtr * >(argp1));
}
}
{
res2 = SWIG_ConvertPtr(argv[1], &argp2, SWIGTYPE_p_CountPtrToTKey_t, 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Signer" "', argument " "2"" of type '" "KeyPtr""'");
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Signer" "', argument " "2"" of type '" "KeyPtr""'");
} else {
arg2 = *(reinterpret_cast< KeyPtr * >(argp2));
}
}
{
res3 = SWIG_ConvertPtr(argv[2], &argp3, SWIGTYPE_p_CountPtrToTX509Certificate_t, 0 );
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Signer" "', argument " "3"" of type '" "X509CertificatePtr""'");
}
if (!argp3) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Signer" "', argument " "3"" of type '" "X509CertificatePtr""'");
} else {
arg3 = *(reinterpret_cast< X509CertificatePtr * >(argp3));
}
}
{
try
{
try {
result = (Signer *)new Signer(arg1,arg2,arg3);DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch(KeyError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_KeyError, SWIG_NewPointerObj((new KeyError(static_cast< const KeyError& >(_e))),SWIGTYPE_p_KeyError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(ValueError &_e) {
SWIG_exception(SWIG_ValueError, (&_e)->what());
}
catch(MemoryError &_e) {
SWIG_exception(SWIG_MemoryError, (&_e)->what());
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_Signer_allocate(VALUE self) {
#else
SWIGINTERN VALUE
_wrap_Signer_allocate(int argc, VALUE *argv, VALUE self) {
#endif
VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Signer);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
rb_obj_call_init(vresult, argc, argv);
#endif
return vresult;
}
SWIGINTERN VALUE
_wrap_new_Signer__SWIG_3(int argc, VALUE *argv, VALUE self) {
SwigValueWrapper<CountPtrTo<XmlDoc > > arg1 ;
SwigValueWrapper<CountPtrTo<Key > > arg2 ;
std::vector<X509CertificatePtr > arg3 ;
Signer *result = 0 ;
void *argp1 ;
int res1 = 0 ;
void *argp2 ;
int res2 = 0 ;
if ((argc < 3) || (argc > 3)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
}
{
res1 = SWIG_ConvertPtr(argv[0], &argp1, SWIGTYPE_p_CountPtrToTXmlDoc_t, 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Signer" "', argument " "1"" of type '" "XmlDocClassPtr""'");
}
if (!argp1) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Signer" "', argument " "1"" of type '" "XmlDocClassPtr""'");
} else {
arg1 = *(reinterpret_cast< XmlDocClassPtr * >(argp1));
}
}
{
res2 = SWIG_ConvertPtr(argv[1], &argp2, SWIGTYPE_p_CountPtrToTKey_t, 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Signer" "', argument " "2"" of type '" "KeyPtr""'");
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Signer" "', argument " "2"" of type '" "KeyPtr""'");
} else {
arg2 = *(reinterpret_cast< KeyPtr * >(argp2));
}
}
{
if (rb_obj_is_kind_of(argv[2],rb_cArray)) {
unsigned int size = RARRAY_LEN(argv[2]);
arg3;
for (unsigned int i=0; i<size; i++) {
VALUE o = RARRAY_PTR(argv[2])[i];
CountPtrTo<X509Certificate >* x;
SWIG_ConvertPtr(o, (void **) &x, SWIGTYPE_p_CountPtrToTX509Certificate_t, 1);
(&arg3)->push_back(*x);
}
} else {
void *ptr;
SWIG_ConvertPtr(argv[2], &ptr, SWIGTYPE_p_std__vectorTCountPtrToTX509Certificate_t_t, 1);
arg3 = *((std::vector<X509CertificatePtr > *) ptr);
}
}
{
try
{
try {
result = (Signer *)new Signer(arg1,arg2,arg3);DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch(KeyError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_KeyError, SWIG_NewPointerObj((new KeyError(static_cast< const KeyError& >(_e))),SWIGTYPE_p_KeyError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(ValueError &_e) {
SWIG_exception(SWIG_ValueError, (&_e)->what());
}
catch(MemoryError &_e) {
SWIG_exception(SWIG_MemoryError, (&_e)->what());
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
SWIGINTERN VALUE _wrap_new_Signer(int nargs, VALUE *args, VALUE self) {
int argc;
VALUE argv[3];
int ii;
argc = nargs;
if (argc > 3) SWIG_fail;
for (ii = 0; (ii < argc); ii++) {
argv[ii] = args[ii];
}
if (argc == 2) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CountPtrToTXmlDoc_t, 0);
_v = SWIG_CheckState(res);
if (_v) {
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_CountPtrToTKey_t, 0);
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_new_Signer__SWIG_0(nargs, args, self);
}
}
}
if (argc == 3) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CountPtrToTXmlDoc_t, 0);
_v = SWIG_CheckState(res);
if (_v) {
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_CountPtrToTKey_t, 0);
_v = SWIG_CheckState(res);
if (_v) {
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_CountPtrToTKey_t, 0);
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_new_Signer__SWIG_1(nargs, args, self);
}
}
}
}
if (argc == 3) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CountPtrToTXmlDoc_t, 0);
_v = SWIG_CheckState(res);
if (_v) {
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_CountPtrToTKey_t, 0);
_v = SWIG_CheckState(res);
if (_v) {
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[2], &vptr, SWIGTYPE_p_CountPtrToTX509Certificate_t, 0);
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_new_Signer__SWIG_2(nargs, args, self);
}
}
}
}
if (argc == 3) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CountPtrToTXmlDoc_t, 0);
_v = SWIG_CheckState(res);
if (_v) {
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_CountPtrToTKey_t, 0);
_v = SWIG_CheckState(res);
if (_v) {
{
/* native sequence? */
if (rb_obj_is_kind_of(argv[2],rb_cArray)) {
unsigned int size = RARRAY_LEN(argv[2]);
if (size == 0) {
/* an empty sequence can be of any type */
_v = 1;
} else {
/* check the first element only */
CountPtrTo<X509Certificate >* x;
VALUE o = RARRAY_PTR(argv[2])[0];
if ((SWIG_ConvertPtr(o,(void **) &x,
SWIGTYPE_p_CountPtrToTX509Certificate_t,0)) != -1)
_v = 1;
else
_v = 0;
}
} else {
/* wrapped vector? */
std::vector<CountPtrTo<X509Certificate > >* v;
if (SWIG_ConvertPtr(argv[2],(void **) &v,
SWIGTYPE_p_std__vectorTCountPtrToTX509Certificate_t_t,0) != -1)
_v = 1;
else
_v = 0;
}
}
if (_v) {
return _wrap_new_Signer__SWIG_3(nargs, args, self);
}
}
}
}
fail:
rb_raise(rb_eArgError, "No matching function for overloaded 'new_Signer'");
return Qnil;
}
SWIGINTERN void
free_Signer(Signer *arg1) {
SWIG_RubyRemoveTracking(arg1);
delete arg1;
}
SWIGINTERN VALUE
_wrap_Signer_sign__SWIG_0(int argc, VALUE *argv, VALUE self) {
Signer *arg1 = (Signer *) 0 ;
SwigValueWrapper<CountPtrTo<XmlDoc > > result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Signer, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sign" "', argument " "1"" of type '" "Signer *""'");
}
arg1 = reinterpret_cast< Signer * >(argp1);
{
try
{
try {
result = (arg1)->sign();
}
catch(MemoryError &_e) {
SWIG_exception(SWIG_MemoryError, (&_e)->what());
}
catch(DocError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_DocError, SWIG_NewPointerObj((new DocError(static_cast< const DocError& >(_e))),SWIGTYPE_p_DocError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(XPathError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_XPathError, SWIG_NewPointerObj((new XPathError(static_cast< const XPathError& >(_e))),SWIGTYPE_p_XPathError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(KeyError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_KeyError, SWIG_NewPointerObj((new KeyError(static_cast< const KeyError& >(_e))),SWIGTYPE_p_KeyError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_NewPointerObj((new XmlDocClassPtr(static_cast< const XmlDocClassPtr& >(result))), SWIGTYPE_p_CountPtrToTXmlDoc_t, SWIG_POINTER_OWN | 0 );
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_Signer_sign__SWIG_1(int argc, VALUE *argv, VALUE self) {
Signer *arg1 = (Signer *) 0 ;
SwigValueWrapper<CountPtrTo<XPath > > arg2 ;
SwigValueWrapper<CountPtrTo<XmlDoc > > result;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 ;
int res2 = 0 ;
VALUE vresult = Qnil;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Signer, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sign" "', argument " "1"" of type '" "Signer *""'");
}
arg1 = reinterpret_cast< Signer * >(argp1);
{
res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_CountPtrToTXPath_t, 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "sign" "', argument " "2"" of type '" "XPathPtr""'");
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "sign" "', argument " "2"" of type '" "XPathPtr""'");
} else {
arg2 = *(reinterpret_cast< XPathPtr * >(argp2));
}
}
{
try
{
try {
result = (arg1)->sign(arg2);
}
catch(MemoryError &_e) {
SWIG_exception(SWIG_MemoryError, (&_e)->what());
}
catch(DocError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_DocError, SWIG_NewPointerObj((new DocError(static_cast< const DocError& >(_e))),SWIGTYPE_p_DocError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(XPathError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_XPathError, SWIG_NewPointerObj((new XPathError(static_cast< const XPathError& >(_e))),SWIGTYPE_p_XPathError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(KeyError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_KeyError, SWIG_NewPointerObj((new KeyError(static_cast< const KeyError& >(_e))),SWIGTYPE_p_KeyError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_NewPointerObj((new XmlDocClassPtr(static_cast< const XmlDocClassPtr& >(result))), SWIGTYPE_p_CountPtrToTXmlDoc_t, SWIG_POINTER_OWN | 0 );
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_Signer_sign__SWIG_2(int argc, VALUE *argv, VALUE self) {
Signer *arg1 = (Signer *) 0 ;
SwigValueWrapper<CountPtrTo<XPath > > arg2 ;
bool arg3 ;
SwigValueWrapper<CountPtrTo<XmlDoc > > result;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 ;
int res2 = 0 ;
bool val3 ;
int ecode3 = 0 ;
VALUE vresult = Qnil;
if ((argc < 2) || (argc > 2)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Signer, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sign" "', argument " "1"" of type '" "Signer *""'");
}
arg1 = reinterpret_cast< Signer * >(argp1);
{
res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_CountPtrToTXPath_t, 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "sign" "', argument " "2"" of type '" "XPathPtr""'");
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "sign" "', argument " "2"" of type '" "XPathPtr""'");
} else {
arg2 = *(reinterpret_cast< XPathPtr * >(argp2));
}
}
ecode3 = SWIG_AsVal_bool(argv[1], &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "sign" "', argument " "3"" of type '" "bool""'");
}
arg3 = static_cast< bool >(val3);
{
try
{
try {
result = (arg1)->sign(arg2,arg3);
}
catch(MemoryError &_e) {
SWIG_exception(SWIG_MemoryError, (&_e)->what());
}
catch(DocError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_DocError, SWIG_NewPointerObj((new DocError(static_cast< const DocError& >(_e))),SWIGTYPE_p_DocError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(XPathError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_XPathError, SWIG_NewPointerObj((new XPathError(static_cast< const XPathError& >(_e))),SWIGTYPE_p_XPathError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(KeyError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_KeyError, SWIG_NewPointerObj((new KeyError(static_cast< const KeyError& >(_e))),SWIGTYPE_p_KeyError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_NewPointerObj((new XmlDocClassPtr(static_cast< const XmlDocClassPtr& >(result))), SWIGTYPE_p_CountPtrToTXmlDoc_t, SWIG_POINTER_OWN | 0 );
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE _wrap_Signer_sign(int nargs, VALUE *args, VALUE self) {
int argc;
VALUE argv[4];
int ii;
argc = nargs + 1;
argv[0] = self;
if (argc > 4) SWIG_fail;
for (ii = 1; (ii < argc); ii++) {
argv[ii] = args[ii-1];
}
if (argc == 1) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Signer, 0);
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_Signer_sign__SWIG_0(nargs, args, self);
}
}
if (argc == 2) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Signer, 0);
_v = SWIG_CheckState(res);
if (_v) {
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_CountPtrToTXPath_t, 0);
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_Signer_sign__SWIG_1(nargs, args, self);
}
}
}
if (argc == 3) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Signer, 0);
_v = SWIG_CheckState(res);
if (_v) {
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_CountPtrToTXPath_t, 0);
_v = SWIG_CheckState(res);
if (_v) {
{
int res = SWIG_AsVal_bool(argv[2], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
return _wrap_Signer_sign__SWIG_2(nargs, args, self);
}
}
}
}
fail:
rb_raise(rb_eArgError, "No matching function for overloaded 'Signer_sign'");
return Qnil;
}
SWIGINTERN VALUE
_wrap_Signer_signInPlace__SWIG_0(int argc, VALUE *argv, VALUE self) {
Signer *arg1 = (Signer *) 0 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Signer, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "signInPlace" "', argument " "1"" of type '" "Signer *""'");
}
arg1 = reinterpret_cast< Signer * >(argp1);
{
try
{
try {
result = (int)(arg1)->signInPlace();
}
catch(DocError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_DocError, SWIG_NewPointerObj((new DocError(static_cast< const DocError& >(_e))),SWIGTYPE_p_DocError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(XPathError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_XPathError, SWIG_NewPointerObj((new XPathError(static_cast< const XPathError& >(_e))),SWIGTYPE_p_XPathError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(KeyError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_KeyError, SWIG_NewPointerObj((new KeyError(static_cast< const KeyError& >(_e))),SWIGTYPE_p_KeyError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_Signer_signInPlace__SWIG_1(int argc, VALUE *argv, VALUE self) {
Signer *arg1 = (Signer *) 0 ;
SwigValueWrapper<CountPtrTo<XPath > > arg2 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 ;
int res2 = 0 ;
VALUE vresult = Qnil;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Signer, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "signInPlace" "', argument " "1"" of type '" "Signer *""'");
}
arg1 = reinterpret_cast< Signer * >(argp1);
{
res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_CountPtrToTXPath_t, 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "signInPlace" "', argument " "2"" of type '" "XPathPtr""'");
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "signInPlace" "', argument " "2"" of type '" "XPathPtr""'");
} else {
arg2 = *(reinterpret_cast< XPathPtr * >(argp2));
}
}
{
try
{
try {
result = (int)(arg1)->signInPlace(arg2);
}
catch(DocError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_DocError, SWIG_NewPointerObj((new DocError(static_cast< const DocError& >(_e))),SWIGTYPE_p_DocError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(XPathError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_XPathError, SWIG_NewPointerObj((new XPathError(static_cast< const XPathError& >(_e))),SWIGTYPE_p_XPathError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(KeyError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_KeyError, SWIG_NewPointerObj((new KeyError(static_cast< const KeyError& >(_e))),SWIGTYPE_p_KeyError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_Signer_signInPlace__SWIG_2(int argc, VALUE *argv, VALUE self) {
Signer *arg1 = (Signer *) 0 ;
SwigValueWrapper<CountPtrTo<XPath > > arg2 ;
bool arg3 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 ;
int res2 = 0 ;
bool val3 ;
int ecode3 = 0 ;
VALUE vresult = Qnil;
if ((argc < 2) || (argc > 2)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Signer, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "signInPlace" "', argument " "1"" of type '" "Signer *""'");
}
arg1 = reinterpret_cast< Signer * >(argp1);
{
res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_CountPtrToTXPath_t, 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "signInPlace" "', argument " "2"" of type '" "XPathPtr""'");
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "signInPlace" "', argument " "2"" of type '" "XPathPtr""'");
} else {
arg2 = *(reinterpret_cast< XPathPtr * >(argp2));
}
}
ecode3 = SWIG_AsVal_bool(argv[1], &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "signInPlace" "', argument " "3"" of type '" "bool""'");
}
arg3 = static_cast< bool >(val3);
{
try
{
try {
result = (int)(arg1)->signInPlace(arg2,arg3);
}
catch(DocError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_DocError, SWIG_NewPointerObj((new DocError(static_cast< const DocError& >(_e))),SWIGTYPE_p_DocError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(XPathError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_XPathError, SWIG_NewPointerObj((new XPathError(static_cast< const XPathError& >(_e))),SWIGTYPE_p_XPathError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(KeyError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_KeyError, SWIG_NewPointerObj((new KeyError(static_cast< const KeyError& >(_e))),SWIGTYPE_p_KeyError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE _wrap_Signer_signInPlace(int nargs, VALUE *args, VALUE self) {
int argc;
VALUE argv[4];
int ii;
argc = nargs + 1;
argv[0] = self;
if (argc > 4) SWIG_fail;
for (ii = 1; (ii < argc); ii++) {
argv[ii] = args[ii-1];
}
if (argc == 1) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Signer, 0);
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_Signer_signInPlace__SWIG_0(nargs, args, self);
}
}
if (argc == 2) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Signer, 0);
_v = SWIG_CheckState(res);
if (_v) {
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_CountPtrToTXPath_t, 0);
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_Signer_signInPlace__SWIG_1(nargs, args, self);
}
}
}
if (argc == 3) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Signer, 0);
_v = SWIG_CheckState(res);
if (_v) {
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_CountPtrToTXPath_t, 0);
_v = SWIG_CheckState(res);
if (_v) {
{
int res = SWIG_AsVal_bool(argv[2], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
return _wrap_Signer_signInPlace__SWIG_2(nargs, args, self);
}
}
}
}
fail:
rb_raise(rb_eArgError, "No matching function for overloaded 'Signer_signInPlace'");
return Qnil;
}
SWIGINTERN VALUE
_wrap_Signer_setKeyStore(int argc, VALUE *argv, VALUE self) {
Signer *arg1 = (Signer *) 0 ;
SwigValueWrapper<CountPtrTo<KeyStore > > arg2 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 ;
int res2 = 0 ;
VALUE vresult = Qnil;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Signer, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "setKeyStore" "', argument " "1"" of type '" "Signer *""'");
}
arg1 = reinterpret_cast< Signer * >(argp1);
{
res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_CountPtrToTKeyStore_t, 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "setKeyStore" "', argument " "2"" of type '" "KeyStorePtr""'");
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "setKeyStore" "', argument " "2"" of type '" "KeyStorePtr""'");
} else {
arg2 = *(reinterpret_cast< KeyStorePtr * >(argp2));
}
}
{
try
{
try {
result = (int)(arg1)->setKeyStore(arg2);
}
catch(ValueError &_e) {
SWIG_exception(SWIG_ValueError, (&_e)->what());
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_Signer_addCertFromFile(int argc, VALUE *argv, VALUE self) {
Signer *arg1 = (Signer *) 0 ;
std::string arg2 ;
std::string arg3 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 2) || (argc > 2)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Signer, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "addCertFromFile" "', argument " "1"" of type '" "Signer *""'");
}
arg1 = reinterpret_cast< Signer * >(argp1);
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "addCertFromFile" "', argument " "2"" of type '" "std::string""'");
}
arg2 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[1], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "addCertFromFile" "', argument " "3"" of type '" "std::string""'");
}
arg3 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
try
{
try {
result = (int)(arg1)->addCertFromFile(arg2,arg3);
}
catch(KeyError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_KeyError, SWIG_NewPointerObj((new KeyError(static_cast< const KeyError& >(_e))),SWIGTYPE_p_KeyError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(IOError &_e) {
SWIG_exception(SWIG_IOError, (&_e)->what());
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_Signer_addCert(int argc, VALUE *argv, VALUE self) {
Signer *arg1 = (Signer *) 0 ;
SwigValueWrapper<CountPtrTo<X509Certificate > > arg2 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 ;
int res2 = 0 ;
VALUE vresult = Qnil;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Signer, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "addCert" "', argument " "1"" of type '" "Signer *""'");
}
arg1 = reinterpret_cast< Signer * >(argp1);
{
res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_CountPtrToTX509Certificate_t, 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "addCert" "', argument " "2"" of type '" "X509CertificatePtr""'");
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "addCert" "', argument " "2"" of type '" "X509CertificatePtr""'");
} else {
arg2 = *(reinterpret_cast< X509CertificatePtr * >(argp2));
}
}
{
try
{
try {
result = (int)(arg1)->addCert(arg2);
}
catch(KeyError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_KeyError, SWIG_NewPointerObj((new KeyError(static_cast< const KeyError& >(_e))),SWIGTYPE_p_KeyError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(ValueError &_e) {
SWIG_exception(SWIG_ValueError, (&_e)->what());
}
catch(MemoryError &_e) {
SWIG_exception(SWIG_MemoryError, (&_e)->what());
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_Signer_useExclusiveCanonicalizer(int argc, VALUE *argv, VALUE self) {
Signer *arg1 = (Signer *) 0 ;
std::string arg2 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Signer, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "useExclusiveCanonicalizer" "', argument " "1"" of type '" "Signer *""'");
}
arg1 = reinterpret_cast< Signer * >(argp1);
{
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(argv[0], &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "useExclusiveCanonicalizer" "', argument " "2"" of type '" "std::string""'");
}
arg2 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
}
{
try
{
result = (int)(arg1)->useExclusiveCanonicalizer(arg2);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_Signer_addReference(int argc, VALUE *argv, VALUE self) {
Signer *arg1 = (Signer *) 0 ;
SwigValueWrapper<CountPtrTo<XPath > > arg2 ;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 ;
int res2 = 0 ;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Signer, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "addReference" "', argument " "1"" of type '" "Signer *""'");
}
arg1 = reinterpret_cast< Signer * >(argp1);
{
res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_CountPtrToTXPath_t, 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "addReference" "', argument " "2"" of type '" "XPathPtr""'");
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "addReference" "', argument " "2"" of type '" "XPathPtr""'");
} else {
arg2 = *(reinterpret_cast< XPathPtr * >(argp2));
}
}
{
try
{
(arg1)->addReference(arg2);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return Qnil;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_Signer_attachPublicKey(int argc, VALUE *argv, VALUE self) {
Signer *arg1 = (Signer *) 0 ;
int arg2 ;
void *argp1 = 0 ;
int res1 = 0 ;
int val2 ;
int ecode2 = 0 ;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Signer, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "attachPublicKey" "', argument " "1"" of type '" "Signer *""'");
}
arg1 = reinterpret_cast< Signer * >(argp1);
ecode2 = SWIG_AsVal_int(argv[0], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "attachPublicKey" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
{
try
{
(arg1)->attachPublicKey(arg2);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return Qnil;
fail:
return Qnil;
}
swig_class cVerifier;
SWIGINTERN VALUE
_wrap_new_Verifier__SWIG_0(int argc, VALUE *argv, VALUE self) {
SwigValueWrapper<CountPtrTo<XmlDoc > > arg1 ;
Verifier *result = 0 ;
void *argp1 ;
int res1 = 0 ;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
{
res1 = SWIG_ConvertPtr(argv[0], &argp1, SWIGTYPE_p_CountPtrToTXmlDoc_t, 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Verifier" "', argument " "1"" of type '" "XmlDocClassPtr""'");
}
if (!argp1) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Verifier" "', argument " "1"" of type '" "XmlDocClassPtr""'");
} else {
arg1 = *(reinterpret_cast< XmlDocClassPtr * >(argp1));
}
}
{
try
{
try {
result = (Verifier *)new Verifier(arg1);DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch(MemoryError &_e) {
SWIG_exception(SWIG_MemoryError, (&_e)->what());
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_Verifier_allocate(VALUE self) {
#else
SWIGINTERN VALUE
_wrap_Verifier_allocate(int argc, VALUE *argv, VALUE self) {
#endif
VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_Verifier);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
rb_obj_call_init(vresult, argc, argv);
#endif
return vresult;
}
SWIGINTERN VALUE
_wrap_new_Verifier__SWIG_1(int argc, VALUE *argv, VALUE self) {
SwigValueWrapper<CountPtrTo<XmlDoc > > arg1 ;
SwigValueWrapper<CountPtrTo<XPath > > arg2 ;
Verifier *result = 0 ;
void *argp1 ;
int res1 = 0 ;
void *argp2 ;
int res2 = 0 ;
if ((argc < 2) || (argc > 2)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
}
{
res1 = SWIG_ConvertPtr(argv[0], &argp1, SWIGTYPE_p_CountPtrToTXmlDoc_t, 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Verifier" "', argument " "1"" of type '" "XmlDocClassPtr""'");
}
if (!argp1) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Verifier" "', argument " "1"" of type '" "XmlDocClassPtr""'");
} else {
arg1 = *(reinterpret_cast< XmlDocClassPtr * >(argp1));
}
}
{
res2 = SWIG_ConvertPtr(argv[1], &argp2, SWIGTYPE_p_CountPtrToTXPath_t, 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Verifier" "', argument " "2"" of type '" "XPathPtr""'");
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Verifier" "', argument " "2"" of type '" "XPathPtr""'");
} else {
arg2 = *(reinterpret_cast< XPathPtr * >(argp2));
}
}
{
try
{
try {
result = (Verifier *)new Verifier(arg1,arg2);DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch(MemoryError &_e) {
SWIG_exception(SWIG_MemoryError, (&_e)->what());
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
SWIGINTERN VALUE _wrap_new_Verifier(int nargs, VALUE *args, VALUE self) {
int argc;
VALUE argv[2];
int ii;
argc = nargs;
if (argc > 2) SWIG_fail;
for (ii = 0; (ii < argc); ii++) {
argv[ii] = args[ii];
}
if (argc == 1) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CountPtrToTXmlDoc_t, 0);
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_new_Verifier__SWIG_0(nargs, args, self);
}
}
if (argc == 2) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CountPtrToTXmlDoc_t, 0);
_v = SWIG_CheckState(res);
if (_v) {
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_CountPtrToTXPath_t, 0);
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_new_Verifier__SWIG_1(nargs, args, self);
}
}
}
fail:
rb_raise(rb_eArgError, "No matching function for overloaded 'new_Verifier'");
return Qnil;
}
SWIGINTERN VALUE
_wrap_Verifier_setKeyStore(int argc, VALUE *argv, VALUE self) {
Verifier *arg1 = (Verifier *) 0 ;
SwigValueWrapper<CountPtrTo<KeyStore > > arg2 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 ;
int res2 = 0 ;
VALUE vresult = Qnil;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Verifier, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "setKeyStore" "', argument " "1"" of type '" "Verifier *""'");
}
arg1 = reinterpret_cast< Verifier * >(argp1);
{
res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_CountPtrToTKeyStore_t, 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "setKeyStore" "', argument " "2"" of type '" "KeyStorePtr""'");
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "setKeyStore" "', argument " "2"" of type '" "KeyStorePtr""'");
} else {
arg2 = *(reinterpret_cast< KeyStorePtr * >(argp2));
}
}
{
try
{
try {
result = (int)(arg1)->setKeyStore(arg2);
}
catch(ValueError &_e) {
SWIG_exception(SWIG_ValueError, (&_e)->what());
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_Verifier_verify__SWIG_0(int argc, VALUE *argv, VALUE self) {
Verifier *arg1 = (Verifier *) 0 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Verifier, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "verify" "', argument " "1"" of type '" "Verifier *""'");
}
arg1 = reinterpret_cast< Verifier * >(argp1);
{
try
{
try {
result = (int)(arg1)->verify();
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(MemoryError &_e) {
SWIG_exception(SWIG_MemoryError, (&_e)->what());
}
catch(KeyError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_KeyError, SWIG_NewPointerObj((new KeyError(static_cast< const KeyError& >(_e))),SWIGTYPE_p_KeyError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(DocError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_DocError, SWIG_NewPointerObj((new DocError(static_cast< const DocError& >(_e))),SWIGTYPE_p_DocError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(XMLError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_XMLError, SWIG_NewPointerObj((new XMLError(static_cast< const XMLError& >(_e))),SWIGTYPE_p_XMLError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_Verifier_verify__SWIG_1(int argc, VALUE *argv, VALUE self) {
Verifier *arg1 = (Verifier *) 0 ;
SwigValueWrapper<CountPtrTo<Key > > arg2 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 ;
int res2 = 0 ;
VALUE vresult = Qnil;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Verifier, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "verify" "', argument " "1"" of type '" "Verifier *""'");
}
arg1 = reinterpret_cast< Verifier * >(argp1);
{
res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_CountPtrToTKey_t, 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "verify" "', argument " "2"" of type '" "KeyPtr""'");
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "verify" "', argument " "2"" of type '" "KeyPtr""'");
} else {
arg2 = *(reinterpret_cast< KeyPtr * >(argp2));
}
}
{
try
{
try {
result = (int)(arg1)->verify(arg2);
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(MemoryError &_e) {
SWIG_exception(SWIG_MemoryError, (&_e)->what());
}
catch(KeyError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_KeyError, SWIG_NewPointerObj((new KeyError(static_cast< const KeyError& >(_e))),SWIGTYPE_p_KeyError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(DocError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_DocError, SWIG_NewPointerObj((new DocError(static_cast< const DocError& >(_e))),SWIGTYPE_p_DocError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(XMLError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_XMLError, SWIG_NewPointerObj((new XMLError(static_cast< const XMLError& >(_e))),SWIGTYPE_p_XMLError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE _wrap_Verifier_verify(int nargs, VALUE *args, VALUE self) {
int argc;
VALUE argv[3];
int ii;
argc = nargs + 1;
argv[0] = self;
if (argc > 3) SWIG_fail;
for (ii = 1; (ii < argc); ii++) {
argv[ii] = args[ii-1];
}
if (argc == 1) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Verifier, 0);
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_Verifier_verify__SWIG_0(nargs, args, self);
}
}
if (argc == 2) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Verifier, 0);
_v = SWIG_CheckState(res);
if (_v) {
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_CountPtrToTKey_t, 0);
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_Verifier_verify__SWIG_1(nargs, args, self);
}
}
}
fail:
rb_raise(rb_eArgError, "No matching function for overloaded 'Verifier_verify'");
return Qnil;
}
SWIGINTERN VALUE
_wrap_Verifier_getVerifyingKey(int argc, VALUE *argv, VALUE self) {
Verifier *arg1 = (Verifier *) 0 ;
SwigValueWrapper<CountPtrTo<Key > > result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Verifier, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getVerifyingKey" "', argument " "1"" of type '" "Verifier *""'");
}
arg1 = reinterpret_cast< Verifier * >(argp1);
{
try
{
try {
result = (arg1)->getVerifyingKey();
}
catch(DocError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_DocError, SWIG_NewPointerObj((new DocError(static_cast< const DocError& >(_e))),SWIGTYPE_p_DocError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(XMLError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_XMLError, SWIG_NewPointerObj((new XMLError(static_cast< const XMLError& >(_e))),SWIGTYPE_p_XMLError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_NewPointerObj((new KeyPtr(static_cast< const KeyPtr& >(result))), SWIGTYPE_p_CountPtrToTKey_t, SWIG_POINTER_OWN | 0 );
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_Verifier_isReferenced(int argc, VALUE *argv, VALUE self) {
Verifier *arg1 = (Verifier *) 0 ;
SwigValueWrapper<CountPtrTo<XPath > > arg2 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 ;
int res2 = 0 ;
VALUE vresult = Qnil;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Verifier, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "isReferenced" "', argument " "1"" of type '" "Verifier *""'");
}
arg1 = reinterpret_cast< Verifier * >(argp1);
{
res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_CountPtrToTXPath_t, 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "isReferenced" "', argument " "2"" of type '" "XPathPtr""'");
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "isReferenced" "', argument " "2"" of type '" "XPathPtr""'");
} else {
arg2 = *(reinterpret_cast< XPathPtr * >(argp2));
}
}
{
try
{
try {
result = (int)(arg1)->isReferenced(arg2);
}
catch(DocError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_DocError, SWIG_NewPointerObj((new DocError(static_cast< const DocError& >(_e))),SWIGTYPE_p_DocError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(XMLError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_XMLError, SWIG_NewPointerObj((new XMLError(static_cast< const XMLError& >(_e))),SWIGTYPE_p_XMLError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_Verifier_getReferencedElements(int argc, VALUE *argv, VALUE self) {
Verifier *arg1 = (Verifier *) 0 ;
std::vector<XmlElementPtr > result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Verifier, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getReferencedElements" "', argument " "1"" of type '" "Verifier *""'");
}
arg1 = reinterpret_cast< Verifier * >(argp1);
{
try
{
try {
result = (arg1)->getReferencedElements();
}
catch(XMLError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_XMLError, SWIG_NewPointerObj((new XMLError(static_cast< const XMLError& >(_e))),SWIGTYPE_p_XMLError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
{
vresult = rb_ary_new2((&result)->size());
for (unsigned int i=0; i<(&result)->size(); i++) {
CountPtrTo<XmlElement >* x = new CountPtrTo<XmlElement >(((std::vector<XmlElementPtr > &)result)[i]);
rb_ary_store(vresult,i,
SWIG_NewPointerObj((void *) x,
SWIGTYPE_p_CountPtrToTXmlElement_t, 1));
}
}
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_Verifier_getCertificate(int argc, VALUE *argv, VALUE self) {
Verifier *arg1 = (Verifier *) 0 ;
SwigValueWrapper<CountPtrTo<X509Certificate > > result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Verifier, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getCertificate" "', argument " "1"" of type '" "Verifier *""'");
}
arg1 = reinterpret_cast< Verifier * >(argp1);
{
try
{
try {
result = (arg1)->getCertificate();
}
catch(DocError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_DocError, SWIG_NewPointerObj((new DocError(static_cast< const DocError& >(_e))),SWIGTYPE_p_DocError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(XMLError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_XMLError, SWIG_NewPointerObj((new XMLError(static_cast< const XMLError& >(_e))),SWIGTYPE_p_XMLError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_NewPointerObj((new X509CertificatePtr(static_cast< const X509CertificatePtr& >(result))), SWIGTYPE_p_CountPtrToTX509Certificate_t, SWIG_POINTER_OWN | 0 );
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_Verifier_getCertificateChain(int argc, VALUE *argv, VALUE self) {
Verifier *arg1 = (Verifier *) 0 ;
std::vector<X509CertificatePtr > result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Verifier, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getCertificateChain" "', argument " "1"" of type '" "Verifier *""'");
}
arg1 = reinterpret_cast< Verifier * >(argp1);
{
try
{
try {
result = (arg1)->getCertificateChain();
}
catch(DocError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_DocError, SWIG_NewPointerObj((new DocError(static_cast< const DocError& >(_e))),SWIGTYPE_p_DocError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(XMLError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_XMLError, SWIG_NewPointerObj((new XMLError(static_cast< const XMLError& >(_e))),SWIGTYPE_p_XMLError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
{
vresult = rb_ary_new2((&result)->size());
for (unsigned int i=0; i<(&result)->size(); i++) {
CountPtrTo<X509Certificate >* x = new CountPtrTo<X509Certificate >(((std::vector<X509CertificatePtr > &)result)[i]);
rb_ary_store(vresult,i,
SWIG_NewPointerObj((void *) x,
SWIGTYPE_p_CountPtrToTX509Certificate_t, 1));
}
}
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_Verifier_skipCertCheck(int argc, VALUE *argv, VALUE self) {
Verifier *arg1 = (Verifier *) 0 ;
int arg2 ;
void *argp1 = 0 ;
int res1 = 0 ;
int val2 ;
int ecode2 = 0 ;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_Verifier, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "skipCertCheck" "', argument " "1"" of type '" "Verifier *""'");
}
arg1 = reinterpret_cast< Verifier * >(argp1);
ecode2 = SWIG_AsVal_int(argv[0], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "skipCertCheck" "', argument " "2"" of type '" "int""'");
}
arg2 = static_cast< int >(val2);
{
try
{
(arg1)->skipCertCheck(arg2);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return Qnil;
fail:
return Qnil;
}
SWIGINTERN void
free_Verifier(Verifier *arg1) {
SWIG_RubyRemoveTracking(arg1);
delete arg1;
}
swig_class cTrustVerifier;
#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_TrustVerifier_allocate(VALUE self) {
#else
SWIGINTERN VALUE
_wrap_TrustVerifier_allocate(int argc, VALUE *argv, VALUE self) {
#endif
VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_TrustVerifier);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
rb_obj_call_init(vresult, argc, argv);
#endif
return vresult;
}
SWIGINTERN VALUE
_wrap_new_TrustVerifier(int argc, VALUE *argv, VALUE self) {
TrustVerifier *result = 0 ;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
{
try
{
result = (TrustVerifier *)new TrustVerifier();DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
SWIGINTERN void
free_TrustVerifier(TrustVerifier *arg1) {
SWIG_RubyRemoveTracking(arg1);
delete arg1;
}
SWIGINTERN VALUE
_wrap_TrustVerifier_verifyTrust__SWIG_0(int argc, VALUE *argv, VALUE self) {
TrustVerifier *arg1 = (TrustVerifier *) 0 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TrustVerifier, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "verifyTrust" "', argument " "1"" of type '" "TrustVerifier *""'");
}
arg1 = reinterpret_cast< TrustVerifier * >(argp1);
{
try
{
try {
result = (int)(arg1)->verifyTrust();
}
catch(TrustVerificationError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_TrustVerificationError, SWIG_NewPointerObj((new TrustVerificationError(static_cast< const TrustVerificationError& >(_e))),SWIGTYPE_p_TrustVerificationError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_TrustVerifier_verifyTrust__SWIG_1(int argc, VALUE *argv, VALUE self) {
TrustVerifier *arg1 = (TrustVerifier *) 0 ;
SwigValueWrapper<CountPtrTo<Key > > arg2 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 ;
int res2 = 0 ;
VALUE vresult = Qnil;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TrustVerifier, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "verifyTrust" "', argument " "1"" of type '" "TrustVerifier *""'");
}
arg1 = reinterpret_cast< TrustVerifier * >(argp1);
{
res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_CountPtrToTKey_t, 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "verifyTrust" "', argument " "2"" of type '" "KeyPtr""'");
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "verifyTrust" "', argument " "2"" of type '" "KeyPtr""'");
} else {
arg2 = *(reinterpret_cast< KeyPtr * >(argp2));
}
}
{
try
{
try {
result = (int)(arg1)->verifyTrust(arg2);
}
catch(TrustVerificationError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_TrustVerificationError, SWIG_NewPointerObj((new TrustVerificationError(static_cast< const TrustVerificationError& >(_e))),SWIGTYPE_p_TrustVerificationError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_TrustVerifier_verifyTrust__SWIG_2(int argc, VALUE *argv, VALUE self) {
TrustVerifier *arg1 = (TrustVerifier *) 0 ;
std::vector<X509CertificatePtr > arg2 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_TrustVerifier, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "verifyTrust" "', argument " "1"" of type '" "TrustVerifier *""'");
}
arg1 = reinterpret_cast< TrustVerifier * >(argp1);
{
if (rb_obj_is_kind_of(argv[0],rb_cArray)) {
unsigned int size = RARRAY_LEN(argv[0]);
arg2;
for (unsigned int i=0; i<size; i++) {
VALUE o = RARRAY_PTR(argv[0])[i];
CountPtrTo<X509Certificate >* x;
SWIG_ConvertPtr(o, (void **) &x, SWIGTYPE_p_CountPtrToTX509Certificate_t, 1);
(&arg2)->push_back(*x);
}
} else {
void *ptr;
SWIG_ConvertPtr(argv[0], &ptr, SWIGTYPE_p_std__vectorTCountPtrToTX509Certificate_t_t, 1);
arg2 = *((std::vector<X509CertificatePtr > *) ptr);
}
}
{
try
{
try {
result = (int)(arg1)->verifyTrust(arg2);
}
catch(TrustVerificationError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_TrustVerificationError, SWIG_NewPointerObj((new TrustVerificationError(static_cast< const TrustVerificationError& >(_e))),SWIGTYPE_p_TrustVerificationError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE _wrap_TrustVerifier_verifyTrust(int nargs, VALUE *args, VALUE self) {
int argc;
VALUE argv[3];
int ii;
argc = nargs + 1;
argv[0] = self;
if (argc > 3) SWIG_fail;
for (ii = 1; (ii < argc); ii++) {
argv[ii] = args[ii-1];
}
if (argc == 1) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_TrustVerifier, 0);
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_TrustVerifier_verifyTrust__SWIG_0(nargs, args, self);
}
}
if (argc == 2) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_TrustVerifier, 0);
_v = SWIG_CheckState(res);
if (_v) {
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_CountPtrToTKey_t, 0);
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_TrustVerifier_verifyTrust__SWIG_1(nargs, args, self);
}
}
}
if (argc == 2) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_TrustVerifier, 0);
_v = SWIG_CheckState(res);
if (_v) {
{
/* native sequence? */
if (rb_obj_is_kind_of(argv[1],rb_cArray)) {
unsigned int size = RARRAY_LEN(argv[1]);
if (size == 0) {
/* an empty sequence can be of any type */
_v = 1;
} else {
/* check the first element only */
CountPtrTo<X509Certificate >* x;
VALUE o = RARRAY_PTR(argv[1])[0];
if ((SWIG_ConvertPtr(o,(void **) &x,
SWIGTYPE_p_CountPtrToTX509Certificate_t,0)) != -1)
_v = 1;
else
_v = 0;
}
} else {
/* wrapped vector? */
std::vector<CountPtrTo<X509Certificate > >* v;
if (SWIG_ConvertPtr(argv[1],(void **) &v,
SWIGTYPE_p_std__vectorTCountPtrToTX509Certificate_t_t,0) != -1)
_v = 1;
else
_v = 0;
}
}
if (_v) {
return _wrap_TrustVerifier_verifyTrust__SWIG_2(nargs, args, self);
}
}
}
fail:
rb_raise(rb_eArgError, "No matching function for overloaded 'TrustVerifier_verifyTrust'");
return Qnil;
}
swig_class cSimpleTrustVerifier;
#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_SimpleTrustVerifier_allocate(VALUE self) {
#else
SWIGINTERN VALUE
_wrap_SimpleTrustVerifier_allocate(int argc, VALUE *argv, VALUE self) {
#endif
VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_SimpleTrustVerifier);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
rb_obj_call_init(vresult, argc, argv);
#endif
return vresult;
}
SWIGINTERN VALUE
_wrap_new_SimpleTrustVerifier(int argc, VALUE *argv, VALUE self) {
std::vector<KeyPtr > arg1 ;
SimpleTrustVerifier *result = 0 ;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
{
if (rb_obj_is_kind_of(argv[0],rb_cArray)) {
unsigned int size = RARRAY_LEN(argv[0]);
arg1;
for (unsigned int i=0; i<size; i++) {
VALUE o = RARRAY_PTR(argv[0])[i];
CountPtrTo<Key >* x;
SWIG_ConvertPtr(o, (void **) &x, SWIGTYPE_p_CountPtrToTKey_t, 1);
(&arg1)->push_back(*x);
}
} else {
void *ptr;
SWIG_ConvertPtr(argv[0], &ptr, SWIGTYPE_p_std__vectorTCountPtrToTKey_t_t, 1);
arg1 = *((std::vector<KeyPtr > *) ptr);
}
}
{
try
{
result = (SimpleTrustVerifier *)new SimpleTrustVerifier(arg1);DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
SWIGINTERN void
free_SimpleTrustVerifier(SimpleTrustVerifier *arg1) {
SWIG_RubyRemoveTracking(arg1);
delete arg1;
}
SWIGINTERN VALUE
_wrap_SimpleTrustVerifier_verifyTrust__SWIG_0(int argc, VALUE *argv, VALUE self) {
SimpleTrustVerifier *arg1 = (SimpleTrustVerifier *) 0 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_SimpleTrustVerifier, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "verifyTrust" "', argument " "1"" of type '" "SimpleTrustVerifier *""'");
}
arg1 = reinterpret_cast< SimpleTrustVerifier * >(argp1);
{
try
{
try {
result = (int)(arg1)->verifyTrust();
}
catch(TrustVerificationError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_TrustVerificationError, SWIG_NewPointerObj((new TrustVerificationError(static_cast< const TrustVerificationError& >(_e))),SWIGTYPE_p_TrustVerificationError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_SimpleTrustVerifier_verifyTrust__SWIG_1(int argc, VALUE *argv, VALUE self) {
SimpleTrustVerifier *arg1 = (SimpleTrustVerifier *) 0 ;
SwigValueWrapper<CountPtrTo<Key > > arg2 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 ;
int res2 = 0 ;
VALUE vresult = Qnil;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_SimpleTrustVerifier, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "verifyTrust" "', argument " "1"" of type '" "SimpleTrustVerifier *""'");
}
arg1 = reinterpret_cast< SimpleTrustVerifier * >(argp1);
{
res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_CountPtrToTKey_t, 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "verifyTrust" "', argument " "2"" of type '" "KeyPtr""'");
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "verifyTrust" "', argument " "2"" of type '" "KeyPtr""'");
} else {
arg2 = *(reinterpret_cast< KeyPtr * >(argp2));
}
}
{
try
{
try {
result = (int)(arg1)->verifyTrust(arg2);
}
catch(TrustVerificationError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_TrustVerificationError, SWIG_NewPointerObj((new TrustVerificationError(static_cast< const TrustVerificationError& >(_e))),SWIGTYPE_p_TrustVerificationError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_SimpleTrustVerifier_verifyTrust__SWIG_2(int argc, VALUE *argv, VALUE self) {
SimpleTrustVerifier *arg1 = (SimpleTrustVerifier *) 0 ;
std::vector<X509CertificatePtr > arg2 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_SimpleTrustVerifier, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "verifyTrust" "', argument " "1"" of type '" "SimpleTrustVerifier *""'");
}
arg1 = reinterpret_cast< SimpleTrustVerifier * >(argp1);
{
if (rb_obj_is_kind_of(argv[0],rb_cArray)) {
unsigned int size = RARRAY_LEN(argv[0]);
arg2;
for (unsigned int i=0; i<size; i++) {
VALUE o = RARRAY_PTR(argv[0])[i];
CountPtrTo<X509Certificate >* x;
SWIG_ConvertPtr(o, (void **) &x, SWIGTYPE_p_CountPtrToTX509Certificate_t, 1);
(&arg2)->push_back(*x);
}
} else {
void *ptr;
SWIG_ConvertPtr(argv[0], &ptr, SWIGTYPE_p_std__vectorTCountPtrToTX509Certificate_t_t, 1);
arg2 = *((std::vector<X509CertificatePtr > *) ptr);
}
}
{
try
{
try {
result = (int)(arg1)->verifyTrust(arg2);
}
catch(TrustVerificationError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_TrustVerificationError, SWIG_NewPointerObj((new TrustVerificationError(static_cast< const TrustVerificationError& >(_e))),SWIGTYPE_p_TrustVerificationError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE _wrap_SimpleTrustVerifier_verifyTrust(int nargs, VALUE *args, VALUE self) {
int argc;
VALUE argv[3];
int ii;
argc = nargs + 1;
argv[0] = self;
if (argc > 3) SWIG_fail;
for (ii = 1; (ii < argc); ii++) {
argv[ii] = args[ii-1];
}
if (argc == 1) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_SimpleTrustVerifier, 0);
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_SimpleTrustVerifier_verifyTrust__SWIG_0(nargs, args, self);
}
}
if (argc == 2) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_SimpleTrustVerifier, 0);
_v = SWIG_CheckState(res);
if (_v) {
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_CountPtrToTKey_t, 0);
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_SimpleTrustVerifier_verifyTrust__SWIG_1(nargs, args, self);
}
}
}
if (argc == 2) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_SimpleTrustVerifier, 0);
_v = SWIG_CheckState(res);
if (_v) {
{
/* native sequence? */
if (rb_obj_is_kind_of(argv[1],rb_cArray)) {
unsigned int size = RARRAY_LEN(argv[1]);
if (size == 0) {
/* an empty sequence can be of any type */
_v = 1;
} else {
/* check the first element only */
CountPtrTo<X509Certificate >* x;
VALUE o = RARRAY_PTR(argv[1])[0];
if ((SWIG_ConvertPtr(o,(void **) &x,
SWIGTYPE_p_CountPtrToTX509Certificate_t,0)) != -1)
_v = 1;
else
_v = 0;
}
} else {
/* wrapped vector? */
std::vector<CountPtrTo<X509Certificate > >* v;
if (SWIG_ConvertPtr(argv[1],(void **) &v,
SWIGTYPE_p_std__vectorTCountPtrToTX509Certificate_t_t,0) != -1)
_v = 1;
else
_v = 0;
}
}
if (_v) {
return _wrap_SimpleTrustVerifier_verifyTrust__SWIG_2(nargs, args, self);
}
}
}
fail:
rb_raise(rb_eArgError, "No matching function for overloaded 'SimpleTrustVerifier_verifyTrust'");
return Qnil;
}
swig_class cX509TrustVerifier;
#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
SWIGINTERN VALUE
_wrap_X509TrustVerifier_allocate(VALUE self) {
#else
SWIGINTERN VALUE
_wrap_X509TrustVerifier_allocate(int argc, VALUE *argv, VALUE self) {
#endif
VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_X509TrustVerifier);
#ifndef HAVE_RB_DEFINE_ALLOC_FUNC
rb_obj_call_init(vresult, argc, argv);
#endif
return vresult;
}
SWIGINTERN VALUE
_wrap_new_X509TrustVerifier(int argc, VALUE *argv, VALUE self) {
std::vector<X509CertificatePtr > arg1 ;
X509TrustVerifier *result = 0 ;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
{
if (rb_obj_is_kind_of(argv[0],rb_cArray)) {
unsigned int size = RARRAY_LEN(argv[0]);
arg1;
for (unsigned int i=0; i<size; i++) {
VALUE o = RARRAY_PTR(argv[0])[i];
CountPtrTo<X509Certificate >* x;
SWIG_ConvertPtr(o, (void **) &x, SWIGTYPE_p_CountPtrToTX509Certificate_t, 1);
(&arg1)->push_back(*x);
}
} else {
void *ptr;
SWIG_ConvertPtr(argv[0], &ptr, SWIGTYPE_p_std__vectorTCountPtrToTX509Certificate_t_t, 1);
arg1 = *((std::vector<X509CertificatePtr > *) ptr);
}
}
{
try
{
result = (X509TrustVerifier *)new X509TrustVerifier(arg1);DATA_PTR(self) = result;
SWIG_RubyAddTracking(result, self);
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
return self;
fail:
return Qnil;
}
SWIGINTERN void
free_X509TrustVerifier(X509TrustVerifier *arg1) {
SWIG_RubyRemoveTracking(arg1);
delete arg1;
}
SWIGINTERN VALUE
_wrap_X509TrustVerifier_verifyTrust__SWIG_0(int argc, VALUE *argv, VALUE self) {
X509TrustVerifier *arg1 = (X509TrustVerifier *) 0 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 0) || (argc > 0)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_X509TrustVerifier, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "verifyTrust" "', argument " "1"" of type '" "X509TrustVerifier *""'");
}
arg1 = reinterpret_cast< X509TrustVerifier * >(argp1);
{
try
{
try {
result = (int)(arg1)->verifyTrust();
}
catch(TrustVerificationError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_TrustVerificationError, SWIG_NewPointerObj((new TrustVerificationError(static_cast< const TrustVerificationError& >(_e))),SWIGTYPE_p_TrustVerificationError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_X509TrustVerifier_verifyTrust__SWIG_1(int argc, VALUE *argv, VALUE self) {
X509TrustVerifier *arg1 = (X509TrustVerifier *) 0 ;
SwigValueWrapper<CountPtrTo<Key > > arg2 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 ;
int res2 = 0 ;
VALUE vresult = Qnil;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_X509TrustVerifier, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "verifyTrust" "', argument " "1"" of type '" "X509TrustVerifier *""'");
}
arg1 = reinterpret_cast< X509TrustVerifier * >(argp1);
{
res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_CountPtrToTKey_t, 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "verifyTrust" "', argument " "2"" of type '" "KeyPtr""'");
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "verifyTrust" "', argument " "2"" of type '" "KeyPtr""'");
} else {
arg2 = *(reinterpret_cast< KeyPtr * >(argp2));
}
}
{
try
{
try {
result = (int)(arg1)->verifyTrust(arg2);
}
catch(TrustVerificationError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_TrustVerificationError, SWIG_NewPointerObj((new TrustVerificationError(static_cast< const TrustVerificationError& >(_e))),SWIGTYPE_p_TrustVerificationError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE
_wrap_X509TrustVerifier_verifyTrust__SWIG_2(int argc, VALUE *argv, VALUE self) {
X509TrustVerifier *arg1 = (X509TrustVerifier *) 0 ;
std::vector<X509CertificatePtr > arg2 ;
int result;
void *argp1 = 0 ;
int res1 = 0 ;
VALUE vresult = Qnil;
if ((argc < 1) || (argc > 1)) {
rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
}
res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_X509TrustVerifier, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "verifyTrust" "', argument " "1"" of type '" "X509TrustVerifier *""'");
}
arg1 = reinterpret_cast< X509TrustVerifier * >(argp1);
{
if (rb_obj_is_kind_of(argv[0],rb_cArray)) {
unsigned int size = RARRAY_LEN(argv[0]);
arg2;
for (unsigned int i=0; i<size; i++) {
VALUE o = RARRAY_PTR(argv[0])[i];
CountPtrTo<X509Certificate >* x;
SWIG_ConvertPtr(o, (void **) &x, SWIGTYPE_p_CountPtrToTX509Certificate_t, 1);
(&arg2)->push_back(*x);
}
} else {
void *ptr;
SWIG_ConvertPtr(argv[0], &ptr, SWIGTYPE_p_std__vectorTCountPtrToTX509Certificate_t_t, 1);
arg2 = *((std::vector<X509CertificatePtr > *) ptr);
}
}
{
try
{
try {
result = (int)(arg1)->verifyTrust(arg2);
}
catch(TrustVerificationError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_TrustVerificationError, SWIG_NewPointerObj((new TrustVerificationError(static_cast< const TrustVerificationError& >(_e))),SWIGTYPE_p_TrustVerificationError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(LibError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_LibError, SWIG_NewPointerObj((new LibError(static_cast< const LibError& >(_e))),SWIGTYPE_p_LibError,SWIG_POINTER_OWN))); SWIG_fail;
}
catch(KeyError &_e) {
rb_exc_raise(SWIG_Ruby_ExceptionType(SWIGTYPE_p_KeyError, SWIG_NewPointerObj((new KeyError(static_cast< const KeyError& >(_e))),SWIGTYPE_p_KeyError,SWIG_POINTER_OWN))); SWIG_fail;
}
}
catch (DsigException& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}
vresult = SWIG_From_int(static_cast< int >(result));
return vresult;
fail:
return Qnil;
}
SWIGINTERN VALUE _wrap_X509TrustVerifier_verifyTrust(int nargs, VALUE *args, VALUE self) {
int argc;
VALUE argv[3];
int ii;
argc = nargs + 1;
argv[0] = self;
if (argc > 3) SWIG_fail;
for (ii = 1; (ii < argc); ii++) {
argv[ii] = args[ii-1];
}
if (argc == 1) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_X509TrustVerifier, 0);
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_X509TrustVerifier_verifyTrust__SWIG_0(nargs, args, self);
}
}
if (argc == 2) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_X509TrustVerifier, 0);
_v = SWIG_CheckState(res);
if (_v) {
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_CountPtrToTKey_t, 0);
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_X509TrustVerifier_verifyTrust__SWIG_1(nargs, args, self);
}
}
}
if (argc == 2) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_X509TrustVerifier, 0);
_v = SWIG_CheckState(res);
if (_v) {
{
/* native sequence? */
if (rb_obj_is_kind_of(argv[1],rb_cArray)) {
unsigned int size = RARRAY_LEN(argv[1]);
if (size == 0) {
/* an empty sequence can be of any type */
_v = 1;
} else {
/* check the first element only */
CountPtrTo<X509Certificate >* x;
VALUE o = RARRAY_PTR(argv[1])[0];
if ((SWIG_ConvertPtr(o,(void **) &x,
SWIGTYPE_p_CountPtrToTX509Certificate_t,0)) != -1)
_v = 1;
else
_v = 0;
}
} else {
/* wrapped vector? */
std::vector<CountPtrTo<X509Certificate > >* v;
if (SWIG_ConvertPtr(argv[1],(void **) &v,
SWIGTYPE_p_std__vectorTCountPtrToTX509Certificate_t_t,0) != -1)
_v = 1;
else
_v = 0;
}
}
if (_v) {
return _wrap_X509TrustVerifier_verifyTrust__SWIG_2(nargs, args, self);
}
}
}
fail:
rb_raise(rb_eArgError, "No matching function for overloaded 'X509TrustVerifier_verifyTrust'");
return Qnil;
}
/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
static void *_p_SimpleTrustVerifierTo_p_TrustVerifier(void *x) {
return (void *)((TrustVerifier *) ((SimpleTrustVerifier *) x));
}
static void *_p_X509TrustVerifierTo_p_TrustVerifier(void *x) {
return (void *)((TrustVerifier *) ((X509TrustVerifier *) x));
}
static void *_p_TrustVerificationErrorTo_p_DsigException(void *x) {
return (void *)((DsigException *) ((TrustVerificationError *) x));
}
static void *_p_KeyErrorTo_p_DsigException(void *x) {
return (void *)((DsigException *) ((KeyError *) x));
}
static void *_p_MemoryErrorTo_p_DsigException(void *x) {
return (void *)((DsigException *) ((MemoryError *) x));
}
static void *_p_IOErrorTo_p_DsigException(void *x) {
return (void *)((DsigException *) ((IOError *) x));
}
static void *_p_ValueErrorTo_p_DsigException(void *x) {
return (void *)((DsigException *) ((ValueError *) x));
}
static void *_p_XPathErrorTo_p_DsigException(void *x) {
return (void *)((DsigException *) ((XPathError *) x));
}
static void *_p_XMLErrorTo_p_DsigException(void *x) {
return (void *)((DsigException *) ((XMLError *) x));
}
static void *_p_LibErrorTo_p_DsigException(void *x) {
return (void *)((DsigException *) ((LibError *) x));
}
static void *_p_DocErrorTo_p_DsigException(void *x) {
return (void *)((DsigException *) ((DocError *) x));
}
static swig_type_info _swigt__p_CountPtrToTKeyStore_t = {"_p_CountPtrToTKeyStore_t", "CountPtrTo<KeyStore > *|KeyStorePtr *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_CountPtrToTKey_t = {"_p_CountPtrToTKey_t", "CountPtrTo<Key > *|KeyPtr *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_CountPtrToTX509Certificate_t = {"_p_CountPtrToTX509Certificate_t", "CountPtrTo<X509Certificate > *|X509CertificatePtr *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_CountPtrToTXPath_t = {"_p_CountPtrToTXPath_t", "CountPtrTo<XPath > *|XPathPtr *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_CountPtrToTXmlDoc_t = {"_p_CountPtrToTXmlDoc_t", "CountPtrTo<XmlDoc > *|XmlDocClassPtr *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_CountPtrToTXmlElement_t = {"_p_CountPtrToTXmlElement_t", "CountPtrTo<XmlElement > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_DocError = {"_p_DocError", "DocError *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_DsigException = {"_p_DsigException", "DsigException *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_IOError = {"_p_IOError", "IOError *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Key = {"_p_Key", "Key *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_KeyError = {"_p_KeyError", "KeyError *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_KeyStore = {"_p_KeyStore", "KeyStore *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_LibError = {"_p_LibError", "LibError *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_MemoryError = {"_p_MemoryError", "MemoryError *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Signer = {"_p_Signer", "Signer *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_SimpleTrustVerifier = {"_p_SimpleTrustVerifier", "SimpleTrustVerifier *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_TrustVerificationError = {"_p_TrustVerificationError", "TrustVerificationError *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_TrustVerifier = {"_p_TrustVerifier", "TrustVerifier *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_ValueError = {"_p_ValueError", "ValueError *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Verifier = {"_p_Verifier", "Verifier *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_X509Certificate = {"_p_X509Certificate", "X509Certificate *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_X509TrustVerifier = {"_p_X509TrustVerifier", "X509TrustVerifier *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_XMLError = {"_p_XMLError", "XMLError *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_XPath = {"_p_XPath", "XPath *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_XPathError = {"_p_XPathError", "XPathError *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_XmlDoc = {"_p_XmlDoc", "XmlDoc *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_XmlElement = {"_p_XmlElement", "XmlElement *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__out_of_range = {"_p_std__out_of_range", "std::out_of_range *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__vectorTCountPtrToTKey_t_t = {"_p_std__vectorTCountPtrToTKey_t_t", "std::vector<CountPtrTo<Key > > *|std::vector<KeyPtr > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__vectorTCountPtrToTX509Certificate_t_t = {"_p_std__vectorTCountPtrToTX509Certificate_t_t", "std::vector<CountPtrTo<X509Certificate > > *|std::vector<X509CertificatePtr > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__vectorTCountPtrToTXmlElement_t_t = {"_p_std__vectorTCountPtrToTXmlElement_t_t", "std::vector<CountPtrTo<XmlElement > > *|std::vector<XmlElementPtr > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_vectorTCountPtrToTX509Certificate_t_t = {"_p_vectorTCountPtrToTX509Certificate_t_t", "vector<CountPtrTo<X509Certificate > > *|vector<X509CertificatePtr > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_xmlNodePtr = {"_p_xmlNodePtr", "xmlNodePtr *", 0, 0, (void*)0, 0};
static swig_type_info *swig_type_initial[] = {
&_swigt__p_CountPtrToTKeyStore_t,
&_swigt__p_CountPtrToTKey_t,
&_swigt__p_CountPtrToTX509Certificate_t,
&_swigt__p_CountPtrToTXPath_t,
&_swigt__p_CountPtrToTXmlDoc_t,
&_swigt__p_CountPtrToTXmlElement_t,
&_swigt__p_DocError,
&_swigt__p_DsigException,
&_swigt__p_IOError,
&_swigt__p_Key,
&_swigt__p_KeyError,
&_swigt__p_KeyStore,
&_swigt__p_LibError,
&_swigt__p_MemoryError,
&_swigt__p_Signer,
&_swigt__p_SimpleTrustVerifier,
&_swigt__p_TrustVerificationError,
&_swigt__p_TrustVerifier,
&_swigt__p_ValueError,
&_swigt__p_Verifier,
&_swigt__p_X509Certificate,
&_swigt__p_X509TrustVerifier,
&_swigt__p_XMLError,
&_swigt__p_XPath,
&_swigt__p_XPathError,
&_swigt__p_XmlDoc,
&_swigt__p_XmlElement,
&_swigt__p_char,
&_swigt__p_std__out_of_range,
&_swigt__p_std__vectorTCountPtrToTKey_t_t,
&_swigt__p_std__vectorTCountPtrToTX509Certificate_t_t,
&_swigt__p_std__vectorTCountPtrToTXmlElement_t_t,
&_swigt__p_vectorTCountPtrToTX509Certificate_t_t,
&_swigt__p_xmlNodePtr,
};
static swig_cast_info _swigc__p_CountPtrToTKeyStore_t[] = { {&_swigt__p_CountPtrToTKeyStore_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_CountPtrToTKey_t[] = { {&_swigt__p_CountPtrToTKey_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_CountPtrToTX509Certificate_t[] = { {&_swigt__p_CountPtrToTX509Certificate_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_CountPtrToTXPath_t[] = { {&_swigt__p_CountPtrToTXPath_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_CountPtrToTXmlDoc_t[] = { {&_swigt__p_CountPtrToTXmlDoc_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_CountPtrToTXmlElement_t[] = { {&_swigt__p_CountPtrToTXmlElement_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_DocError[] = { {&_swigt__p_DocError, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_DsigException[] = { {&_swigt__p_TrustVerificationError, _p_TrustVerificationErrorTo_p_DsigException, 0, 0}, {&_swigt__p_DsigException, 0, 0, 0}, {&_swigt__p_KeyError, _p_KeyErrorTo_p_DsigException, 0, 0}, {&_swigt__p_MemoryError, _p_MemoryErrorTo_p_DsigException, 0, 0}, {&_swigt__p_IOError, _p_IOErrorTo_p_DsigException, 0, 0}, {&_swigt__p_ValueError, _p_ValueErrorTo_p_DsigException, 0, 0}, {&_swigt__p_XPathError, _p_XPathErrorTo_p_DsigException, 0, 0}, {&_swigt__p_XMLError, _p_XMLErrorTo_p_DsigException, 0, 0}, {&_swigt__p_LibError, _p_LibErrorTo_p_DsigException, 0, 0}, {&_swigt__p_DocError, _p_DocErrorTo_p_DsigException, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_IOError[] = { {&_swigt__p_IOError, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Key[] = { {&_swigt__p_Key, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_KeyError[] = { {&_swigt__p_KeyError, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_KeyStore[] = { {&_swigt__p_KeyStore, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_LibError[] = { {&_swigt__p_LibError, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_MemoryError[] = { {&_swigt__p_MemoryError, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Signer[] = { {&_swigt__p_Signer, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_SimpleTrustVerifier[] = { {&_swigt__p_SimpleTrustVerifier, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_TrustVerificationError[] = { {&_swigt__p_TrustVerificationError, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_TrustVerifier[] = { {&_swigt__p_TrustVerifier, 0, 0, 0}, {&_swigt__p_SimpleTrustVerifier, _p_SimpleTrustVerifierTo_p_TrustVerifier, 0, 0}, {&_swigt__p_X509TrustVerifier, _p_X509TrustVerifierTo_p_TrustVerifier, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_ValueError[] = { {&_swigt__p_ValueError, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Verifier[] = { {&_swigt__p_Verifier, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_X509Certificate[] = { {&_swigt__p_X509Certificate, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_X509TrustVerifier[] = { {&_swigt__p_X509TrustVerifier, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_XMLError[] = { {&_swigt__p_XMLError, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_XPath[] = { {&_swigt__p_XPath, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_XPathError[] = { {&_swigt__p_XPathError, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_XmlDoc[] = { {&_swigt__p_XmlDoc, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_XmlElement[] = { {&_swigt__p_XmlElement, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__out_of_range[] = { {&_swigt__p_std__out_of_range, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__vectorTCountPtrToTKey_t_t[] = { {&_swigt__p_std__vectorTCountPtrToTKey_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__vectorTCountPtrToTX509Certificate_t_t[] = { {&_swigt__p_std__vectorTCountPtrToTX509Certificate_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__vectorTCountPtrToTXmlElement_t_t[] = { {&_swigt__p_std__vectorTCountPtrToTXmlElement_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_vectorTCountPtrToTX509Certificate_t_t[] = { {&_swigt__p_vectorTCountPtrToTX509Certificate_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_xmlNodePtr[] = { {&_swigt__p_xmlNodePtr, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info *swig_cast_initial[] = {
_swigc__p_CountPtrToTKeyStore_t,
_swigc__p_CountPtrToTKey_t,
_swigc__p_CountPtrToTX509Certificate_t,
_swigc__p_CountPtrToTXPath_t,
_swigc__p_CountPtrToTXmlDoc_t,
_swigc__p_CountPtrToTXmlElement_t,
_swigc__p_DocError,
_swigc__p_DsigException,
_swigc__p_IOError,
_swigc__p_Key,
_swigc__p_KeyError,
_swigc__p_KeyStore,
_swigc__p_LibError,
_swigc__p_MemoryError,
_swigc__p_Signer,
_swigc__p_SimpleTrustVerifier,
_swigc__p_TrustVerificationError,
_swigc__p_TrustVerifier,
_swigc__p_ValueError,
_swigc__p_Verifier,
_swigc__p_X509Certificate,
_swigc__p_X509TrustVerifier,
_swigc__p_XMLError,
_swigc__p_XPath,
_swigc__p_XPathError,
_swigc__p_XmlDoc,
_swigc__p_XmlElement,
_swigc__p_char,
_swigc__p_std__out_of_range,
_swigc__p_std__vectorTCountPtrToTKey_t_t,
_swigc__p_std__vectorTCountPtrToTX509Certificate_t_t,
_swigc__p_std__vectorTCountPtrToTXmlElement_t_t,
_swigc__p_vectorTCountPtrToTX509Certificate_t_t,
_swigc__p_xmlNodePtr,
};
/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
/* -----------------------------------------------------------------------------
* Type initialization:
* This problem is tough by the requirement that no dynamic
* memory is used. Also, since swig_type_info structures store pointers to
* swig_cast_info structures and swig_cast_info structures store pointers back
* to swig_type_info structures, we need some lookup code at initialization.
* The idea is that swig generates all the structures that are needed.
* The runtime then collects these partially filled structures.
* The SWIG_InitializeModule function takes these initial arrays out of
* swig_module, and does all the lookup, filling in the swig_module.types
* array with the correct data and linking the correct swig_cast_info
* structures together.
*
* The generated swig_type_info structures are assigned staticly to an initial
* array. We just loop through that array, and handle each type individually.
* First we lookup if this type has been already loaded, and if so, use the
* loaded structure instead of the generated one. Then we have to fill in the
* cast linked list. The cast data is initially stored in something like a
* two-dimensional array. Each row corresponds to a type (there are the same
* number of rows as there are in the swig_type_initial array). Each entry in
* a column is one of the swig_cast_info structures for that type.
* The cast_initial array is actually an array of arrays, because each row has
* a variable number of columns. So to actually build the cast linked list,
* we find the array of casts associated with the type, and loop through it
* adding the casts to the list. The one last trick we need to do is making
* sure the type pointer in the swig_cast_info struct is correct.
*
* First off, we lookup the cast->type name to see if it is already loaded.
* There are three cases to handle:
* 1) If the cast->type has already been loaded AND the type we are adding
* casting info to has not been loaded (it is in this module), THEN we
* replace the cast->type pointer with the type pointer that has already
* been loaded.
* 2) If BOTH types (the one we are adding casting info to, and the
* cast->type) are loaded, THEN the cast info has already been loaded by
* the previous module so we just ignore it.
* 3) Finally, if cast->type has not already been loaded, then we add that
* swig_cast_info to the linked list (because the cast->type) pointer will
* be correct.
* ----------------------------------------------------------------------------- */
#ifdef __cplusplus
extern "C" {
#if 0
} /* c-mode */
#endif
#endif
#if 0
#define SWIGRUNTIME_DEBUG
#endif
SWIGRUNTIME void
SWIG_InitializeModule(void *clientdata) {
size_t i;
swig_module_info *module_head, *iter;
int found;
clientdata = clientdata;
/* check to see if the circular list has been setup, if not, set it up */
if (swig_module.next==0) {
/* Initialize the swig_module */
swig_module.type_initial = swig_type_initial;
swig_module.cast_initial = swig_cast_initial;
swig_module.next = &swig_module;
}
/* Try and load any already created modules */
module_head = SWIG_GetModule(clientdata);
if (!module_head) {
/* This is the first module loaded for this interpreter */
/* so set the swig module into the interpreter */
SWIG_SetModule(clientdata, &swig_module);
module_head = &swig_module;
} else {
/* the interpreter has loaded a SWIG module, but has it loaded this one? */
found=0;
iter=module_head;
do {
if (iter==&swig_module) {
found=1;
break;
}
iter=iter->next;
} while (iter!= module_head);
/* if the is found in the list, then all is done and we may leave */
if (found) return;
/* otherwise we must add out module into the list */
swig_module.next = module_head->next;
module_head->next = &swig_module;
}
/* Now work on filling in swig_module.types */
#ifdef SWIGRUNTIME_DEBUG
printf("SWIG_InitializeModule: size %d\n", swig_module.size);
#endif
for (i = 0; i < swig_module.size; ++i) {
swig_type_info *type = 0;
swig_type_info *ret;
swig_cast_info *cast;
#ifdef SWIGRUNTIME_DEBUG
printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
#endif
/* if there is another module already loaded */
if (swig_module.next != &swig_module) {
type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
}
if (type) {
/* Overwrite clientdata field */
#ifdef SWIGRUNTIME_DEBUG
printf("SWIG_InitializeModule: found type %s\n", type->name);
#endif
if (swig_module.type_initial[i]->clientdata) {
type->clientdata = swig_module.type_initial[i]->clientdata;
#ifdef SWIGRUNTIME_DEBUG
printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
#endif
}
} else {
type = swig_module.type_initial[i];
}
/* Insert casting types */
cast = swig_module.cast_initial[i];
while (cast->type) {
/* Don't need to add information already in the list */
ret = 0;
#ifdef SWIGRUNTIME_DEBUG
printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
#endif
if (swig_module.next != &swig_module) {
ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
#ifdef SWIGRUNTIME_DEBUG
if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
#endif
}
if (ret) {
if (type == swig_module.type_initial[i]) {
#ifdef SWIGRUNTIME_DEBUG
printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
#endif
cast->type = ret;
ret = 0;
} else {
/* Check for casting already in the list */
swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
#ifdef SWIGRUNTIME_DEBUG
if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
#endif
if (!ocast) ret = 0;
}
}
if (!ret) {
#ifdef SWIGRUNTIME_DEBUG
printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
#endif
if (type->cast) {
type->cast->prev = cast;
cast->next = type->cast;
}
type->cast = cast;
}
cast++;
}
/* Set entry in modules->types array equal to the type */
swig_module.types[i] = type;
}
swig_module.types[i] = 0;
#ifdef SWIGRUNTIME_DEBUG
printf("**** SWIG_InitializeModule: Cast List ******\n");
for (i = 0; i < swig_module.size; ++i) {
int j = 0;
swig_cast_info *cast = swig_module.cast_initial[i];
printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
while (cast->type) {
printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
cast++;
++j;
}
printf("---- Total casts: %d\n",j);
}
printf("**** SWIG_InitializeModule: Cast List ******\n");
#endif
}
/* This function will propagate the clientdata field of type to
* any new swig_type_info structures that have been added into the list
* of equivalent types. It is like calling
* SWIG_TypeClientData(type, clientdata) a second time.
*/
SWIGRUNTIME void
SWIG_PropagateClientData(void) {
size_t i;
swig_cast_info *equiv;
static int init_run = 0;
if (init_run) return;
init_run = 1;
for (i = 0; i < swig_module.size; i++) {
if (swig_module.types[i]->clientdata) {
equiv = swig_module.types[i]->cast;
while (equiv) {
if (!equiv->converter) {
if (equiv->type && !equiv->type->clientdata)
SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
}
equiv = equiv->next;
}
}
}
}
#ifdef __cplusplus
#if 0
{ /* c-mode */
#endif
}
#endif
#ifdef __cplusplus
extern "C"
#endif
SWIGEXPORT void Init_xmlsig(void) {
size_t i;
SWIG_InitRuntime();
mXmlsig = rb_define_module("Xmlsig");
SWIG_InitializeModule(0);
for (i = 0; i < swig_module.size; i++) {
SWIG_define_class(swig_module.types[i]);
}
SWIG_RubyInitializeTrackings();
rb_define_module_function(mXmlsig, "dsigInit", VALUEFUNC(_wrap_dsigInit), -1);
rb_define_module_function(mXmlsig, "dsigShutdown", VALUEFUNC(_wrap_dsigShutdown), -1);
dsigInit();
cDsigException.klass = rb_define_class_under(mXmlsig, "DsigException", rb_cObject);
SWIG_TypeClientData(SWIGTYPE_p_DsigException, (void *) &cDsigException);
rb_define_alloc_func(cDsigException.klass, _wrap_DsigException_allocate);
rb_define_method(cDsigException.klass, "initialize", VALUEFUNC(_wrap_new_DsigException), -1);
rb_define_method(cDsigException.klass, "what", VALUEFUNC(_wrap_DsigException_what), -1);
cDsigException.mark = 0;
cDsigException.destroy = (void (*)(void *)) free_DsigException;
cDsigException.trackObjects = 1;
cIOError.klass = rb_define_class_under(mXmlsig, "IOError", ((swig_class *) SWIGTYPE_p_DsigException->clientdata)->klass);
SWIG_TypeClientData(SWIGTYPE_p_IOError, (void *) &cIOError);
rb_define_alloc_func(cIOError.klass, _wrap_IOError_allocate);
rb_define_method(cIOError.klass, "initialize", VALUEFUNC(_wrap_new_IOError), -1);
cIOError.mark = 0;
cIOError.destroy = (void (*)(void *)) free_IOError;
cIOError.trackObjects = 1;
cMemoryError.klass = rb_define_class_under(mXmlsig, "MemoryError", ((swig_class *) SWIGTYPE_p_DsigException->clientdata)->klass);
SWIG_TypeClientData(SWIGTYPE_p_MemoryError, (void *) &cMemoryError);
rb_define_alloc_func(cMemoryError.klass, _wrap_MemoryError_allocate);
rb_define_method(cMemoryError.klass, "initialize", VALUEFUNC(_wrap_new_MemoryError), -1);
cMemoryError.mark = 0;
cMemoryError.destroy = (void (*)(void *)) free_MemoryError;
cMemoryError.trackObjects = 1;
cValueError.klass = rb_define_class_under(mXmlsig, "ValueError", ((swig_class *) SWIGTYPE_p_DsigException->clientdata)->klass);
SWIG_TypeClientData(SWIGTYPE_p_ValueError, (void *) &cValueError);
rb_define_alloc_func(cValueError.klass, _wrap_ValueError_allocate);
rb_define_method(cValueError.klass, "initialize", VALUEFUNC(_wrap_new_ValueError), -1);
cValueError.mark = 0;
cValueError.destroy = (void (*)(void *)) free_ValueError;
cValueError.trackObjects = 1;
cXMLError.klass = rb_define_class_under(mXmlsig, "XMLError", ((swig_class *) SWIGTYPE_p_DsigException->clientdata)->klass);
SWIG_TypeClientData(SWIGTYPE_p_XMLError, (void *) &cXMLError);
rb_define_alloc_func(cXMLError.klass, _wrap_XMLError_allocate);
rb_define_method(cXMLError.klass, "initialize", VALUEFUNC(_wrap_new_XMLError), -1);
cXMLError.mark = 0;
cXMLError.destroy = (void (*)(void *)) free_XMLError;
cXMLError.trackObjects = 1;
cKeyError.klass = rb_define_class_under(mXmlsig, "KeyError", ((swig_class *) SWIGTYPE_p_DsigException->clientdata)->klass);
SWIG_TypeClientData(SWIGTYPE_p_KeyError, (void *) &cKeyError);
rb_define_alloc_func(cKeyError.klass, _wrap_KeyError_allocate);
rb_define_method(cKeyError.klass, "initialize", VALUEFUNC(_wrap_new_KeyError), -1);
cKeyError.mark = 0;
cKeyError.destroy = (void (*)(void *)) free_KeyError;
cKeyError.trackObjects = 1;
cDocError.klass = rb_define_class_under(mXmlsig, "DocError", ((swig_class *) SWIGTYPE_p_DsigException->clientdata)->klass);
SWIG_TypeClientData(SWIGTYPE_p_DocError, (void *) &cDocError);
rb_define_alloc_func(cDocError.klass, _wrap_DocError_allocate);
rb_define_method(cDocError.klass, "initialize", VALUEFUNC(_wrap_new_DocError), -1);
cDocError.mark = 0;
cDocError.destroy = (void (*)(void *)) free_DocError;
cDocError.trackObjects = 1;
cXPathError.klass = rb_define_class_under(mXmlsig, "XPathError", ((swig_class *) SWIGTYPE_p_DsigException->clientdata)->klass);
SWIG_TypeClientData(SWIGTYPE_p_XPathError, (void *) &cXPathError);
rb_define_alloc_func(cXPathError.klass, _wrap_XPathError_allocate);
rb_define_method(cXPathError.klass, "initialize", VALUEFUNC(_wrap_new_XPathError), -1);
cXPathError.mark = 0;
cXPathError.destroy = (void (*)(void *)) free_XPathError;
cXPathError.trackObjects = 1;
cTrustVerificationError.klass = rb_define_class_under(mXmlsig, "TrustVerificationError", ((swig_class *) SWIGTYPE_p_DsigException->clientdata)->klass);
SWIG_TypeClientData(SWIGTYPE_p_TrustVerificationError, (void *) &cTrustVerificationError);
rb_define_alloc_func(cTrustVerificationError.klass, _wrap_TrustVerificationError_allocate);
rb_define_method(cTrustVerificationError.klass, "initialize", VALUEFUNC(_wrap_new_TrustVerificationError), -1);
cTrustVerificationError.mark = 0;
cTrustVerificationError.destroy = (void (*)(void *)) free_TrustVerificationError;
cTrustVerificationError.trackObjects = 1;
cLibError.klass = rb_define_class_under(mXmlsig, "LibError", ((swig_class *) SWIGTYPE_p_DsigException->clientdata)->klass);
SWIG_TypeClientData(SWIGTYPE_p_LibError, (void *) &cLibError);
rb_define_alloc_func(cLibError.klass, _wrap_LibError_allocate);
rb_define_method(cLibError.klass, "initialize", VALUEFUNC(_wrap_new_LibError), -1);
rb_define_singleton_method(cLibError.klass, "clearErrorLogs", VALUEFUNC(_wrap_LibError_clearErrorLogs), -1);
cLibError.mark = 0;
cLibError.destroy = (void (*)(void *)) free_LibError;
cLibError.trackObjects = 1;
cX509CertificateBase.klass = rb_define_class_under(mXmlsig, "X509CertificateBase", rb_cObject);
SWIG_TypeClientData(SWIGTYPE_p_X509Certificate, (void *) &cX509CertificateBase);
rb_define_alloc_func(cX509CertificateBase.klass, _wrap_X509CertificateBase_allocate);
rb_define_method(cX509CertificateBase.klass, "initialize", VALUEFUNC(_wrap_new_X509CertificateBase), -1);
rb_define_method(cX509CertificateBase.klass, "loadFromFile", VALUEFUNC(_wrap_X509CertificateBase_loadFromFile), -1);
rb_define_method(cX509CertificateBase.klass, "getSubjectDN", VALUEFUNC(_wrap_X509CertificateBase_getSubjectDN), -1);
rb_define_method(cX509CertificateBase.klass, "getIssuerDN", VALUEFUNC(_wrap_X509CertificateBase_getIssuerDN), -1);
rb_define_method(cX509CertificateBase.klass, "getVersion", VALUEFUNC(_wrap_X509CertificateBase_getVersion), -1);
rb_define_method(cX509CertificateBase.klass, "isValid", VALUEFUNC(_wrap_X509CertificateBase_isValid), -1);
rb_define_method(cX509CertificateBase.klass, "getBasicConstraints", VALUEFUNC(_wrap_X509CertificateBase_getBasicConstraints), -1);
rb_define_method(cX509CertificateBase.klass, "getKey", VALUEFUNC(_wrap_X509CertificateBase_getKey), -1);
cX509CertificateBase.mark = 0;
cX509CertificateBase.destroy = (void (*)(void *)) free_X509Certificate;
cX509CertificateBase.trackObjects = 1;
cX509Certificate.klass = rb_define_class_under(mXmlsig, "X509Certificate", rb_cObject);
SWIG_TypeClientData(SWIGTYPE_p_CountPtrToTX509Certificate_t, (void *) &cX509Certificate);
rb_define_alloc_func(cX509Certificate.klass, _wrap_X509Certificate_allocate);
rb_define_method(cX509Certificate.klass, "initialize", VALUEFUNC(_wrap_new_X509Certificate), -1);
rb_define_method(cX509Certificate.klass, "__deref__", VALUEFUNC(_wrap_X509Certificate___deref__), -1);
rb_define_method(cX509Certificate.klass, "loadFromFile", VALUEFUNC(_wrap_X509Certificate_loadFromFile), -1);
rb_define_method(cX509Certificate.klass, "getSubjectDN", VALUEFUNC(_wrap_X509Certificate_getSubjectDN), -1);
rb_define_method(cX509Certificate.klass, "getIssuerDN", VALUEFUNC(_wrap_X509Certificate_getIssuerDN), -1);
rb_define_method(cX509Certificate.klass, "getVersion", VALUEFUNC(_wrap_X509Certificate_getVersion), -1);
rb_define_method(cX509Certificate.klass, "isValid", VALUEFUNC(_wrap_X509Certificate_isValid), -1);
rb_define_method(cX509Certificate.klass, "getBasicConstraints", VALUEFUNC(_wrap_X509Certificate_getBasicConstraints), -1);
rb_define_method(cX509Certificate.klass, "getKey", VALUEFUNC(_wrap_X509Certificate_getKey), -1);
cX509Certificate.mark = 0;
cX509Certificate.destroy = (void (*)(void *)) free_CountPtrTo_Sl_X509Certificate_Sg_;
cX509Certificate.trackObjects = 1;
cX509CertificateVector.klass = rb_define_class_under(mXmlsig, "X509CertificateVector", rb_cObject);
SWIG_TypeClientData(SWIGTYPE_p_std__vectorTCountPtrToTX509Certificate_t_t, (void *) &cX509CertificateVector);
rb_include_module(cX509CertificateVector.klass, rb_eval_string("Enumerable"));
rb_define_alloc_func(cX509CertificateVector.klass, _wrap_X509CertificateVector_allocate);
rb_define_method(cX509CertificateVector.klass, "initialize", VALUEFUNC(_wrap_new_X509CertificateVector), -1);
rb_define_method(cX509CertificateVector.klass, "length", VALUEFUNC(_wrap_X509CertificateVector___len__), -1);
rb_define_method(cX509CertificateVector.klass, "empty?", VALUEFUNC(_wrap_X509CertificateVector_emptyq___), -1);
rb_define_method(cX509CertificateVector.klass, "clear", VALUEFUNC(_wrap_X509CertificateVector_clear), -1);
rb_define_method(cX509CertificateVector.klass, "push", VALUEFUNC(_wrap_X509CertificateVector_push), -1);
rb_define_method(cX509CertificateVector.klass, "pop", VALUEFUNC(_wrap_X509CertificateVector_pop), -1);
rb_define_method(cX509CertificateVector.klass, "[]", VALUEFUNC(_wrap_X509CertificateVector___getitem__), -1);
rb_define_method(cX509CertificateVector.klass, "[]=", VALUEFUNC(_wrap_X509CertificateVector___setitem__), -1);
rb_define_method(cX509CertificateVector.klass, "each", VALUEFUNC(_wrap_X509CertificateVector_each), -1);
cX509CertificateVector.mark = 0;
cX509CertificateVector.destroy = (void (*)(void *)) free_std_vector_Sl_X509CertificatePtr_Sg_;
cX509CertificateVector.trackObjects = 1;
cKeyBase.klass = rb_define_class_under(mXmlsig, "KeyBase", rb_cObject);
SWIG_TypeClientData(SWIGTYPE_p_Key, (void *) &cKeyBase);
rb_define_alloc_func(cKeyBase.klass, _wrap_KeyBase_allocate);
rb_define_method(cKeyBase.klass, "initialize", VALUEFUNC(_wrap_new_KeyBase), -1);
rb_define_method(cKeyBase.klass, "loadFromFile", VALUEFUNC(_wrap_KeyBase_loadFromFile), -1);
rb_define_method(cKeyBase.klass, "loadFromKeyInfoFile", VALUEFUNC(_wrap_KeyBase_loadFromKeyInfoFile), -1);
rb_define_method(cKeyBase.klass, "loadHMACFromString", VALUEFUNC(_wrap_KeyBase_loadHMACFromString), -1);
rb_define_method(cKeyBase.klass, "setName", VALUEFUNC(_wrap_KeyBase_setName), -1);
rb_define_method(cKeyBase.klass, "getName", VALUEFUNC(_wrap_KeyBase_getName), -1);
rb_define_method(cKeyBase.klass, "isValid", VALUEFUNC(_wrap_KeyBase_isValid), -1);
rb_define_method(cKeyBase.klass, "getCertificate", VALUEFUNC(_wrap_KeyBase_getCertificate), -1);
rb_define_method(cKeyBase.klass, "getCertificateChain", VALUEFUNC(_wrap_KeyBase_getCertificateChain), -1);
rb_define_method(cKeyBase.klass, "dump", VALUEFUNC(_wrap_KeyBase_dump), -1);
cKeyBase.mark = 0;
cKeyBase.destroy = (void (*)(void *)) free_Key;
cKeyBase.trackObjects = 1;
cKey.klass = rb_define_class_under(mXmlsig, "Key", rb_cObject);
SWIG_TypeClientData(SWIGTYPE_p_CountPtrToTKey_t, (void *) &cKey);
rb_define_alloc_func(cKey.klass, _wrap_Key_allocate);
rb_define_method(cKey.klass, "initialize", VALUEFUNC(_wrap_new_Key), -1);
rb_define_method(cKey.klass, "__deref__", VALUEFUNC(_wrap_Key___deref__), -1);
rb_define_method(cKey.klass, "loadFromFile", VALUEFUNC(_wrap_Key_loadFromFile), -1);
rb_define_method(cKey.klass, "loadFromKeyInfoFile", VALUEFUNC(_wrap_Key_loadFromKeyInfoFile), -1);
rb_define_method(cKey.klass, "loadHMACFromString", VALUEFUNC(_wrap_Key_loadHMACFromString), -1);
rb_define_method(cKey.klass, "setName", VALUEFUNC(_wrap_Key_setName), -1);
rb_define_method(cKey.klass, "getName", VALUEFUNC(_wrap_Key_getName), -1);
rb_define_method(cKey.klass, "isValid", VALUEFUNC(_wrap_Key_isValid), -1);
rb_define_method(cKey.klass, "getCertificate", VALUEFUNC(_wrap_Key_getCertificate), -1);
rb_define_method(cKey.klass, "getCertificateChain", VALUEFUNC(_wrap_Key_getCertificateChain), -1);
rb_define_method(cKey.klass, "dump", VALUEFUNC(_wrap_Key_dump), -1);
cKey.mark = 0;
cKey.destroy = (void (*)(void *)) free_CountPtrTo_Sl_Key_Sg_;
cKey.trackObjects = 1;
cKeyVector.klass = rb_define_class_under(mXmlsig, "KeyVector", rb_cObject);
SWIG_TypeClientData(SWIGTYPE_p_std__vectorTCountPtrToTKey_t_t, (void *) &cKeyVector);
rb_include_module(cKeyVector.klass, rb_eval_string("Enumerable"));
rb_define_alloc_func(cKeyVector.klass, _wrap_KeyVector_allocate);
rb_define_method(cKeyVector.klass, "initialize", VALUEFUNC(_wrap_new_KeyVector), -1);
rb_define_method(cKeyVector.klass, "length", VALUEFUNC(_wrap_KeyVector___len__), -1);
rb_define_method(cKeyVector.klass, "empty?", VALUEFUNC(_wrap_KeyVector_emptyq___), -1);
rb_define_method(cKeyVector.klass, "clear", VALUEFUNC(_wrap_KeyVector_clear), -1);
rb_define_method(cKeyVector.klass, "push", VALUEFUNC(_wrap_KeyVector_push), -1);
rb_define_method(cKeyVector.klass, "pop", VALUEFUNC(_wrap_KeyVector_pop), -1);
rb_define_method(cKeyVector.klass, "[]", VALUEFUNC(_wrap_KeyVector___getitem__), -1);
rb_define_method(cKeyVector.klass, "[]=", VALUEFUNC(_wrap_KeyVector___setitem__), -1);
rb_define_method(cKeyVector.klass, "each", VALUEFUNC(_wrap_KeyVector_each), -1);
cKeyVector.mark = 0;
cKeyVector.destroy = (void (*)(void *)) free_std_vector_Sl_KeyPtr_Sg_;
cKeyVector.trackObjects = 1;
cKeyStoreBase.klass = rb_define_class_under(mXmlsig, "KeyStoreBase", rb_cObject);
SWIG_TypeClientData(SWIGTYPE_p_KeyStore, (void *) &cKeyStoreBase);
rb_define_alloc_func(cKeyStoreBase.klass, _wrap_KeyStoreBase_allocate);
rb_define_method(cKeyStoreBase.klass, "initialize", VALUEFUNC(_wrap_new_KeyStoreBase), -1);
rb_define_method(cKeyStoreBase.klass, "addTrustedCert", VALUEFUNC(_wrap_KeyStoreBase_addTrustedCert), -1);
rb_define_method(cKeyStoreBase.klass, "addUntrustedCert", VALUEFUNC(_wrap_KeyStoreBase_addUntrustedCert), -1);
rb_define_method(cKeyStoreBase.klass, "addTrustedCertFromFile", VALUEFUNC(_wrap_KeyStoreBase_addTrustedCertFromFile), -1);
rb_define_method(cKeyStoreBase.klass, "addUntrustedCertFromFile", VALUEFUNC(_wrap_KeyStoreBase_addUntrustedCertFromFile), -1);
rb_define_method(cKeyStoreBase.klass, "addKey", VALUEFUNC(_wrap_KeyStoreBase_addKey), -1);
rb_define_method(cKeyStoreBase.klass, "addKeyFromFile", VALUEFUNC(_wrap_KeyStoreBase_addKeyFromFile), -1);
rb_define_method(cKeyStoreBase.klass, "saveToFile", VALUEFUNC(_wrap_KeyStoreBase_saveToFile), -1);
rb_define_method(cKeyStoreBase.klass, "loadFromFile", VALUEFUNC(_wrap_KeyStoreBase_loadFromFile), -1);
cKeyStoreBase.mark = 0;
cKeyStoreBase.destroy = (void (*)(void *)) free_KeyStore;
cKeyStoreBase.trackObjects = 1;
cKeyStore.klass = rb_define_class_under(mXmlsig, "KeyStore", rb_cObject);
SWIG_TypeClientData(SWIGTYPE_p_CountPtrToTKeyStore_t, (void *) &cKeyStore);
rb_define_alloc_func(cKeyStore.klass, _wrap_KeyStore_allocate);
rb_define_method(cKeyStore.klass, "initialize", VALUEFUNC(_wrap_new_KeyStore), -1);
rb_define_method(cKeyStore.klass, "__deref__", VALUEFUNC(_wrap_KeyStore___deref__), -1);
rb_define_method(cKeyStore.klass, "addTrustedCert", VALUEFUNC(_wrap_KeyStore_addTrustedCert), -1);
rb_define_method(cKeyStore.klass, "addUntrustedCert", VALUEFUNC(_wrap_KeyStore_addUntrustedCert), -1);
rb_define_method(cKeyStore.klass, "addTrustedCertFromFile", VALUEFUNC(_wrap_KeyStore_addTrustedCertFromFile), -1);
rb_define_method(cKeyStore.klass, "addUntrustedCertFromFile", VALUEFUNC(_wrap_KeyStore_addUntrustedCertFromFile), -1);
rb_define_method(cKeyStore.klass, "addKey", VALUEFUNC(_wrap_KeyStore_addKey), -1);
rb_define_method(cKeyStore.klass, "addKeyFromFile", VALUEFUNC(_wrap_KeyStore_addKeyFromFile), -1);
rb_define_method(cKeyStore.klass, "saveToFile", VALUEFUNC(_wrap_KeyStore_saveToFile), -1);
rb_define_method(cKeyStore.klass, "loadFromFile", VALUEFUNC(_wrap_KeyStore_loadFromFile), -1);
cKeyStore.mark = 0;
cKeyStore.destroy = (void (*)(void *)) free_CountPtrTo_Sl_KeyStore_Sg_;
cKeyStore.trackObjects = 1;
cXmlDocBase.klass = rb_define_class_under(mXmlsig, "XmlDocBase", rb_cObject);
SWIG_TypeClientData(SWIGTYPE_p_XmlDoc, (void *) &cXmlDocBase);
rb_define_alloc_func(cXmlDocBase.klass, _wrap_XmlDocBase_allocate);
rb_define_method(cXmlDocBase.klass, "initialize", VALUEFUNC(_wrap_new_XmlDocBase), -1);
rb_define_method(cXmlDocBase.klass, "loadFromString", VALUEFUNC(_wrap_XmlDocBase_loadFromString), -1);
rb_define_method(cXmlDocBase.klass, "loadFromFile", VALUEFUNC(_wrap_XmlDocBase_loadFromFile), -1);
rb_define_method(cXmlDocBase.klass, "toString", VALUEFUNC(_wrap_XmlDocBase_toString), -1);
rb_define_method(cXmlDocBase.klass, "toFile", VALUEFUNC(_wrap_XmlDocBase_toFile), -1);
rb_define_method(cXmlDocBase.klass, "dump", VALUEFUNC(_wrap_XmlDocBase_dump), -1);
rb_define_method(cXmlDocBase.klass, "addIdAttr", VALUEFUNC(_wrap_XmlDocBase_addIdAttr), -1);
cXmlDocBase.mark = 0;
cXmlDocBase.destroy = (void (*)(void *)) free_XmlDoc;
cXmlDocBase.trackObjects = 1;
cXmlDoc.klass = rb_define_class_under(mXmlsig, "XmlDoc", rb_cObject);
SWIG_TypeClientData(SWIGTYPE_p_CountPtrToTXmlDoc_t, (void *) &cXmlDoc);
rb_define_alloc_func(cXmlDoc.klass, _wrap_XmlDoc_allocate);
rb_define_method(cXmlDoc.klass, "initialize", VALUEFUNC(_wrap_new_XmlDoc), -1);
rb_define_method(cXmlDoc.klass, "__deref__", VALUEFUNC(_wrap_XmlDoc___deref__), -1);
rb_define_method(cXmlDoc.klass, "loadFromString", VALUEFUNC(_wrap_XmlDoc_loadFromString), -1);
rb_define_method(cXmlDoc.klass, "loadFromFile", VALUEFUNC(_wrap_XmlDoc_loadFromFile), -1);
rb_define_method(cXmlDoc.klass, "toString", VALUEFUNC(_wrap_XmlDoc_toString), -1);
rb_define_method(cXmlDoc.klass, "toFile", VALUEFUNC(_wrap_XmlDoc_toFile), -1);
rb_define_method(cXmlDoc.klass, "dump", VALUEFUNC(_wrap_XmlDoc_dump), -1);
rb_define_method(cXmlDoc.klass, "addIdAttr", VALUEFUNC(_wrap_XmlDoc_addIdAttr), -1);
cXmlDoc.mark = 0;
cXmlDoc.destroy = (void (*)(void *)) free_CountPtrTo_Sl_XmlDoc_Sg_;
cXmlDoc.trackObjects = 1;
cXPathBase.klass = rb_define_class_under(mXmlsig, "XPathBase", rb_cObject);
SWIG_TypeClientData(SWIGTYPE_p_XPath, (void *) &cXPathBase);
rb_define_alloc_func(cXPathBase.klass, _wrap_XPathBase_allocate);
rb_define_method(cXPathBase.klass, "initialize", VALUEFUNC(_wrap_new_XPathBase), -1);
rb_define_method(cXPathBase.klass, "addNamespace", VALUEFUNC(_wrap_XPathBase_addNamespace), -1);
rb_define_method(cXPathBase.klass, "getXPath", VALUEFUNC(_wrap_XPathBase_getXPath), -1);
rb_define_method(cXPathBase.klass, "setXPath", VALUEFUNC(_wrap_XPathBase_setXPath), -1);
cXPathBase.mark = 0;
cXPathBase.destroy = (void (*)(void *)) free_XPath;
cXPathBase.trackObjects = 1;
cXPath.klass = rb_define_class_under(mXmlsig, "XPath", rb_cObject);
SWIG_TypeClientData(SWIGTYPE_p_CountPtrToTXPath_t, (void *) &cXPath);
rb_define_alloc_func(cXPath.klass, _wrap_XPath_allocate);
rb_define_method(cXPath.klass, "initialize", VALUEFUNC(_wrap_new_XPath), -1);
rb_define_method(cXPath.klass, "__deref__", VALUEFUNC(_wrap_XPath___deref__), -1);
rb_define_method(cXPath.klass, "addNamespace", VALUEFUNC(_wrap_XPath_addNamespace), -1);
rb_define_method(cXPath.klass, "getXPath", VALUEFUNC(_wrap_XPath_getXPath), -1);
rb_define_method(cXPath.klass, "setXPath", VALUEFUNC(_wrap_XPath_setXPath), -1);
cXPath.mark = 0;
cXPath.destroy = (void (*)(void *)) free_CountPtrTo_Sl_XPath_Sg_;
cXPath.trackObjects = 1;
cXmlElementBase.klass = rb_define_class_under(mXmlsig, "XmlElementBase", rb_cObject);
SWIG_TypeClientData(SWIGTYPE_p_XmlElement, (void *) &cXmlElementBase);
rb_define_alloc_func(cXmlElementBase.klass, _wrap_XmlElementBase_allocate);
rb_define_method(cXmlElementBase.klass, "initialize", VALUEFUNC(_wrap_new_XmlElementBase), -1);
rb_define_method(cXmlElementBase.klass, "getNode", VALUEFUNC(_wrap_XmlElementBase_getNode), -1);
rb_define_method(cXmlElementBase.klass, "getTagName", VALUEFUNC(_wrap_XmlElementBase_getTagName), -1);
rb_define_method(cXmlElementBase.klass, "getAttribute", VALUEFUNC(_wrap_XmlElementBase_getAttribute), -1);
rb_define_method(cXmlElementBase.klass, "getNodePath", VALUEFUNC(_wrap_XmlElementBase_getNodePath), -1);
cXmlElementBase.mark = 0;
cXmlElementBase.destroy = (void (*)(void *)) free_XmlElement;
cXmlElementBase.trackObjects = 1;
cXmlElement.klass = rb_define_class_under(mXmlsig, "XmlElement", rb_cObject);
SWIG_TypeClientData(SWIGTYPE_p_CountPtrToTXmlElement_t, (void *) &cXmlElement);
rb_define_alloc_func(cXmlElement.klass, _wrap_XmlElement_allocate);
rb_define_method(cXmlElement.klass, "initialize", VALUEFUNC(_wrap_new_XmlElement), -1);
rb_define_method(cXmlElement.klass, "__deref__", VALUEFUNC(_wrap_XmlElement___deref__), -1);
rb_define_method(cXmlElement.klass, "getNode", VALUEFUNC(_wrap_XmlElement_getNode), -1);
rb_define_method(cXmlElement.klass, "getTagName", VALUEFUNC(_wrap_XmlElement_getTagName), -1);
rb_define_method(cXmlElement.klass, "getAttribute", VALUEFUNC(_wrap_XmlElement_getAttribute), -1);
rb_define_method(cXmlElement.klass, "getNodePath", VALUEFUNC(_wrap_XmlElement_getNodePath), -1);
cXmlElement.mark = 0;
cXmlElement.destroy = (void (*)(void *)) free_CountPtrTo_Sl_XmlElement_Sg_;
cXmlElement.trackObjects = 1;
cXmlElementVector.klass = rb_define_class_under(mXmlsig, "XmlElementVector", rb_cObject);
SWIG_TypeClientData(SWIGTYPE_p_std__vectorTCountPtrToTXmlElement_t_t, (void *) &cXmlElementVector);
rb_include_module(cXmlElementVector.klass, rb_eval_string("Enumerable"));
rb_define_alloc_func(cXmlElementVector.klass, _wrap_XmlElementVector_allocate);
rb_define_method(cXmlElementVector.klass, "initialize", VALUEFUNC(_wrap_new_XmlElementVector), -1);
rb_define_method(cXmlElementVector.klass, "length", VALUEFUNC(_wrap_XmlElementVector___len__), -1);
rb_define_method(cXmlElementVector.klass, "empty?", VALUEFUNC(_wrap_XmlElementVector_emptyq___), -1);
rb_define_method(cXmlElementVector.klass, "clear", VALUEFUNC(_wrap_XmlElementVector_clear), -1);
rb_define_method(cXmlElementVector.klass, "push", VALUEFUNC(_wrap_XmlElementVector_push), -1);
rb_define_method(cXmlElementVector.klass, "pop", VALUEFUNC(_wrap_XmlElementVector_pop), -1);
rb_define_method(cXmlElementVector.klass, "[]", VALUEFUNC(_wrap_XmlElementVector___getitem__), -1);
rb_define_method(cXmlElementVector.klass, "[]=", VALUEFUNC(_wrap_XmlElementVector___setitem__), -1);
rb_define_method(cXmlElementVector.klass, "each", VALUEFUNC(_wrap_XmlElementVector_each), -1);
cXmlElementVector.mark = 0;
cXmlElementVector.destroy = (void (*)(void *)) free_std_vector_Sl_XmlElementPtr_Sg_;
cXmlElementVector.trackObjects = 1;
cSigner.klass = rb_define_class_under(mXmlsig, "Signer", rb_cObject);
SWIG_TypeClientData(SWIGTYPE_p_Signer, (void *) &cSigner);
rb_define_alloc_func(cSigner.klass, _wrap_Signer_allocate);
rb_define_method(cSigner.klass, "initialize", VALUEFUNC(_wrap_new_Signer), -1);
rb_define_method(cSigner.klass, "sign", VALUEFUNC(_wrap_Signer_sign), -1);
rb_define_method(cSigner.klass, "signInPlace", VALUEFUNC(_wrap_Signer_signInPlace), -1);
rb_define_method(cSigner.klass, "setKeyStore", VALUEFUNC(_wrap_Signer_setKeyStore), -1);
rb_define_method(cSigner.klass, "addCertFromFile", VALUEFUNC(_wrap_Signer_addCertFromFile), -1);
rb_define_method(cSigner.klass, "addCert", VALUEFUNC(_wrap_Signer_addCert), -1);
rb_define_method(cSigner.klass, "useExclusiveCanonicalizer", VALUEFUNC(_wrap_Signer_useExclusiveCanonicalizer), -1);
rb_define_method(cSigner.klass, "addReference", VALUEFUNC(_wrap_Signer_addReference), -1);
rb_define_method(cSigner.klass, "attachPublicKey", VALUEFUNC(_wrap_Signer_attachPublicKey), -1);
cSigner.mark = 0;
cSigner.destroy = (void (*)(void *)) free_Signer;
cSigner.trackObjects = 1;
cVerifier.klass = rb_define_class_under(mXmlsig, "Verifier", rb_cObject);
SWIG_TypeClientData(SWIGTYPE_p_Verifier, (void *) &cVerifier);
rb_define_alloc_func(cVerifier.klass, _wrap_Verifier_allocate);
rb_define_method(cVerifier.klass, "initialize", VALUEFUNC(_wrap_new_Verifier), -1);
rb_define_method(cVerifier.klass, "setKeyStore", VALUEFUNC(_wrap_Verifier_setKeyStore), -1);
rb_define_method(cVerifier.klass, "verify", VALUEFUNC(_wrap_Verifier_verify), -1);
rb_define_method(cVerifier.klass, "getVerifyingKey", VALUEFUNC(_wrap_Verifier_getVerifyingKey), -1);
rb_define_method(cVerifier.klass, "isReferenced", VALUEFUNC(_wrap_Verifier_isReferenced), -1);
rb_define_method(cVerifier.klass, "getReferencedElements", VALUEFUNC(_wrap_Verifier_getReferencedElements), -1);
rb_define_method(cVerifier.klass, "getCertificate", VALUEFUNC(_wrap_Verifier_getCertificate), -1);
rb_define_method(cVerifier.klass, "getCertificateChain", VALUEFUNC(_wrap_Verifier_getCertificateChain), -1);
rb_define_method(cVerifier.klass, "skipCertCheck", VALUEFUNC(_wrap_Verifier_skipCertCheck), -1);
cVerifier.mark = 0;
cVerifier.destroy = (void (*)(void *)) free_Verifier;
cVerifier.trackObjects = 1;
cTrustVerifier.klass = rb_define_class_under(mXmlsig, "TrustVerifier", rb_cObject);
SWIG_TypeClientData(SWIGTYPE_p_TrustVerifier, (void *) &cTrustVerifier);
rb_define_alloc_func(cTrustVerifier.klass, _wrap_TrustVerifier_allocate);
rb_define_method(cTrustVerifier.klass, "initialize", VALUEFUNC(_wrap_new_TrustVerifier), -1);
rb_define_method(cTrustVerifier.klass, "verifyTrust", VALUEFUNC(_wrap_TrustVerifier_verifyTrust), -1);
cTrustVerifier.mark = 0;
cTrustVerifier.destroy = (void (*)(void *)) free_TrustVerifier;
cTrustVerifier.trackObjects = 1;
cSimpleTrustVerifier.klass = rb_define_class_under(mXmlsig, "SimpleTrustVerifier", ((swig_class *) SWIGTYPE_p_TrustVerifier->clientdata)->klass);
SWIG_TypeClientData(SWIGTYPE_p_SimpleTrustVerifier, (void *) &cSimpleTrustVerifier);
rb_define_alloc_func(cSimpleTrustVerifier.klass, _wrap_SimpleTrustVerifier_allocate);
rb_define_method(cSimpleTrustVerifier.klass, "initialize", VALUEFUNC(_wrap_new_SimpleTrustVerifier), -1);
rb_define_method(cSimpleTrustVerifier.klass, "verifyTrust", VALUEFUNC(_wrap_SimpleTrustVerifier_verifyTrust), -1);
cSimpleTrustVerifier.mark = 0;
cSimpleTrustVerifier.destroy = (void (*)(void *)) free_SimpleTrustVerifier;
cSimpleTrustVerifier.trackObjects = 1;
cX509TrustVerifier.klass = rb_define_class_under(mXmlsig, "X509TrustVerifier", ((swig_class *) SWIGTYPE_p_TrustVerifier->clientdata)->klass);
SWIG_TypeClientData(SWIGTYPE_p_X509TrustVerifier, (void *) &cX509TrustVerifier);
rb_define_alloc_func(cX509TrustVerifier.klass, _wrap_X509TrustVerifier_allocate);
rb_define_method(cX509TrustVerifier.klass, "initialize", VALUEFUNC(_wrap_new_X509TrustVerifier), -1);
rb_define_method(cX509TrustVerifier.klass, "verifyTrust", VALUEFUNC(_wrap_X509TrustVerifier_verifyTrust), -1);
cX509TrustVerifier.mark = 0;
cX509TrustVerifier.destroy = (void (*)(void *)) free_X509TrustVerifier;
cX509TrustVerifier.trackObjects = 1;
}
| [
"[email protected]"
]
| [
[
[
1,
13363
]
]
]
|
7c8c12e4ec3f42daf6e99129964f338ed5b5343e | 2d978d6a23763d194e594f0c067fc52092f5c486 | /Win32/CefSharp/BrowserSettings.h | 5c0983f422e687670cb91f9c24443a566cb9023b | []
| no_license | WindowsTermKit/TermKit | 08ce90aed222e9261f1132d5d243d4cf3ab9242b | 414a36452fac78e2553265c2b43be05dd7a61656 | refs/heads/master | 2021-01-17T21:36:24.528259 | 2011-06-04T02:59:28 | 2011-06-04T02:59:28 | 1,808,466 | 25 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 9,076 | h | #include "stdafx.h"
#pragma once
namespace CefSharp
{
public ref class BrowserSettings
{
internal:
CefBrowserSettings* _browserSettings;
public:
BrowserSettings() : _browserSettings(new CefBrowserSettings()) { }
!BrowserSettings() { delete _browserSettings; }
~BrowserSettings() { delete _browserSettings; }
property int DefaultFontSize
{
int get() { return _browserSettings->default_font_size; }
void set(int value) { _browserSettings->default_font_size = value; }
}
property int DefaultFixedFontSize
{
int get() { return _browserSettings->default_fixed_font_size; }
void set(int value) { _browserSettings->default_fixed_font_size = value; }
}
property int MinimumFontSize
{
int get() { return _browserSettings->minimum_font_size; }
void set(int value) { _browserSettings->minimum_font_size = value; }
}
property int MinimumLogicalFontSize
{
int get() { return _browserSettings->minimum_logical_font_size; }
void set(int value) { _browserSettings->minimum_logical_font_size = value; }
}
property bool RemoteFontsDisabled
{
bool get() { return _browserSettings->remote_fonts_disabled; }
void set(bool value) { _browserSettings->remote_fonts_disabled = value; }
}
property String^ DefaultEncoding
{
String^ get() { return convertToString(_browserSettings->default_encoding); }
void set(String^ value) { assignFromString(_browserSettings->default_encoding, value); }
}
property bool EncodingDetectorEnabled
{
bool get() { return _browserSettings->encoding_detector_enabled; }
void set(bool value) { _browserSettings->encoding_detector_enabled = value; }
}
property bool JavaScriptDisabled
{
bool get() { return _browserSettings->javascript_disabled; }
void set(bool value) { _browserSettings->javascript_disabled = value; }
}
property bool JavaScriptOpenWindowsDisallowed
{
bool get() { return _browserSettings->javascript_open_windows_disallowed; }
void set(bool value) { _browserSettings->javascript_open_windows_disallowed = value; }
}
property bool JavaScriptCloseWindowsDisallowed
{
bool get() { return _browserSettings->javascript_close_windows_disallowed; }
void set(bool value) { _browserSettings->javascript_close_windows_disallowed = value; }
}
property bool JavaScriptAccessClipboardDisallowed
{
bool get() { return _browserSettings->javascript_access_clipboard_disallowed; }
void set(bool value) { _browserSettings->javascript_access_clipboard_disallowed = value; }
}
property bool DomPasteDisabled
{
bool get() { return _browserSettings->dom_paste_disabled; }
void set(bool value) { _browserSettings->dom_paste_disabled = value; }
}
property bool CaretBrowsingEnabled
{
bool get() { return _browserSettings->caret_browsing_enabled; }
void set(bool value) { _browserSettings->caret_browsing_enabled = value; }
}
property bool JavaDisabled
{
bool get() { return _browserSettings->java_disabled; }
void set(bool value) { _browserSettings->java_disabled = value; }
}
property bool PluginsDisabled
{
bool get() { return _browserSettings->plugins_disabled; }
void set(bool value) { _browserSettings->plugins_disabled = value; }
}
property bool UniversalAccessFromFileUrlsAllowed
{
bool get() { return _browserSettings->universal_access_from_file_urls_allowed; }
void set(bool value) { _browserSettings->universal_access_from_file_urls_allowed = value; }
}
property bool FileAccessFromFileUrlsAllowed
{
bool get() { return _browserSettings->file_access_from_file_urls_allowed; }
void set(bool value) { _browserSettings->file_access_from_file_urls_allowed = value; }
}
property bool WebSecurityDisabled
{
bool get() { return _browserSettings->web_security_disabled; }
void set(bool value) { _browserSettings->web_security_disabled = value; }
}
property bool XssAuditorEnabled
{
bool get() { return _browserSettings->xss_auditor_enabled; }
void set(bool value) { _browserSettings->xss_auditor_enabled = value; }
}
property bool ImageLoadDisabled
{
bool get() { return _browserSettings->image_load_disabled; }
void set(bool value) { _browserSettings->image_load_disabled = value; }
}
property bool ShrinkStandaloneImagesToFit
{
bool get() { return _browserSettings->shrink_standalone_images_to_fit; }
void set(bool value) { _browserSettings->shrink_standalone_images_to_fit = value; }
}
property bool SiteSpecificQuirksDisabled
{
bool get() { return _browserSettings->site_specific_quirks_disabled; }
void set(bool value) { _browserSettings->site_specific_quirks_disabled = value; }
}
property bool TextAreaResizeDisabled
{
bool get() { return _browserSettings->text_area_resize_disabled; }
void set(bool value) { _browserSettings->text_area_resize_disabled = value; }
}
property bool PageCacheDisabled
{
bool get() { return _browserSettings->page_cache_disabled; }
void set(bool value) { _browserSettings->page_cache_disabled = value; }
}
property bool TabToLinksDisabled
{
bool get() { return _browserSettings->tab_to_links_disabled; }
void set(bool value) { _browserSettings->tab_to_links_disabled = value; }
}
property bool HyperlinkAuditingDisabled
{
bool get() { return _browserSettings->hyperlink_auditing_disabled; }
void set(bool value) { _browserSettings->hyperlink_auditing_disabled = value; }
}
property bool UserStyleSheetEnabled
{
bool get() { return _browserSettings->user_style_sheet_enabled; }
void set(bool value) { _browserSettings->user_style_sheet_enabled = value; }
}
property String^ UserStyleSheetLocation
{
String^ get() { return convertToString(_browserSettings->user_style_sheet_location); }
void set(String^ value) { assignFromString(_browserSettings->user_style_sheet_location, value); }
}
property bool AuthorAndUserStylesDisabled
{
bool get() { return _browserSettings->author_and_user_styles_disabled; }
void set(bool value) { _browserSettings->author_and_user_styles_disabled = value; }
}
property bool LocalStorageDisabled
{
bool get() { return _browserSettings->local_storage_disabled; }
void set(bool value) { _browserSettings->local_storage_disabled = value; }
}
property bool DatabasesDisabled
{
bool get() { return _browserSettings->databases_disabled; }
void set(bool value) { _browserSettings->databases_disabled = value; }
}
property bool ApplicationCacheDisabled
{
bool get() { return _browserSettings->application_cache_disabled; }
void set(bool value) { _browserSettings->application_cache_disabled = value; }
}
property bool WebGlDisabled
{
bool get() { return _browserSettings->webgl_disabled; }
void set(bool value) { _browserSettings->webgl_disabled = value; }
}
property bool AcceleratedCompositingDisabled
{
bool get() { return _browserSettings->accelerated_compositing_disabled; }
void set(bool value) { _browserSettings->accelerated_compositing_disabled = value; }
}
property bool AcceleratedLayersDisabled
{
bool get() { return _browserSettings->accelerated_layers_disabled; }
void set(bool value) { _browserSettings->accelerated_layers_disabled = value; }
}
property bool Accelerated2dCanvasDisabled
{
bool get() { return _browserSettings->accelerated_2d_canvas_disabled; }
void set(bool value) { _browserSettings->accelerated_2d_canvas_disabled = value; }
}
};
} | [
"[email protected]"
]
| [
[
[
1,
236
]
]
]
|
2c7c141be604ba53e9ed7050e5ac74081e03028d | e8c9bfda96c507c814b3378a571b56de914eedd4 | /engineTest/PlayerStates.cpp | 4c59b057bc1523fe5c9842066a0cbe045f76e715 | []
| no_license | VirtuosoChris/quakethecan | e2826f832b1a32c9d52fb7f6cf2d972717c4275d | 3159a75117335f8e8296f699edcfe87f20d97720 | refs/heads/master | 2021-01-18T09:20:44.959838 | 2009-04-20T13:32:36 | 2009-04-20T13:32:36 | 32,121,382 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,631 | cpp | #include "player.h"
#include "PlayerStates.h"
#include "MessageHandler.h"
#include <iostream>
using std::cout;
PlayerPlay* PlayerPlay::GetInstance(){
static PlayerPlay only_inst;
return &only_inst;
}
void PlayerPlay::Enter(player & plyr){
//set anim to stand
plyr.getDevice()->getVideoDriver()->setFog(irr::video::SColor(255,25,25,25), true, 0,750, 0, true, true);//set the fog properties
}
void PlayerPlay::Execute(player & plyr, const irr::ITimer* timer){
}
void PlayerPlay::Exit(player & plyr){
}
bool PlayerPlay::ExecuteMessage(player & plyr, const Message * msg){
switch(msg->messageType){
case KTC_KILL: if(plyr.pl_inv.getTime() > 0){
return true;
}
plyr.GetFSM()->ChangeState(PlayerDie::GetInstance());
return true;
}
//false always gets returned here because we don't want to handle any messages in the Play state
return false;
}
PlayerDie* PlayerDie::GetInstance(){
static PlayerDie only_inst;
return &only_inst;
}
void PlayerDie::Enter(player & plyr){
start = plyr.getDevice()->getTimer()->getTime();
finish = start + 10000;
temp = plyr.getSceneNode()->getPosition();
}
void PlayerDie::Execute(player &plyr, const irr::ITimer* timer){
plyr.getSceneNode()->setPosition(temp);
static int bloodier = 25;
static int decrease = 25;
if(plyr.getDevice()->getTimer()->getTime()< finish){
if(decrease == 0){
if(bloodier == 255)
plyr.getDevice()->getVideoDriver()->setFog(irr::video::SColor(255,255,0,0),true, 0,750,0,true,true);
else{
plyr.getDevice()->getVideoDriver()->setFog(irr::video::SColor(255,bloodier,0,0),true,0,750, 0, true, true);
bloodier+=5;
}
}else{
plyr.getDevice()->getVideoDriver()->setFog(irr::video::SColor(255,bloodier, decrease, decrease), true, 0, 750, 0, true, true);
bloodier+=5;
decrease-=1;
}
}
}
void PlayerDie::Exit(player& plyr){
plyr.getDevice()->getVideoDriver()->setFog(irr::video::SColor(255,25,25,25), true, 0, 750, 0, true, true);
}
bool PlayerDie::ExecuteMessage(player & plyr, const Message* msg){
switch(msg->messageType){
case KTC_REVIVE:
plyr.GetFSM()->ChangeState(PlayerPlay::GetInstance());
return true;
}
return false;
}
PlayerWait* PlayerWait::GetInstance(){
static PlayerWait only_inst;
return &only_inst;
}
void PlayerWait::Enter(player & plyr){
std::cout << "Entering player wait state.\n";
}
void PlayerWait::Execute(player & plyr, const irr::ITimer* timer){
}
void PlayerWait::Exit(player & plyr){
}
bool PlayerWait::ExecuteMessage(player & plyr, const Message * msg){
//false always gets returned here because we don't want to handle any messages in the wait state
return false;
}
PlayerStart* PlayerStart::GetInstance(){
static PlayerStart only_inst;
return &only_inst;
}
void PlayerStart::Enter(player & plyr){
//return;
std::cout << "Entering player wait state.\n";
//set the fog properties
plyr.getDevice()->getVideoDriver()->setFog(irr::video::SColor(255,0,0,0), true, 0,0, 0, true, true);
std::cout <<"I got fog.\n";
start = plyr.getDevice()->getTimer()->getTime();
finish = start + 10000;
temp = plyr.getSceneNode()->getPosition();
}
void PlayerStart::Execute(player & plyr, const irr::ITimer* timer){
// plyr.GetFSM()->ChangeState(PlayerPlay::GetInstance());
if(plyr.getDevice()->getTimer()->getTime() >= finish)
plyr.GetFSM()->ChangeState(PlayerPlay::GetInstance());
plyr.getSceneNode()->setPosition(temp);
if(plyr.getDevice()->getTimer()->getTime() < finish){
int diff = plyr.getDevice()->getTimer()->getTime() - start;
int range = -1500 + 2250.0f *((double)diff / (double)((finish- start)));
int color = 25.0f *((double)diff / (double)((finish- start)));
if(range >= 0){
plyr.getDevice()->getVideoDriver()->setFog(irr::video::SColor(255, color,color,color), true, 0,range,0,true, true);
}
else{
plyr.getDevice()->getVideoDriver()->setFog(irr::video::SColor( 255, color, color, color), true, 0, 1, 0, true, true);
}
}
}
void PlayerStart::Exit(player & plyr){
plyr.getDevice()->getVideoDriver()->setFog(irr::video::SColor(255,25,25,25), true, 0,750, 0, true, true);//set the fog properties
}
bool PlayerStart::ExecuteMessage(player & plyr, const Message * msg){
//false always gets returned here because we don't want to handle any messages in the wait state
return false;
} | [
"cthomas.mail@f96ad80a-2d29-11de-ba44-d58fe8a9ce33",
"chrispugh666@f96ad80a-2d29-11de-ba44-d58fe8a9ce33"
]
| [
[
[
1,
15
],
[
17,
28
],
[
43,
46
],
[
131,
138
],
[
141,
141
],
[
143,
143
],
[
168,
174
],
[
176,
177
],
[
179,
179
],
[
185,
186
],
[
188,
206
],
[
209,
211
],
[
213,
216
]
],
[
[
16,
16
],
[
29,
42
],
[
47,
130
],
[
139,
140
],
[
142,
142
],
[
144,
167
],
[
175,
175
],
[
178,
178
],
[
180,
184
],
[
187,
187
],
[
207,
208
],
[
212,
212
]
]
]
|
d91851fe2fee34bea03782a0de7c56f6baa55852 | 33f59b1ba6b12c2dd3080b24830331c37bba9fe2 | /Depend/Foundation/Mathematics/Wm4Ellipse2.inl | 1f4aa94d9f6682011aedca3ab21a421475f0dc48 | []
| no_license | daleaddink/flagship3d | 4835c223fe1b6429c12e325770c14679c42ae3c6 | 6cce5b1ff7e7a2d5d0df7aa0594a70d795c7979a | refs/heads/master | 2021-01-15T16:29:12.196094 | 2009-11-01T10:18:11 | 2009-11-01T10:18:11 | 37,734,654 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,009 | inl | // Geometric Tools, Inc.
// http://www.geometrictools.com
// Copyright (c) 1998-2006. All Rights Reserved
//
// The Wild Magic Version 4 Foundation Library source code is supplied
// under the terms of the license agreement
// http://www.geometrictools.com/License/Wm4FoundationLicense.pdf
// and may not be copied or disclosed except in accordance with the terms
// of that agreement.
//----------------------------------------------------------------------------
template <class Real>
Ellipse2<Real>::Ellipse2 ()
{
// uninitialized
}
//----------------------------------------------------------------------------
template <class Real>
Ellipse2<Real>::Ellipse2 (const Vector2<Real>& rkCenter,
const Vector2<Real>* akAxis, const Real* afExtent)
:
Center(rkCenter)
{
for (int i = 0; i < 2; i++)
{
Axis[i] = akAxis[i];
Extent[i] = afExtent[i];
}
}
//----------------------------------------------------------------------------
template <class Real>
Ellipse2<Real>::Ellipse2 (const Vector2<Real>& rkCenter,
const Vector2<Real>& rkAxis0, const Vector2<Real>& rkAxis1, Real fExtent0,
Real fExtent1)
:
Center(rkCenter)
{
Axis[0] = rkAxis0;
Axis[1] = rkAxis1;
Extent[0] = fExtent0;
Extent[1] = fExtent1;
}
//----------------------------------------------------------------------------
template <class Real>
void Ellipse2<Real>::GetM (Matrix2<Real>& rkM) const
{
Vector2<Real> kRatio0 = Axis[0]/Extent[0];
Vector2<Real> kRatio1 = Axis[1]/Extent[1];
rkM = Matrix2<Real>(kRatio0,kRatio0) + Matrix2<Real>(kRatio1,kRatio1);
}
//----------------------------------------------------------------------------
template <class Real>
void Ellipse2<Real>::GetMInverse (Matrix2<Real>& rkMInverse) const
{
Vector2<Real> kRatio0 = Axis[0]*Extent[0];
Vector2<Real> kRatio1 = Axis[1]*Extent[1];
rkMInverse = Matrix2<Real>(kRatio0,kRatio0) +
Matrix2<Real>(kRatio1,kRatio1);
}
//----------------------------------------------------------------------------
template <class Real>
void Ellipse2<Real>::ToCoefficients (Real afCoeff[6]) const
{
Matrix2<Real> kA;
Vector2<Real> kB;
Real fC;
ToCoefficients(kA,kB,fC);
Convert(kA,kB,fC,afCoeff);
// arrange for one of the x0^2 or x1^2 coefficients to be 1
Real fMax = Math<Real>::FAbs(afCoeff[3]);
int iMax = 3;
Real fAbs = Math<Real>::FAbs(afCoeff[5]);
if (fAbs > fMax)
{
fMax = fAbs;
iMax = 5;
}
Real fInvMax = ((Real)1.0)/fMax;
for (int i = 0; i < 6; i++)
{
if (i != iMax)
{
afCoeff[i] *= fInvMax;
}
else
{
afCoeff[i] = (Real)1.0;
}
}
}
//----------------------------------------------------------------------------
template <class Real>
void Ellipse2<Real>::ToCoefficients (Matrix2<Real>& rkA, Vector2<Real>& rkB,
Real& rfC) const
{
Vector2<Real> kRatio0 = Axis[0]/Extent[0];
Vector2<Real> kRatio1 = Axis[1]/Extent[1];
rkA = Matrix2<Real>(kRatio0,kRatio0) + Matrix2<Real>(kRatio1,kRatio1);
rkB = ((Real)-2.0)*(rkA*Center);
rfC = rkA.QForm(Center,Center) - (Real)1.0;
}
//----------------------------------------------------------------------------
template <class Real>
bool Ellipse2<Real>::FromCoefficients (const Real afCoeff[6])
{
Matrix2<Real> kA;
Vector2<Real> kB;
Real fC;
Convert(afCoeff,kA,kB,fC);
return FromCoefficients(kA,kB,fC);
}
//----------------------------------------------------------------------------
template <class Real>
bool Ellipse2<Real>::FromCoefficients (const Matrix2<Real>& rkA,
const Vector2<Real>& rkB, Real fC)
{
// compute the center K = -A^{-1}*B/2
Matrix2<Real> kInvA = rkA.Inverse();
if (kInvA == Matrix2<Real>::ZERO)
{
return false;
}
Center = ((Real)-0.5)*(kInvA*rkB);
// compute B^T*A^{-1}*B/4 - C = K^T*A*K - C = -K^T*B/2 - C
Real fRHS = -((Real)0.5)*(Center.Dot(rkB)) - fC;
if (Math<Real>::FAbs(fRHS) < Math<Real>::ZERO_TOLERANCE)
{
return false;
}
// compute M = A/(K^T*A*K - C)
Real fInvRHS = ((Real)1.0)/fRHS;
Matrix2<Real> kM = fInvRHS*rkA;
// factor into M = R*D*R^T
Eigen<Real> kES(kM);
kES.IncrSortEigenStuff2();
for (int i = 0; i < 2; i++)
{
if (kES.GetEigenvalue(i) <= (Real)0.0)
{
return false;
}
Extent[i] = Math<Real>::InvSqrt(kES.GetEigenvalue(i));
kES.GetEigenvector(i,Axis[i]);
}
return true;
}
//----------------------------------------------------------------------------
template <class Real>
bool Ellipse2<Real>::Contains (const Vector2<Real>& rkPoint)
{
Vector2<Real> kDiff = rkPoint - Center;
Real fRatio0 = Axis[0].Dot(kDiff)/Extent[0];
Real fRatio1 = Axis[1].Dot(kDiff)/Extent[1];
Real fTest = fRatio0*fRatio0 + fRatio1*fRatio1 - (Real)1.0;
return fTest <= (Real)0.0;
}
//----------------------------------------------------------------------------
template <class Real>
void Ellipse2<Real>::Convert (const Real afCoeff[6], Matrix2<Real>& rkA,
Vector2<Real>& rkB, Real& rfC)
{
rfC = afCoeff[0];
rkB[0] = afCoeff[1];
rkB[1] = afCoeff[2];
rkA[0][0] = afCoeff[3];
rkA[0][1] = ((Real)0.5)*afCoeff[4];
rkA[1][0] = rkA[0][1];
rkA[1][1] = afCoeff[5];
}
//----------------------------------------------------------------------------
template <class Real>
void Ellipse2<Real>::Convert (const Matrix2<Real>& rkA,
const Vector2<Real>& rkB, Real fC, Real afCoeff[6])
{
afCoeff[0] = fC;
afCoeff[1] = rkB[0];
afCoeff[2] = rkB[1];
afCoeff[3] = rkA[0][0];
afCoeff[4] = ((Real)2.0)*rkA[0][1];
afCoeff[5] = rkA[1][1];
}
//----------------------------------------------------------------------------
| [
"yf.flagship@e79fdf7c-a9d8-11de-b950-3d5b5f4ea0aa"
]
| [
[
[
1,
190
]
]
]
|
0cc478cb8e60e73f586e326d9bcd532c0d366ac3 | 50f4c404a5bace0abf8970ed79623a9c18b3909b | /Color.cpp | ef50539eaaaa1f62cf13970a26f0577af7661319 | []
| no_license | Fissuras/mugenformation | 94fba15e08ee836db6948e16c0f6b2b552d10a80 | 9293988dd5032538646ef9db8639622ce038239c | refs/heads/master | 2021-01-10T17:21:54.359790 | 2008-07-30T04:15:27 | 2008-07-30T04:15:27 | 49,397,123 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,330 | cpp | /**
* Implementation of the Color class.
*
* @author Francis BISSON
*/
// INCLUDES ////////////////////////////////////////////////////////////////////
#include "Color.h"
#include "Debug.h"
#include "Types.h"
// STATIC MEMBERS INITIALIZATION ///////////////////////////////////////////////
const Color Color::White( 0xff, 0xff, 0xff );
const Color Color::Black( 0x00, 0x00, 0x00 );
const Color Color::Red( 0xff, 0x00, 0x00 );
const Color Color::Green( 0x00, 0xff, 0x00 );
const Color Color::Blue ( 0x00, 0x00, 0xff );
const Color Color::Grey ( 0x80, 0x80, 0x80 );
// IMPLEMENTATION //////////////////////////////////////////////////////////////
Color::Color()
:m_Red(0)
,m_Green(0)
,m_Blue(0)
{
}
Color::Color(Byte r, Byte g, Byte b)
:m_Red(r)
,m_Green(g)
,m_Blue(b)
{
}
Color::Color(int hexCode)
{
Byte mask = 0xff;
m_Red = (Byte)(mask & (hexCode >> 16));
m_Green = (Byte)(mask & (hexCode >> 8));
m_Blue = (Byte)(mask & hexCode);
}
Color::~Color()
{
}
bool Color::operator== (const Color& color) const
{
return IsEqual(color);
}
bool Color::operator!= (const Color& color) const
{
return !IsEqual(color);
}
bool Color::IsEqual(const Color& color) const
{
return (color.m_Red == m_Red && color.m_Green == m_Green && color.m_Blue == m_Blue);
}
| [
"xezekielx@4c29ad15-fc4f-0410-bf84-09c4532b2003"
]
| [
[
[
1,
61
]
]
]
|
ece52b8c55d3813584511ed4c9fdabcf3aa550ca | 74c8da5b29163992a08a376c7819785998afb588 | /NetAnimal/Game/Hunter/NewGameComponent/GameDiamondComponent/include/GameBallComponent.h | 72dfc26f105e4a4256a898ca216f006aeb7d5a8f | []
| no_license | dbabox/aomi | dbfb46c1c9417a8078ec9a516cc9c90fe3773b78 | 4cffc8e59368e82aed997fe0f4dcbd7df626d1d0 | refs/heads/master | 2021-01-13T14:05:10.813348 | 2011-06-07T09:36:41 | 2011-06-07T09:36:41 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 1,514 | h | #ifndef __Orz_GameBallComponent__
#define __Orz_GameBallComponent__
#include "CGameBallInterface.h"
class _UpdateInOgreRenderingQueued_Ball;
namespace Ogre
{
class SceneNode;
}
namespace ParticleUniverse
{
class ParticleUniverseSystem;
}
class MyMaterialInstance;
namespace Orz
{
class CGameBallInterface;
class GameBallComponent: public Component
{
public :
friend _UpdateInOgreRenderingQueued_Ball;
GameBallComponent(void);
virtual ~GameBallComponent(void);
private:
virtual ComponentInterface * _queryInterface(const TypeInfo & info) const;
boost::scoped_ptr<CGameBallInterface> _BallInterface;
bool load(Ogre::SceneNode * node);
boost::scoped_ptr<MyMaterialInstance> _emi;
bool enable(CGameBallInterface::STATE state);
bool update(TimeType time);
bool updateFatein(TimeType time);
bool updateFateout(TimeType time);
bool updateRotate(TimeType time);
bool updatesetNumber(TimeType time);
void addNumber(int n);
void setNumber(int Num);//设定显示的数字0-9
void setAngle(float angle);
Ogre::SceneNode* ballnode;
TimeType stopTimePass;
bool isStop;
bool isThisRoundDisplayed;
Ogre::Vector3 _pos;
Ogre::SceneNode * _node;
TimeType _curTime;
TimeType _runAllTime;
Ogre::Entity * Ball;
Ogre::BillboardSet* bbset;
Ogre::Billboard* bb;
std::deque<UINT> _dequeNumber;
ParticleUniverse::ParticleUniverseSystem * psystem;
boost::scoped_ptr<_UpdateInOgreRenderingQueued_Ball> _updateInOgreRenderingQueued_Ball;
};
}
#endif
| [
"[email protected]"
]
| [
[
[
1,
57
]
]
]
|
f2d8e9ac39a5d6db5332c97c6fd7733489953cb2 | c02cb25416f1f32b1264792c256bc8e9ddb36463 | /CMotherboard.h | ab280874e0770b6310b79e547680a9ef335435b4 | []
| no_license | tronster/node | 230b60095202c9e8c7459c570d1d6b1689730786 | ea14fc32bbbadf24549f693b3cd52b7423fc4365 | refs/heads/master | 2016-09-05T22:32:32.820092 | 2011-07-12T23:29:48 | 2011-07-12T23:29:48 | 2,039,073 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,162 | h | //////////////////////////////////////////////////////////////////////////////
//
// CMotherboard.h
// Header file for CMotherboard, CWhisp classes
//
// - CMotherboard defines a 3D fly-through of a motherboard
// - CWhip is a whisp of light used in the motherboard scene
// - Tabs set a 3. (Tronster prefers real tabs, Moby Disk prefers spaces.)
//
//////////////////////////////////////////////////////////////////////////////
#ifndef __CMotherboard_h__
#define __CMotherboard_h__
// Define this constant to allow keyboard control instead of auto fly-through
#undef MANUAL_CONTROL
// GLdebug library is used for outputting debug text to the screen
// - only used in debug mode
#ifdef _DEBUG
#include "gldebug.h"
#endif
// Header files
#include "geometry3d.h" // GeoGL geometry and opengl classes
#include "flythru3d.h" // GeoGL cubic interpolating camera
#include "frustum3d.h" // GeoGL frustum class for clipping objects
#include "mduke.h" // Mediaduke loader
#include "CDemoEffect.h" // DemoEffect base class for CMotherboard
// Various constants for arrays
#define num_PCI 5 // Number of PCI slots
#define num_Cap 19 // Number of capacitors
#define num_Res 4 // Number of resistors
#define num_DIMM 6 // Number of DIMM slits
#define num_Chip 3 // Number of generic microchips
//////////////////////////////////////////////////////////////////////////////
//
// Whisp of light that flies upward in smooth arcs
// - Moves along Z-axis, fluidly "fluxing" from side to side
// - Starts out dark, gets brighter to fade in (instead of just appearing)
//
//////////////////////////////////////////////////////////////////////////////
class CWhisp
{
public:
geoGL::fVector3D basePos, // Base position of whisp, moves along z
fluxDir, // Direction of flux on x-y plane
fluxPos; // Current position including flux
float zSpeed, // Speed along z-axis
rSpeed; // Speed of fluxing
float fluxCnt, // Flux animation variable
bright; // Brightness
inline CWhisp() // Create an empty CWhisp
{ memset(this,0,sizeof(*this)); }
void reset(); // Reset CWhisp to starting values
void advance(float fFrameFactor); // Step animation of CWhisp
};
//////////////////////////////////////////////////////////////////////////////
//
// Main motherboard scene
// - Implements CDemoEffect interface (virtual base class)
// - Contains objects, textures, lights, camera
// - Demonstrates full functionality of GeoGL
//
//////////////////////////////////////////////////////////////////////////////
class CMotherboard : public CDemoEffect
{
public:
//CDemoEffect
// Constructor/destructor
CMotherboard(CEnvInfo *);
~CMotherboard();
// Overloads for initialization, animation
bool advanceFrame();
bool renderFrame();
bool init();
bool unInit();
bool start();
bool stop();
protected:
//CMotherboard
// Initialization
void initGLstuff(); // Apply opengl settings, fog, attenuation, light...
void initObjects(); // Load objects, setup properties, positions...
void initLight(); // Initialize light map & associated tables
void loadGLTextures(); // Load textures, allocate procedural textures
void setAttenuation(); // Set light attenuation values
// Load/mipmap a single texture
GLuint loadGLTexture(
md::CmediaDuke &mediaDuke,
char *filename,
char *textureName=NULL);
// Animation
bool drawVisibleObject(geoGL::ObjectSet3D &obj); // Draw specified object if in view frustum
void advanceGlowingBurst(float fGlowFactor); // Animate the glowing burst of light on chip
void advanceChipTexture (float fAnimateFactor); // Animate procedural chip texture ("mindware logo")
void advanceLightMap(); // Animate the light map for motherboard
void drawBump(int,int); // Draw bump map into light map
// Standard objects
geoGL::ObjectSet3D computer, motherboard, socket, CPUchip, // singular
coolchip, ISA, AGP, RAM, socketHandle;
geoGL::ObjectSet3D capacitor[num_Cap], PCI[num_PCI], // multiple
resistor[num_Res],
DIMM[num_DIMM], microchip[num_Chip];
// Special effect objects
geoGL::ObjectSet3D glowing, glowingOld; // Glowing light column
geoGL::ObjectSet3D flare; // Exploding light flare
geoGL::ObjectSet3D lightBeam; // Light etching MW logo
geoGL::ObjectSet3D motherboardBump;
// Light whisps from socket
int nWhispy; // Number of them
refptr<geoGL::ObjectSet3D> whispy; // Light whisps from socket
refptr<CWhisp> whispyData; // and their data
// Lights
geoGL::Light3D light0, // Standard light
lightSocket; // Light at CPU socket
int lx0,ly0; // Position of light0 in prev frame
// Fly-through
geoGL::FlyThru3D flight; // Flight path
geoGL::Frustum3D frustum; // View frustum
// Start time, elapsed time since start
unsigned int nTimeStart, nElapsedTime;
// CDemoEffect environment information (resolution, color depth, quality...)
CEnvInfo & m_oEnvInfo;
float fTesselationFactor;
char * m_szBumpFile;
// Textures
geoGL::TextureID text_cap32, text_res32, text_metal1;
geoGL::TextureID text_circuit, text_flare1, text_flare3, text_mbmap;
geoGL::TextureID text_socket, text_slot, text_animate,
text_microchip1, text_microchip2, text_greenchip;
geoGL::TextureID text_mindware, text_lightMap;
// Images
md::Cimage img_mindware, // Mindware logo (final)
img_mindware0, // Mindware logo (procedural)
img_animate, // Light beam "etching" logo
img_bump,
img_light,
img_lightMap;
// User interface if enabled
#ifdef MANUAL_CONTROL
geoGL::fVector3D motion, rotation;
#endif
};
#endif | [
"[email protected]"
]
| [
[
[
1,
162
]
]
]
|
b85013f184bd455b908d6a92a6e6180559954be0 | fd196fe7f1a57a3d589dd987127391b6428dbc9f | /Workbench/GraphicWorkbench/RenderWindow.h | 6897c55239fb85bf09c3f5472a0a9a839b2f52cf | []
| no_license | aosyang/Graphic-Workbench | 73651b597b7ad9f759618bad30313bfad12a35b5 | 48c3b4b034ea332fb926ac0a0bd1f7c1fc1a2bb1 | refs/heads/master | 2021-01-22T23:25:48.330855 | 2011-11-29T09:27:52 | 2011-11-29T09:27:52 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 917 | h | #ifndef RenderWindow_h__
#define RenderWindow_h__
#include "GWTypes.h"
#include "Platform.h"
#ifdef __PLATFORM_WIN32
typedef HWND RenderWindowHandle;
#elif defined __PLATFORM_LINUX
typedef struct
{
void* display;
int screen;
unsigned long window;
} RenderWindowHandle;
#endif
struct RenderWindowParam
{
RenderWindowHandle handle;
unsigned int width, height;
unsigned int colorDepthBit;
};
class RenderWindow
{
public:
RenderWindow();
~RenderWindow();
bool Create(const GWChar* titleName, uint32 width, uint32 height, uint32 depthBits, bool fullscreen);
void Destroy();
uint32 GetWidth() const;
uint32 GetHeight() const;
RenderWindowParam* GetWindowHandle();
bool HandleWindowMessage();
protected:
RenderWindowParam m_RenderWindowParam;
bool m_FullScreen;
String m_TitleName;
};
#endif // RenderWindow_h__ | [
"[email protected]@b4c0308a-e464-ec88-fcea-6ff8c68c914a"
]
| [
[
[
1,
48
]
]
]
|
d86c2ee702ce43f3bcca979a64f6453574f665a5 | 27d5670a7739a866c3ad97a71c0fc9334f6875f2 | /CPP/Shared/Nav2ErrorEs.cpp | 4bbe1f08ffc4b1c1b34e9bd8b1412570bfa07bb8 | [
"BSD-3-Clause"
]
| permissive | ravustaja/Wayfinder-S60-Navigator | ef506c418b8c2e6498ece6dcae67e583fb8a4a95 | 14d1b729b2cea52f726874687e78f17492949585 | refs/heads/master | 2021-01-16T20:53:37.630909 | 2010-06-28T09:51:10 | 2010-06-28T09:51:10 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,280 | cpp | /*
Copyright (c) 1999 - 2010, Vodafone Group Services Ltd
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of the Vodafone Group Services Ltd nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#define LANGUAGE_SP
#include "master.loc"
#include "Nav2Error.h"
#include "Nav2ErrorXX.h"
namespace isab {
namespace Nav2Error {
static const Nav2ErrorElement nav2ErrorVector[] = {
#define NAV2ERROR_LINE(symbol, id, txt) {ErrorNbr(id), txt},
#define NAV2ERROR_LINE_LAST(symbol, id, txt) {ErrorNbr(id), txt}
#include "Nav2Error.master"
#undef NAV2ERROR_LINE
#undef NAV2ERROR_LINE_LAST
};
Nav2ErrorTableEs::Nav2ErrorTableEs() : Nav2ErrorTable()
{
int32 elementSize = (uint8*)&nav2ErrorVector[1] -
(uint8*)&nav2ErrorVector[0];
m_table = nav2ErrorVector;
m_tableSize = sizeof(nav2ErrorVector) / elementSize;
}
} /* namespace Nav2Error */
} /* namespace isab */
| [
"[email protected]"
]
| [
[
[
1,
41
]
]
]
|
594fc4ff22ba464eebb643b5717d344ecbd5c655 | 9bd07026f2d56d271651c9c23c549185e72aceac | /final/Maxavl.h | 8c8edb56413e41402fc509229ee50bedf53c764e | []
| no_license | tzafrir/mivni2 | b5ae5e08a6592fe6cd1f3da9aedd5d1ac11fb04b | 58766fe5b8a79df382612b4917b065e80bf77af1 | refs/heads/master | 2020-06-05T15:37:33.885943 | 2009-06-21T09:28:15 | 2009-06-21T09:28:15 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 12,386 | h | #ifndef MAXAVL_H
#define MAXAVL_H
/*
*
* Maxavl.h
*
*/
#include <cstddef>
template <typename T>
class MAXAVL{
public:
enum AVLReturnCodes
{
Success,
Item_already_exist,
Item_doesnt_exist
};
// A unary predicate class - used to preform operations on the items in the tree
// while traversal the tree
// return true to stop the tree-traversal
class Predicate{
public:
virtual bool DoWork(T* item) = 0;
};
MAXAVL() : root(NULL) {};
void DestroyTree(bool FreeItems)
{
Destroy(root,FreeItems);
root = NULL;
}
//results of the compare function
//number so it will be easy to convert compare result and direction
//to continue search
enum CmpResult
{
Bellow=0,
Above=1,
Equal
};
// returns the Height of the tree
int Height() const
{
int Height = -1;
node* ptr = root;
while (ptr != NULL)
{
ptr = ptr->bf > 0 ? ptr->Children[Left] : ptr->Children[Right];
Height++;
}
return Height;
}
//traverse the tree in order until p->dowork return true
//calls p->DoWork on each item in the tree
// notice: if you want to change an item in a way that effects how
// it compares to other items, you should remove it from the tree
// make the change and reinsert it.
void inorder(Predicate *p) const
{
inorder(root,p);
}
// inserts the item to the tree. The item is added AS-IS -
// no copy of the pointed item is created
// notice: if you want to change an item in a way that effects how
// it compares to other items, you should remove it from the tree
// make the change and reinsert it.
// Warning: might throw std::bad_alloc
AVLReturnCodes insert(T *item)
{
return insert(root, item) != Error ? Success : Item_already_exist;
}
// removes an item from the tree, the argument
// should be an item which is equal to the item
// to remove according to the <= function
T* remove(T *item)
{
return remove(root, item) != Error ? item : NULL;
}
// retrieves an item from the tree, the argument
// should be an item which is equal to the item
// to find according to the <= function
T* find(T *item) const
{
node* ptr = root;
while (ptr != NULL)
{
CmpResult res= Cmp(ptr->data,item);
if (res == Equal)
{
return ptr->data; //item found
}
//else
directions dir = (directions) res; //bellow -> left, above -> right
ptr = ptr->Children[dir];
}
return NULL; //if we arrive here item wasn't found
}
//return the minimal item in the tree according to <=,
//or null if the tree is empty
T* GetMax() const
{
node* ptr = root;
T* item;
while (ptr != NULL)
{
item = ptr->data;
ptr = ptr->Children[Right];
}
return item;
}
// retrieves the Closest item in Dir directions from the tree
// according to the <= function
T* findClosest(T *item, CmpResult res, int& Min, int& Max) const
{
Min = Max = -1;
return Closest(root,item,(directions)res, Min, Max);
}
private:
MAXAVL(const MAXAVL&) {}; //no copying of tree is allowed
static const int NumberOfChildren = 2;
// internal class - not needed for usage of Tree
class node
{
public:
node(T *newdata) : data(newdata),Max(-1),Min(-1),bf(0)
{
Min = Max = newdata->AValue();
Children[Left]=Children[Right] = NULL;
}
T *data;
int Max; //maximum of subtree
int Min;
node* Children[NumberOfChildren];
int bf;
};
//direction, or the indexes of the children of a node
enum directions
{
Left=0,
Right=1
};
//return values of various recursive function
//tells the caller if the height changed or not
//and if there was an error
enum HeightChange
{
NoHeightChange,
HeightChanged,
Error //problem in insert, remove, etc..
};
//receives a direction and returns the opposite direction
static inline directions OtherDirection(directions dir)
{
return (directions) (1 - dir);
}
static int Max(int x, int y)
{
return x > y ? x : y;
}
static int Min(int x, int y)
{
//we want -1 to be consider as larger then any value
return (unsigned int)x < (unsigned int)y ? x : y;
}
static inline int GetMax(node* Node)
{
return Node == NULL ? -1 : Node->Max;
}
static inline int GetMin(node* Node)
{
return Node == NULL ? -1 : Node->Min;
}
static void UpdateMinMax(node* root)
{
root->Min = root->Max = root->data->AValue();
for (int dir = Left; dir <= Right; dir++)
{
root->Max = Max(GetMax(root->Children[directions (dir)]),root->Max);
root->Min = Min(GetMin(root->Children[directions (dir)]),root->Min);
}
}
//calc the bfchange if a balanced tree grow by 1 in dir direction
//if dir = left we need to add 1 to bf, if
//dir == right we need to add -1 to bf
static inline int CalcBfChange(directions Dir)
{
return (1 - 2 * Dir);
}
//compares two items using <= and returns result
static CmpResult Cmp(const T* x,const T* y)
{
if (*y <= *x)
{
if (*x <= *y)
{
//*x == *y
return Equal;
}
//*x < *y
return Bellow;
}
else
{
//*x > *y
return Above;
}
}
//receives the root and the change in bf, updates Bf and
//preforms roll if necessary and returns whether a roll occurred
static bool UpdateBalance(node* &root,int BfChange)
{
root->bf += BfChange;
if (root->bf == 2*BfChange)
{
directions RollDirection = root->bf == 2 ? Right : Left; //if we arrive here bf is either 2 or -2
//if its two need to roll to the right otherwise to the left
directions OppositeDirection = OtherDirection(RollDirection);
if (root->Children[OppositeDirection]->bf == CalcBfChange(RollDirection))
{ //if direction is Right(=0), we need
//to check if the left subtree's bf is -1 and if is is do LR roll
//if direction is Left(=1), we need
//to check if the Right subtree's bf is 1 and if it is do RL roll
//LR or RL roll
Roll(root->Children[OppositeDirection],OppositeDirection,RollDirection);
Roll(root,RollDirection,OppositeDirection);
}
else
{
//LL or RR roll
Roll(root,RollDirection,OppositeDirection);
}
return true;
}
return false;
}
//preforms a roll in RollDirection to the subtree whose root is root
static void Roll(node* &root, directions RollDirection, directions OppositeDirection)
{
node* ptr = root->Children[OppositeDirection];
root->Children[OppositeDirection] = ptr->Children[RollDirection];
ptr->Children[RollDirection] = root;
int BfValue = CalcBfChange(RollDirection); //1 for left -1 for right
//balance updates
//description for left roll (other side is symmetric)
//old root:
//we lose the right child, and the child's right child
//so first we decrease one for child
//second we check if the right child's right subtree is bigger
//the right child's left sub tree if it is we also gain the difference between the subtrees
root->bf += BfValue;
if (ptr->bf * BfValue < 0)
{
root->bf -= ptr->bf;
}
//description for left roll (other side is symmetric)
//new root:
//in the new root we gain the old root as the left child,
//now we have to check if our old left subtree is smaller then
//the oldroot left subtree, if it his we also gain this difference
//we can preform this check according to the old root new bfvalue
ptr->bf += BfValue;
if (root->bf * BfValue > 0)
{
ptr->bf += root->bf;
}
UpdateMinMax(root);
UpdateMinMax(ptr);
root = ptr; //update root
}
//internal insert function
static HeightChange insert(node* &root,T *item)
{
if (root == NULL)
{
root = new node(item);
return HeightChanged;
}
//else
CmpResult res= Cmp(root->data,item);
if (res == Equal)
{
//we arrive here if the item already exist
return Error;
}
else
{
directions dir = (directions) res; //bellow -> left, above -> right
HeightChange height = insert(root->Children[dir],item);
UpdateMinMax(root);
if (height == HeightChanged)
{
if (UpdateBalance(root,CalcBfChange(dir)) || root->bf == 0)
{
//if the tree is balanced now it was imbalanced we didn't change the height,
//if its -1 or 1 it means that one of the sides grow
height = NoHeightChange;
}
}
return height;
}
}
//internal remove function
static HeightChange remove(node* &root,T* &item)
{
if (root == NULL)
{
return Error; //item wasn't found
}
//else
int BfChange;
HeightChange height;
CmpResult res= Cmp(root->data,item);
if (res == Equal)
{
item = root->data; //return item to caller
//found item need to delete it
if (root->Children[Right] == NULL) //we don't have right child
{
node* ptr = root; //save pointer to root to free it
root = root->Children[Left]; //make the left child (or null) the name child of parent
delete ptr; //free node;
return HeightChanged; //we changed the height
}
else //we have a right child
{
//extract the minimum of the sub tree and put it in root
height = ExtractMin(root->Children[Right],root->data);
BfChange = 1;
}
}
else
{
directions dir = (directions) res; //bellow -> left, above -> right
BfChange = -CalcBfChange(dir);
height = remove(root->Children[dir],item);
}
UpdateMinMax(root);
if (height == HeightChanged)
{
if ((UpdateBalance(root,BfChange) && root->bf != 0)
|| root->bf != 0)
{
height = NoHeightChange; //if we preformed a roll and the tree still isn't balanced
//or if we didn't, the tree was balanced but now it isn't then the height didn't change
}
}
return height;
}
//Extract the minimum from the tree and put it in Min
//could be done with getmin + remove, but then we would travel
//the tree twice and do unnecessary compares
static HeightChange ExtractMin(node* &root,T* &Min)
{
if (root->Children[Left] == NULL)
{
node* ptr = root->Children[Right];
Min = root->data;
delete(root); //free node
root = ptr; //update the child of the parent to point to the right child
return HeightChanged; //we deleted a node so the height changed
}
//else
HeightChange height = ExtractMin(root->Children[Left],Min);
UpdateMinMax(root);
if (height == HeightChanged)
{
if ((UpdateBalance(root,-1) && root->bf != 0)
|| root->bf != 0)
{
height = NoHeightChange; //if we preformed a roll and now the tree is balanced,
//or if we didn't, the tree was balanced but now it isn't then the height didn't change
}
}
return height;
}
//finds closest item in dir and the maximum in opposite direction
static T* Closest(node* root,T *item, directions Dir, int& rMin, int& rMax)
{
int myMax = rMax;
int myMin = rMin;
while (root != NULL)
{
CmpResult res= Cmp(root->data,item);
if (res != (CmpResult)Dir)
{
rMax = myMax = Max(Max(myMax,root->data->AValue()),GetMax(root->Children[Dir]));
rMin = myMin = Min(Min(myMin,root->data->AValue()),GetMin(root->Children[Dir]));
T* InSubTree = Closest(root->Children[OtherDirection(Dir)],item,Dir,rMin,rMax);
if (InSubTree == NULL || Cmp(InSubTree,root->data)!=(CmpResult)Dir)
{
rMax = myMax;
rMin = myMin;
return root->data;
}
else
{
//rin, rmax is alreay up to date
return InSubTree;
}
}
//else
root = root->Children[Dir];
}
rMin = rMax = -1;
return NULL; //if we arrive here item wasn't found
}
//internal inorder function
static bool inorder(node* root,Predicate *p)
{
if (root != NULL)
{
return inorder(root->Children[Left],p)
|| p->DoWork(root->data)
|| inorder(root->Children[Right],p);
}
return false;
}
//internal free function
static void Destroy(node* root,bool FreeItems)
{
if (root != NULL)
{
Destroy(root->Children[Left],FreeItems);
Destroy(root->Children[Right],FreeItems);
if (FreeItems)
{
delete root->data;
}
delete root;
}
}
node* root;
};
#endif
| [
"[email protected]"
]
| [
[
[
1,
504
]
]
]
|
bf10c2071508ced0bbcc727702b6575a26c3f88b | e7c45d18fa1e4285e5227e5984e07c47f8867d1d | /SMDK/Alcan/AlcanBayer/AlcanSM.h | 877e7b76e822112e3d13a0637bc9156ad6c601d6 | []
| no_license | abcweizhuo/Test3 | 0f3379e528a543c0d43aad09489b2444a2e0f86d | 128a4edcf9a93d36a45e5585b70dee75e4502db4 | refs/heads/master | 2021-01-17T01:59:39.357645 | 2008-08-20T00:00:29 | 2008-08-20T00:00:29 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,451 | h | //===========================================================================
//=== SysCAD SMDK - Alcan Bayer Properties Model 2003 : Alcan, Kenwalt ===
//===========================================================================
#ifndef __AlcanSM_H_
#define __AlcanSM_H_
#include "md_headers.h"
#include <vector>
class CAlcanSM; // forward declare
//===========================================================================
// A helper class to assist with calculating iterative concentration and density
// calculations.
class CAlcanConcs
{
public:
static bool NaFactorOK;
static MArrayI NaFactor;
CAlcanSM *pBayerMdl;
MArrayI Liq; //array of concentrations at 25C as Na2CO3 Equiv
double Density25; // Density @ 25 C
CAlcanConcs(CAlcanSM *pMdl);
void Zero();
bool Converge(MArray & MA);
double LTotalSodium(MArray & MA);
double LiquorDensity(double T_, MArray & MA);
static double LiquorDensEqn1(double Tc, double WTNa, double WAlumina);
static double LiquorDensEqn2(double Tc, double XNaC, double XNa, double XAl);
static double LiquorDensEqn3(double Tc, double XAl2O3, double XCaust, double XTTS, double XOC);
};
//===========================================================================
class CAlcanSM : public MSpModelBase, public MIBayer
{
friend class CAlcanConcs;
protected:
CAlcanConcs LiqConcs25;
//globals...
static byte sm_iASatMethod;
static byte sm_iDensityMethod;
static byte sm_iGrowthMethod;
static byte sm_iCPMethod;
static byte sm_iBPEMethod;
static double sm_dMinSolCp;
static double sm_dH2OTestFrac0;
static double sm_dH2OTestFrac1;
static double sm_Morphology;
static double sm_Nucleation;
static double sm_Na2OFactor;
static double sm_CarbonFactor;
bool fDoCalc;
bool m_bRqdAt25;
double dRqd_AtoC, dRqd_C, dRqd_CtoS;
double dRqd_Sul, dRqd_Sil, dRqd_Salt;
double dRqd_P2O5, dRqd_Fl;
double dRqd_Ox, dRqd_TOC;
double dRqd_SolFrac, dRqd_SolConc;
double dRqd_SolOx, dRqd_SolOccSoda;
static CArray <int, int> LclParm;
public:
CAlcanSM(TaggedObject * pNd);
~CAlcanSM();
void BuildDataFields();
bool ExchangeDataFields();
bool ValidateDataFields();
// Standard Methods
bool get_IsBaseClassOf(LPCTSTR OtherProgID);
LPCTSTR get_PreferredModelProgID();
double get_Density(long Phases, double T, double P, MArray * pMA);
double get_msEnthalpy(long Phases, double T, double P, MArray * pMA);
double get_msEntropy(long Phases, double T, double P, MArray * pMA);
double get_msCp(long Phases, double T, double P, MArray * pMA);
double get_SaturationT(double P, MArray * pMA);
double get_SaturationP(double T, MArray * pMA);
double get_DynamicViscosity(long Phases, double T, double P, MArray * pMA);
double get_ThermalConductivity(long Phases, double T, double P, MArray * pMA);
long DefinedPropertyCount();
long DefinedPropertyInfo(long Index, MPropertyInfo & Info);
DWORD GetPropertyVisibility(long Index);
void GetPropertyValue(long Index, ULONG Phase, double T, double P, MPropertyValue & Value);
void PutPropertyValue(long Index, MPropertyValue & Value);
// User Stuff
//DDEF_Flags FixSpEditFlags(DDEF_Flags Flags, int iSpid, bool AsParms);
double LiqCpCalc(MArray & MA, double T);
double BoilPtElev(MArray & MA, double T);
void InputCalcs(bool DoIt, double T_);
// User Props
double THAMassFlow();
double THADens(double T_);
double CausticConc(double T_);
double AluminaConc(double T_);
double SodaConc(double T_);
double SodiumCarbonateConc(double T_);
double SodiumSulphateConc(double T_);
double SodiumOxalateConc(double T_);
double SolidsConc(double T_);
double IonicStrength();
double AluminaConcSat(double T_);
double IonicStrengthBoehmite();
double AluminaSolubility(double T_) { return AluminaConcSat(T_); };
double OxalateSolubility(double T_);
double SulphateSolubility(double T_) { return 0.0; };
double CarbonateSolubility(double T_) { return 0.0; };
double BoehmiteSolubility(double T_);
double AtoCSaturation(double T_);
double SSNRatio(double T_);
double AluminaSSN(double T_);
double TOC(double T_);
double FreeCaustic(double T_);
double AtoC();
double CtoS();
double CltoC();
double Na2SO4toC();
double Na2CO3toS();
double MR();
double AA(); //Total Na conc as Na2O equivilant
double TT(); //Caustic conc as Na2O equivilant
double SPO();
double Na2OSolFrac();
double LDensity25();
double SLDensity25();
double LVolume25();
double SLVolume25();
double TotalSodium();
double ChlorineConc25();
double SulphateConc25();
double OrganicO11Conc25();
double OrganateConc25();
double OxalateConc25();
double TotalOrganicsConc25();
double TotalSodiumConc25();
double TOC25();
double SolidsConc25();
double SodiumOxalate_Conc();
double OrganicO11_Conc();
double Sulphate_Conc();
double Chlorine_Conc();
double Fluoride_Conc();
double Silicate_Conc();
double GrowthRate();
double AgglomerationRate();
double NucleationRate(double SpecSurface);
};
//===========================================================================
//===========================================================================
#endif //__AlcanSM_H_
| [
"[email protected]",
"[email protected]"
]
| [
[
[
1,
72
],
[
76,
168
]
],
[
[
73,
75
]
]
]
|
d14eff21079f14a3119281866208ae30be756d75 | eb8a27a2cc7307f0bc9596faa4aa4a716676c5c5 | /WinEditionWithJRE/browser-lcc/jscc/src/v8/v8sh.cc | c7892e16da12723b2c688f13b2368e5e99d88f60 | [
"BSD-3-Clause",
"Artistic-1.0",
"LicenseRef-scancode-public-domain",
"Artistic-2.0"
]
| permissive | baxtree/OKBuzzer | c46c7f271a26be13adcf874d77a7a6762a8dc6be | a16e2baad145f5c65052cdc7c767e78cdfee1181 | refs/heads/master | 2021-01-02T22:17:34.168564 | 2011-06-15T02:29:56 | 2011-06-15T02:29:56 | 1,790,181 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 12,120 | cc | // Parts Copyright 2008 Louis P. Santillan ([email protected])
// Copyright 2008 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// To compile, you must build V8 JavaScript Engine from svn. See the
// following link (http://code.google.com/apis/v8/build.html) for an
// example of how to build the shell. Executing the following to
// achieve this:
// svn checkout http://v8.googlecode.com/svn/trunk/ v8
// cd v8
// scons mode=release library=static snapshot=on sample=shell
// cd ..
// g++ -O3 -o v8sh v8sh.cc -I./v8/src -L./v8 -lv8 -lpthread
#include <v8.h>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <unistd.h>
void RunShell(v8::Handle<v8::Context> context);
bool ExecuteString(v8::Handle<v8::String> source,
v8::Handle<v8::Value> name,
bool print_result,
bool report_exceptions);
v8::Handle<v8::Value> Print(const v8::Arguments& args);
v8::Handle<v8::Value> Load(const v8::Arguments& args);
v8::Handle<v8::Value> Quit(const v8::Arguments& args);
v8::Handle<v8::Value> Version(const v8::Arguments& args);
v8::Handle<v8::Value> Read_Line(const v8::Arguments& args);
v8::Handle<v8::Value> File_Exists(const v8::Arguments& args);
v8::Handle<v8::Value> File_Write(const v8::Arguments& args);
v8::Handle<v8::Value> File_Read(const v8::Arguments& args);
v8::Handle<v8::String> ReadFile(const char* name);
void ReportException(v8::TryCatch* handler);
v8::Handle<v8::Array> arguments;
int main(int argc, char* argv[]) {
v8::V8::SetFlagsFromCommandLine(&argc, argv, true);
v8::HandleScope handle_scope;
// Create a template for the global object.
v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New();
// Bind the global 'print' function to the C++ Print callback.
global->Set(v8::String::New("print"), v8::FunctionTemplate::New(Print));
// Bind the global 'load' function to the C++ Load callback.
global->Set(v8::String::New("load"), v8::FunctionTemplate::New(Load));
// Bind the 'quit' function
global->Set(v8::String::New("quit"), v8::FunctionTemplate::New(Quit));
// Bind the 'version' function
global->Set(v8::String::New("version"), v8::FunctionTemplate::New(Version));
// Bind the 'read_line' function
global->Set(v8::String::New("read_line"), v8::FunctionTemplate::New(Read_Line));
// Bind the 'file_exists' function
global->Set(v8::String::New("file_exists"), v8::FunctionTemplate::New(File_Exists));
// Bind the 'file_write' function
global->Set(v8::String::New("file_write"), v8::FunctionTemplate::New(File_Write));
// Bind the 'file_read' function
global->Set(v8::String::New("file_read"), v8::FunctionTemplate::New(File_Read));
// Create a new execution environment containing the built-in
// functions
v8::Handle<v8::Context> context = v8::Context::New(NULL, global);
// Enter the newly created execution environment.
v8::Context::Scope context_scope(context);
// Bind the 'arguments' array
arguments = v8::Array::New( argc - 2 );
for( int i = 2; i < argc; i++ )
{
arguments->Set( v8::Number::New( i - 2 ), v8::String::New( argv[ i ] ) );
}
context->Global()->Set( v8::String::New( "arguments" ), arguments );
bool run_shell = (argc == 1);
int script_count = 0;
for (int i = 1; i < argc; i++) {
const char* str = argv[i];
if (strcmp(str, "--shell") == 0) {
run_shell = true;
} else if (strcmp(str, "-f") == 0) {
// Ignore any -f flags for compatibility with the other stand-
// alone JavaScript engines.
continue;
} else if (strncmp(str, "--", 2) == 0) {
printf("Warning: unknown flag %s.\n", str);
} else if (strcmp(str, "-e") == 0 && i + 1 < argc) {
// Execute argument given to -e option directly
v8::HandleScope handle_scope;
v8::Handle<v8::String> file_name = v8::String::New("unnamed");
v8::Handle<v8::String> source = v8::String::New(argv[i + 1]);
if (!ExecuteString(source, file_name, false, true))
return 1;
i++;
} else {
if( run_shell ) continue;
if( ++script_count <= 1 )
{
// Use all other arguments as names of files to load and run.
v8::HandleScope handle_scope;
v8::Handle<v8::String> file_name = v8::String::New(str);
v8::Handle<v8::String> source = ReadFile(str);
if (source.IsEmpty()) {
printf("Error reading '%s'\n", str);
return 1;
}
if (!ExecuteString(source, file_name, false, true))
return 1;
}
}
}
if (run_shell) RunShell(context);
return 0;
}
// The callback that is invoked by v8 whenever the JavaScript 'print'
// function is called. Prints its arguments on stdout separated by
// spaces and ending with a newline.
v8::Handle<v8::Value> Print(const v8::Arguments& args) {
bool first = true;
for (int i = 0; i < args.Length(); i++) {
v8::HandleScope handle_scope;
if (first) {
first = false;
} else {
printf(" ");
}
v8::String::Utf8Value str(args[i]);
printf("%s", *str);
}
printf("\n");
return v8::Undefined();
}
// The callback that is invoked by v8 whenever the JavaScript 'load'
// function is called. Loads, compiles and executes its argument
// JavaScript file.
v8::Handle<v8::Value> Load(const v8::Arguments& args) {
for (int i = 0; i < args.Length(); i++) {
v8::HandleScope handle_scope;
v8::String::Utf8Value file(args[i]);
v8::Handle<v8::String> source = ReadFile(*file);
if (source.IsEmpty()) {
return v8::ThrowException(v8::String::New("Error loading file"));
}
if (!ExecuteString(source, v8::String::New(*file), false, false)) {
return v8::ThrowException(v8::String::New("Error executing file"));
}
}
return v8::Undefined();
}
// The callback that is invoked by v8 whenever the JavaScript 'quit'
// function is called. Quits.
v8::Handle<v8::Value> Quit(const v8::Arguments& args) {
// If not arguments are given args[0] will yield undefined which
// converts to the integer value 0.
int exit_code = args[0]->Int32Value();
exit(exit_code);
return v8::Undefined();
}
v8::Handle<v8::Value> Version(const v8::Arguments& args) {
return v8::String::New(v8::V8::GetVersion());
}
v8::Handle<v8::Value> Read_Line( const v8::Arguments& args )
{
char buf[ 256 ];
buf[ 255 ] = '\0';
scanf( "%255[^\n]", buf );
return( v8::String::New( buf ) );
}
v8::Handle<v8::Value> File_Exists( const v8::Arguments& args )
{
v8::String::Utf8Value f( args[ 0 ] );
if( access( *f, R_OK | F_OK ) == 0 )
{
return( v8::Boolean::New( true ) );
}
return( v8::Boolean::New( false ) );
}
v8::Handle<v8::Value> File_Write( const v8::Arguments& args )
{
v8::String::Utf8Value f( args[ 0 ] ), d( args[ 1 ] );
FILE* fp = fopen( *f, "w" );
if( fp == NULL )
{
return( v8::Boolean::New( false ) );
}
fputs( *d, fp );
fclose( fp );
return( v8::Boolean::New( true ) );
}
v8::Handle<v8::Value> File_Read( const v8::Arguments& args )
{
v8::String::Utf8Value f( args[ 0 ] );
return( ReadFile( *f ) );
}
// Reads a file into a v8 string.
v8::Handle<v8::String> ReadFile(const char* name) {
FILE* file = fopen(name, "rb");
if (file == NULL) return v8::Handle<v8::String>();
fseek(file, 0, SEEK_END);
int size = ftell(file);
rewind(file);
char* chars = new char[size + 1];
chars[size] = '\0';
for (int i = 0; i < size;) {
int read = fread(&chars[i], 1, size - i, file);
i += read;
}
fclose(file);
v8::Handle<v8::String> result = v8::String::New(chars, size);
delete[] chars;
return result;
}
// The read-eval-execute loop of the shell.
void RunShell(v8::Handle<v8::Context> context) {
printf("V8 version %s\n", v8::V8::GetVersion());
static const int kBufferSize = 256;
while (true) {
char buffer[kBufferSize];
printf("> ");
char* str = fgets(buffer, kBufferSize, stdin);
if (str == NULL) break;
v8::HandleScope handle_scope;
ExecuteString(v8::String::New(str),
v8::String::New("(shell)"),
true,
true);
}
printf("\n");
}
// Executes a string within the current v8 context.
bool ExecuteString(v8::Handle<v8::String> source,
v8::Handle<v8::Value> name,
bool print_result,
bool report_exceptions) {
v8::HandleScope handle_scope;
v8::TryCatch try_catch;
v8::Handle<v8::Script> script = v8::Script::Compile(source, name);
if (script.IsEmpty()) {
// Print errors that happened during compilation.
if (report_exceptions)
ReportException(&try_catch);
return false;
} else {
v8::Handle<v8::Value> result = script->Run();
if (result.IsEmpty()) {
// Print errors that happened during execution.
if (report_exceptions)
ReportException(&try_catch);
return false;
} else {
if (print_result && !result->IsUndefined()) {
// If all went well and the result wasn't undefined then print
// the returned value.
v8::String::Utf8Value str(result);
printf("%s\n", *str);
}
return true;
}
}
}
void ReportException(v8::TryCatch* try_catch) {
v8::HandleScope handle_scope;
v8::String::Utf8Value exception(try_catch->Exception());
v8::Handle<v8::Message> message = try_catch->Message();
if (message.IsEmpty()) {
// V8 didn't provide any extra information about this error; just
// print the exception.
printf("%s\n", *exception);
} else {
// Print (filename):(line number): (message).
v8::String::Utf8Value filename(message->GetScriptResourceName());
int linenum = message->GetLineNumber();
printf("%s:%i: %s\n", *filename, linenum, *exception);
// Print line of source code.
v8::String::Utf8Value sourceline(message->GetSourceLine());
printf("%s\n", *sourceline);
// Print wavy underline (GetUnderline is deprecated).
int start = message->GetStartColumn();
for (int i = 0; i < start; i++) {
printf(" ");
}
int end = message->GetEndColumn();
for (int i = start; i < end; i++) {
printf("^");
}
printf("\n");
}
}
| [
"[email protected]"
]
| [
[
[
1,
345
]
]
]
|
121bcdbb8ad1e6e89872c661b4c1e393b4be07de | d37a1d5e50105d82427e8bf3642ba6f3e56e06b8 | /DVR/HaohanITPlayer/private/DVR/ComSocket.h | 711a77b6a899e6cfc4651b44dfa69f22cdd52afe | []
| no_license | 080278/dvrmd-filter | 176f4406dbb437fb5e67159b6cdce8c0f48fe0ca | b9461f3bf4a07b4c16e337e9c1d5683193498227 | refs/heads/master | 2016-09-10T21:14:44.669128 | 2011-10-17T09:18:09 | 2011-10-17T09:18:09 | 32,274,136 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 1,095 | h | #ifndef _COMSOCKET_H
#define _COMSOCKET_H
#include <winsock2.h>
#define MAX_RECV_BUFFER (1024 * 1024)
#define UNKNOWN_SOCKET 0
#define CS_SOCKET 1
#define VS_SOCKET 2
#define DOG_SOCKET 3
#define SOCKET_DESCRIBE_LENGTH 128
class CComSocket
{
public:
CComSocket( INT nTimeOut = 2, INT skRecvBufSize = 10 );
~CComSocket();
INT Connect( CHAR* strRemote, UINT nPort );
INT Close( );
INT Send( CHAR* strData, INT iLen );
//接收完整的iLen长度或出错负数
BOOL Receive( CHAR* strData, INT iLen );
//返回实际接收到的长度,有可能小于len
INT Recv( CHAR* buf, INT len );
sockaddr_in GetSockAddr();
VOID SetSkDescription(CHAR* pDescription);
private:
INT Create( );
sockaddr_in m_sockaddr;
sockaddr_in m_rsockaddr;
BOOL m_bConnected;
INT m_nTimeOut; //超时时间 recv send等待的时间
INT m_skRecvBufSize;//SOCKET接收缓冲
CHAR m_skDescription[SOCKET_DESCRIBE_LENGTH];
public:
SOCKET m_hSocket;
};
#endif | [
"[email protected]@27769579-7047-b306-4d6f-d36f87483bb3",
"[email protected]@27769579-7047-b306-4d6f-d36f87483bb3"
]
| [
[
[
1,
17
],
[
19,
54
]
],
[
[
18,
18
]
]
]
|
bf2a95afb2b5d4fc91a8d5f51aab9458aae10961 | d1bf1aaa9175579a13b3e19808f8d887a40e0253 | /src/RobustSensorsSimulator.cpp | 3605973ce8eced7138649c6eb15136726ace85c4 | []
| no_license | peterfine/Robust-Sensors | 06aa38fcc7ac014befe0f77dacad1f8c5bb988f7 | d7312bf2316520225b77ee06c820e177393abdbc | refs/heads/master | 2020-04-09T17:43:58.820589 | 2011-11-03T00:35:48 | 2011-11-03T00:35:48 | 2,699,181 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,796 | cpp | /*******************************************************************************
* RobustSensorsSimulator.cpp
*
* Peter Fine - EASy MSC, Thesis
* Created March '05
*
******************************************************************************/
using namespace std;
#include "RobustSensorsSimulator.h"
#include "Genotype.h"
#include "MersenneTwister.cpp"
#include "Properties.h"
RobustSensorsSimulator::RobustSensorsSimulator(NeuralNetwork& network, Properties& properties,
MTRand& random)
: myNetwork(network),
myProperties(properties),
myRand(random),
myNoLights(properties.getInt("noLights")),
myOverwriteLightAngle(false), // Follow the pre-coded angles in resetLight.
myFitnessDuration(properties.getDouble("fitnessDuration")),
myTimestep(properties.getDouble("timestep")),
myTime(0.0),
myRadius(properties.getDouble("agentRadius")),
myLightDurationMin(properties.getDouble("lightDurationMin")),
myLightDurationMax(properties.getDouble("lightDurationMax")),
myLightDistanceMin(properties.getDouble("lightDistanceMin")),
myLightDistanceMax(properties.getDouble("lightDistanceMax")),
myPi(3.14159265),
myChangeAngleDuringTrial(false),
myExperimentHasEnded(false),
mySensorAngle1D(properties.getBool("sensorAngle1D"))
{ }
void RobustSensorsSimulator::configure() {
myUnNormalizedFitness = 0.0;
myTotalFitnessTime = 0.0;
myExperimentHasEnded = false;
myNetwork.resetNetwork();
myTime = 0.0;
// Reset the agent's position and generate a light position.
myAgentX = 0.0;
myAgentY = 0.0;
myAgentHeading = 0.0;
myLightNo = 0;
resetLight(false); // The first light doesn't contribute to fitness.
// Set an inital sensor angle of 0.5 pi (which could be identified as coming from this line).
mySensor1Angle = myPi / 2;
}
void RobustSensorsSimulator::overwriteSensorAngle(double angle1) {
mySensor1Angle = angle1;
}
// Note that the below is only called if the simulation is of a genetic nature.
void RobustSensorsSimulator::reconstruct(Genotype& genotype) {
myNetwork.reconstructNetwork(genotype);
}
double RobustSensorsSimulator::runSimulation() {
// Run the simulation.
while(!myExperimentHasEnded) {
update();
}
// Normalize the fitness and return.
if(myTotalFitnessTime > 0.0) { return myUnNormalizedFitness / myTotalFitnessTime; }
else { return 0.0; }
}
// UPDATE ---------------------------------------------------------------------------------------------------------------
void RobustSensorsSimulator::update() {
// Determine whether to move to the next light and sensor angle -----------------------------------------------------
if(myTimeUntilNextLight <= 0.0) {
// Check to see if the experiment has ended. If so, return.
if(myLightNo == (myNoLights - 1)) {
myExperimentHasEnded = true;
return;
}
myLightNo++;
// Now determine if the angle should be changed or not.
bool angleWasChanged = changeAngleIfRequired();
bool lightContributesToFitness = !angleWasChanged; // If the angle was changed, the light won't contribute.
// Reset the light. Note that reset is also called in configure();
resetLight(lightContributesToFitness);
}
myTimeUntilNextLight -= myTimestep;
// Calculate Sensor Inputs -------------------------------------------------------------------------
// Calculate the sensor locations.
double agentDistSq = pow(myLightX - myAgentX, 2) + pow(myLightY - myAgentY, 2);
double agentDist = sqrt(agentDistSq);
mySensor1X = myAgentX + myRadius * cos(myAgentHeading + mySensor1Angle);
mySensor1Y = myAgentY + myRadius * sin(myAgentHeading + mySensor1Angle);
double sensor1DistSq = pow(myLightX - mySensor1X, 2) + pow(myLightY - mySensor1Y, 2);
double sensor1Dist = sqrt(sensor1DistSq);
// Calculate whether the light impinges on the sensor 1.
mySensor1Input = 0.0;
if((pow(myRadius, 2) + sensor1DistSq) / agentDistSq <= 1) {
// Calculate the linear sensor input.
if(sensor1Dist < myLightDistanceMax * 1.5) {
mySensor1Input = (1 - sensor1Dist / (myLightDistanceMax * 1.5));
}
}
myNetwork.setInput(0, mySensor1Input);
// Update the network and calculate the motor outputs ----------------------------------------------------------------
myNetwork.updateNetwork(myTimestep);
double moveV = (myNetwork.getOutput(0) + myNetwork.getOutput(1)) / 2;
double turnV = (myNetwork.getOutput(0) - myNetwork.getOutput(1)) / (2 * myRadius);
myAgentX += myTimestep * moveV * cos(myAgentHeading);
myAgentY += myTimestep * moveV * sin(myAgentHeading);
myAgentHeading += myTimestep * turnV;
// Only add this to the fitness value if...
if(myLightContributesToFitness && // This light is not part of the initial phase (or after a change of angle).
(myTimeUntilNextLight <= myFitnessDuration)) { // The time is within the fitness contributing phase of the current light
double currentFitness = 0.0;
if(agentDist < myLightDistanceMax) {
currentFitness = 1.0 - (agentDist / myLightDistanceMax);
}
myUnNormalizedFitness += currentFitness * myTimestep;
myTotalFitnessTime += myTimestep;
}
myTime += myTimestep;
}
// RESET LIGHT ------------------------------------------------------------------------------------------------------------------
void RobustSensorsSimulator::resetLight(bool contributesToFitness) {
myLightContributesToFitness = contributesToFitness;
myTimeUntilNextLight = myRand.rand() * (myLightDurationMax - myLightDurationMin) + myLightDurationMin;
//myTimeUntilNextLight = 50.0;
double lightAngle = myRand.rand() * 2.0 * myPi;
double lightDistance = myRand.rand() * (myLightDistanceMax - myLightDistanceMin) + myLightDistanceMin;
/* Overwrite the light angles, if requested. Only for the first few lights.
if(myOverwriteLightAngle) {
lightDistance = 0.5 * (myLightDistanceMax - myLightDistanceMin) + myLightDistanceMin;
switch(myLightNo) {
case 0 : lightAngle = myPi; break;
case 1 : lightAngle = myPi; break;
case 2 : lightAngle = 0.0; break;
case 3 : lightAngle = 0.0; break;
case 4 : lightAngle = myPi; break;
}
}*/
myLightX = myAgentX + cos(lightAngle) * lightDistance;
myLightY = myAgentY + sin(lightAngle) * lightDistance;
}
// CHANGE ANGLE ------------------------------------------------------------------------------------------------------------------
bool RobustSensorsSimulator::changeAngleIfRequired() {
bool angleWasChanged = false;
if(myChangeAngleDuringTrial) {
if(count(myChangeAngleSchedule.begin(), myChangeAngleSchedule.end(), myLightNo) > 0) {
// Change the sensor angle.
angleWasChanged = true;
if(mySensorAngle1D) {
// Flip the sensor angle.
if(mySensor1Angle < (myPi / 2)) { overwriteSensorAngle(myPi); }
else {overwriteSensorAngle(0.0); }
}
else { // Sensors not 1D
// Select a random angle.
overwriteSensorAngle(myRand.rand() * 2 * myPi);
}
}
}
return angleWasChanged;
}
// Generate change angles -----------------------------------------------------------------------------------------------------
void RobustSensorsSimulator::generateChangeAngleSchedule(int noChanges) {
myChangeAngleSchedule.clear();
for(int i = 0; i < noChanges; i++) {
int nextChangeLightNo;
do {
nextChangeLightNo = myRand.randInt(myNoLights - 1);
} while((count(myChangeAngleSchedule.begin(), myChangeAngleSchedule.end(), nextChangeLightNo) != 0) &&
(nextChangeLightNo != 0));
myChangeAngleSchedule.push_back(nextChangeLightNo);
}
sort(myChangeAngleSchedule.begin(), myChangeAngleSchedule.end());
}
void RobustSensorsSimulator::setChangeAngleSchedule(vector<int>& aChangeAngleSchedule) {
myChangeAngleSchedule = aChangeAngleSchedule;
}
void RobustSensorsSimulator::generateSingleChangeAngleSchedule(int meanLightNo, int maxVariationFromMean) {
myChangeAngleSchedule.clear();
myChangeAngleSchedule.push_back((int)(myNoLights / 2) + (myRand.randInt(4) - 2));
}
void RobustSensorsSimulator::addProperties(Properties& properties) {
properties.addDoubleItem("timestep");
properties.addIntItem("noLights");
properties.addDoubleItem("agentRadius");
properties.addDoubleItem("lightDurationMin");
properties.addDoubleItem("lightDurationMax");
properties.addDoubleItem("lightDistanceMin");
properties.addDoubleItem("lightDistanceMax");
// The fitnessDuration is the time before each light change during which fitness is recorded.
properties.addDoubleItem("fitnessDuration");
properties.addDoubleItem("angleDuration");
properties.addBoolItem("sensorAngle1D");
//properties.addDoubleItem("xxxAngle");
}
| [
"Peter@Peter-Laptop.(none)"
]
| [
[
[
1,
239
]
]
]
|
e15dd89e1f623bfcf4e39fa210ae1109f13cea58 | eb5155eeef7dbd21be10be214e1fce9a6ac2f3f1 | /wc3mousecapture.cpp | 41cad3163820edef2c990f3579695152341570d0 | []
| no_license | Dilaz/WC3-Mousecapture | e2cd343002ad05429e5143a562994f75929f3efe | 028b916b9f21e5ab8332b118151ec65533a52cf1 | refs/heads/master | 2021-01-01T15:41:31.386716 | 2011-07-01T16:17:42 | 2011-07-01T16:17:42 | 1,984,092 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,608 | cpp | #include "wc3mousecapture.h"
WC3MouseCapture::WC3MouseCapture(QWidget *parent)
: QWidget(parent), m_icon(QIcon(ICON_NAME), this), m_timer(this), m_menu(this),
m_exitAction(EXIT_ACTION_TITLE, this), m_isDisabled(false) {
// Set up trayicon
m_icon.show();
// Hide widget
//QTimer::singleShot(0, this, SLOT(hide()));
// Set up menu
m_menu.addAction(&m_exitAction);
m_icon.setContextMenu(&m_menu);
// Save default mouse rect
GetClipCursor(&m_defaultRect);
// Connect signals & slots
QObject::connect(&m_timer, SIGNAL(timeout()), this, SLOT(checkActiveWindow()));
QObject::connect(this, SIGNAL(wc3Activated(HWND&)), this, SLOT(captureMouse(HWND&)));
QObject::connect(this, SIGNAL(wc3Deactivated()), this, SLOT(endCapture()));
QObject::connect(&m_exitAction, SIGNAL(activated()), this, SLOT(close()));
// Start the timer
m_timer.start(DEFAULT_TIMEOUT);
// Register hotkey
RegisterHotKey(QWidget::winId(), NULL, NULL, DEFAULT_HOTKEY);
}
WC3MouseCapture::~WC3MouseCapture() {
// Stop the timer
m_timer.stop();
// Reset mouse rect
endCapture();
// Delete context menu
m_menu.deleteLater();
}
bool WC3MouseCapture::winEvent(MSG *message, long *result) {
if (message->message == WM_HOTKEY) {
endCapture();
m_isDisabled = true;
return false;
}
return QWidget::winEvent(message, result);
}
void WC3MouseCapture::captureMouse(HWND &hWnd) {
// Check if capture is disabled
if (m_isDisabled) {
return;
}
// Get WC3 window & client rect
RECT windowRect, clientRect;
GetWindowRect(hWnd, &windowRect);
GetClientRect(hWnd, &clientRect);
// Calculate border size
int borderSize = (windowRect.right - windowRect.left - clientRect.right) / 2;
// Calculate titlebar size
int titlebarSize = windowRect.bottom - windowRect.top - clientRect.bottom - borderSize;
// Calculate new coordinates
windowRect.top += titlebarSize;
windowRect.left += borderSize;
windowRect.bottom -= borderSize;
windowRect.right -= borderSize;
// Clip cursor to wc3 window
ClipCursor(&windowRect);
}
void WC3MouseCapture::endCapture() {
// End disable
m_isDisabled = false;
// Restore mouse rect to default
ClipCursor(&m_defaultRect);
}
void WC3MouseCapture::checkActiveWindow() {
// Find WC3 window
HWND hWnd = FindWindowA(NULL, reinterpret_cast<LPCSTR>(WC3_WINDOW_NAME));
// Check if WC3 is open
if (hWnd == NULL) {
return;
}
// Check if WC3 window is active
if (hWnd == GetForegroundWindow()) {
emit wc3Activated(hWnd);
}
else {
emit wc3Deactivated();
}
}
| [
"[email protected]"
]
| [
[
[
1,
104
]
]
]
|
0cc3b0abdb5b3f9fed0c4ea7fe3e2be1ab3a1057 | c5534a6df16a89e0ae8f53bcd49a6417e8d44409 | /trunk/Tutorials/Tutorial_1_6/App.cpp | b6aafdabb38205e4c582621f04cd6094bae9dde1 | []
| no_license | svn2github/ngene | b2cddacf7ec035aa681d5b8989feab3383dac012 | 61850134a354816161859fe86c2907c8e73dc113 | refs/heads/master | 2023-09-03T12:34:18.944872 | 2011-07-27T19:26:04 | 2011-07-27T19:26:04 | 78,163,390 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,784 | cpp | #include "App.h"
#include "nGENE.h"
#include "ScriptLua.h"
void hello() {
cout << "Hello world from tutorial 1.7!" << endl;
}
void App::createApplication()
{
FrameworkWin32::createApplication();
m_pMouse->setSensitivity(0.02f);
m_pPartitioner = new ScenePartitionerQuadTree();
SceneManager* sm = Engine::getSingleton().getSceneManager(0);
sm->setScenePartitioner(m_pPartitioner);
Renderer& renderer = Renderer::getSingleton();
renderer.setClearColour(0);
renderer.setCullingMode(CULL_CW);
uint anisotropy = 0;
renderer.getDeviceRender().testCapabilities(CAPS_MAX_ANISOTROPY, &anisotropy);
for(uint i = 0; i < 8; ++i)
renderer.setAnisotropyLevel(i, anisotropy);
CameraThirdPerson* cam;
cam = (CameraThirdPerson*)sm->createCamera(L"CameraThirdPerson", L"Camera");
cam->setVelocity(10.0f);
cam->setPosition(Vector3(0.0f, 10.0f, -10.0f));
cam->setTarget(Vector3(0.0f, 0.0f, 7.0f));
cam->setDistanceFromTarget(20.0f);
sm->getRootNode()->addChild(L"Camera", cam);
Engine::getSingleton().setActiveCamera(cam);
NodeMesh <MeshLoadPolicyXFile>* pSculp = sm->createMesh <MeshLoadPolicyXFile>(L"statue.x");
pSculp->setPosition(0.0f, 0.0f, 7.0f);
pSculp->setScale(0.25f, 0.25f, 0.25f);
Surface* pSurface = pSculp->getSurface(L"surface_2");
pSurface->flipWindingOrder();
Material* matstone = MaterialManager::getSingleton().getLibrary(L"default")->getMaterial(L"dotCel");
pSurface->setMaterial(matstone);
sm->getRootNode()->addChild(L"Sculpture", *pSculp);
Plane pl(Vector3::UNIT_Y, Point(0.0f, 0.0f, 0.0f));
PrefabPlane* plane = sm->createPlane(pl, Vector2(400.0f, 400.0f));
plane->setPosition(0.0f, 1.4, 0.0f);
pSurface = plane->getSurface(L"Base");
Material* matGround = MaterialManager::getSingleton().getLibrary(L"default")->getMaterial(L"normalMap");
pSurface->setMaterial(matGround);
sm->getRootNode()->addChild(L"Plane", plane);
NodeLight* pLight = sm->createLight(LT_DIRECTIONAL);
pLight->setPosition(-4.0f, 5.0f, 0.0f);
pLight->setDirection(Vector3(0.7f, -0.5f, 1.0f));
pLight->setDrawDebug(false);
Colour clrWorld(204, 204, 0);
pLight->setColour(clrWorld);
pLight->setRadius(180.0f);
sm->getRootNode()->addChild(L"WorldLight", *pLight);
renderer.addLight(pLight);
m_pInputListener = new MyInputListener();
m_pInputListener->setApp(this);
InputSystem::getSingleton().addInputListener(m_pInputListener);
luabind::module(Engine::getSingleton().getLuaScripting()->getVM())
[
luabind::def("hello", &hello)
];
pScript = Engine::getSingleton().getLuaScripting()->createScript();
pScript->runScriptFromFile("../media/simple_script.lua");
}
int main()
{
App app;
app.createApplication();
app.run();
app.shutdown();
return 0;
}
| [
"Riddlemaster@fdc6060e-f348-4335-9a41-9933a8eecd57"
]
| [
[
[
1,
88
]
]
]
|
aa9495910ea86c10a5880e3d34442ac66a1a5d03 | c7120eeec717341240624c7b8a731553494ef439 | /src/cplusplus/freezone-samp/src/player_ban_serial.hpp | af82ab174fb58c3b2d77ae0dec73af26a58add52 | []
| no_license | neverm1ndo/gta-paradise-sa | d564c1ed661090336621af1dfd04879a9c7db62d | 730a89eaa6e8e4afc3395744227527748048c46d | refs/heads/master | 2020-04-27T22:00:22.221323 | 2010-09-04T19:02:28 | 2010-09-04T19:02:28 | 174,719,907 | 1 | 0 | null | 2019-03-09T16:44:43 | 2019-03-09T16:44:43 | null | WINDOWS-1251 | C++ | false | false | 3,411 | hpp | #ifndef PLAYER_BAN_SERIAL_HPP
#define PLAYER_BAN_SERIAL_HPP
#include "core/module_h.hpp"
#include "player_ban_serial_item.hpp"
#include <string>
#include <set>
#include <map>
#include <bitset>
struct ban_reason_t {
enum ban_reason_e {
reason_none = 0,
reason_ip = 1 << 0,
reason_serial = 1 << 1,
reason_as_num = 1 << 2,
reason_ban_item = 1 << 3,
reason_ban_item_dynamic = 1 << 4
};
static inline std::string get_reason_string(ban_reason_e reason) {
std::bitset<5> b(reason);
return b.to_string();
}
};
inline ban_reason_t::ban_reason_e operator +=(ban_reason_t::ban_reason_e& a, ban_reason_t::ban_reason_e b) {
a = static_cast<ban_reason_t::ban_reason_e>(a + b);
return a;
}
class player_ban_serial
:public application_item
,public configuradable
,public createble_i
,public players_events::on_rejectable_connect_i
,public on_timer15000_i
{
public:
typedef std::tr1::shared_ptr<player_ban_serial> ptr;
static ptr instance();
public:
player_ban_serial();
virtual ~player_ban_serial();
public: // createble_i
virtual void create();
public: // configuradable
virtual void configure_pre();
virtual void configure(buffer::ptr const& buff, def_t const& def);
virtual void configure_post();
public: // auto_name
SERIALIZE_MAKE_CLASS_NAME(player_ban_serial);
private:
command_arguments_rezult cmd_ban_serial_unban(player_ptr_t const& player_ptr, std::string const& arguments, messages_pager& pager, messages_sender const& sender, messages_params& params);
command_arguments_rezult cmd_ban_serial_list(player_ptr_t const& player_ptr, std::string const& arguments, messages_pager& pager, messages_sender const& sender, messages_params& params);
public: // players_events::on_rejectable_connect_i
virtual bool on_rejectable_connect(player_ptr_t const& player_ptr);
virtual void on_timer15000();
public:
void ban_serial(player_ptr_t const& player_ptr);
private:
typedef time_outs<player_ban_serial_item_t, int> prebans_t;
typedef time_outs<player_ban_serial_item_t> bans_t;
typedef std::set<std::string> ips_t;
typedef std::set<std::string> serials_t;
typedef std::set<int> as_nums_t;
typedef std::set<player_ban_serial_item_t> ban_items_t;
bool is_serial_bans_active;
int preban_min_count;
int preban_timeout;
int bans_timeout;
// Список белых листов
ips_t whitelist_ips;
serials_t whitelist_serials;
as_nums_t whitelist_as_nums;
ban_items_t whitelist_ban_items;
// Список черных листов
ips_t blacklist_ips;
serials_t blacklist_serials;
as_nums_t blacklist_as_nums;
ban_items_t blacklist_ban_items;
prebans_t prebans;
bans_t bans;
private:
void on_unban_serial(player_ban_serial_item_t const& item, time_base::millisecond_t const& last_update, time_outs_dummy_val const& dummy);
bool access_checker(player_ptr_t const& player_ptr, std::string const& cmd_name);
bool is_banned(player_ban_serial_item_t const& item, std::string const& ip_string, ban_reason_t::ban_reason_e& reason) const;
};
#endif // PLAYER_BAN_SERIAL_HPP
| [
"dimonml@19848965-7475-ded4-60a4-26152d85fbc5"
]
| [
[
[
1,
101
]
]
]
|
0e416df47895e525080dc833e0d3de20d20a9a3d | 0f8559dad8e89d112362f9770a4551149d4e738f | /Wall_Destruction/Havok/Source/Common/Base/Container/String/hkStringBuf.h | 0e2e64698b4e016951c1026cc2fac5b9952bd91c | []
| no_license | TheProjecter/olafurabertaymsc | 9360ad4c988d921e55b8cef9b8dcf1959e92d814 | 456d4d87699342c5459534a7992f04669e75d2e1 | refs/heads/master | 2021-01-10T15:15:49.289873 | 2010-09-20T12:58:48 | 2010-09-20T12:58:48 | 45,933,002 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,175 | h | /*
*
* Confidential Information of Telekinesys Research Limited (t/a Havok). Not for disclosure or distribution without Havok's
* prior written consent. This software contains code, techniques and know-how which is confidential and proprietary to Havok.
* Level 2 and Level 3 source code contains trade secrets of Havok. Havok Software (C) Copyright 1999-2009 Telekinesys Research Limited t/a Havok. All Rights Reserved. Use of this software is subject to the terms of an end user license agreement.
*
*/
#ifndef HKBASE_HKSTRINGBUF_H
#define HKBASE_HKSTRINGBUF_H
class hkStringPtr;
/// String and buffer functions normally found in libc.
class hkStringBuf
{
public:
HK_DECLARE_NONVIRTUAL_CLASS_ALLOCATOR(HK_MEMORY_CLASS_STRING, hkStringBuf );
/// Creates an empty string.
hkStringBuf();
/// Creates a new string as a copy from a null terminated character array.
hkStringBuf(const char* s);
/// Copy from a string ptr.
explicit hkStringBuf(const hkStringPtr& s);
/// Construct a string as the concatenation of several strings.
/// The list is terminated by the first null pointer.
hkStringBuf(const char* s0, const char* s1, const char* s2=HK_NULL, const char* s3=HK_NULL, const char* s4=HK_NULL, const char* s5=HK_NULL);
/// Creates a new string as a copy from a buffer of length len.
/// The copied string will automatically be null terminated.
hkStringBuf(const char* b, int len);
/// Creates a new string as a copy of an existing one.
hkStringBuf(const hkStringBuf& s);
/// Copy of an existing string.
hkStringBuf& operator=(const hkStringBuf& s);
/// Copy of an existing c string.
hkStringBuf& operator=(const char* s);
private:
/// For internal use only
/// Noncopying constructor, the buffer pointed by ptr is used.
hkStringBuf(char* ptr, int size, int capacity);
/// sets the size as length+1
void setLength( int length );
public:
/// Read only access the internal buffer.
operator const char*() const;
/// Read only access the internal buffer.
const char* cString() const;
/// Returns the number of characters in this string excluding the trailing NULL
int getLength() const;
/// Read only access the i'th character.
char operator[] (int i) const;
/// Returns the first index of c given range, or -1 if not found.
/// The index returned is from the start of the string, not from startIndex.
int indexOf (char c, int startIndex=0, int endIndex=HK_INT32_MAX) const;
/// Returns the first index of c given range, or -1 if not found.
/// The index returned is from the start of the string, not from startIndex.
int indexOf( const char* s, int startIndex=0, int endIndex=HK_INT32_MAX ) const;
/// Returns the first index of c given range ignoring case, or -1 if not found.
int indexOfCase( const char* s ) const;
/// Returns the last index of c, or -1 if not found.
/// The index returned is from the start of the string, not from startIndex.
int lastIndexOf(char c, int startIndex=0, int endIndex=HK_INT32_MAX) const;
/// Returns the last index of the string s, or -1 if not found.
/// The index returned is from the start of the string, not from startIndex.
int lastIndexOf(const char* s, int startIndex=0, int endIndex=HK_INT32_MAX) const;
/// Returns <0,0,>0 if *this is lexicographically less than, equal to or greater than other.
int compareTo(const char* other) const;
/// Returns <0,0,>0 if *this is lexicographically less than, equal to or greater than other, ignoring case.
int compareToIgnoreCase(const char* other) const;
/// Convenience operator for use in map<>
hkBool operator< (const char* other) const;
/// Returns compareTo(s)==0
hkBool32 operator==(const char* s) const;
/// Return true if this string starts with s.
hkBool32 startsWith(const char* s) const;
/// Return true if this string starts with s, ignoring case.
hkBool32 startsWithCase(const char* s) const;
/// Return true if this string ends with s.
hkBool32 endsWith(const char* s) const;
/// Return true if this string ends with s, ignoring case.
hkBool32 endsWithCase(const char* s) const;
/// Splits this string at the separator and returns the sub strings.
/// This method destroys the original string as it replaces occurrences
/// of the separator with null bytes. Returns the number of splits.
int split( int sep, hkArray<const char*>::Temp& bits );
/// Set this to the empty string ("")
void clear();
/// Overwrite the current value. Arguments are the same as for ::sprintf.
void printf(const char* format, ...); // member function, not HK_CALL
/// Append a formatted string. Arguments are the same as for ::sprintf.
void appendPrintf(const char* format, ...); // member function, not HK_CALL
/// Sets *this as the concatenation of *this and other.
hkStringBuf& operator+= (const char* other);
/// Parameter to hkStringBuf::replace functions
enum ReplaceType
{
REPLACE_ONE,
REPLACE_ALL
};
void appendJoin(const char* s0, const char* s1=HK_NULL, const char* s2=HK_NULL, const char* s3=HK_NULL, const char* s4=HK_NULL, const char* s5=HK_NULL);
void setJoin(const char* s0, const char* s1=HK_NULL, const char* s2=HK_NULL, const char* s3=HK_NULL, const char* s4=HK_NULL, const char* s5=HK_NULL);
/// Remove n characters from the start of this string.
void chompStart(int n);
/// Remove n characters from the end of this string.
void chompEnd(int n);
/// Set the string as a substring of itself.
void slice(int startOffset, int length);
/// Set the string as a substring of itself.
void set(const char* s, int len=-1);
void append(const char* s, int len=-1);
void prepend(const char* s, int len=-1);
void insert(int pos, const char* s, int len=-1);
/// Extract the filename part after the last '/'. e.g. Path/To/File -> File.
/// If there is no '/', the result is unchanged.
void pathBasename();
/// Extract the value up to the last '/'. e.g. Path/To/File -> Path/To.
/// If there is no '/', the result is the empty string.
void pathDirname();
/// Extract the value after the first '/'. e.g. Path/To/File -> To/File.
/// If there is no '/', the result is the empty string.
void pathChildname();
/// Returns a new string where occurrences of 'from' have been replaced with 'to'.
/// If ReplaceType==REPLACE_ONE only the first occurrence is replaced.
hkBool32 replace(char from, char to, ReplaceType=REPLACE_ALL);
hkBool32 replace(const char* from, const char* to, ReplaceType=REPLACE_ALL);
/// Make all characters lower case.
void lowerCase();
/// Make all characters upper case.
void upperCase();
// Advanced usage.
hkArray<char>::Temp& getArray();
private:
/// The string storage.
/// The storage is always null terminated and the null terminator is included in the array
/// size so the length of the string is always m_string.getSize()-1.
hkInplaceArray<char, 128, hkContainerTempAllocator> m_string;
};
# define HK_PRINTF_FORMAT_INT64 "%I64i"
# define HK_PRINTF_FORMAT_UINT64 "%I64u"
#if HK_POINTER_SIZE==4
# define HK_PRINTF_FORMAT_ULONG "%u"
#else
# define HK_PRINTF_FORMAT_ULONG HK_PRINTF_FORMAT_UINT64
#endif
#include <Common/Base/Container/String/hkStringBuf.inl>
#endif // HKBASE_HKSTRING_H
/*
* Havok SDK - NO SOURCE PC DOWNLOAD, BUILD(#20091222)
*
* Confidential Information of Havok. (C) Copyright 1999-2009
* Telekinesys Research Limited t/a Havok. All Rights Reserved. The Havok
* Logo, and the Havok buzzsaw logo are trademarks of Havok. Title, ownership
* rights, and intellectual property rights in the Havok software remain in
* Havok and/or its suppliers.
*
* Use of this software for evaluation purposes is subject to and indicates
* acceptance of the End User licence Agreement for this product. A copy of
* the license is included with this software and is also available at www.havok.com/tryhavok.
*
*/
| [
"[email protected]"
]
| [
[
[
1,
202
]
]
]
|
f9c00cf3d1b9616b481f2fe6f3635b40c8befa8a | ea613c6a4d531be9b5d41ced98df1a91320c59cc | /7-Zip/CPP/7zip/Compress/PpmdEncoder.cpp | a29c9f62433e405413734d21ac0e51a59f3ad15c | []
| no_license | f059074251/interested | 939f938109853da83741ee03aca161bfa9ce0976 | b5a26ad732f8ffdca64cbbadf9625dd35c9cdcb2 | refs/heads/master | 2021-01-15T14:49:45.217066 | 2010-09-16T10:42:30 | 2010-09-16T10:42:30 | 34,316,088 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,961 | cpp | // PpmdEncoder.cpp
// 2009-05-30 : Igor Pavlov : Public domain
#include "StdAfx.h"
// #include <fstream.h>
// #include <iomanip.h>
#include "../Common/StreamUtils.h"
#include "PpmdEncoder.h"
namespace NCompress {
namespace NPpmd {
const UInt32 kMinMemSize = (1 << 11);
const UInt32 kMinOrder = 2;
/*
UInt32 g_NumInner = 0;
UInt32 g_InnerCycles = 0;
UInt32 g_Encode2 = 0;
UInt32 g_Encode2Cycles = 0;
UInt32 g_Encode2Cycles2 = 0;
class CCounter
{
public:
CCounter() {}
~CCounter()
{
ofstream ofs("Res.dat");
ofs << "innerEncode1 = " << setw(10) << g_NumInner << endl;
ofs << "g_InnerCycles = " << setw(10) << g_InnerCycles << endl;
ofs << "g_Encode2 = " << setw(10) << g_Encode2 << endl;
ofs << "g_Encode2Cycles = " << setw(10) << g_Encode2Cycles << endl;
ofs << "g_Encode2Cycles2= " << setw(10) << g_Encode2Cycles2 << endl;
}
};
CCounter g_Counter;
*/
STDMETHODIMP CEncoder::SetCoderProperties(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps)
{
for (UInt32 i = 0; i < numProps; i++)
{
const PROPVARIANT &prop = props[i];
switch(propIDs[i])
{
case NCoderPropID::kUsedMemorySize:
if (prop.vt != VT_UI4)
return E_INVALIDARG;
if (prop.ulVal < kMinMemSize || prop.ulVal > kMaxMemBlockSize)
return E_INVALIDARG;
_usedMemorySize = (UInt32)prop.ulVal;
break;
case NCoderPropID::kOrder:
if (prop.vt != VT_UI4)
return E_INVALIDARG;
if (prop.ulVal < kMinOrder || prop.ulVal > kMaxOrderCompress)
return E_INVALIDARG;
_order = (Byte)prop.ulVal;
break;
default:
return E_INVALIDARG;
}
}
return S_OK;
}
STDMETHODIMP CEncoder::WriteCoderProperties(ISequentialOutStream *outStream)
{
const UInt32 kPropSize = 5;
Byte props[kPropSize];
props[0] = _order;
for (int i = 0; i < 4; i++)
props[1 + i] = Byte(_usedMemorySize >> (8 * i));
return WriteStream(outStream, props, kPropSize);
}
const UInt32 kUsedMemorySizeDefault = (1 << 24);
const int kOrderDefault = 6;
CEncoder::CEncoder():
_usedMemorySize(kUsedMemorySizeDefault),
_order(kOrderDefault)
{
}
HRESULT CEncoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
const UInt64 * /* inSize */, const UInt64 * /* outSize */, ICompressProgressInfo *progress)
{
if (!_inStream.Create(1 << 20))
return E_OUTOFMEMORY;
if (!_rangeEncoder.Create(1 << 20))
return E_OUTOFMEMORY;
if (!_info.SubAllocator.StartSubAllocator(_usedMemorySize))
return E_OUTOFMEMORY;
_inStream.SetStream(inStream);
_inStream.Init();
_rangeEncoder.SetStream(outStream);
_rangeEncoder.Init();
CEncoderFlusher flusher(this);
_info.MaxOrder = 0;
_info.StartModelRare(_order);
for (;;)
{
UInt32 size = (1 << 18);
do
{
Byte symbol;
if (!_inStream.ReadByte(symbol))
{
// here we can write End Mark for stream version.
// In current version this feature is not used.
// _info.EncodeSymbol(-1, &_rangeEncoder);
return S_OK;
}
_info.EncodeSymbol(symbol, &_rangeEncoder);
}
while (--size != 0);
if (progress != NULL)
{
UInt64 inSize = _inStream.GetProcessedSize();
UInt64 outSize = _rangeEncoder.GetProcessedSize();
RINOK(progress->SetRatioInfo(&inSize, &outSize));
}
}
}
STDMETHODIMP CEncoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress)
{
try { return CodeReal(inStream, outStream, inSize, outSize, progress); }
catch(const COutBufferException &e) { return e.ErrorCode; }
catch(const CInBufferException &e) { return e.ErrorCode; }
catch(...) { return E_FAIL; }
}
}}
| [
"[email protected]@8d1da77e-e9f6-11de-9c2a-cb0f5ba72f9d"
]
| [
[
[
1,
148
]
]
]
|
339122ad9cac7f63589b299093e470ca829df75c | b414a8f5b425617f897b5d97bbede96507e17d96 | /agdevku_qt_version/agdevku_GUI/heap/DirectoryHeaderPage.h | be556f6299a50ae2e737ca172039053f3d39a6a2 | []
| no_license | agenthunt/agdevku | e7ce02e6f936a6980839fc538f158160c2060d05 | c6f6c8e9fbbb71f2b0288b8ab3ebd001aac6d5d7 | refs/heads/master | 2016-08-02T23:22:21.985871 | 2010-01-24T01:00:36 | 2010-01-24T01:00:36 | 32,114,047 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,288 | h | /*
* DirectoryHeaderPage.h
*
* Created on: Oct 2, 2009
* Author: shailesh
*/
#ifndef DIRECTORYHEADERPAGE_H_
#define DIRECTORYHEADERPAGE_H_
#include "../global/GlobalStructures.h"
#include "../global/StatusCodes.h"
#include <string>
class DirectoryHeaderPage {
public:
DirectoryHeaderPage();
DirectoryHeaderPage(int pageNumber);
DirectoryHeaderPage(char *pageData);
virtual ~DirectoryHeaderPage();
STATUS_CODE createDirectoryHeaderPage();
STATUS_CODE createFirstDirectoryPage();
int getFirstDirectoryPageNumber();
int getNumberOfRecords();
int getNumberOfDirectoryPages();
int getDirectoryEntrySize();
int getMaxNumberOfDirectoryEntries();
int getPageNumber();
void updateFirstDirectoryPageNumber(int pageNumber);
void updateNumOfRecords(int numOfRecords);
std::string toString();
private:
typedef struct DirectoryHeaderPageStructure{
GeneralPageHeaderStruct generalPageHeader;
int numberOfRecords;
int numberOfDirectoryPages;
int firstDirectoryPageNumber;
int directoryEntrySize;
int maxNumberOfDirectoryEntries;
} DirectoryHeaderPageStruct;
DirectoryHeaderPageStruct directoryHeaderPageStruct_;
char *pageData_;
bool haveIPinnedThePage;
bool isDirty;
};
#endif /* DIRECTORYHEADERPAGE_H_ */
| [
"[email protected]@1dbec2b6-b029-11de-8bdf-3374eb5c7316"
]
| [
[
[
1,
48
]
]
]
|
5e46a84e17720a9819af0d85f11d9a985fcd9519 | b1936b91f941b5ed7c4ef6263fbe68aab7bf3c08 | /PortScan.h | d01259235ad40ce5f749ab4b342a03fab1fb4f2d | []
| no_license | philsong/smartkid | dd0f920f505fbf7db3d60de9a2cbc08b33885878 | 1eb26544e206cb1f1ca97b72d4a85ad461827f05 | refs/heads/master | 2021-01-18T17:17:33.679817 | 2006-12-29T14:37:53 | 2006-12-29T14:37:53 | 32,116,947 | 1 | 0 | null | null | null | null | GB18030 | C++ | false | false | 1,160 | h | #pragma once
class CsmartkidDlg;
class CPortScan
{
public:
CPortScan(void);
~CPortScan(void);
void start_scan();
private:
static UINT scanthread(LPVOID);
static void InitCnnPacket();
static void InitSynPacket();
static UINT conect_scanthread(LPVOID);
static UINT syn_scanthread(LPVOID);
static void check_port(char *buffer);
static UINT recv_packet_thread(LPVOID);
public:
static u_short m_portnum; ///<端口数
static u_short m_ncounter;
private:
static CCriticalSection m_Sync;
static link_type m_scantype;
static u_short m_threadnum; ///<启动线程数
static u_short m_mainnum; ///<批次数
static u_short m_listCounter;
static char m_source_ip[16];
static char m_target_ip[16];
static u_short m_target_port;
static u_short m_start_port;
static u_short m_end_port;
static bool m_isspecial;
static volatile SOCKET sock;
static SOCKET recv_sock;
static SOCKADDR_IN connect_in;
static SOCKADDR_IN synscan_in;
static volatile IP_HEADER ipheader;
static volatile TCP_HEADER tcpheader;
static volatile PSD_HEADER psdheader;
static CsmartkidDlg *m_pDlg;
};
| [
"songbohr@99f8ccfc-bd25-0410-92d8-6ff52df36cf9"
]
| [
[
[
1,
48
]
]
]
|
cf7df6bbbf5d897d47d0ad54f729e2857a51a626 | ff24756dc4add027f5953a4954a4855d824a5a63 | /SolutionsEngine.h | 55e92c82c2af8dfd00020cc00d7e86981dc6e7eb | []
| no_license | weekydy/molt-asb-bigz-sont-dans-un-bateau | 640b4170b0ed9e07ca08641add9f57198bc2e8a6 | 2f116842bf604125ecbdd10226f79d0b085d0b4f | refs/heads/master | 2021-01-09T21:54:53.848431 | 2010-06-17T07:24:26 | 2010-06-17T07:24:26 | 55,782,366 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 615 | h | #ifndef SOLUTIONSENGINE_H
#define SOLUTIONSENGINE_H
#include <QtCore>
#include <QtGui>
#include <QtSql>
class SolutionsEngine
{
public :
SolutionsEngine();
~SolutionsEngine();
QDateTime findHours(QDateTime date, QTime duration, int id_room, QSet<int> id_people, bool available, bool extend);
int findRoom(int nb_people, bool guest, QList<int> equipment_id, bool equipment);
int verif(QDateTime begin, QDateTime end, int room, QSet<int> people, bool available, bool guest);
int rateUser(QDate date, int user_id);
};
#endif // SOLUTIONSENGINE_H
| [
"bastien.cramillet@df1d4e54-f2be-1ee4-b4f2-52395a1b115b"
]
| [
[
[
1,
20
]
]
]
|
749fae6332cf4676dc8ebc6b36b8d3eebdfb7bdd | fd196fe7f1a57a3d589dd987127391b6428dbc9f | /Workbench/Utilities/EmdExporterMax2011/RootExporter.cpp | 40207c34b0c22896cb40135ab970f403344979b3 | []
| no_license | aosyang/Graphic-Workbench | 73651b597b7ad9f759618bad30313bfad12a35b5 | 48c3b4b034ea332fb926ac0a0bd1f7c1fc1a2bb1 | refs/heads/master | 2021-01-22T23:25:48.330855 | 2011-11-29T09:27:52 | 2011-11-29T09:27:52 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,668 | cpp | #include "RootExporter.h"
#include <IGame/IGame.h>
#include "../../libEmdMesh/EmdDefine.h"
RootExporter::RootExporter()
{
Reset();
}
RootExporter::~RootExporter()
{
}
void RootExporter::AddNode( IGameNode* gameNode )
{
switch ( gameNode->GetIGameObject()->GetIGameType() )
{
case IGameObject::IGAME_MESH:
// TODO: Save data to mesh hierarchy
GetMeshData( gameNode );
break;
}
// TODO: We'll deal with mesh hierarchy later
//int childCount = gameNode->GetChildCount();
//for ( int i=0; i<childCount; i++ )
// AddNode( gameNode->GetNodeChild( i ) );
}
void RootExporter::Reset()
{
m_PositionArray.clear();
m_NormalArray.clear();
m_TexcoordArray.clear();
m_TangentArray.clear();
m_BinormalArray.clear();
m_VertexMap.clear();
m_IndexArray.clear();
}
bool RootExporter::SaveToFile( const EChar* filename )
{
std::ofstream fout( filename, std::ios_base::binary );
if (!fout.is_open()) return false;
fout.write("EMDL", 4);
uint32 ver = EMDL_VERSION;
fout.write( (char*)&ver, sizeof(ver) );
// export indices
WriteLump( fout, LUMP_INDEX, m_IndexArray.size() * sizeof(uint32), &m_IndexArray[0] );
WriteLump( fout, LUMP_VERTEX_POSITION, m_PositionArray.size() * sizeof(float), &m_PositionArray[0] );
WriteLump( fout, LUMP_VERTEX_NORMAL, m_NormalArray.size() * sizeof(float), &m_NormalArray[0] );
WriteLump( fout, LUMP_VERTEX_TEXCOORD0, m_TexcoordArray.size() * sizeof(float), &m_TexcoordArray[0] );
WriteLump( fout, LUMP_VERTEX_TANGENT, m_TangentArray.size() * sizeof(float), &m_TangentArray[0] );
WriteLump( fout, LUMP_VERTEX_BINORMAL, m_BinormalArray.size() * sizeof(float), &m_BinormalArray[0] );
fout.close();
//std::ofstream textOut( L"F:/textOut.txt" );
//textOut << "Tangent" << std::endl;
//for (int i=0; i<m_TangentArray.size(); i+=3)
//{
// textOut << m_TangentArray[i] << " " << m_TangentArray[i+1] << " " << m_TangentArray[i+2] << std::endl;
//}
//textOut << "Binormal" << std::endl;
//for (int i=0; i<m_BinormalArray.size(); i+=3)
//{
// textOut << m_BinormalArray[i] << " " << m_BinormalArray[i+1] << " " << m_BinormalArray[i+2] << std::endl;
//}
//textOut.close();
return true;
}
void RootExporter::WriteLump( std::ofstream& fout, uint32 lump, uint32 size_byte, void* data )
{
fout.write( (char*)&lump, sizeof(lump) );
fout.write( (char*)&size_byte, sizeof(size_byte) );
fout.write( (char*)data, size_byte );
}
void RootExporter::GetMeshData( IGameNode* gameNode )
{
// TODO: for now, only one mesh is stored in the class
IGameObject* obj = gameNode->GetIGameObject();
obj->InitializeData();
IGameMesh* mesh = (IGameMesh*)obj;
mesh->InitializeBinormalData();
int faceCount = mesh->GetNumberOfFaces();
// TODO: Handle materials
int index = 0;
// save index data
for (int faceIndex=0; faceIndex<faceCount; faceIndex++)
{
FaceEx* face = mesh->GetFace(faceIndex);
for (int faceVertexIndex=0; faceVertexIndex<3; faceVertexIndex++)
{
VertexData v;
DWORD vi = face->vert[faceVertexIndex];
Point3 pos = mesh->GetVertex(vi, true);
v.x = pos.x;
v.y = pos.y;
v.z = pos.z;
vi = face->norm[faceVertexIndex];
Point3 normal = mesh->GetNormal(vi, true);
v.nx = normal.x;
v.ny = normal.y;
v.nz = normal.z;
vi = face->texCoord[faceVertexIndex];
Point2 texcoord = mesh->GetTexVertex(vi);
v.u = texcoord.x;
v.v = texcoord.y;
vi = mesh->GetFaceVertexTangentBinormal(faceIndex, faceVertexIndex);
Point3 tangent = mesh->GetTangent(vi);
v.tx = tangent.x;
v.ty = tangent.y;
v.tz = tangent.z;
Point3 binormal = mesh->GetBinormal(vi);
v.bx = binormal.x;
v.by = binormal.y;
v.bz = binormal.z;
// remove duplicated vertex with std::map
if ( m_VertexMap.find(v) != m_VertexMap.end() )
{
m_IndexArray.push_back( m_VertexMap[v] );
}
else
{
m_IndexArray.push_back( index );
m_VertexMap[v] = index;
// save vertex to array
m_PositionArray.push_back( v.x );
m_PositionArray.push_back( v.y );
m_PositionArray.push_back( v.z );
m_NormalArray.push_back( v.nx );
m_NormalArray.push_back( v.ny );
m_NormalArray.push_back( v.nz );
m_TexcoordArray.push_back( v.u );
m_TexcoordArray.push_back( v.v );
m_TangentArray.push_back( v.tx );
m_TangentArray.push_back( v.ty );
m_TangentArray.push_back( v.tz );
m_BinormalArray.push_back( v.bx );
m_BinormalArray.push_back( v.by );
m_BinormalArray.push_back( v.bz );
index++;
}
}
}
int b = 0;
}
| [
"[email protected]@b4c0308a-e464-ec88-fcea-6ff8c68c914a"
]
| [
[
[
1,
184
]
]
]
|
b14c0891192d1013e1af3e5dde4f8ae73a9f75bf | 59066f5944bffb953431bdae0482a2abfb75f49a | /trunk/ogreopcode/example/src/ogreOpcodeExampleApp.cpp | 63eb168029dfdcc3abcdd66fbd7b4307bf787091 | []
| no_license | BackupTheBerlios/conglomerate-svn | 5b1afdea5fbcdd8b3cdcc189770b1ad0f8027c58 | bbecac90353dca2ae2114d40f5a6697b18c435e5 | refs/heads/master | 2021-01-01T18:37:56.730293 | 2006-05-21T03:12:39 | 2006-05-21T03:12:39 | 40,668,508 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 17,308 | cpp | #include "ogreOpcodeExampleApp.h"
#include "NikkiDotscene.h"
using namespace nikkiloader;
//-------------------------------------------------------------------------------------
OgreOpcodeExampleApp::OgreOpcodeExampleApp(void)
: OgreOpcodeExample(),
mCollideContext(0),
mRobotCollObj(0),
mPlayAnimation(false),
mVisualizeObjects(false),
mDoABBVisualization(false),
mDoLocalVisualization(true),
mDoGlobalVisualization(true),
mDoContacts(false),
mDoShapeVisualization(true),
mSkipLevelRayCheck(true),
mRobotEntity(0)
{
}
//-------------------------------------------------------------------------------------
OgreOpcodeExampleApp::~OgreOpcodeExampleApp(void)
{
delete CollisionManager::getSingletonPtr();
delete mRobotEntity;
}
//-------------------------------------------------------------------------------------
void OgreOpcodeExampleApp::createScene(void)
{
// Set ambient light
mSceneMgr->setAmbientLight(ColourValue(1.0, 0.8, 0.8));
//// Create a skydome
//mSceneMgr->setSkyDome(true, "Examples/CloudySky", 5, 8);
mTargetSight = (Overlay*)OverlayManager::getSingleton().getByName("gunTarget");
mTargetSight->show();
mHotTargetSight = (Overlay*)OverlayManager::getSingleton().getByName("hotGunTarget");
mHotTargetSight->hide();
mInfoOverlay = (Overlay*)OverlayManager::getSingleton().getByName("OgreOpcode/InfoOverlay");
mInfoOverlay->show();
mRayObjectText = OverlayManager::getSingleton().getOverlayElement("OgreOpcodeExample/Demo/RayIsHitting");
mRayObjectText->setCaption("None");
mRayDistanceText = OverlayManager::getSingleton().getOverlayElement("OgreOpcodeExample/Demo/RayDistance");
mRayDistanceText->setCaption("None");
// Move the debug overlay up a bit so we can get 2 lines in.
OverlayElement* dbgTxt = OverlayManager::getSingleton().getOverlayElement("Core/DebugText");
dbgTxt->setTop(dbgTxt->getTop()-dbgTxt->getHeight());
new CollisionManager(mSceneMgr);
CollisionManager::getSingletonPtr()->beginCollClasses();
CollisionManager::getSingletonPtr()->addCollClass("level");
CollisionManager::getSingletonPtr()->addCollClass("bullet");
CollisionManager::getSingletonPtr()->addCollClass("ogrerobot");
CollisionManager::getSingletonPtr()->addCollClass("powerup");
CollisionManager::getSingletonPtr()->endCollClasses();
CollisionManager::getSingletonPtr()->beginCollTypes();
CollisionManager::getSingletonPtr()->addCollType("level", "level", COLLTYPE_IGNORE);
CollisionManager::getSingletonPtr()->addCollType("ogrerobot", "bullet", COLLTYPE_EXACT);
CollisionManager::getSingletonPtr()->addCollType("level", "ogrerobot", COLLTYPE_EXACT);
CollisionManager::getSingletonPtr()->addCollType("level", "powerup", COLLTYPE_QUICK);
CollisionManager::getSingletonPtr()->addCollType("level", "ogrerobot", COLLTYPE_EXACT);
CollisionManager::getSingletonPtr()->addCollType("powerup", "powerup", COLLTYPE_IGNORE);
CollisionManager::getSingletonPtr()->addCollType("powerup", "bullet", COLLTYPE_IGNORE);
CollisionManager::getSingletonPtr()->addCollType("bullet", "bullet", COLLTYPE_IGNORE);
CollisionManager::getSingletonPtr()->endCollTypes();
mCollideContext = CollisionManager::getSingletonPtr()->getDefaultContext();
mRobotEntity = new RobotEntity(mSceneMgr);
mRobotEntity->initialise();
SceneNode* theSphereNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("theSphereNode");
theSphereNode->setPosition(200.0f, 60.0f, 10.0f);
mTestCollShape = CollisionManager::getSingletonPtr()->createSphereMeshCollisionShape("ellipsoid");
mTestCollShape->load("testShape", theSphereNode, 25.0f);
mTestCollObj = mCollideContext->newObject("ellipsoid");
mTestCollObj->setCollClass("ogrerobot");
mTestCollObj->setShape(mTestCollShape);
mCollideContext->addObject(mTestCollObj);
parseDotScene("scene.xml");
mCollideContext->reset();
new Details::OgreOpcodeDebugger(mSceneMgr);
}
//-------------------------------------------------------------------------------------
bool OgreOpcodeExampleApp::processUnbufferedKeyInput(const FrameEvent& evt)
{
if (mInputDevice->isKeyDown(KC_B) && mTimeUntilNextToggle <=0)
{
mVisualizeObjects = !mVisualizeObjects;
mTimeUntilNextToggle = 1.0;
}
if (mInputDevice->isKeyDown(KC_V) && mTimeUntilNextToggle <=0)
{
mDoShapeVisualization = !mDoShapeVisualization;
mTimeUntilNextToggle = 1.0;
}
if (mInputDevice->isKeyDown(KC_L) && mTimeUntilNextToggle <= 0)
{
mPlayAnimation = !mPlayAnimation;
mSceneMgr->getEntity("theRobot")->getAnimationState("Walk")->setEnabled(true);
mTimeUntilNextToggle = 1.0;
}
if (mInputDevice->isKeyDown(KC_Z) && mTimeUntilNextToggle <= 0)
{
mDoABBVisualization = !mDoABBVisualization;
mTimeUntilNextToggle = 1.0;
}
if (mInputDevice->isKeyDown(KC_X) && mTimeUntilNextToggle <= 0)
{
mDoLocalVisualization = !mDoLocalVisualization;
mTimeUntilNextToggle = 1.0;
}
if (mInputDevice->isKeyDown(KC_C) && mTimeUntilNextToggle <= 0)
{
mDoGlobalVisualization = !mDoGlobalVisualization;
mTimeUntilNextToggle = 1.0;
}
if (mInputDevice->isKeyDown(KC_1) && mTimeUntilNextToggle <= 0)
{
mCollideContext->destroyObject(mRobotEntity->getCollisionObject());
CollisionManager::getSingletonPtr()->destroyShape(mRobotEntity->getCollisionShape());
mRobotEntity->reinit();
mRobotEntity->getCollisionShape()->refit();
mTimeUntilNextToggle = 1.0;
}
if (mInputDevice->isKeyDown(KC_2) && mTimeUntilNextToggle <= 0)
{
mSkipLevelRayCheck = !mSkipLevelRayCheck;
mTimeUntilNextToggle = 1.0;
}
return OgreOpcodeExample::processUnbufferedKeyInput(evt);
}
//-------------------------------------------------------------------------------------
bool OgreOpcodeExampleApp::frameStarted(const FrameEvent& evt)
{
static Real transAmount = -0.8f;
static Real transTraveled = 0.0f;
if(transTraveled >= 480.0f)
transAmount = -0.8f;
if(transTraveled <= -480.0f)
transAmount = 0.8f;
transTraveled += transAmount;
mRobotEntity->translate(0.0f, transAmount, 0.0f);
if (mPlayAnimation)
{
mSceneMgr->getEntity("theRobot")->getAnimationState("Walk")->addTime(evt.timeSinceLastFrame/5);
mRobotEntity->getCollisionObject()->refit();
}
// This has to be here - debug visualization needs to be updated each frame..
// but only after we update objects!
mCollideContext->visualize(mVisualizeObjects, mDoLocalVisualization, mDoContacts, mDoGlobalVisualization, mDoShapeVisualization, mDoABBVisualization);
CollisionManager::getSingletonPtr()->getDefaultContext()->collide(evt.timeSinceLastFrame);
mRay = mCamera->getCameraToViewportRay(0.5, 0.5);
//CollisionObject* tempCollObj = mCollideContext->getAttachedObject("TestLevel");
//if(mSkipLevelRayCheck)
//{
// // remove level from context - we don't care when ray testing against entities..
// CollisionManager::getSingletonPtr()->getDefaultContext()->removeObject(tempCollObj);
//}
CollisionPair **pick_report;
int num_picks = CollisionManager::getSingletonPtr()->getDefaultContext()->rayCheck(mRay, 2000.0f, COLLTYPE_CONTACT, COLLTYPE_ALWAYS_CONTACT, pick_report);
mDbgMsg1 = "";
mDbgMsg2 = "";
if (num_picks > 0)
{
mTargetSight->hide();
mHotTargetSight->show();
mDbgMsg1 += Ogre::StringConverter::toString(num_picks) + " ";
for(int i = 0; i < num_picks; i++)
{
CollisionObject* yeah = pick_report[0]->co_this;
Vector3 contact = pick_report[0]->contact;
mDbgMsg1 = mDbgMsg1 + yeah->getShape()->getName();
mDbgMsg2 = mDbgMsg2 + " Distance: " + StringConverter::toString(pick_report[0]->distance);
}
}
else
{
mTargetSight->show();
mHotTargetSight->hide();
}
//if(mSkipLevelRayCheck)
//{
// // Add the level back into the CollisionContext
// CollisionManager::getSingletonPtr()->getDefaultContext()->addObject(tempCollObj);
//}
// Check Robot for collisions
if(mRobotEntity->hasCollisions())
{
int mCollObj1Picks = mRobotEntity->getCollisions(pick_report);
transAmount = 0.8f;
mWindow->setDebugText("Robot collided: " + StringConverter::toString(mCollObj1Picks) + " times against " + pick_report[0]->co_this->getName() );
}
mDbgMsg2 = mDbgMsg2 + " \nCollisionContext attached objects: " + StringConverter::toString(mCollideContext->getAttachedObjectCount());
mDbgMsg2 = mDbgMsg2 + " \nCollisionContext owned objects: " + StringConverter::toString(mCollideContext->getOwnedObjectCount());
mDbgMsg2 = mDbgMsg2 + " \nCollisionManager shapes: " + StringConverter::toString(CollisionManager::getSingletonPtr()->getShapeCount());
mRayObjectText->setCaption(mDbgMsg1);
mRayDistanceText->setCaption(mDbgMsg2);
return OgreOpcodeExample::frameStarted(evt);
}
//-------------------------------------------------------------------------------------
void OgreOpcodeExampleApp::addCollisionShape(const String& shapeName, Entity* entity, bool makeStatic)
{
EntityCollisionShape* tempCollShape;
CollisionObject* tempCollObject;
tempCollShape = CollisionManager::getSingletonPtr()->createEntityCollisionShape(shapeName);
if(makeStatic)
tempCollShape->setStatic();
entity->setNormaliseNormals(true);
tempCollShape->load(entity);
tempCollObject = mCollideContext->newObject(shapeName);
if(makeStatic)
{
tempCollObject->setCollClass("level");
}
else
tempCollObject->setCollClass("ogrerobot");
tempCollObject->setShape(tempCollShape);
mCollideContext->addObject(tempCollObject);
LogManager::getSingleton().logMessage("[addCollisionShape] Added : " + tempCollObject->getName() + " to the context.");
}
//-------------------------------------------------------------------------------------
void OgreOpcodeExampleApp::parseDotScene( const String &SceneName)
{
TiXmlDocument *XMLDoc;
TiXmlElement *XMLRoot, *XMLNodes;
try
{
DataStreamPtr pStream = ResourceGroupManager::getSingleton().
openResource( SceneName, "General" );
String data = pStream->getAsString();
// Open the .scene File
XMLDoc = new TiXmlDocument();
XMLDoc->Parse( data.c_str() );
pStream->close();
pStream.setNull();
if( XMLDoc->Error() )
{
//We'll just log, and continue on gracefully
LogManager::getSingleton().logMessage("[dotSceneLoader] The TiXmlDocument reported an error");
delete XMLDoc;
return;
}
}
catch(...)
{
//We'll just log, and continue on gracefully
LogManager::getSingleton().logMessage("[dotSceneLoader] Error creating TiXmlDocument");
delete XMLDoc;
return;
}
// Validate the File
XMLRoot = XMLDoc->RootElement();
if( String( XMLRoot->Value()) != "scene" ) {
LogManager::getSingleton().logMessage( "[dotSceneLoader]Error: Invalid .scene File. Missing <scene>" );
delete XMLDoc;
return;
}
XMLNodes = XMLRoot->FirstChildElement( "nodes" );
// Read in the scene nodes
if( XMLNodes )
{
TiXmlElement *XMLNode, *XMLPosition, *XMLRotation, *XMLScale, *XMLEntity, *XMLBillboardSet, *XMLLight, *XMLUserData;
XMLNode = XMLNodes->FirstChildElement( "node" );
while( XMLNode )
{
// Process the current node
// Grab the name of the node
String NodeName = XMLNode->Attribute("name");
// First create the new scene node
SceneNode* NewNode = mSceneMgr->getRootSceneNode()->createChildSceneNode( NodeName );
Vector3 TempVec;
String TempValue;
// Now position it...
XMLPosition = XMLNode->FirstChildElement("position");
if( XMLPosition ){
TempValue = XMLPosition->Attribute("x");
TempVec.x = StringConverter::parseReal(TempValue);
TempValue = XMLPosition->Attribute("y");
TempVec.y = StringConverter::parseReal(TempValue);
TempValue = XMLPosition->Attribute("z");
TempVec.z = StringConverter::parseReal(TempValue);
NewNode->setPosition( TempVec );
}
// Rotate it...
XMLRotation = XMLNode->FirstChildElement("rotation");
if( XMLRotation ){
Quaternion TempQuat;
TempValue = XMLRotation->Attribute("qx");
TempQuat.x = StringConverter::parseReal(TempValue);
TempValue = XMLRotation->Attribute("qy");
TempQuat.y = StringConverter::parseReal(TempValue);
TempValue = XMLRotation->Attribute("qz");
TempQuat.z = StringConverter::parseReal(TempValue);
TempValue = XMLRotation->Attribute("qw");
TempQuat.w = StringConverter::parseReal(TempValue);
NewNode->setOrientation( TempQuat );
}
// Scale it.
XMLScale = XMLNode->FirstChildElement("scale");
if( XMLScale ){
TempValue = XMLScale->Attribute("x");
TempVec.x = StringConverter::parseReal(TempValue);
TempValue = XMLScale->Attribute("y");
TempVec.y = StringConverter::parseReal(TempValue);
TempValue = XMLScale->Attribute("z");
TempVec.z = StringConverter::parseReal(TempValue);
NewNode->setScale( TempVec );
}
XMLLight = XMLNode->FirstChildElement( "light" );
if( XMLLight )
NewNode->attachObject( LoadLight( XMLLight, mSceneMgr ) );
// Check for an Entity
XMLEntity = XMLNode->FirstChildElement("entity");
if( XMLEntity )
{
String EntityName, EntityMeshFilename, IamStatic;
EntityName = XMLEntity->Attribute( "name" );
EntityMeshFilename = XMLEntity->Attribute( "meshFile" );
//IamStatic = XMLEntity->Attribute( "static" );
bool makeStatic = false;//= StringConverter::parseBool(IamStatic);
// Create entity
Entity* NewEntity = mSceneMgr->createEntity(EntityName, EntityMeshFilename);
NewNode->attachObject( NewEntity );
addCollisionShape(EntityName, NewEntity, makeStatic);
}
XMLBillboardSet = XMLNode->FirstChildElement( "billboardSet" );
if( XMLBillboardSet )
{
String TempValue;
BillboardSet* bSet = mSceneMgr->createBillboardSet( NewNode->getName() );
BillboardType Type;
TempValue = XMLBillboardSet->Attribute( "type" );
if( TempValue == "orientedCommon" )
Type = BBT_ORIENTED_COMMON;
else if( TempValue == "orientedSelf" )
Type = BBT_ORIENTED_SELF;
else Type = BBT_POINT;
BillboardOrigin Origin;
TempValue = XMLBillboardSet->Attribute( "type" );
if( TempValue == "bottom_left" )
Origin = BBO_BOTTOM_LEFT;
else if( TempValue == "bottom_center" )
Origin = BBO_BOTTOM_CENTER;
else if( TempValue == "bottomRight" )
Origin = BBO_BOTTOM_RIGHT;
else if( TempValue == "left" )
Origin = BBO_CENTER_LEFT;
else if( TempValue == "right" )
Origin = BBO_CENTER_RIGHT;
else if( TempValue == "topLeft" )
Origin = BBO_TOP_LEFT;
else if( TempValue == "topCenter" )
Origin = BBO_TOP_CENTER;
else if( TempValue == "topRight" )
Origin = BBO_TOP_RIGHT;
else
Origin = BBO_CENTER;
bSet->setBillboardType( Type );
bSet->setBillboardOrigin( Origin );
TempValue = XMLBillboardSet->Attribute( "name" );
bSet->setMaterialName( TempValue );
int width, height;
width = (int) StringConverter::parseReal( XMLBillboardSet->Attribute( "width" ) );
height = (int) StringConverter::parseReal( XMLBillboardSet->Attribute( "height" ) );
bSet->setDefaultDimensions( width, height );
bSet->setVisible( true );
NewNode->attachObject( bSet );
TiXmlElement *XMLBillboard;
XMLBillboard = XMLBillboardSet->FirstChildElement( "billboard" );
while( XMLBillboard )
{
Billboard *b;
// TempValue;
TempVec = Vector3( 0, 0, 0 );
ColourValue TempColour(1,1,1,1);
XMLPosition = XMLBillboard->FirstChildElement( "position" );
if( XMLPosition ){
TempValue = XMLPosition->Attribute("x");
TempVec.x = StringConverter::parseReal(TempValue);
TempValue = XMLPosition->Attribute("y");
TempVec.y = StringConverter::parseReal(TempValue);
TempValue = XMLPosition->Attribute("z");
TempVec.z = StringConverter::parseReal(TempValue);
}
TiXmlElement* XMLColour = XMLBillboard->FirstChildElement( "colourDiffuse" );
if( XMLColour ){
TempValue = XMLColour->Attribute("r");
TempColour.r = StringConverter::parseReal(TempValue);
TempValue = XMLColour->Attribute("g");
TempColour.g = StringConverter::parseReal(TempValue);
TempValue = XMLColour->Attribute("b");
TempColour.b = StringConverter::parseReal(TempValue);
}
b = bSet->createBillboard( TempVec, TempColour);
XMLBillboard = XMLBillboard->NextSiblingElement( "billboard" );
}
}
XMLUserData = XMLNode->FirstChildElement( "userData" );
if ( XMLUserData )
{
TiXmlElement *XMLProperty;
XMLProperty = XMLUserData->FirstChildElement("property");
while ( XMLProperty )
{
String first = NewNode->getName();
String second = XMLProperty->Attribute("name");
String third = XMLProperty->Attribute("data");
nodeProperty newProp(first,second,third);
nodeProperties.push_back(newProp);
XMLProperty = XMLProperty->NextSiblingElement("property");
}
}
// Move to the next node
XMLNode = XMLNode->NextSiblingElement( "node" );
}
}
// Close the XML File
delete XMLDoc;
}
| [
"jacmoe@4fa2dde5-35f3-0310-a95e-e112236e8438"
]
| [
[
[
1,
491
]
]
]
|
2ad5307a112b004950d57b1d62e9ebbb1cdb0771 | 775618667b614499fc215aa06c5933af3af21abe | /rfidLoginPlugin.cpp | 55aaf63fb46651734550aa85d42ebd98368b1a04 | []
| no_license | ChunHuCui/pgina-nfc-login-plugin | 4a44e2d330cb365e018fc7b8c71d61b547e5f16c | 9c2efa21e08738c325ea049cf8324804d999ae73 | refs/heads/master | 2021-09-08T02:46:55.897740 | 2011-12-20T17:22:18 | 2011-12-20T17:22:18 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,199 | cpp | /*
Adapted from pGina Dummy plugin skeleton example code
*/
#include "stdafx.h"
#include <wchar.h>
#include <tchar.h>
#include <cstdio>
#include "rfidLoginPlugin.h"
#include "users.h"
static int getUIDfromNFC();
static void printCStr(char * cString);
static void printCStr(char * cString, char *title);
// This isn't strictly necessary, but can be handy if you are going to add Dialog's etc
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
/* This is the function that pGina calls to find out whether a user is authorized or not
it is also the place to put changes in per-user configurations etc. */
RFIDPLUGIN_API BOOL UserLogin(LPTSTR Username, LPTSTR Password, pGinaInfo *settingsInfo)
{
// Validate user bsed on RFID tag
// Launch process to read UID from rfid card
int uid = getUIDfromNFC();
for (int i=0; i<MAX_ITEMS_IN_DB; ++i)
{
if( (uid==store[i].uid) /*&& (!_tcscmp(store[i].userName, Username))*/)
{
// found match in db
settingsInfo->Username = _tcsdup(store[i].userName);
settingsInfo->Password = _tcsdup(store[i].password);
return true;
}
}
// Nobody else gets in, unless they have a local account
settingsInfo->errorString = _tcsdup(TEXT("The username was not recognized."));
return false;
}
RFIDPLUGIN_API BOOL ChangeUserPassword(LPTSTR Username,LPTSTR OldPassword,LPTSTR NewPassword)
{
return true;
}
RFIDPLUGIN_API LPCTSTR AboutPlugin(void)
{
// Return a sample descriptions string
return TEXT("Authenticates users based on RFID. \
Fall back to local machine username/password authentication.");
}
RFIDPLUGIN_API void ChangePluginSettings(void)
{
// Describe in a messagebox what this would do
MessageBox(NULL,TEXT("This would bring up settings... but this is a simple plugin, so no settings."),TEXT("ChangePluginSettings()"),MB_OK);
}
RFIDPLUGIN_API void LoginHook(pGinaInfo *settingsInfo)
{
}
RFIDPLUGIN_API void LogoutHook(pGinaInfo *settingsInfo)
{
}
RFIDPLUGIN_API BOOL IsRequired(void)
{
return false;
}
static int getUIDfromNFC(){
int ret = -1;
/* CreateProcess API initialization */
STARTUPINFOW siStartupInfo;
PROCESS_INFORMATION piProcessInfo;
memset(&siStartupInfo, 0, sizeof(siStartupInfo));
memset(&piProcessInfo, 0, sizeof(piProcessInfo));
siStartupInfo.cb = sizeof(siStartupInfo);
#define baseDir TEXT("d:\\infosec\\rfid\\nfcLoginPlugin\\other resources\\")
#define procName TEXT("nfc-mfultralight-getid.exe")
#define proc baseDir procName
if (!CreateProcessW(proc,
proc,
0, 0, false,
CREATE_NEW_CONSOLE, 0, 0,
&siStartupInfo, &piProcessInfo) != false)
{
/* CreateProcess failed */
MessageBox(NULL, TEXT("Create process failed"), TEXT("Error"),MB_OK);
}
else
{
/* Watch the process. */
DWORD dwExitCode = 0;
DWORD SecondsToWait = 5;
char code[100];
// Wait for the external process to finish.
WaitForSingleObject(piProcessInfo.hProcess, (SecondsToWait * 1000));
if (!GetExitCodeProcess(piProcessInfo.hProcess, &dwExitCode))
{
// Handle error
}
else
{
sprintf_s(code, "%d", dwExitCode);
//printCStr(code, "Read tag UID:");
ret = dwExitCode;
}
/* Release handles */
CloseHandle(piProcessInfo.hProcess);
CloseHandle(piProcessInfo.hThread);
}
return ret;
}
static void printCStr(char * cString, char *title){
// Get the size of the string by setting the 4th parameter to -1:
DWORD textLen = MultiByteToWideChar (CP_ACP, 0, cString, -1, NULL, 0);
DWORD titleLen = MultiByteToWideChar (CP_ACP, 0, title, -1, NULL, 0);
wchar_t *wText = new wchar_t[textLen];
wchar_t *wTitle = new wchar_t[titleLen];
MultiByteToWideChar( CP_ACP, NULL, cString, -1, wText, textLen );
MultiByteToWideChar( CP_ACP, NULL, title, -1, wTitle, titleLen );
MessageBox(NULL, wText, wTitle, MB_OK);
delete[] wText;
delete[] wTitle;
} | [
"liviu@laptop"
]
| [
[
[
1,
158
]
]
]
|
3d9293c6714158a7249e1bf1f16754ad1f1142ed | 4c03dbe453fd89b72e87b0a4ff48efb417dbd12f | /mainwindow.h | dfeb1779cef3736b82b0b79846b5477df1527af4 | [
"WTFPL"
]
| permissive | manuelcarrizo/whereru | e3f0254c4056b27ca76d09d6e1df1411a38c5ffa | 1ee9a2fda6b34d9d24e010367376402b04421ba4 | refs/heads/master | 2020-05-20T05:19:15.910189 | 2011-08-23T00:51:43 | 2011-08-23T00:51:43 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,150 | h | #ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QProcess>
#include <QSystemTrayIcon>
#include <QMenu>
#include "findutils.h"
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private:
Ui::MainWindow *ui;
void showTrayIcon();
void configureContextMenu();
void loadScreenPosition();
void saveScreenPosition();
void locate(const QString & text);
void updatedb();
void update_statistics();
void resizeEvent(QResizeEvent *);
signals:
void results_modified();
private slots:
void on_query_editingFinished();
void system_tray_clicked(QSystemTrayIcon::ActivationReason reason);
void toogle_visibility();
void updatedb_finished();
void locate_finished(const QStringList & results);
void statistics_finished(QString message);
private:
QIcon * tray_icon;
QSystemTrayIcon * system_tray;
QMenu * system_tray_menu;
FindUtils findutils;
};
#endif // MAINWINDOW_H
| [
"[email protected]"
]
| [
[
[
1,
61
]
]
]
|
8d8cbbb44b37a9988aaad3411610c10306db9eee | 6dc976d19edc24eda572338646eb23b054880c55 | /PS3/Ini/IniFile.h | bbb83daeb4b55d590f62760aa633ad85a31235e5 | []
| no_license | wsz8/ps3sx | aae188451b93398795e98c1fbdad2a2163f3cfd1 | 06fe64c85acb406676d3cff8889736db8d6c749e | refs/heads/master | 2020-04-20T16:59:17.347699 | 2011-01-06T11:34:52 | 2011-01-06T11:34:52 | 34,731,825 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,497 | h | // Read an INI file into easy-to-access name/value pairs.
// inih and INIReader are released under the New BSD license (see LICENSE.txt).
// Go to the project home page for more info:
//
// http://code.google.com/p/inih/
#ifndef __INIREADER_H__
#define __INIREADER_H__
#include <map>
#include <string>
// Read an INI file into easy-to-access name/value pairs. (Note that I've gone
// for simplicity here rather than speed, but it should be pretty decent.)
class INIReader
{
public:
// Construct INIReader and parse given filename. See ini.h for more info
// about the parsing.
INIReader(std::string filename);
// Return the result of ini_parse(), i.e., 0 on success, line number of
// first error on parse error, or -1 on file open error.
int ParseError();
// Get a string value from INI file, returning default_value if not found.
std::string Get(std::string section, std::string name,
std::string default_value);
// Get an integer (long) value from INI file, returning default_value if
// not found.
long GetInteger(std::string section, std::string name, long default_value);
private:
int _error;
std::map<std::string, std::string> _values;
static std::string MakeKey(std::string section, std::string name);
static int ValueHandler(void* user, const char* section, const char* name,
const char* value);
};
#endif // __INIREADER_H__
| [
"[email protected]@34f3eeab-e43a-e0a5-f347-2cf37759d9c2"
]
| [
[
[
1,
44
]
]
]
|
350d552c9876972cadd45f694bd508525605d9aa | eb0b8f9d3bb244ad033c052041b8189e0c1ac461 | /iPhoneAugmentedVideo/Classes/NyARToolkitCPP-2.5.4/src/core/NyARContourPickup.cpp | 002b460dcf63d93af36dac2dc1228666ffc1cd98 | []
| no_license | nickthedude/iPhone-Stuff | 66bacc8eb89238b3f2852bb821348ecdad6fc590 | b85111dec18a4fbd98f81240f37bd5b5b8efe141 | refs/heads/master | 2021-01-01T17:16:30.540264 | 2010-12-14T17:07:19 | 2010-12-14T17:07:19 | null | 0 | 0 | null | null | null | null | SHIFT_JIS | C++ | false | false | 7,535 | cpp | /*
* PROJECT: NyARToolkitCPP
* --------------------------------------------------------------------------------
*
* The NyARToolkitCPP is C++ version NyARToolkit class library.
* Copyright (C)2008-2009 Ryo Iizuka
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For further information please contact.
* http://nyatla.jp/nyatoolkit/
* <airmail(at)ebony.plala.or.jp> or <nyatla(at)nyatla.jp>
*
*/
#include "nyarcore.h"
#include "NyARContourPickup.h"
#include "NyAR_types.h"
#include "INyARPca2d.h"
#include "NyARLabelingImage.h"
#include "NyARBinRaster.h"
namespace NyARToolkitCPP
{
//巡回参照できるように、テーブルを二重化
// 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6
const static int _getContour_xdir[15] = { 0, 1, 1, 1, 0,-1,-1,-1 , 0, 1, 1, 1, 0,-1,-1};
const static int _getContour_ydir[15] = {-1,-1, 0, 1, 1, 1, 0,-1 ,-1,-1, 0, 1, 1, 1, 0};
int NyARContourPickup::getContour(const NyARBinRaster& i_raster,int i_entry_x,int i_entry_y,int i_array_size,int* o_coord_x,int* o_coord_y)const
{
const int* xdir = _getContour_xdir;// static int xdir[8] = { 0, 1, 1, 1, 0,-1,-1,-1};
const int* ydir = _getContour_ydir;// static int ydir[8] = {-1,-1, 0, 1, 1, 1, 0,-1};
int* i_buf=(int*)i_raster.getBuffer();
int width=i_raster.getWidth();
int height=i_raster.getHeight();
//クリップ領域の上端に接しているポイントを得る。
int coord_num = 1;
o_coord_x[0] = i_entry_x;
o_coord_y[0] = i_entry_y;
int dir = 5;
int c = i_entry_x;
int r = i_entry_y;
for (;;) {
dir = (dir + 5) % 8;//dirの正規化
//ここは頑張ればもっと最適化できると思うよ。
//4隅以外の境界接地の場合に、境界チェックを省略するとかね。
if(c>=1 && c<width-1 && r>=1 && r<height-1){
for(;;){//gotoのエミュレート用のfor文
//境界に接していないとき
if (i_buf[(r + ydir[dir])*width+(c + xdir[dir])] == 0) {
break;
}
dir++;
if (i_buf[(r + ydir[dir])*width+(c + xdir[dir])] == 0) {
break;
}
dir++;
if (i_buf[(r + ydir[dir])*width+(c + xdir[dir])] == 0) {
break;
}
dir++;
if (i_buf[(r + ydir[dir])*width+(c + xdir[dir])] == 0) {
break;
}
dir++;
if (i_buf[(r + ydir[dir])*width+(c + xdir[dir])] == 0) {
break;
}
dir++;
if (i_buf[(r + ydir[dir])*width+(c + xdir[dir])] == 0) {
break;
}
dir++;
if (i_buf[(r + ydir[dir])*width+(c + xdir[dir])] == 0) {
break;
}
dir++;
if (i_buf[(r + ydir[dir])*width+(c + xdir[dir])] == 0) {
break;
}
/*
try{
BufferedImage b=new BufferedImage(width,height,ColorSpace.TYPE_RGB);
NyARRasterImageIO.copy(i_raster, b);
ImageIO.write(b,"png",new File("bug.png"));
}catch(Exception e){
}*/
//8方向全て調べたけどラベルが無いよ?
throw NyARException();
}
}else{
//境界に接しているとき
int i;
for (i = 0; i < 8; i++){
const int x=c + xdir[dir];
const int y=r + ydir[dir];
//境界チェック
if(x>=0 && x<width && y>=0 && y<height){
if (i_buf[(y)*width+(x)] == 0) {
break;
}
}
dir++;//倍長テーブルを参照するので問題なし
}
if (i == 8) {
//8方向全て調べたけどラベルが無いよ?
throw NyARException();// return(-1);
}
}
dir=dir% 8;//dirの正規化
// xcoordとycoordをc,rにも保存
c = c + xdir[dir];
r = r + ydir[dir];
o_coord_x[coord_num] = c;
o_coord_y[coord_num] = r;
// 終了条件判定
if (c == i_entry_x && r == i_entry_y){
coord_num++;
break;
}
coord_num++;
if (coord_num == i_array_size) {
//輪郭が末端に達した
return coord_num;
}
}
return coord_num;
}
int NyARContourPickup::getContour(const NyARLabelingImage& i_raster,int i_entry_x,int i_entry_y,int i_array_size,int* o_coord_x,int* o_coord_y)const
{
const int* xdir = _getContour_xdir;// static int xdir[8] = { 0, 1, 1, 1, 0,-1,-1,-1};
const int* ydir = _getContour_ydir;// static int ydir[8] = {-1,-1, 0, 1, 1, 1, 0,-1};
const int* i_buf=(const int*)i_raster.getBuffer();
const int width=i_raster.getWidth();
const int height=i_raster.getHeight();
//クリップ領域の上端に接しているポイントを得る。
int sx=i_entry_x;
int sy=i_entry_y;
int coord_num = 1;
o_coord_x[0] = sx;
o_coord_y[0] = sy;
int dir = 5;
int c = o_coord_x[0];
int r = o_coord_y[0];
for (;;) {
dir = (dir + 5) % 8;//dirの正規化
//ここは頑張ればもっと最適化できると思うよ。
//4隅以外の境界接地の場合に、境界チェックを省略するとかね。
if(c>=1 && c<width-1 && r>=1 && r<height-1){
for(;;){//gotoのエミュレート用のfor文
//境界に接していないとき
if (i_buf[(r + ydir[dir])*width+(c + xdir[dir])] > 0) {
break;
}
dir++;
if (i_buf[(r + ydir[dir])*width+(c + xdir[dir])] > 0) {
break;
}
dir++;
if (i_buf[(r + ydir[dir])*width+(c + xdir[dir])] > 0) {
break;
}
dir++;
if (i_buf[(r + ydir[dir])*width+(c + xdir[dir])] > 0) {
break;
}
dir++;
if (i_buf[(r + ydir[dir])*width+(c + xdir[dir])] > 0) {
break;
}
dir++;
if (i_buf[(r + ydir[dir])*width+(c + xdir[dir])] > 0) {
break;
}
dir++;
if (i_buf[(r + ydir[dir])*width+(c + xdir[dir])] > 0) {
break;
}
dir++;
if (i_buf[(r + ydir[dir])*width+(c + xdir[dir])] > 0) {
break;
}
//8方向全て調べたけどラベルが無いよ?
throw NyARException();
}
}else{
//境界に接しているとき
int i;
for (i = 0; i < 8; i++){
const int x=c + xdir[dir];
const int y=r + ydir[dir];
//境界チェック
if(x>=0 && x<width && y>=0 && y<height){
if (i_buf[(y)*width+(x)] > 0) {
break;
}
}
dir++;//倍長テーブルを参照するので問題なし
}
if (i == 8) {
//8方向全て調べたけどラベルが無いよ?
throw NyARException();// return(-1);
}
}
dir=dir% 8;//dirの正規化
// xcoordとycoordをc,rにも保存
c = c + xdir[dir];
r = r + ydir[dir];
o_coord_x[coord_num] = c;
o_coord_y[coord_num] = r;
// 終了条件判定
if (c == sx && r == sy){
coord_num++;
break;
}
coord_num++;
if (coord_num == i_array_size) {
//輪郭が末端に達した
return coord_num;
}
}
return coord_num;
}
}
| [
"[email protected]"
]
| [
[
[
1,
250
]
]
]
|
eead3427bba8a9498275b7bffa469d70d2d828c8 | c95a83e1a741b8c0eb810dd018d91060e5872dd8 | /Game/ClientShellDLL/ClientShellShared/BaseParticleSystemFX.h | cf309ee73381bdf05a3931eff77829e348004e5c | []
| no_license | rickyharis39/nolf2 | ba0b56e2abb076e60d97fc7a2a8ee7be4394266c | 0da0603dc961e73ac734ff365bfbfb8abb9b9b04 | refs/heads/master | 2021-01-01T17:21:00.678517 | 2011-07-23T12:11:19 | 2011-07-23T12:11:19 | 38,495,312 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,554 | h | // ----------------------------------------------------------------------- //
//
// MODULE : BaseParticleSystemFX.h
//
// PURPOSE : BaseParticleSystem special fx class - Definition
//
// CREATED : 10/21/97
//
// (c) 1997-2000 Monolith Productions, Inc. All Rights Reserved
//
// ----------------------------------------------------------------------- //
#ifndef __BASE_PARTICLE_SYSTEM_FX_H__
#define __BASE_PARTICLE_SYSTEM_FX_H__
#include "SpecialFX.h"
#define PSFX_DEFAULT_GRAVITY -500
#define PSFX_DEFAULT_RADIUS 500
struct BPSCREATESTRUCT : public SFXCREATESTRUCT
{
BPSCREATESTRUCT();
LTBOOL bRelToCameraPos;
LTFLOAT fInnerCamRadius;
LTFLOAT fOuterCamRadius;
LTBOOL bAdditive;
LTBOOL bMultiply;
LTBOOL bClientControlsPos;
LTBOOL bAdjustParticleAlpha;
LTBOOL bAdjustParticleScale;
LTFLOAT fStartParticleScale;
LTFLOAT fEndParticleScale;
LTFLOAT fStartParticleAlpha;
LTFLOAT fEndParticleAlpha;
};
inline BPSCREATESTRUCT::BPSCREATESTRUCT()
{
bRelToCameraPos = LTFALSE;
fInnerCamRadius = 0.0f;
fOuterCamRadius = 0.0f;
bAdditive = LTFALSE;
bMultiply = LTFALSE;
bClientControlsPos = LTFALSE;
bAdjustParticleAlpha = LTFALSE;
bAdjustParticleScale = LTFALSE;
fStartParticleScale = 0.0f;
fEndParticleScale = 0.0f;
fStartParticleAlpha = 0.0f;
fEndParticleAlpha = 0.0f;
}
class CBaseParticleSystemFX : public CSpecialFX
{
public :
CBaseParticleSystemFX() : CSpecialFX()
{
m_pTextureName = LTNULL;
m_fGravity = PSFX_DEFAULT_GRAVITY;
m_fRadius = PSFX_DEFAULT_RADIUS;
m_dwFlags = 0;
m_fColorScale = 1.0f;
m_vRotAmount.Init();
m_vRotVel.Init();
m_vPos.Init();
m_vPosOffset.Init();
m_vColorRange.Init();
m_vColor1.Init(255.0f, 255.0f, 255.0f);
m_vColor2.Init( 255.0f, 255.0f, 255.0f);
m_rRot.Init();
}
virtual LTBOOL Init(HLOCALOBJ hServObj, ILTMessage_Read *pMsg)
{
return CSpecialFX::Init(hServObj, pMsg);
}
virtual LTBOOL Init(SFXCREATESTRUCT* psfxCreateStruct);
virtual LTBOOL Update();
virtual LTBOOL CreateObject(ILTClient* pClientDE);
protected :
const char* m_pTextureName; // Name of the particle texture
LTFLOAT m_fGravity; // Gravity of particle system
LTFLOAT m_fRadius; // Radius of particle system
uint32 m_dwFlags; // Particle system setup flags
LTFLOAT m_fColorScale; // System starting color scale
LTVector m_vPos; // Particle system initial pos
LTRotation m_rRot; // Particle system ininial rotation
LTVector m_vRotAmount; // Amount to rotate
LTVector m_vRotVel; // Rotation velocity
LTVector m_vPosOffset; // Our position offset from server object
LTVector m_vColor1; // Low color value
LTVector m_vColor2; // Low high color value
LTVector m_vColorRange; // Range of particle colors
BPSCREATESTRUCT m_basecs; // Create struct
virtual LTBOOL SetupSystem();
virtual void GetRandomColorInRange(LTVector & vColor);
virtual int GetNumParticles(int nNumParticles);
virtual void RemoveAllParticles();
};
#endif // __BASE_PARTICLE_SYSTEM_FX_H__ | [
"[email protected]"
]
| [
[
[
1,
112
]
]
]
|
e76cc4398a586f0769c913c3c7b6df12700a3042 | 1bbd5854d4a2efff9ee040e3febe3f846ed3ecef | /src/scrview/host.cpp | b5e98e5648a85d43be2432a9fd43e3f20b65c6a2 | []
| no_license | amanuelg3/screenviewer | 2b896452a05cb135eb7b9eb919424fe6c1ce8dd7 | 7fc4bb61060e785aa65922551f0e3ff8423eccb6 | refs/heads/master | 2021-01-01T18:54:06.167154 | 2011-12-21T02:19:10 | 2011-12-21T02:19:10 | 37,343,569 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 749 | cpp | #include "host.h"
#include "server.h"
Host::Host(int w, int h, QString format) {
this->w = w;
this->h = h;
this->format = format;
scrMutex = new QMutex();
mouseMutex = new QMutex();
serv = new Server(scrMutex, mouseMutex, this);
scrProcess = new ScrMaker(scrMutex, serv, w, h, format);
mouseProcess = new MouseDataCollector(mouseMutex, serv);
serv->listen(QHostAddress::Any, 4200);
}
void Host::run() {
scrProcess->start();
mouseProcess->start();
while (isClient) {
//cheeck if connection is not dropped
}
mouseProcess->stop();
scrProcess->stop();
scrMutex->unlock();
mouseMutex->unlock();
mouseProcess->wait();
scrProcess->wait();
}
| [
"JuliusR@localhost"
]
| [
[
[
1,
28
]
]
]
|
7bef211fb454f3a5fd257746f8d7543aca9e6292 | 1dba10648f60dea02c9be242c668f3488ae8dec4 | /program/src/modwidget.cpp | d35f12f57ec63e4f637868b1bf1fda69a548b54a | []
| no_license | hateom/si-air | f02ffc8ba9fac9777d12a40627f06044c92865f0 | 2094c98a04a6785078b4c8bcded8f8b4450c8b92 | refs/heads/master | 2021-01-15T17:42:12.887029 | 2007-01-21T17:48:48 | 2007-01-21T17:48:48 | 32,139,237 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,513 | cpp | #include "modwidget.h"
#include <qpushbutton.h>
#include <qlineedit.h>
#include <qcheckbox.h>
#include <qapp.h>
#include "optform.h"
#include "mp_logger.h"
#include "module_mgr.h"
#include "main_buttons.h"
//////////////////////////////////////////////////////////////////////////
modWidget::modWidget( long new_id, moduleBase * mod, OptionsBox * opt_f,
QWidget * parent, const char * name ) :
id(new_id), module(mod), QGroupBox( parent, name ), opt_form(opt_f),
del_btn( (const char**) btn2_data ), cfg_btn((const char**) btn0_data),
prv_btn( (const char**) btn5_data )
{
edit_name = new QLineEdit( this, "editname" );
edit_name->setGeometry( QRect( 10, 10, 180, 25 ) );
check_prev = new QPushButton( this, "checkPrev" );
check_prev->setGeometry( QRect( 205, 10, 30, 25 ) );
check_prev->setPixmap( prv_btn );
check_prev->setToggleButton( true );
check_prev->setBackgroundColor( QColor( 244, 244, 244 ) );
button_conf = new QPushButton( this, "buttonConf" );
button_conf->setGeometry( QRect( 245, 10, 25, 25 ) );
button_conf->setPixmap( cfg_btn );
button_conf->setBackgroundColor( QColor( 244, 244, 244 ) );
button_del = new QPushButton( this, "buttonDel" );
button_del->setGeometry( QRect( 275, 10, 25, 25 ) );
button_del->setPixmap( del_btn );
button_del->setBackgroundColor( QColor( 244, 244, 244 ) );
connect( button_conf, SIGNAL(clicked()), this, SLOT(configure_mod()) );
connect( button_del, SIGNAL(clicked()), this, SLOT(rm_mod()) );
connect( check_prev, SIGNAL(clicked()), this, SLOT(preview_changed()) );
/*
int check;
if( module->get_param( "preview_param", &check ) == 0 && check == 1 )
{
//check_prev->setChecked( true );
check_prev->setOn( true );
setPaletteBackgroundColor( QColor( 220, 255, 220 ) );
}
else
{
//check_prev->setChecked( false );
check_prev->setOn( false );
setPaletteBackgroundColor( QColor( 255, 220, 220 ) );
}
*/
update_prev();
language_changed();
resize( QSize( 310, 40 ) );
}
//////////////////////////////////////////////////////////////////////////
modWidget::~modWidget()
{
}
//////////////////////////////////////////////////////////////////////////
void modWidget::language_changed()
{
// button_conf->setText( tr("Cfg") );
// button_del->setText( tr("Del") );
// check_prev->setText( tr("Prv") );
edit_name->setText( tr( module->get_module_description() ) );
}
//////////////////////////////////////////////////////////////////////////
void modWidget::update_prev()
{
int par;
if( module->get_param( "preview_param", &par ) != 0 ) return;
if( par )
{
check_prev->setOn( true );
setPaletteBackgroundColor( QColor( 220, 255, 220 ) );
}
else
{
setPaletteBackgroundColor( QColor( 255, 220, 220 ) );
check_prev->setOn( false );
}
}
//////////////////////////////////////////////////////////////////////////
void modWidget::preview_changed()
{
mb_param * par;
par = module->find_param( "preview_param" );
if( !par ) return;
//if( check_prev->isChecked() )
if( check_prev->isOn() )
{
//*((int*)(par->data)) = 1;
module->set_param( "preview_param", 1 );
setPaletteBackgroundColor( QColor( 220, 255, 220 ) );
sModuleMgr->switch_preview( module, 1 );
}
else
{
//*((int*)(par->data)) = 0;
module->set_param( "preview_param", 0 );
setPaletteBackgroundColor( QColor( 255, 220, 220 ) );
sModuleMgr->switch_preview( module, 0 );
}
}
//////////////////////////////////////////////////////////////////////////
void modWidget::rm_mod()
{
if( sModuleMgr->remove_module( module ) == ST_OK )
{
close( true );
}
}
//////////////////////////////////////////////////////////////////////////
void modWidget::configure_mod()
{
OptForm * optForm;
opt_form->remove_last_cfg_form();
// optForm = new OptForm( module, opt_form );
optForm = new OptForm( module, opt_form->viewport() );
opt_form->set_current_cfg_form( optForm );
// optForm->setGeometry( QRect( 5, 15, 250, 320 ) );
// sview->addChild( optForm );
opt_form->addChild( optForm/*, 0, 34*/ );
optForm->show();
qApp->processEvents();
}
//////////////////////////////////////////////////////////////////////////
bool modWidget::has_preview()
{
if( check_prev != NULL )
{
return( check_prev->isOn() );
//return( check_prev->isChecked() );
}
return( false );
}
//////////////////////////////////////////////////////////////////////////
| [
"tomasz.huczek@9b5b1781-be22-0410-ac8e-a76ce1d23082"
]
| [
[
[
1,
167
]
]
]
|
1806759ffb87fd59beb706c4f88fcda7da912dba | 9c62af23e0a1faea5aaa8dd328ba1d82688823a5 | /rl/trunk/engine/rules/src/StepRecognitionMovement.cpp | bfd1779d1d15257e15f4bb3baeb0ea200a0fac73 | [
"ClArtistic",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
]
| permissive | jacmoe/dsa-hl-svn | 55b05b6f28b0b8b216eac7b0f9eedf650d116f85 | 97798e1f54df9d5785fb206c7165cd011c611560 | refs/heads/master | 2021-04-22T12:07:43.389214 | 2009-11-27T22:01:03 | 2009-11-27T22:01:03 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,952 | cpp | /* This source file is part of Rastullahs Lockenpracht.
* Copyright (C) 2003-2008 Team Pantheon. http://www.team-pantheon.de
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the Clarified Artistic License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* Clarified Artistic License for more details.
*
* You should have received a copy of the Clarified Artistic License
* along with this program; if not you can get it here
* http://www.jpaulmorrison.com/fbp/artistic2.htm.
*/
#include "stdinc.h" //precompiled header
#include "StepRecognitionMovement.h"
using namespace std;
using namespace Ogre;
/// @todo: use TriggerVolumes
// void NewtonCollisionSetAsTriggerVolume(const NewtonCollision* convexCollision, int trigger);
namespace rl
{
StepRecognitionMovement::StepRecognitionMovement(CreatureController *creature) :
AbstractMovement(creature),
mMoveToNextTarget(false)
{
mLinearSpringK = 600.0f;
Real relationCoefficient = 1.2f;
mLinearDampingK = relationCoefficient * 2.0f * Math::Sqrt(mLinearSpringK);
}
void StepRecognitionMovement::activate()
{
AbstractMovement::activate();
mMoveToNextTarget = false;
}
void StepRecognitionMovement::deactivate()
{
AbstractMovement::deactivate();
}
bool StepRecognitionMovement::calculateBaseVelocity(Real &velocity)
{
velocity = 0.0f;
return isPossible();
}
bool StepRecognitionMovement::isPossible() const
{
return
mMovingCreature->getAbstractLocation() == CreatureController::AL_FLOOR &&
mMovingCreature->getCreature()->getAu() > 0 &&
!(mMovingCreature->getCreature()->getLifeState() & (Effect::LS_IMMOBILE));
}
void StepRecognitionMovement::calculateForceAndTorque(Vector3 &force, Vector3 &torque, Real timestep)
{
// move to nextTarget
if( mMoveToNextTarget )
{
Real mass;
Vector3 inertia;
OgreNewt::Body *body = mMovingCreature->getCreature()->getActor()->getPhysicalThing()->_getBody();
body->getMassMatrix(mass, inertia);
Vector3 pos = mMovingCreature->getCreature()->getPosition();
Vector3 diff = mNextTarget - pos;
Vector3 vel = body->getVelocity();
force.y = mass*( mLinearSpringK*diff.y - mLinearDampingK*vel.y );
std::ostringstream oss;
oss << "Step-Recognition: diff: " << diff.y << " vel: " << vel.y << " Step force: " << force.y;
oss << " DiffToTarget: " <<
mMovingCreature->getCreature()->getOrientation().Inverse() *
(mNextTarget - mMovingCreature->getCreature()->getPosition());
LOG_MESSAGE(Logger::RULES, oss.str());
}
}
bool StepRecognitionMovement::run(Ogre::Real elapsedTime, Ogre::Vector3 direction, Ogre::Vector3 rotation)
{
Vector3 vel = mMovingCreature->getCreature()->getActor()->getPhysicalThing()->getVelocity();
Real velY = vel.y;
vel.y = 0;
// raycast in the direction we should move to
Vector3 globalDir = mMovingCreature->getCreature()->getOrientation() * direction; // the direction in global space
if( globalDir == Vector3::ZERO )
return true;
// the materials that are triggered here
PhysicsMaterialRaycast::MaterialVector materialVector;
materialVector.push_back(PhysicsManager::getSingleton().getMaterialID("character")); // should we perhaps only use level here?
materialVector.push_back(PhysicsManager::getSingleton().getMaterialID("camera"));
// first of all check if we are not standing in front of a wall or sth like this
PhysicalThing *thing = mMovingCreature->getCreature()->getActor()->getPhysicalThing();
Real height = thing->_getBody()->getCollision()->getAABB().getSize().y;
Vector3 start = mMovingCreature->getCreature()->getPosition() + Vector3(0,height/2,0);
Vector3 end = start + globalDir * 0.5;
RaycastInfo info;
info = mRaycast.execute(
PhysicsManager::getSingleton()._getNewtonWorld(),
&materialVector,
start,
end,
true);
if(info.mBody)
{
mMoveToNextTarget = false;
return false;
}
if( !mMoveToNextTarget ) // check if we need to move up for a step
{
Real raylen = vel.length() / 3; // use longer ray, if higher velocity
if ( raylen < 0.5 )
raylen = 0.4;
//std::ostringstream oss;
//oss << "StepRecognition Raylen: " << raylen;
//LOG_MESSAGE(Logger::RULES, oss.str());
// raycasts
Vector3 start = mMovingCreature->getCreature()->getPosition() + Vector3::UNIT_Y * 0.1f;
globalDir.y = 0;
globalDir.normalise();
Vector3 end = start + globalDir*raylen;
bool foundbody = false;
Real foundDistance = 0;
RaycastInfo info;
do
{
info =
mRaycast.execute(
PhysicsManager::getSingleton()._getNewtonWorld(),
&materialVector,
start, end, true);
// do we need to check bodies left and right of this ray? (step width?)
// already found nearer body
if( foundbody )
{
if( info.mBody && (info.mDistance*raylen >= foundDistance*raylen + 0.19) || // step deep enough
!info.mBody )
{
// found a step
mMoveToNextTarget = true;
mNextTarget = start + globalDir*raylen*foundDistance + 0.1 * globalDir;
std::ostringstream oss;
Vector3 stepInLocalCoords = mNextTarget - mMovingCreature->getCreature()->getPosition();
Quaternion ori = mMovingCreature->getCreature()->getOrientation();
stepInLocalCoords = ori.Inverse() * stepInLocalCoords;
oss << "Step-Recognition: Next Step: " << stepInLocalCoords;
LOG_MESSAGE(Logger::RULES, oss.str());
break;
}
}
if( info.mBody )
{
foundbody = true;
foundDistance = info.mDistance;
}
start += Vector3::UNIT_Y * 0.05f;
end += Vector3::UNIT_Y * 0.05f;
}
while( info.mBody && (start - mMovingCreature->getCreature()->getPosition()).y <= 0.5 );
}
// check if the target is still needed
// perform check also to verify found step
if( mMoveToNextTarget )
{
Vector3 diffToTarget = mNextTarget - mMovingCreature->getCreature()->getPosition();
Real diffToTargetY = diffToTarget.y;
diffToTarget.y = 0;
// different direction
Vector3 globalDir = mMovingCreature->getCreature()->getOrientation() * direction; // the direction in global space
globalDir.y = 0;
if( globalDir == Vector3::ZERO )
{
mMoveToNextTarget = false;
LOG_MESSAGE(Logger::RULES, "Testing Step-Recognition: Step direction null");
return false;
}
// target reached
if( diffToTarget.squaredLength() < 0.01)
{
mMoveToNextTarget = false;
LOG_MESSAGE(Logger::RULES, "Testing Step-Recognition: Step reached");
return false;
}
// different direction
Quaternion oriDiff = diffToTarget.getRotationTo(globalDir, Vector3::UNIT_Y);
Degree angleDiff;
Vector3 axis = Vector3::UNIT_Y;
oriDiff.ToAngleAxis(angleDiff, axis);
Real f = angleDiff.valueDegrees();
//std::ostringstream oss;
//oss << "Step-Recognition: angle: " << f << " axis: " << axis;
//LOG_MESSAGE(Logger::RULES, oss.str());
//if( !diffToTarget.directionEquals(globalDir, Degree(15)) )
if( f > 2.0f )
{
mMoveToNextTarget = false;
//LOG_MESSAGE(Logger::RULES, "Testing Step-Recognition: Step direction wrong");
return false;
}
// already above target, but slow velocity
if( diffToTargetY < 0 && fabs(velY) < 0.01 )
{
mMoveToNextTarget = false;
//LOG_MESSAGE(Logger::RULES, "Testing Step-Recognition: slow and abov target-height!");
return false;
}
}
return mMoveToNextTarget;
}
bool StepRecognitionMovement::isDirectionPossible(Ogre::Vector3 &direction) const
{
Vector3 oldDirection(direction);
direction = Vector3::ZERO;
return oldDirection == Vector3::ZERO;
}
bool StepRecognitionMovement::isRotationPossible(Ogre::Vector3 &rotation) const
{
Vector3 oldRotation(rotation);
rotation = Vector3::ZERO;
return oldRotation == Vector3::ZERO;
}
}
| [
"melven@4c79e8ff-cfd4-0310-af45-a38c79f83013"
]
| [
[
[
1,
266
]
]
]
|
cb3a35ab7ded5b176ef6af113b7fd581560337bd | bef7d0477a5cac485b4b3921a718394d5c2cf700 | /dingus/dingus/gfx/ModelDesc.h | c544738b6c153e4fec36fb240851992da5a275c4 | [
"MIT"
]
| permissive | TomLeeLive/aras-p-dingus | ed91127790a604e0813cd4704acba742d3485400 | 22ef90c2bf01afd53c0b5b045f4dd0b59fe83009 | refs/heads/master | 2023-04-19T20:45:14.410448 | 2011-10-04T10:51:13 | 2011-10-04T10:51:13 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,587 | h | // --------------------------------------------------------------------------
// Dingus project - a collection of subsystems for game/graphics applications
// --------------------------------------------------------------------------
#ifndef __GFX_MODEL_DESC_H
#define __GFX_MODEL_DESC_H
#include "../renderer/EffectParams.h"
#include "../resource/ResourceId.h"
#include "../utils/MemoryPool.h"
namespace dingus {
class CEffectParams;
// --------------------------------------------------------------------------
class CModelDesc : public boost::noncopyable {
public:
struct SParams {
public:
typedef std::pair<std::string,std::string> TNameIDPair;
typedef std::pair<std::string,SVector3> TNameVec3Pair;
typedef std::pair<std::string,SVector4> TNameVec4Pair;
typedef std::pair<std::string,float> TNameFloatPair;
typedef fastvector<TNameIDPair> TNameIDVector;
typedef fastvector<TNameVec3Pair> TNameVec3Vector;
typedef fastvector<TNameVec4Pair> TNameVec4Vector;
typedef fastvector<TNameFloatPair> TNameFloatVector;
public:
SParams() { }
SParams( const SParams& rhs );
const SParams& operator=( const SParams& rhs );
public:
TNameIDVector textures;
TNameIDVector cubemaps;
TNameIDVector stextures;
TNameVec3Vector vectors3;
TNameVec4Vector vectors4;
TNameFloatVector floats;
};
public:
CModelDesc( const CResourceId& meshID );
const CResourceId& getMeshID() const { return mMeshID; }
void setMeshID( const CResourceId& mid ) { mMeshID = mid; }
void addGroup( int renderPriority, const CResourceId& fxID );
void clearGroups() { mGroups.clear(); }
void addParamTexture( int group, const std::string& name, const std::string& value );
void addParamCubemap( int group, const std::string& name, const std::string& value );
void addParamSTexture( int group, const std::string& name, const std::string& value );
void addParamVec3( int group, const std::string& name, const SVector3& value );
void addParamVec4( int group, const std::string& name, const SVector4& value );
void addParamFloat( int group, const std::string& name, float value );
int getGroupCount() const;
const CResourceId& getFxID( int group ) const;
int getRenderPriority( int group ) const;
const SParams& getParams( int group ) const;
void fillFxParams( int group, CEffectParams& dest ) const;
private:
struct SGroup {
public:
SGroup( const CResourceId& fx, int rpri ) : fxID(fx), renderPriority(rpri) { }
SGroup( const SGroup& rhs );
const SGroup& operator=( const SGroup& rhs );
public:
SParams params;
CResourceId fxID;
int renderPriority;
};
typedef fastvector<SGroup> TGroupsVector;
private:
DECLARE_POOLED_ALLOC(dingus::CModelDesc);
private:
CResourceId mMeshID;
TGroupsVector mGroups;
};
// --------------------------------------------------------------------------
inline CModelDesc::CModelDesc( const CResourceId& meshID )
: mMeshID( meshID )
{
}
inline int CModelDesc::getGroupCount() const
{
return (int)mGroups.size();
}
inline int CModelDesc::getRenderPriority( int group ) const
{
assert(group>=0&&group<getGroupCount());
return mGroups[group].renderPriority;
}
inline const CResourceId& CModelDesc::getFxID( int group ) const
{
assert(group>=0&&group<getGroupCount());
return mGroups[group].fxID;
}
inline const CModelDesc::SParams& CModelDesc::getParams( int group ) const
{
assert(group>=0&&group<getGroupCount());
return mGroups[group].params;
}
}; // namespace
#endif
| [
"[email protected]"
]
| [
[
[
1,
119
]
]
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.