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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
af32f6ba3b649cec89489f6b0db80e9d86cd21ff | 1033609e705e0b432f8a0760d32befa92c2b9cb5 | /trunk/singleton.h | 1af82979e5bb5b0bc306a4977a86954c7a265a0e | []
| no_license | BackupTheBerlios/cb-svn-svn | 5b89c2c5445cf7a51575cf08c0eaaf832074b266 | 6b512f58bbb56fbc186ca26d5c934e1fe83173af | refs/heads/master | 2020-04-02T00:14:00.063607 | 2005-10-26T13:52:08 | 2005-10-26T13:52:08 | 40,614,579 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 811 | h | /*
* This file is part of the Code::Blocks SVN Plugin
* Copyright (C) 2005 Thomas Denk
* (actually, this specific class is borrowed from an older project, so should be more like (c) 2001)
*
* This program is licensed 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.
*
* $HeadURL$
* $Id$
*/
#ifndef __SINGLETON_H__
#define __SINGLETON_H__
template <typename T>
class Singleton
{
public:
static T* Instance()
{
static T instance;
return &instance;
};
protected:
Singleton()
{}
;
virtual ~Singleton()
{}
;
private:
Singleton(const Singleton& source)
{}
;
};
#endif
| [
"thomasdenk@96b225bb-4cfa-0310-88f5-88b948d20ad7"
]
| [
[
[
1,
43
]
]
]
|
76903a7889c900722a475b0160358b9777ac0677 | ef635cec76312aacc67e7df87db7084a455be2ea | /servotube_driver/servotube_driver.cpp | b93a38d3866a392b04a9ea4bc0fd328bdd8960f6 | []
| no_license | jsteinha/Water-Tunnel | 200161d2bb5d6bcdfd62e9c432df1c5f418d9e2e | 556842dd4ee38fabe8ba303e280cf01bf89fa9a9 | refs/heads/master | 2016-09-08T02:01:50.631983 | 2010-09-15T19:33:32 | 2010-09-15T19:33:32 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,479 | cpp | #include "servotube_driver.h"
#include <fstream>
#include <time.h>
#include <stdlib.h>
#include <iostream>
#using <system.dll>
//lcm
static lcmt_hcp_u_subscription_t * sub;
static lcm_t * lcm;
static int commandType = 1;
static double commandVal= 0.0;
static int final_iter = 0;
//end lcm
enum operationStateTypes{ executeLCMCommand, recenter, idle, finishAndTerminate};
clock_t lastCommandClock;
double allowableCommandWait = .1;
static double dt = .001/ServoTube::speedVkhz;
static const double omega=4.7385;
static double Etilde; //unitless energy error
static operationStateTypes parseLCMCommand(int curCommType, double curCommVal, ServoTube* CartPole);
static double recenterAccelGen(double x, double xd);
static bool nearEnoughToZero(ServoTube* CartPole);
ServoTube* CartPole;
KvaserCAN* kvaserCANbus;
const char *canDevice = "kvaser0"; // Identifies the CAN device, if necessary
using namespace System;
using namespace System::Timers;
static clock_t previousClock;
static clock_t curClock;
static clock_t firstClock;
static HANDLE lcm_watcher_thread;
static unsigned lcm_watcher_thread_ID;
static HANDLE mutex = CreateMutex(NULL, true, "wt_command_mutex");
static double deltaT=0.0;
static double measurements[2]; //store encoder measurements to send to state estimator
static int iter = 0;
static double finishingWaitTime=3;
static bool keepRunning = true;
static operationStateTypes operatingState;
static double curCommVal = 0.0;
static int curCommType = 1;
lcmt_hcp_y myState;
public ref class Timer1
{
private:
static System::Timers::Timer^ aTimer;
public:
static void BeginTimerExecution()
{
// Create a new Timer with Interval set to 10 seconds.
aTimer = gcnew System::Timers::Timer( 10000 );
// Hook up the Elapsed event for the timer.
aTimer->Elapsed += gcnew ElapsedEventHandler( Timer1::OnTimedEvent );
aTimer->Interval = 1;
aTimer->Enabled = true;
}
private:
// Specify what you want to happen when the Elapsed event is
// raised.
static void OnTimedEvent( Object^ source, ElapsedEventArgs^ e )
{
iter++;
//get positions from amp
CartPole->update();
measurements[0]=CartPole->get_motor_pos();
measurements[1]=CartPole->get_load_enc_pos();
//printf("Pos: %f %f\n",measurements[0],measurements[1]);
//set current clock and send measurements
curClock = clock();
myState.y = measurements[0];
myState.theta = measurements[1];
send_message (lcm, &myState);
//read in command if not finishing
if(operatingState != finishAndTerminate && operatingState != recenter)
{
if(WaitForSingleObject(mutex, 10000)==WAIT_TIMEOUT)
printf("MUTEX TIMEOUT ERROR 4\n");
else
{
bool gotRecentCommand = (1.0*(curClock-lastCommandClock))/CLOCKS_PER_SEC <= allowableCommandWait;
if( !gotRecentCommand && operatingState != idle && iter!= 1)
{
operatingState = idle;
printf("No command received for %f seconds. Idling...\n",allowableCommandWait);
}
if( ((1.0*(curClock-lastCommandClock))/CLOCKS_PER_SEC < allowableCommandWait) )
operatingState = executeLCMCommand;
curCommVal = commandVal;
curCommType = commandType;
}
ReleaseMutex(mutex);
}
switch(operatingState)
{
case executeLCMCommand:
operatingState = parseLCMCommand(curCommType,curCommVal,CartPole);
break;
case recenter:
if(nearEnoughToZero(CartPole))
{
CartPole->set_vel_command(0.0);
operatingState = idle;
}
else
CartPole->accelerate(recenterAccelGen(measurements[0], CartPole->get_motor_vel()));
break;
case idle:
if(abs(CartPole->get_motor_vel())<.02)
CartPole->set_vel_command(0.0);
else
CartPole->accelerate(-15*CartPole->get_motor_vel());
break;
case finishAndTerminate:
if(nearEnoughToZero(CartPole))
{
CartPole->set_vel_command(0.0);
keepRunning = false;
}
else
CartPole->accelerate(recenterAccelGen(measurements[0], CartPole->get_motor_vel()));
break;
default:
printf("Shouldn't get here!\n");
CartPole->accelerate(recenterAccelGen(measurements[0], CartPole->get_motor_vel()));
operatingState = finishAndTerminate;
break;
}
}
};
int main(int argc, char** argv)
{
lcm = lcm_create ("udpm://");
if (!lcm)
return 1;
lastCommandClock=clock();
mutex = CreateMutex(NULL, true, "wt_command_mutex");
ReleaseMutex(mutex);
lcm_watcher_thread =(HANDLE)_beginthreadex( NULL , 0,&lcm_watcher, lcm, 0, &lcm_watcher_thread_ID);
char userinput;
if(argc>1)
userinput = argv[1][0];
else
{
printf("STARTUP MENU \n\n");
printf("Select one of the options below: \n");
printf("[1] Begin operation\n");
printf("Enter command: ");
std::cin>>userinput;
printf("\n\n");
switch(userinput)
{
case '1':
//normal operation
break;
default:
printf("Command not understood. Turning off.\n\n");
return 0;
break;
}
}
//setup can connection
kvaserCANbus = new KvaserCAN( canDevice );
CartPole = new ServoTube(kvaserCANbus);
//wait till connection established to set initial clocks (curClock will be initialized in loop)
firstClock = clock();
previousClock = firstClock;
operatingState = executeLCMCommand;
Timer1::BeginTimerExecution();
while(keepRunning)//begin control loop
{
/*
iter++;
//get positions from amp
CartPole->update();
measurements[0]=CartPole->get_motor_pos();
measurements[1]=CartPole->get_load_enc_pos();
//printf("Pos: %f %f\n",measurements[0],measurements[1]);
//set current clock and send measurements
curClock = clock();
myState.y = measurements[0];
myState.theta = measurements[1];
send_message (lcm, &myState);
//read in command if not finishing
if(operatingState != finishAndTerminate && operatingState != recenter)
{
if(WaitForSingleObject(mutex, 10000)==WAIT_TIMEOUT)
printf("MUTEX TIMEOUT ERROR 4\n");
else
{
bool gotRecentCommand = (1.0*(curClock-lastCommandClock))/CLOCKS_PER_SEC <= allowableCommandWait;
if( !gotRecentCommand && operatingState != idle && iter!= 1)
{
operatingState = idle;
printf("No command received for %f seconds. Idling...\n",allowableCommandWait);
}
if( ((1.0*(curClock-lastCommandClock))/CLOCKS_PER_SEC < allowableCommandWait) )
operatingState = executeLCMCommand;
curCommVal = commandVal;
curCommType = commandType;
}
ReleaseMutex(mutex);
}
switch(operatingState)
{
case executeLCMCommand:
operatingState = parseLCMCommand(curCommType,curCommVal,CartPole);
break;
case recenter:
if(nearEnoughToZero(CartPole))
{
CartPole->set_vel_command(0.0);
operatingState = idle;
}
else
CartPole->accelerate(recenterAccelGen(measurements[0], CartPole->get_motor_vel()));
break;
case idle:
if(abs(CartPole->get_motor_vel())<.02)
CartPole->set_vel_command(0.0);
else
CartPole->accelerate(-15*CartPole->get_motor_vel());
break;
case finishAndTerminate:
if(nearEnoughToZero(CartPole))
{
CartPole->set_vel_command(0.0);
keepRunning = false;
}
else
CartPole->accelerate(recenterAccelGen(measurements[0], CartPole->get_motor_vel()));
break;
default:
printf("Shouldn't get here!\n");
CartPole->accelerate(recenterAccelGen(measurements[0], CartPole->get_motor_vel()));
operatingState = finishAndTerminate;
break;
}*/
}
CartPole->set_vel_command(0.0); //zero velocity on exit
return 0;
}
////////////////////////////
//Helper functions
////////////////////////////
static bool nearEnoughToZero(ServoTube* CartPole)
{
const double posThreshold = .0025; //m
const double velThreshold = .025; //m/s
return abs(CartPole->get_motor_vel())<velThreshold && abs(CartPole->get_motor_pos())<posThreshold;
}
static operationStateTypes parseLCMCommand(int curCommType, double curCommVal, ServoTube* CartPole)
{
switch(curCommType)
{
case 0:
printf("Recentering...\n");
return recenter;
break;
case 1:
CartPole->accelerate(curCommVal);
return executeLCMCommand;
break;
case 2:
CartPole->set_vel_command(curCommVal);
return executeLCMCommand;
break;
case -1:
printf("Stopping operation on terminate signal...\n");
return finishAndTerminate;
break;
default:
printf("LCM command not understood. Stopping operation...\n");
return finishAndTerminate;
break;
}
}
static double recenterAccelGen(double x, double xd)
{
return -15*x - 15*xd;
}
//LCM Code
unsigned __stdcall lcm_watcher(void *param)
{
sub = lcmt_hcp_u_subscribe (lcm, "hcp_u", &my_handler, NULL);
while(1)
{
//printf("Handling\n");
lcm_handle((lcm_t*) param);
}
_endthreadex(0);
return 0;
}
static void my_handler (const lcm_recv_buf_t *rbuf, const char * channel,
const lcmt_hcp_u * msg, void* user)
{
static HANDLE mutex = CreateMutex(NULL, false, "wt_command_mutex");
if(WaitForSingleObject(mutex, 10000)==WAIT_TIMEOUT)
{
printf("MUTEX TIMEOUT ERROR 3\n");
}
else
{
commandType= msg->commandType;
commandVal= msg->commandValue;
lastCommandClock = clock();
//printf("comVal: %f\n",commandVal);
}
ReleaseMutex(mutex);
}
static void send_message (lcm_t * lcm, lcmt_hcp_y* my_data)
{
lcmt_hcp_y_publish (lcm, "hcp_y", my_data);
} | [
"[email protected]"
]
| [
[
[
1,
382
]
]
]
|
90aebd8c40d382baa1c70b9720c775d7167185db | 191d4160cba9d00fce9041a1cc09f17b4b027df5 | /ZeroLag/ZeroLag/FileMd5Dlg.h | bb659e7b0463b55bcb5c99cb8876fd4941edb756 | []
| no_license | zapline/zero-lag | f71d35efd7b2f884566a45b5c1dc6c7eec6577dd | 1651f264c6d2dc64e4bdcb6529fb6280bbbfbcf4 | refs/heads/master | 2021-01-22T16:45:46.430952 | 2011-05-07T13:22:52 | 2011-05-07T13:22:52 | 32,774,187 | 3 | 2 | null | null | null | null | GB18030 | C++ | false | false | 614 | h | #pragma once
// CFileMd5Dlg 对话框
class CFileMd5Dlg : public CDialog
{
DECLARE_DYNAMIC(CFileMd5Dlg)
public:
CFileMd5Dlg(CWnd* pParent = NULL); // 标准构造函数
virtual ~CFileMd5Dlg();
// 对话框数据
enum { IDD = IDD_DIALOG_FILEMD5 };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
DECLARE_MESSAGE_MAP()
public:
CString m_PathName;
public:
CString m_md5_16;
public:
CString m_md5_32;
public:
virtual BOOL OnInitDialog();
public:
afx_msg void OnBnClickedFilemd516();
public:
afx_msg void OnBnClickedFilemd532();
};
| [
"Administrator@PC-200201010241"
]
| [
[
[
1,
33
]
]
]
|
6a3d8d395c5e593e547ef9db1651fd1d05b99a5b | dd007771e947dbed60fe6a80d4f325c4ed006f8c | /Bullet.h | f2a50aba962928ae45b2fb2a1873a850c91c41e7 | []
| no_license | chenzhi/CameraGame | fccea24426ea5dacbe140b11adc949e043e84ef7 | 914e1a2b8bb45b729e8d55b4baebc9ba18989b55 | refs/heads/master | 2016-09-05T20:06:11.694787 | 2011-09-09T09:09:39 | 2011-09-09T09:09:39 | 2,005,632 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 2,411 | h | //
// Bullet.h
// ogreApp
//
// Created by thcz on 11-6-21.
// Copyright 2011年 __MyCompanyName__. All rights reserved.
//
#ifndef Bullet_h_h_h_h_
#define Bullet_h_h_h_h_
#include "enemy.h"
class Bullet
{
// friend class WarManager;
protected:
public:
enum BulletState
{
BS_NONE, //隐藏状态
BS_SHOOT, //发射状态
BS_REFLECT,//击中后反弹状态
};
Bullet(Ogre::SceneManager* pSceneMrg);
~Bullet();
public:
///每帧更新,如果是发射状态返回真。非发射状态返回假
bool update(float time);
/**发射子弹
*@param position,发射的初始位置,
*@param dir 子弹的发射的方向,需要归一化向量
*/
void shoot(const Ogre::Vector3& position, const Ogre::Vector3& dir);
void setliftTime(float time){m_LiftTime=time;}
BulletState getState()const {return m_State;}
/**返回上一帧时间度的射线和长度*/
bool getFrameRay(Ogre::Ray& ray,float& lenght);
/**设置击中标记,计算反射*/
void hitTarget();
/**设置子弹的方向*/
void setBulletDir(const Ogre::Vector3& dir){m_Dir=dir;}
/**设置是否可见*/
void setVisible(bool b);
protected:
/**销毁*/
void destroy();
/**重置*/
void reset();
protected:
/**判断是否击中目标
*@param dir 子弹飞行的方向
*@param length 子弹在一帧内分行的长度
*@warning 只做外框盒检查
*/
// void updateHit(const Ogre::Vector3& pos,const Ogre::Vector3& dir,float length);
protected:
Ogre::Entity* m_pEntity;
Ogre::SceneNode* m_pNode;
Ogre::Vector3 m_Gravity;///子弹的重力
Ogre::Vector3 m_OrigiPosition;
Ogre::Vector3 m_Dir;///子弹发射方向
float m_Force; ///动力
float m_LiftTime;///生命周期
float m_CurrentTime;///当前生命时期
float m_Speed; ///子弹的速度
Ogre::SceneManager* m_pSceneMrg;
// Ogre::RaySceneQuery* m_pRayQuery;
BulletState m_State;
Ogre::Ray m_ray;
float m_raylenght;
};
#endif | [
"chenzhi@aee8fb6d-90e1-2f42-9ce8-abdac5710353"
]
| [
[
[
1,
119
]
]
]
|
b46c41224b9803a6059a3cbaf4bae481678fc737 | 6406ffa37fd4b705e61b79312f0ebe1035228365 | /src/edge/MixedTimeBurstlengthBasedQueue.cc | 647ec77218aa5b9d25254e69ab2b08c76b40d1a3 | []
| no_license | kitakita/omnetpp_obs | 65904d4e37637706a385476f7c33656c491e2fbd | 19e7c8f0eafcd293d381e733712ecbb2a3564b08 | refs/heads/master | 2021-01-02T12:55:37.328995 | 2011-01-30T10:42:56 | 2011-01-30T10:42:56 | 1,189,202 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 3,147 | cc | //
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
//
#include "MixedTimeBurstlengthBasedQueue.h"
#include "Burst.h"
#include "IPControlInfo.h"
Define_Module(MixedTimeBurstlengthBasedQueue);
int MixedTimeBurstlengthBasedQueue::counter;
MixedTimeBurstlengthBasedQueue::MixedTimeBurstlengthBasedQueue()
{
queue = NULL;
timeoutEvent = NULL;
}
MixedTimeBurstlengthBasedQueue::~MixedTimeBurstlengthBasedQueue()
{
while (!queue->empty())
delete queue->pop();
delete queue;
cancelAndDelete(timeoutEvent);
}
void MixedTimeBurstlengthBasedQueue::initialize()
{
queue = new cPacketQueue("queue");
maxByteBurstlength = par("maxBurstlength");
timeout = par("timeout");
timeoutEvent = new cMessage("BurstAssembleTimeout");
counter = 0;
}
void MixedTimeBurstlengthBasedQueue::handleMessage(cMessage *msg)
{
if (!msg->isSelfMessage())
handlePacket(msg);
else if (msg == timeoutEvent)
handleTimeout();
else
{
opp_error("Receive unknown message (%s).", msg);
delete msg;
}
if (ev.isGUI())
{
char buf[32];
sprintf(buf, "%d packets", queue->length());
getDisplayString().setTagArg("t", 0, buf);
}
}
void MixedTimeBurstlengthBasedQueue::handleTimeout()
{
ev << "Queue was timeout." << endl;
assembleBurst();
}
void MixedTimeBurstlengthBasedQueue::assembleBurst()
{
char msgName[32];
sprintf(msgName, "burst-%d", counter++);
Burst *bst = new Burst(msgName);
cPacket *pkt = queue->get(0);
if (pkt == NULL)
opp_error("%s assembled burst with timeout. But queue is empty.", getFullName());
IPControlInfo *bstCtrl = new IPControlInfo();
IPControlInfo *pktCtrl = (IPControlInfo *)pkt->getControlInfo();
bstCtrl->setSrcAddr(pktCtrl->getSrcAddr());
bstCtrl->setDestAddr(pktCtrl->getDestAddr());
bst->setControlInfo(bstCtrl);
ev << "Queue assemble burst (" << msgName << ": " << queue->info() << ")" << endl;
bst->setPacketQueue(queue);
queue = new cPacketQueue("queue");
send(bst, "out");
}
void MixedTimeBurstlengthBasedQueue::handlePacket(cMessage *msg)
{
cPacket *pkt = check_and_cast<cPacket *>(msg);
if (queue->isEmpty())
{
queue->insert(pkt);
scheduleAt(simTime() + timeout, timeoutEvent);
}
else
{
if (queue->getByteLength() + pkt->getByteLength() <= maxByteBurstlength)
queue->insert(pkt);
else
{
assembleBurst();
cancelEvent(timeoutEvent);
handlePacket(msg);
}
}
}
| [
"[email protected]"
]
| [
[
[
1,
119
]
]
]
|
2d475a84e883ae0fa1cce2e7bd53694e2557708e | 0c930838cc851594c9eceab6d3bafe2ceb62500d | /include/jflib/timeseries/traits/oper.hpp | cb40557b52aeb6527c8be242fa1e206a581ed84e | [
"BSD-3-Clause"
]
| permissive | quantmind/jflib | 377a394c17733be9294bbf7056dd8082675cc111 | cc240d2982f1f1e7e9a8629a5db3be434d0f207d | refs/heads/master | 2021-01-19T07:42:43.692197 | 2010-04-19T22:04:51 | 2010-04-19T22:04:51 | 439,289 | 4 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 2,981 | hpp | /**
* \brief Timeseries operation traits
*/
#ifndef __TIMESERIES_OPER_TRAITS_HPP_
#define __TIMESERIES_OPER_TRAITS_HPP_
#include <jflib/timeseries/structures.hpp>
#include <jflib/timeseries/traits/matrix.hpp>
#include <boost/numeric/ublas/symmetric.hpp>
// Boost numeric bindings
//#include <jflib/linalg/lapack/eigen.hpp>
#include <boost/numeric/bindings/traits/type_traits.hpp>
#include <boost/numeric/bindings/traits/ublas_vector.hpp>
#include <boost/numeric/bindings/traits/ublas_matrix.hpp>
#include <boost/numeric/bindings/lapack/driver/gels.hpp>
namespace jflib { namespace timeseries {
namespace lapack = boost::numeric::bindings::lapack;
}}
namespace jflib { namespace timeseries { namespace traits {
template<class TS, unsigned D>
class oper_traits;
template<class TS>
struct oper_traits<TS,0u> {};
template<class T>
struct oper_traits_vector {
typedef boost::numeric::ublas::vector<T> type;
};
template<class T>
struct oper_traits_matrix {
typedef boost::numeric::ublas::matrix<T> type;
};
template<class T>
struct oper_traits_symmetric {
typedef boost::numeric::ublas::symmetric_matrix<T> type;
};
template<class T, unsigned D>
struct oper_traits_bounded_vector {
typedef boost::numeric::ublas::bounded_array<T,D> storage_type;
typedef boost::numeric::ublas::vector<T,storage_type> type;
//typedef boost::numeric::ublas::bounded_vector<numtype,D> type;
};
template<class Key, class T, class Tag, unsigned F>
class oper_traits<timeseries<Key,T,Tag,F,false>, 1u> {
public:
typedef typename ts<Key,T,Tag>::type tstype;
typedef typename tstype::numtype numtype;
typedef numtype type;
static void init(const tstype& ts, type& v) {v = 0;}
};
template<class Key, class T, class Tag, unsigned F, unsigned D>
class oper_traits<timeseries<Key,T,Tag,F,false>, D> {
public:
typedef typename ts<Key,T,Tag>::type tstype;
typedef typename tstype::numtype numtype;
typedef typename oper_traits_bounded_vector<numtype,D>::type type;
static void init(const tstype& ts, type& v) {
v.resize(D,false);
std::fill(v.begin(),v.end(),0);
}
};
template<class TS>
class oper_traits<TS,1u> {
public:
typedef TS tstype;
typedef typename tstype::numtype numtype;
typedef typename oper_traits_vector<numtype>::type type;
static void init(const tstype& ts, type& v) {
v.resize(ts.series(),false);
std::fill(v.begin(),v.end(),0);
}
};
template<class TS, unsigned D>
class oper_traits {
public:
typedef TS tstype;
typedef typename tstype::numtype numtype;
typedef typename oper_traits_vector<numtype>::type vectype;
typedef typename oper_traits_bounded_vector<vectype,D>::type type;
static void init(const tstype& ts, type& v) {
vectype vec(ts.series(), 0);
v.resize(D,false);
std::fill(v.begin(),v.end(),vec);
}
};
}}}
#endif // __TIMESERIES_OPER_TRAITS_HPP_
| [
"[email protected]"
]
| [
[
[
1,
113
]
]
]
|
a54c3352aa53ae5ecea8a79d737d13da251070ef | 913f43ef4d03bd5d6b42b9e31b1048ae54493f59 | /CraterRacer/CraterRacer/Source_Code/Utility Files/SceneLoader.h | 4582bc57cfcfddd4faedeb4b8b1ef1baab8cdaca | []
| no_license | GreenAdept/cpsc585 | bfba6ea333c2857df0822dd7d00768df6a010a73 | c66745e77be4c78e435da1a59ae94ac2a61228cf | refs/heads/master | 2021-01-10T16:42:03.804213 | 2010-04-27T00:13:52 | 2010-04-27T00:13:52 | 48,024,449 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,391 | h | #pragma once
#ifndef SCENE_LOADER_H
#define SCENE_LOADER_H
//--------------------------------------------------------
// INCLUDES
//--------------------------------------------------------
#include <iostream>
#include <fstream>
#include <string>
#include <stdio.h>
#include <sstream>
#include "Constants.h"
#include "EntityManager.h"
#include "Simulator.h"
#include "GameCamera.h"
#include "Sound.h"
#include "Prop.h"
#include "XBox360Controller.h"
#include "Renderer.h"
#include "Input.h"
#include "DebugWriter.h"
#include "VarLoader.h"
#include "Constants.h"
#include "GameObj.h"
#include "MeteorGroup.h"
using namespace std;
//-----------------------------------------------------------------
// STRUCT: SceneObject
//-----------------------------------------------------------------
struct SceneObjects
{
EntityManager* entityManager;
Simulator* simulator;
vector< GameCamera* > gameCameras;
Renderer* renderer;
DebugWriter* debugger;
VarLoader* varLoader;
vector<XBox360Controller*> controllers;
SceneObjects ();
};
class GameObj; //forward declaration
//-----------------------------------------------------------------
// CLASS: SceneLoader
//-----------------------------------------------------------------
class SceneLoader
{
public:
//Public Interface -----------------------------------
SceneLoader ( );
~SceneLoader( );
void startGame ( string filename );
void initScene ( GameObj** obj );
void initVars ( Device* device, const D3DSURFACE_DESC* backSurface, string filename );
void processTerrainInfo ( ifstream& file );
void processPathInfo ( ifstream& file );
void processMeteorInfo ( ifstream& file );
void processCraterInfo ( ifstream& file );
void processPropInfo ( ifstream& file );
void processVehicleInfo ( ifstream& file );
void initializeSimulator ( );
private:
wstring toLPCWSTR ( std::string& s );
void processComputerVehicles ( ifstream& file, int num );
void processPlayerVehicles ( ifstream& file, int num );
//Date Members ---------------------------------------
Device* m_Device;
D3DSURFACE_DESC* m_BackSurface;
GameObj* m_Game;
SceneObjects m_Objs;
string m_InitFilename;
vector<Mesh*> m_Ramps;
vector<Prop*> m_Props;
Terrain* m_InnerTerrain;
};
#endif //SCENE_LOADER_H | [
"amber.wetherill@b92cab1e-0213-11df-804c-772d9fe11005",
"wshnng@b92cab1e-0213-11df-804c-772d9fe11005",
"[email protected]",
"tfalders@b92cab1e-0213-11df-804c-772d9fe11005"
]
| [
[
[
1,
18
],
[
20,
26
],
[
28,
44
],
[
47,
68
],
[
73,
89
],
[
91,
94
]
],
[
[
19,
19
],
[
90,
90
]
],
[
[
27,
27
]
],
[
[
45,
46
],
[
69,
72
]
]
]
|
b2f2bc31a03b6caf470c5e8c75f1bfdda22fc782 | 159402746e43a74a25885880de26297562e79c42 | /assignment_4-1/cluster.cpp | c339c0b696165fe81fad0cc45f52f5a384b5455c | []
| no_license | soap-axis/cpts223 | ec91650e6a2fcf2240e196760a87bf5392725e78 | 62c0645e0fb47973c7736015f033f002d4f7d2fd | refs/heads/master | 2020-06-02T18:49:01.247354 | 2011-11-05T00:01:31 | 2011-11-05T00:01:31 | 2,676,397 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 22 | cpp |
#include "cluster.h" | [
"soap@voodoo.(none)"
]
| [
[
[
1,
2
]
]
]
|
ea4551ce0118917ac0c42360ce6a31c942db7bf1 | a699a508742a0fd3c07901ab690cdeba2544a5d1 | /RailwayDetection/RWDSClient/OrgList.cpp | 02e4a8e4c5d126968d34fe46253f37c3227e82cf | []
| no_license | xiaomailong/railway-detection | 2bf92126bceaa9aebd193b570ca6cd5556faef5b | 62e998f5de86ee2b6282ea71b592bc55ee25fe14 | refs/heads/master | 2021-01-17T06:04:48.782266 | 2011-09-27T15:13:55 | 2011-09-27T15:13:55 | 42,157,845 | 0 | 1 | null | 2015-09-09T05:24:10 | 2015-09-09T05:24:09 | null | GB18030 | C++ | false | false | 13,395 | cpp | // OrgList.cpp : 实现文件
//
#include "stdafx.h"
#include "RWDSClient.h"
#include "OrgList.h"
#include "afxdialogex.h"
#include "ErrorDefine.h"
#include "DataService.h"
#include "CmdDefine.h"
// COrgList 对话框
IMPLEMENT_DYNAMIC(COrgList, CDialogEx)
COrgList::COrgList(CWnd* pParent /*=NULL*/)
: CDialogEx(COrgList::IDD, pParent)
{
m_CRWDSClientView = static_cast<CRWDSClientView*>(pParent);
m_SeletedOrg = NULL;
m_ComoParentEnable = FALSE;
m_AddNewOrg = FALSE;
}
COrgList::~COrgList()
{
}
void COrgList::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
DDX_Control(pDX, IDC_TREE_ORGLIST, m_TreeOrg);
DDX_Control(pDX, IDC_COMBO_ORGPARENT, m_ComboOrgParent);
DDX_Control(pDX, IDC_COMBO_BOUNDARY, m_ComboBoundaryLine);
}
BEGIN_MESSAGE_MAP(COrgList, CDialogEx)
ON_NOTIFY(TVN_SELCHANGED, IDC_TREE_ORGLIST, &COrgList::OnTvnSelchangedTreeOrglist)
ON_NOTIFY(TVN_ITEMEXPANDED, IDC_TREE_ORGLIST, &COrgList::OnTvnItemexpandedTreeOrglist)
ON_BN_CLICKED(IDC_BTN_ADDORG, &COrgList::OnBnClickedBtnAddorg)
ON_BN_CLICKED(IDC_BTN_MODIFYORG, &COrgList::OnBnClickedBtnModifyorg)
ON_BN_CLICKED(IDC_BTN_DELETEORG, &COrgList::OnBnClickedBtnDeleteorg)
ON_BN_CLICKED(IDCANCEL, &COrgList::OnBnClickedCancel)
END_MESSAGE_MAP()
// COrgList 消息处理程序
void COrgList::LoadOrgTreeCtrl()
{
//m_CRWDSClientView->m_Org
}
void COrgList::OrgListVisitForAddComboOrgParent(OrganizationInfo* aOrg)
{
if (aOrg)
{
CString str;
str.Format(_T("%d"), aOrg->iOrgID);
int comboSize = m_ComboOrgParent.GetCount();
m_ComboOrgParent.AddString(str);
m_ComboOrgParent.SetItemData(comboSize, (DWORD_PTR)aOrg);
OrganizationInfo* childOrg = NULL;
for(size_t i=0; i<aOrg->iChildOrg.size(); i++)
{
childOrg = aOrg->iChildOrg[i];
//str.Format(_T("%d"), childOrg->iOrgID);
//m_ComboOrgParent.AddString(str);
OrgListVisitForAddComboOrgParent(childOrg);
}
}
}
HTREEITEM COrgList::FindItemFromTreeOrg(HTREEITEM aTreeItem, DWORD_PTR aItemData)
{
HTREEITEM treeItem;
if (aTreeItem)
treeItem = aTreeItem;
else
treeItem = m_TreeOrg.GetRootItem();
if(aItemData == m_TreeOrg.GetItemData(treeItem))
return treeItem;
if(m_TreeOrg.ItemHasChildren(treeItem))
{
HTREEITEM item = m_TreeOrg.GetChildItem(treeItem);
treeItem = NULL;
while (item != NULL)
{
treeItem = FindItemFromTreeOrg(item, aItemData);
if (treeItem)
{
break;
}
item = m_TreeOrg.GetNextItem(item, TVGN_NEXT);
}
}
return treeItem;
}
int COrgList::AddOrgToTreeOrg(OrganizationInfo* aAddedOrg, OrganizationInfo* aParentOrg)
{
HTREEITEM treeItem = FindItemFromTreeOrg(NULL, (DWORD_PTR)aParentOrg);
if (treeItem)
{
HTREEITEM childItem = m_TreeOrg.InsertItem(aAddedOrg->iOrgName, treeItem);
m_TreeOrg.SetItemData(childItem, (DWORD_PTR)aAddedOrg);
//为了在新加的树上显示+号
m_TreeOrg.InsertItem(_T(""), childItem);
}
return KErrNone;
}
BOOL COrgList::OnInitDialog()
{
CDialogEx::OnInitDialog();
// TODO: 在此添加额外的初始化
DWORD newStyle = WS_CHILD | WS_VISIBLE | TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS | TVS_SHOWSELALWAYS;
DWORD oldStyle = m_TreeOrg.GetStyle();
m_TreeOrg.ModifyStyle(oldStyle, newStyle);
CString str;
HTREEITEM hRoot = m_TreeOrg.InsertItem(m_CRWDSClientView->m_Org[0]->iOrgName);
m_TreeOrg.SetItemData(hRoot, (DWORD_PTR)m_CRWDSClientView->m_Org[0]);
m_TreeOrg.InsertItem(_T(""), hRoot);//为了显示+号
m_ComboOrgParent.ResetContent();
//添加上级机构
str.Format(_T("%d"), m_CRWDSClientView->m_Org[0]->iParentID);
m_ComboOrgParent.AddString(str);
m_ComboOrgParent.SetItemData(0, NULL);
OrgListVisitForAddComboOrgParent(m_CRWDSClientView->m_Org[0]);
for(size_t i=0; i<gRailLineList.size(); i++)
{
m_ComboBoundaryLine.AddString(gRailLineList[i]->iRailName);
m_ComboBoundaryLine.SetItemData(i, (DWORD_PTR)gRailLineList[i]);
}
return TRUE; // return TRUE unless you set the focus to a control
// 异常: OCX 属性页应返回 FALSE
}
void COrgList::OnTvnSelchangedTreeOrglist(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR);
// TODO: 在此添加控件通知处理程序代码
HTREEITEM curItem = m_TreeOrg.GetSelectedItem();
if (curItem == NULL)
{
return;
}
OrganizationInfo* curOrg = (OrganizationInfo*) m_TreeOrg.GetItemData(curItem);
m_SeletedOrg = curOrg;
CString str;
str.Format(_T("%d"), curOrg->iOrgID);
GetDlgItem(IDC_EDIT_ORGID)->SetWindowText(str);
GetDlgItem(IDC_EDIT_ORGNAME)->SetWindowText(curOrg->iOrgName);
//查找上级机构对应的combo值
int comboIndex = -1;
CString parentID;
parentID.Format(_T("%d"), curOrg->iParentID);
comboIndex = m_ComboOrgParent.FindString(0, parentID);
m_ComboOrgParent.SetCurSel(comboIndex);
RailLine* rail = GetRailLineByID(gRailLineList, curOrg->iBoundaryRail);
m_ComboBoundaryLine.SetCurSel(0);
for (int i=0; i<m_ComboBoundaryLine.GetCount(); i++)
{
if ((DWORD_PTR)rail == m_ComboBoundaryLine.GetItemData(i))
{
m_ComboBoundaryLine.SetCurSel(i);
break;
}
}
//CString str;
str.Format(_T("%d"), curOrg->iBoundaryStartKM);
GetDlgItem(IDC_EDIT_BOUNDARYSTARTKM)->SetWindowText(str);
str.Format(_T("%d"), curOrg->iBoundaryEndKM);
GetDlgItem(IDC_EDIT_BOUNDARYENDKM)->SetWindowText(str);
*pResult = 0;
}
void COrgList::OnTvnItemexpandedTreeOrglist(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR);
// TODO: 在此添加控件通知处理程序代码
if (pNMTreeView->action == TVE_EXPAND)
{
//HTREEITEM curItem = m_wndFileView.GetSelectedItem();
HTREEITEM curItem = reinterpret_cast<LPNMTREEVIEW>(pNMHDR)->itemNew.hItem;
HTREEITEM childItem = m_TreeOrg.GetChildItem(curItem);
if (m_TreeOrg.GetItemText(childItem).Compare(_T("")) != 0)
{//该item已经展开过,不用获取数据
return;
}
else
{
m_TreeOrg.DeleteItem(childItem);//清楚临时无效item
}
OrganizationInfo* curOrg = (OrganizationInfo*) m_TreeOrg.GetItemData(curItem);
HTREEITEM tmpChild;
if(curOrg->iChildOrg.size() > 0)
{//加载子项
OrganizationInfo* org;
for(size_t i=0; i<curOrg->iChildOrg.size(); i++)
{
org = curOrg->iChildOrg[i];
tmpChild = m_TreeOrg.InsertItem(org->iOrgName, 8, 8, curItem);
m_TreeOrg.SetItemData(tmpChild, (DWORD_PTR)org);
m_TreeOrg.InsertItem(_T(""), tmpChild);//为了显示+号
}
}
}
*pResult = 0;
}
void COrgList::AddNewOrg()
{
CString orgID;
CString orgName;
int comboIndex;
OrganizationInfo* parentOrg = NULL;
GetDlgItem(IDC_EDIT_ORGID)->GetWindowText(orgID);
GetDlgItem(IDC_EDIT_ORGNAME)->GetWindowText(orgName);
comboIndex = m_ComboOrgParent.GetCurSel();
if (comboIndex == -1)
{
AfxMessageBox(_T("请选择上级机构"));
return;
}
else
{
parentOrg = (OrganizationInfo*)m_ComboOrgParent.GetItemData(comboIndex);
}
if(parentOrg->iOrgLevel == 4)
{
AfxMessageBox(_T("该机构不能拥有下属机构"));
return;
}
int iOrgID = _ttoi(orgID);
BOOL foundID = FALSE;
for(size_t i=0; i<m_CRWDSClientView->m_Org.size(); i++)
{//判断是否重复的机构号
if (iOrgID == m_CRWDSClientView->m_Org[i]->iOrgID)
{
foundID = TRUE;
break;
}
}
if (foundID)
{
AfxMessageBox(_T("机构号重复"));
return;
}
CString boxMessage;
boxMessage.Format(_T("确认添加机构: \r机构号:%s\r机构名:%s\r上级机构号:%d"),
orgID, orgName, parentOrg->iOrgID);
if(AfxMessageBox(boxMessage, MB_OKCANCEL) == IDOK)
{
OrganizationInfo* newOrg = new OrganizationInfo;
newOrg->iOrgID = iOrgID;
newOrg->iOrgName = orgName;
newOrg->iParentOrg = parentOrg;
newOrg->iParentID = parentOrg->iOrgID;
newOrg->iOrgLevel = parentOrg->iOrgLevel+1;
parentOrg->iChildID.push_back(newOrg->iOrgID);
parentOrg->iChildOrg.push_back(newOrg);
newOrg->iBoundaryRail = ((RailLine*)m_ComboBoundaryLine.GetItemData(m_ComboBoundaryLine.GetCurSel()))->iRailID;
CString str;
GetDlgItem(IDC_EDIT_BOUNDARYSTARTKM)->GetWindowText(str);
newOrg->iBoundaryStartKM = _ttoi(str);
GetDlgItem(IDC_EDIT_BOUNDARYENDKM)->GetWindowText(str);
newOrg->iBoundaryEndKM = _ttoi(str);
AddOrgToTreeOrg(newOrg, parentOrg);
str.Format(_T("%d"), newOrg->iOrgID);
m_ComboOrgParent.AddString(str);
m_ComboOrgParent.SetItemData(m_ComboOrgParent.GetCount()-1, (DWORD_PTR)newOrg);
SetOrganization(CMD_ORG_ADD, newOrg);
}
m_ComboOrgParent.EnableWindow(FALSE);
GetDlgItem(IDC_EDIT_ORGID)->EnableWindow(FALSE);
m_ComoParentEnable = FALSE;
m_AddNewOrg = FALSE;
GetDlgItem(IDC_BTN_ADDORG)->EnableWindow(TRUE);
GetDlgItem(IDC_BTN_DELETEORG)->EnableWindow(TRUE);
}
void COrgList::OnBnClickedBtnAddorg()
{
// TODO: 在此添加控件通知处理程序代码
m_ComboOrgParent.EnableWindow(TRUE);
GetDlgItem(IDC_EDIT_ORGID)->EnableWindow(TRUE);
m_ComoParentEnable = TRUE;
m_AddNewOrg = TRUE;
GetDlgItem(IDC_BTN_ADDORG)->EnableWindow(FALSE);
GetDlgItem(IDC_BTN_DELETEORG)->EnableWindow(FALSE);
GetDlgItem(IDC_EDIT_ORGID)->SetWindowText(_T(""));
GetDlgItem(IDC_EDIT_ORGNAME)->SetWindowText(_T(""));
GetDlgItem(IDC_EDIT_BOUNDARYSTARTKM)->SetWindowText(_T(""));
GetDlgItem(IDC_EDIT_BOUNDARYENDKM)->SetWindowText(_T(""));
//m_ComboOrgParent.SetCurSel(-1);
m_ComboBoundaryLine.SetCurSel(-1);
}
void COrgList::OnBnClickedBtnModifyorg()
{
// TODO: 在此添加控件通知处理程序代码
if (m_AddNewOrg)
{//如果是新添加机构点的修改
AddNewOrg();
return;
}
if (!m_SeletedOrg)
{
return;
}
CString orgID;
CString orgName;
//GetDlgItem(IDC_EDIT_ORGID)->GetWindowText(orgID);
GetDlgItem(IDC_EDIT_ORGNAME)->GetWindowText(orgName);
//int iOrgID = _ttoi(orgID);
int comboIndex = m_ComboOrgParent.GetCurSel();
OrganizationInfo* parentOrg = (OrganizationInfo*)m_ComboOrgParent.GetItemData(comboIndex);
if (parentOrg && parentOrg != m_SeletedOrg->iParentOrg)
{
AfxMessageBox(_T("上级机构不能修改"));
return;
}
if (AfxMessageBox(_T("确认修改?"), MB_OKCANCEL) == IDOK)
{
//if (m_SeletedOrg->iOrgID != iOrgID)
//{//修改combo下拉机构号
// CString str;
// str.Format(_T("%d"), m_SeletedOrg->iOrgID);
// int original = m_ComboOrgParent.FindString(0, str);
// m_ComboOrgParent.DeleteString(original);
// str.Format(_T("%d"), iOrgID);
// m_ComboOrgParent.InsertString(original, str);
// m_ComboOrgParent.SetItemData(original, (DWORD_PTR)m_SeletedOrg);
//}
//m_SeletedOrg->iOrgID = iOrgID;
m_SeletedOrg->iOrgName = orgName;
m_SeletedOrg->iBoundaryRail = ((RailLine*)m_ComboBoundaryLine.GetItemData(m_ComboBoundaryLine.GetCurSel()))->iRailID;
CString str;
GetDlgItem(IDC_EDIT_BOUNDARYSTARTKM)->GetWindowText(str);
m_SeletedOrg->iBoundaryStartKM = _ttoi(str);
GetDlgItem(IDC_EDIT_BOUNDARYENDKM)->GetWindowText(str);
m_SeletedOrg->iBoundaryEndKM = _ttoi(str);
SetOrganization(CMD_ORG_MODIFY, m_SeletedOrg);
}
}
void COrgList::OnBnClickedBtnDeleteorg()
{
// TODO: 在此添加控件通知处理程序代码
HTREEITEM curItem = m_TreeOrg.GetSelectedItem();
if (curItem == NULL)
{
return;
}
if (AfxMessageBox(_T("确认删除?"), MB_OKCANCEL) == IDOK)
{
OrganizationInfo* org = (OrganizationInfo*)m_TreeOrg.GetItemData(curItem);
SetOrganization(CMD_ORG_DELETE, m_SeletedOrg);
delete org;
m_TreeOrg.DeleteItem(curItem);
}
}
void COrgList::OnBnClickedCancel()
{
// TODO: 在此添加控件通知处理程序代码
if (m_AddNewOrg)
{
m_ComboOrgParent.EnableWindow(FALSE);
m_ComoParentEnable = FALSE;
m_AddNewOrg = FALSE;
GetDlgItem(IDC_BTN_ADDORG)->EnableWindow(TRUE);
GetDlgItem(IDC_BTN_DELETEORG)->EnableWindow(TRUE);
return;
}
CDialogEx::OnCancel();
}
| [
"[email protected]@4d6b9eea-9d24-033f-dd66-d003eccfd9d3",
"[email protected]@4d6b9eea-9d24-033f-dd66-d003eccfd9d3"
]
| [
[
[
1,
381
],
[
383,
398
]
],
[
[
382,
382
]
]
]
|
4a5829c6587dd12dcab4ca5ebdcfa34aa0aae200 | 49f5a108a2ac593b9861f9747bd82eb597b01e24 | /src/JSON/MiniCommon/Quaternion.h | 46151bd6a84bf1cd48412fd658cfa422c2932bed | []
| no_license | gpascale/iSynth | 5801b9a1b988303ad77872fad98d4bf76d86e8fe | e45e24590fabb252a5ffd10895b2cddcc988b83d | refs/heads/master | 2021-03-19T06:01:57.451784 | 2010-08-02T02:22:54 | 2010-08-02T02:22:54 | 811,695 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 5,122 | h | #ifndef Quaternion_h
#define Quaternion_h
#include "Space.h"
#include "Hyperspace.h"
#include "Matrix.h"
#include "Random.h"
template <class T>
class TQuaternion {
public:
typedef TQuaternion<T> Q;
typedef TPoint3FDI<T> V;
typedef const Q cQ;
typedef const V cV;
typedef DMatrix4 M;
typedef const M cM;
typedef DMatrix3 M3;
typedef const M3 cM3;
T x,y,z,w;
enum { D=4, R=3 };
const T & operator [] (int i) const { b_assert(i>=0 && i<D); return (&x)[i]; }
T & operator [] (int i) { b_assert(i>=0 && i<D); return (&x)[i]; }
TQuaternion() : x(0), y(0), z(0), w(1) {}
explicit TQuaternion(int) : x(0), y(0), z(0), w(1) {}
TQuaternion(T a, T b, T c, T d) : x(a), y(b), z(c), w(d) {}
TQuaternion(T a, T b, T c ) : x(a), y(b), z(c), w(1.) {}
TQuaternion(T a, T b ) : x(a), y(b), z(0), w(1.) {}
TQuaternion(V & v, T d) : x(v.x), y(v.y), z(v.z), w(d) {}
TQuaternion(cQ & rhs) : x(rhs.x), y(rhs.y), z(rhs.z), w(rhs.w) {}
template <class U> explicit TQuaternion(const TQuaternion<U> & rhs) :
x(T(rhs.x)),
y(T(rhs.y)),
z(T(rhs.z)),
w(T(rhs.w)) {}
Q & operator = (cQ & v) { x=v.x; y=v.y; z=v.z; w=v.w; return *this; }
Q & operator += (cQ & v) { x+=v.x; y+=v.y; z+=v.z; w+=v.w; return *this; }
Q & operator -= (cQ & v) { x-=v.x; y-=v.y; z-=v.z; w-=v.w; return *this; }
Q operator + (cQ & v) const { return Q(x+v.x, y+v.y, z+v.z, w+v.w); }
Q operator - (cQ & v) const { return Q(x-v.x, y-v.y, z-v.z, w-v.w); }
Q & operator *= (T f) { x*=f, y*=f, z*=f, w*=f; return *this; }
Q & operator /= (T f) { x/=f, y/=f, z/=f, w/=f; return *this; }
Q operator - () const { return Q(-x,-y,-z,w); }
Q operator * (T f) const { return Q(x*f, y*f, z*f, w*f); }
Q operator / (T f) const { return Q(x/f, y/f, z/f, w/f); }
void Identity() { x=y=z=T(0); w=T(1); }
DPoint3 vectorPart() const { return V(x,y,z); }
M toMatrix() const;
void toMatrix(M & m) const;
void fromMatrix(cM & m);
M3 toMatrix3() const;
void toMatrix(M3 & m) const;
void fromMatrix(cM3 & m);
void fromAngularMomentum(T lx, T ly, T lz);
DPoint3 toAngularMomentum() const;
void fromAxis(cV & axis, double theta);
void toAxis(V * axis, double * theta) const;
void fromBallPoints(cV & from, cV & to);
void toBallPoints(V & from, V & to) const;
void fromAngularMomentum(cV & L);
void toAngularMomentum(T * lx, T * ly, T * lz) const;
void set(cV & v, T d) { x=v.x,y=v.y,z=v.z,w=d; }
T dot(cQ & rhs) const { return x*rhs.x + y*rhs.y + z*rhs.z + w*rhs.w; }
void set(T a, T b, T c, T d) { x=a,y=b,z=c,w=d; }
void set(T a, T b, T c ) { x=a,y=b,z=c,w=1.; }
void set(T a, T b ) { x=a,y=b,z=0,w=1.; }
double sqr() const { return x*x + y*y + z*z + w*w; }
double len() const { return sqrt(sqr()); }
void normalize() { *this /= len(); }
void random();
Q conj() const { return Q(-x,-y,-z,w); }
Q inv() const { return conj()/sqr(); }
};
typedef TQuaternion<double> DQuaternion;
typedef TQuaternion<float > FQuaternion;
template <class T> inline
TQuaternion<T> operator * (const TQuaternion<T> & lhs,
const TQuaternion<T> & rhs) {
return TQuaternion<T>(lhs.w*rhs.x + lhs.x*rhs.w + lhs.y*rhs.z - lhs.z*rhs.y,
lhs.w*rhs.y + lhs.y*rhs.w + lhs.z*rhs.x - lhs.x*rhs.z,
lhs.w*rhs.z + lhs.z*rhs.w + lhs.x*rhs.y - lhs.y*rhs.x,
lhs.w*rhs.w - lhs.x*rhs.x - lhs.y*rhs.y - lhs.z*rhs.z);
}
template <class T> inline
TQuaternion<T> quaternionProduct(const TQuaternion<T> & lhs,
const TQuaternion<T> & rhs) { return lhs*rhs; }
template <class T> inline
DPoint3 xyzCross(const TQuaternion<T> & a,
const TQuaternion<T> & b) {
return DPoint3(a.y*b.z - a.z*b.y,
a.z*b.x - a.x*b.z,
a.x*b.y - a.y*b.x);
}
template <class T>
void SlerpQuaternion(double alpha,
const TQuaternion<T> & a,
const TQuaternion<T> & b,
TQuaternion<T> & q,
int spin =0);
template <class T>
void SlerpQuaternion3(double alpha,
double beta,
double gamma,
const TQuaternion<T> & a,
const TQuaternion<T> & b,
const TQuaternion<T> & c,
TQuaternion<T> & q);
template <class T>
bool operator==(const TQuaternion<T>& lhs, const TQuaternion<T>& rhs) {
return lhs.x == rhs.x
&& lhs.y == rhs.y
&& lhs.z == rhs.z
&& lhs.w == rhs.w;
}
template <class T>
bool operator!=(const TQuaternion<T>& lhs, const TQuaternion<T>& rhs) {
return !(lhs == rhs);
}
#include "Quaternion.hpp"
#endif // Quaternion_h
| [
"[email protected]"
]
| [
[
[
1,
147
]
]
]
|
ce96acf4d702c31c68f9f1aacdb3fd5595eb6441 | 5d8070c3ad1d3ef09cc350f210fcd5be994171b9 | /src/error.cpp | 8e47b5ea6c38925785a8babf2fddf1d814b5f3cc | []
| no_license | python50/Space-Shooter-Demo | 08a5db204dd1db99ccf6c9d4c1a924e5caaa285d | 77715e7837fb2c485dee226a9e74f57de13a9675 | refs/heads/master | 2021-01-01T15:24:58.884177 | 2011-09-19T10:58:42 | 2011-09-19T10:58:42 | 2,037,477 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,614 | cpp | /**
** Code Copyright (C) 2011 Jason White <[email protected]>
** White Waters Software - http://wwsoft.co.cc
**
** modifying, copying and distribution of this source is prohibited without
** explicit authorization by the copyright holder: Jason White
**/
#include "error.h"
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
//using namespace std;
error::error(error_level level,std::string message)
{
if (level==FATAL_ERROR or level==F_ERR)
{
message="FATAL ERROR: "+message;
log(message);
}
if (level==WARNING or level==WARN)
{
message="WARNING: "+message;
log(message);
}
if (level==INFO_HIGH or level==INFO_H)
{
message="INFO HIGH: "+message;
log(message);
}
if (level==INFO_MEDIUM or level==INFO_M)
{
message="INFO MEDIUM: "+message;
log(message);
}
if (level==INFO_LOW or level==INFO_L)
{
message="INFO LOW: "+message;
log(message);
}
}
/*
*/
void error::log(std::string message)
{
// Format Time String
time_t rawtime;
struct tm * timeinfo;
char buffer [80];
time ( &rawtime );
timeinfo = localtime ( &rawtime );
strftime (buffer,80,"%H:%M:%S",timeinfo);
std::string time=buffer;
// [12:30:02] FATAL_ERROR: Resource Not Found
message="["+time+"] "+message+"\n";
// Write to log
FILE *log;
log=fopen("error.log", "a");
fprintf(log, message.c_str());
printf(message.c_str());
fclose(log);
}
error::~error()
{
//dtor
}
| [
"jason@jason-master-desktop.(none)"
]
| [
[
[
1,
83
]
]
]
|
740c7d33b24dc33840f9ce8cd2796e747868fd0e | 431ce937f7b189cacca9a78dfea3e0d2e1bb9e1d | /c/data-structures/data-structures/sort.h | 2f03d29d11060ca9af51ce87a5b7eed11ea319c8 | []
| no_license | KiraiChang/c-lib-data-structures | 3eef8b2b38d7c619d945db7640cc1a52a0195106 | 4a36ccba7c38b5d43f4534589547c013c983a84b | refs/heads/master | 2020-05-22T14:42:05.416553 | 2010-04-30T07:58:39 | 2010-04-30T07:58:39 | 32,336,930 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 1,629 | h | #ifndef _SORT_H_
#define _SORT_H_
//template<class T>
//void swap(T &x, T &y)
//{
// T temp;
// temp = x;
// x = y;
// y = temp;
//}
template<class T>
void swap(T &x, T &y)
{
x = x + y;
y = x - y;
x = x - y;
}
template<class T>
void select_sort(T &n)
{
int min ;
for(int i = 0; i < sizeof(n)/sizeof(n[0]) - 1; i++)
{
min = i;
//т程
for(int j = i+1; j <= sizeof(n)/sizeof(n[0]) - 1; j++)
if(n[j] < n[min])
min = j;
//р程蛤材iユ传
if(min != i)
{
swap(n[i], n[min]);
}
}
}
template<class T>
void select_sort(T n[])
{
int min ;
for(int i = 0; i < sizeof(n) - 1; i++)
{
min = i;
//т程
for(int j = i+1; j <= sizeof(n) - 1; j++)
if(n[j] < n[min])
min = j;
//р程蛤材iユ传
if(min != i)
{
swap(n[i], n[min]);
}
}
}
template<class T>
void bubble_sort(T &n)
{
//ゑ耕n-1Ω
for(int i = sizeof(n)/sizeof(n[0]) - 1; i > 0; i--)
{
for(int j = 1; j <= i; j++)
if(n[j-1] > n[j])
{
//璝j-1j玥ㄢ计ユ传
swap(n[j-1], n[j]);
}
}
}
template<class T>
void bubble_sort(T n[])
{
//ゑ耕n-1Ω
for(int i = sizeof(n) - 1; i > 0; i--)
{
for(int j = 1; j <= i; j++)
if(n[j-1] > n[j])
{
//璝j-1j玥ㄢ计ユ传
swap(n[j-1], n[j]);
}
}
}
template<class T>
void insertion_sort(T n[])
{
for(int i = 1; i < sizeof(n); i++)
{
T target = n[i];
int j = i;
while((n[j-1] > target) && (j > 0))
{
n[j] = n[j-1];
j--;
}
n[j] = target;
}
}
#endif //_SORT_H_ | [
"[email protected]@97b2a582-fab2-11de-8c8a-61c5e9addfc9"
]
| [
[
[
1,
108
]
]
]
|
11c8d9305f57e6c2949080d91dcf17bb320c8578 | 46b3500c9ab98883091eb9d4ca49a6854451d76b | /ghost/config.h | 968cb977148deaee1f4c9aa03aabccb70c4d2a2d | [
"Apache-2.0"
]
| permissive | kr4uzi/pyghost | 7baa511fa05ddaba57880d2c7483694d5c5816b7 | 35e5bdd838cb21ad57b3c686349251eb277d2e6a | refs/heads/master | 2020-04-25T21:05:20.995556 | 2010-11-21T13:57:49 | 2010-11-21T13:57:49 | 42,011,079 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,083 | 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 CONFIG_H
#define CONFIG_H
//
// CConfig
//
class CConfig
{
private:
map<string, string> m_CFG;
public:
CConfig( );
~CConfig( );
void Read( string file );
bool Exists( string key );
int GetInt( string key, int x );
string GetString( string key, string x );
void Set( string key, string x );
public:
static void RegisterPythonClass( );
};
#endif
| [
"kr4uzi@88aed30e-2b04-91ce-7a47-0ae997e79d63"
]
| [
[
[
1,
47
]
]
]
|
cabfa5607cc8f1a555c23c90719aa46872bd0825 | daaf6aa03a70dac88956fda2debd9e058694f371 | /moc_modelt.cpp | 70a269c8740829b8cc077db0e22c539e29f73a90 | []
| no_license | deepbadger/bplayer | 0778967e54ec47ed2ed281270136bd718ef627de | e353c12e39e29f4eca7d99a5d61051592598cef3 | refs/heads/master | 2021-03-19T07:12:56.333095 | 2010-04-06T15:45:47 | 2010-04-06T15:45:47 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,099 | cpp | /****************************************************************************
** Meta object code from reading C++ file 'modelt.h'
**
** Created: Mon 15. Mar 19:42:46 2010
** by: The Qt Meta Object Compiler version 62 (Qt 4.6.2)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "modelt.h"
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'modelt.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 62
#error "This file was generated using the moc from 4.6.2. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
static const uint qt_meta_data_Modelt[] = {
// content:
4, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
0 // eod
};
static const char qt_meta_stringdata_Modelt[] = {
"Modelt\0"
};
const QMetaObject Modelt::staticMetaObject = {
{ &QAbstractTableModel::staticMetaObject, qt_meta_stringdata_Modelt,
qt_meta_data_Modelt, 0 }
};
#ifdef Q_NO_DATA_RELOCATION
const QMetaObject &Modelt::getStaticMetaObject() { return staticMetaObject; }
#endif //Q_NO_DATA_RELOCATION
const QMetaObject *Modelt::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
}
void *Modelt::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_Modelt))
return static_cast<void*>(const_cast< Modelt*>(this));
return QAbstractTableModel::qt_metacast(_clname);
}
int Modelt::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QAbstractTableModel::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
return _id;
}
QT_END_MOC_NAMESPACE
| [
"[email protected]"
]
| [
[
[
1,
69
]
]
]
|
8c8bc2f3509bc1661dd17755f7b97d6c5883f075 | 74d531abb9fda8dc621c5d8376eb10ec4ef19568 | /src/game-render.cpp | 3f3fac73c272f0475d116b50ccd58f0373a8c9ac | []
| no_license | aljosaosep/xsoko | e207d6ec8de3196029e569e7765424a399a50f04 | c52440ecee65dc2f3f38d996936e65b3ff3b8b5e | refs/heads/master | 2021-01-10T14:27:04.644013 | 2009-09-02T20:39:53 | 2009-09-02T20:39:53 | 49,592,571 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,711 | cpp | /*
* codename: xSoko
* Copyright (C) Aljosa Osep, Jernej Skrabec, Jernej Halozan 2008 <[email protected], [email protected], [email protected]>
*
* xSoko project 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.
*
* xSoko project 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/>.
*/
/*
* I think it should be obsolete, but don't delete it yet, I will -- Aljosa
*/
/*
codename: Pac-Game
Aljosa Osep 2007
*/
/*#include "game.h"
namespace PacGame
{
namespace GameClasses
{
float angle = 0.0;
float z = -20.0;
void zoom()
{
z+=0.4;
}
void PGame::renderGame()
{
// reset view matrix
glLoadIdentity();
// temp
glTranslatef(-1.0, -2.0, z);
glRotatef(angle, 1.0, 1.0, 0.0);
// glDisable(GL_TEXTURE_2D);
// glEnable(GL_LIGHTING);
renderer.drawCube(0.0, 0.0, 1.0);
// renderer.drawFloor(0.0, -1.0, 1.0);
angle+=0.03;
}
}
}*/
| [
"aljosa.osep@d77d96cf-bc4d-0410-95e8-7f58e8f99bdb",
"jernej.halozan@d77d96cf-bc4d-0410-95e8-7f58e8f99bdb"
]
| [
[
[
1,
22
],
[
27,
27
],
[
33,
43
],
[
45,
57
],
[
59,
60
]
],
[
[
23,
26
],
[
28,
32
],
[
44,
44
],
[
58,
58
]
]
]
|
d962a7fcac082d69eceec0f0e20aea0e8764f3e7 | 3cfa229d1d57ce69e0e83bc99c3ca1d005ae38ad | /glome/common/packed.hpp | a3bc6ba5ac8240ffbd69854b66da6c8e2a3b8e27 | []
| no_license | chadaustin/sphere | 33fc2fe65acf2eb56e35ade3619643faaced7021 | 0d74cfb268c16d07ebb7cb2540b7b0697c2a127a | refs/heads/master | 2021-01-10T13:28:33.766988 | 2009-11-08T00:38:57 | 2009-11-08T00:38:57 | 36,419,098 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 585 | hpp | #ifndef PACKED_HPP
#define PACKED_HPP
#include <assert.h>
#include <stdlib.h>
#ifdef NDEBUG
#define ASSERT_STRUCT_SIZE(name, size) ;
#else
#define ASSERT_STRUCT_SIZE(name, size) \
static class name##_AssertStructSize__ \
{ \
public: \
name##_AssertStructSize__() \
{ \
assert(sizeof(name) == size); \
} \
} name##_AssertStructSize___;
#endif // NDEBUG
#endif // PACKED_HPP
| [
"surreality@c0eb2ce6-7f40-480a-a1e0-6c4aea08c2c2"
]
| [
[
[
1,
28
]
]
]
|
de0da97f3b85d74c88fc9aa5736ec6c9332697a4 | b24d5382e0575ad5f7c6e5a77ed065d04b77d9fa | /GCore/GCore/GC_Timer.h | 42a5b64df3b0adbdcfeb48ca56cf3294e9bd4e45 | []
| no_license | Klaim/radiant-laser-cross | f65571018bf612820415e0f672c216caf35de439 | bf26a3a417412c0e1b77267b4a198e514b2c7915 | refs/heads/master | 2021-01-01T18:06:58.019414 | 2010-11-06T14:56:11 | 2010-11-06T14:56:11 | 32,205,098 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,463 | h | #ifndef GC_TIMER_H
#define GC_TIMER_H
#pragma once
#include <algorithm>
#include <vector>
#include <functional>
#include "GC_Common.h"
#include "GC_Time.h"
#include "GC_TimerManager.h"
namespace gcore
{
class Timer;
class Clock;
/** Listener called when a timer it is registered in trigger.
@see Timer
*/
class GCORE_API TimerListener
{
public:
TimerListener(){}
virtual ~TimerListener(){}
virtual void onTimerTrigger( Timer& timer ) = 0;
};
typedef std::tr1::function< void ( Timer& ) > TimerListenerFunction;
class ProxyTimerListener : public TimerListener
{
public:
ProxyTimerListener( const TimerListenerFunction& timerListenerFunction )
: m_timerListenerFunction( timerListenerFunction )
{ }
inline void onTimerTrigger( Timer& timer )
{
m_timerListenerFunction( timer );
}
private:
TimerListenerFunction m_timerListenerFunction;
};
/** Trigger listeners when a specified amount of time passed.
Managed by TimerManager.
@see TimerManager
*/
class GCORE_API Timer
{
public:
/** Register a listener to be called on trigger.
*/
void registerListener( TimerListener* timerListener );
/** Unregister a registered listener.
*/
void unregisterListener( TimerListener* timerListener );
/** Unregister all registered listeners.
*/
void unregisterAllListeners();
/** Verify passed time since last update and trigger listeners if
the specified time passed.
@remark Call this method one time by clock update.
*/
void update();
/** Reset the time counting data.
*/
void reset();
/// Count how many time this timer triggered.
unsigned long getTriggerCount() const { return m_triggerCount; }
/// Time span to wait before trigger.
TimeValue getWaitTime() const { return m_waitTime; }
/** Time span to wait before trigger.
@remark 0 Wait time will deactivate this timer.
*/
void setWaitTime( const TimeValue& waitTime ){ m_waitTime = waitTime; }
/** Name of this timer or empty string if no name set on creation.
*/
const std::string& getName() const { return m_name; }
/** True if this timer have to trigger only one time and then do nothing.
*/
bool isTriggerOnce() const { return m_triggerOnce; }
/** True if this timer have to trigger only one time and then do nothing.
*/
void setTriggerOnce( bool triggerOnce = true ) { m_triggerOnce = triggerOnce; }
protected:
private:
/// Name of this timer.
const std::string m_name;
/// Count how many time this timer triggered.
unsigned long m_triggerCount;
/// Time since the last time we triggered.
TimeValue m_timeSinceLastTrigger;
/// Time span to wait before trigger.
TimeValue m_waitTime;
/// True if this timer have to trigger only one time and then do nothing.
bool m_triggerOnce;
/// Clock used as a time reference provider.
const Clock& m_clock;
/// Listeners registered to this timer.
std::vector< TimerListener* > m_timerListenerList;
bool m_timerListenerListChanged;
std::vector< TimerListener* > m_triggerList;
friend class TimerManager;
friend typedef TimerManager::TimerPool;
/** Constructor.
@param clock Clock used as a time reference.
*/
Timer( const std::string& name, const Clock& clock);
/** Destructor.
*/
~Timer();
};
}
#endif | [
"[email protected]"
]
| [
[
[
1,
154
]
]
]
|
8b1c24f99da35645d7065d940c1b73cb70413cc4 | 3bfe835203f793ee00bdf261c26992b1efea69ed | /spring08/cs350/A4/CS350-framework-src/common.h | 4c5141531eeb61b2e6eb1226fa0ea04533f1623e | []
| no_license | yxrkt/DigiPen | 0bdc1ed3ee06e308b4942a0cf9de70831c65a3d3 | e1bb773d15f63c88ab60798f74b2e424bcc80981 | refs/heads/master | 2020-06-04T20:16:05.727685 | 2009-11-18T00:26:56 | 2009-11-18T00:26:56 | 814,145 | 1 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 2,515 | h | //------------------------------------------------------------------------------
#ifndef COMMON_H
#define COMMON_H
//------------------------------------------------------------------------------
#include <list>
#include "framework.h"
#include "geomlib.h"
#include "transformation.h"
#include "scenelib.h"
#define ERRCHECK(str)\
while ( true )\
{\
GLenum err = glGetError();\
if ( err == GL_NO_ERROR ) break;\
printf( "ERROR: 0x%x at %s\n", err, str );\
}
// constants
const float OPACITY_THRESHOLD = .975f;
const float TRANSPARENCY_THRESHOLD = .80f;
// classes and structs
struct HOM
{
HOM( int _width = 0, int _height = 0, HOM *_prev = NULL )
: width( _width )
, height( _height )
, map( new float[width * height] )
, depth( new float[width * height] )
, prev( _prev )
, next( NULL ) {}
~HOM()
{
if ( this->next != NULL )
delete this->next;
delete [] map;
delete [] depth;
}
inline float &Map( int x, int y )
{
return map[x + y * width];
}
inline float &Depth( int x, int y )
{
return depth[x + y * width];
}
const int width;
const int height;
float *map;
float *depth;
HOM *prev;
HOM *next;
};
struct Box2D
{
inline float Area() const
{
return ( ( extent[0] - origin[0] ) * ( extent[1] - origin[1] ) );
}
Point2D origin;
Point2D extent;
};
// typedefs
typedef std::vector< Object > ObjectVec;
typedef ObjectVec::iterator ObjectVecIt;
// useful inlines
template< typename T, typename U >
inline T force_cast( const U &data ) { return *(T *)&data; }
inline Point3D GetScreenCrds( const Point3D &world, Scene &scene, int width, int height )
{
Point3D ndc = ( scene.projection.Transform( scene.viewing.Transform( Vector4D( world ) ) ).Hdiv() );
return Point3D( ( ndc[0] + 1.f ) * (float)( width / 2 ), ( ndc[1] + 1.f ) * (float)( height / 2 ), ndc[2] );
}
// other forward decls
HOM *BuildHOM( Scene &scene, int width, int height );
unsigned RemoveOccludedObjects( Scene &scene, int width, int height );
void BeginDraw( Scene &scene, int width, int height );
void DrawObject( Object &obj, bool filled = true );
void BeginDefaultDraw( int width, int height );
bool Occluded( const Box2D &bound, float depth, const HOM *hom,
int scnWidth, int scnHeight, bool autoFind = true );
float GetMaxDepth( const Object &obj, Scene &scene, int width, int height );
#endif
| [
"[email protected]"
]
| [
[
[
1,
96
]
]
]
|
f0be2de6eaa95c1c9b05c8918c7f7e394e8bb8bd | 9c62af23e0a1faea5aaa8dd328ba1d82688823a5 | /rl/trunk/engine/script/src/LightNodeProcessor.cpp | a496a5d22113c55e54ac72498c7535578b5286b4 | [
"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 | 5,039 | 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 "LightNodeProcessor.h"
#include "Actor.h"
#include "ActorManager.h"
using namespace Ogre;
namespace rl
{
bool LightNodeProcessor::processNode(const TiXmlElement* nodeElem, const Ogre::String& resourceGroup, bool loadGameObjects)
{
if (!hasNodeName(nodeElem, "light"))
{
return false;
}
LOG_DEBUG(Logger::RULES,
"Processing light node "
+ getAttributeValueAsStdString(nodeElem, "name"));
Ogre::String name = getAttributeValueAsStdString(nodeElem, "name");
Ogre::String stype = getAttributeValueAsStdString(nodeElem, "type");
bool visible = getAttributeValueAsBool(nodeElem, "visible");
bool shadowCaster = getAttributeValueAsBool(nodeElem, "castShadows");
LightObject::LightTypes type = LightObject::LT_DIRECTIONAL;
if (stype == "point")
{
type = LightObject::LT_POINT;
}
else if (stype == "directional")
{
type = LightObject::LT_DIRECTIONAL;
}
else if (stype == "spot")
{
type = LightObject::LT_SPOTLIGHT;
}
else
{
LOG_ERROR(Logger::RULES, "Could not create light.");
return false;
}
Actor* lightActor = ActorManager::getSingleton().createLightActor(name, type);
const TiXmlElement* posElem = getChildNamed(nodeElem, "position");
if (posElem != NULL)
{
lightActor->placeIntoScene(processVector3(posElem));
}
else
{
lightActor->placeIntoScene(Vector3::ZERO);
}
LightObject* light = static_cast<LightObject*>(lightActor->getControlledObject());
light->setCastShadows(shadowCaster);
light->setActive(visible);
const TiXmlElement* diffElem = getChildNamed(nodeElem, "colourDiffuse");
if (diffElem != NULL)
{
light->setDiffuseColour(processColour(diffElem));
}
const TiXmlElement* specElem = getChildNamed(nodeElem, "colourSpecular");
if (specElem != NULL)
{
light->setSpecularColour(processColour(specElem));
}
const TiXmlElement* attElem = getChildNamed(nodeElem, "lightAttenuation");
if (attElem != NULL)
{
if (hasAttribute(attElem, "range")
&& hasAttribute(attElem, "constant")
&& hasAttribute(attElem, "linear")
&& hasAttribute(attElem, "quadratic"))
{
Ogre::Real range = getAttributeValueAsReal(attElem, "range");
Ogre::Real constant = getAttributeValueAsReal(attElem, "constant");
Ogre::Real linear = getAttributeValueAsReal(attElem, "linear");
Ogre::Real quadratic = getAttributeValueAsReal(attElem, "quadratic");
light->setAttenuation(range, constant, linear, quadratic);
}
}
///@todo default attenuation?
if (stype == "directional")
{
const TiXmlElement* dirElem = getChildNamed(nodeElem, "direction");
if (dirElem != NULL)
{
light->setDirection(processVector3(dirElem));
}
else
{
light->setDirection(Vector3::NEGATIVE_UNIT_Y);
}
}
else if (stype == "spot")
{
const TiXmlElement* rangeElem = getChildNamed(nodeElem, "spotlightrange");
if (rangeElem != NULL)
{
Ogre::Real innerAngle = getAttributeValueAsReal(rangeElem, "inner");
Ogre::Real outerAngle = getAttributeValueAsReal(rangeElem, "outer");
if (hasAttribute(rangeElem, "falloff"))
{
light->setSpotlightRange(
innerAngle, outerAngle, getAttributeValueAsReal(rangeElem, "falloff"));
}
else
{
light->setSpotlightRange(innerAngle, outerAngle);
}
}
}
///@todo create light
return true;
}
}
| [
"blakharaz@4c79e8ff-cfd4-0310-af45-a38c79f83013",
"ablock@4c79e8ff-cfd4-0310-af45-a38c79f83013"
]
| [
[
[
1,
15
],
[
18,
33
],
[
36,
36
],
[
38,
41
],
[
43,
76
],
[
78,
82
],
[
84,
143
]
],
[
[
16,
17
],
[
34,
35
],
[
37,
37
],
[
42,
42
],
[
77,
77
],
[
83,
83
]
]
]
|
1f071560e4e1f72006aaa35aaf2e8de76ef28740 | 2fe5b841aec3a564c05d1a63de375d5cb64b700f | /MHydrax/MHydrax/MHydrax.cpp | e6c9de17283bd623976c174573587e7329d9b5ba | []
| no_license | fartwhif/extramegablob | 3e3495f826e9d3d90226f669c6c2a0db1492bb89 | ae743f73cf6de5c926de02855c1948eadf552d0a | refs/heads/master | 2021-05-30T17:07:46.598358 | 2011-04-22T03:41:46 | 2011-04-22T03:41:46 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,483 | cpp | /*
--------------------------------------------------------------------------------
This source file is part of MHydrax.
Visit ---
Copyright (C) 2009 Christian Haettig
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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, or go to
http://www.gnu.org/copyleft/lesser.txt.
--------------------------------------------------------------------------------
*/
// MHydrax.cpp
// This is the main DLL file.
#include "Stdafx.h"
#include "Util.h"
#include "MEnums.h"
#include "MHelp.h"
#include "MMesh.h"
#include "MDecalsManager.h"
#include "MMaterialManager.h"
#include "MCfgFileManager.h"
#include "MNoise.h"
#include "MPerlin.h"
#include "MFFT.h"
#include "MGodRaysManager.h"
#include "MModule.h"
#include "MHydrax.h"
#include "MProjectedGrid.h"
#include "MSimpleGrid.h"
#include "MRadialGrid.h" | [
"[email protected]"
]
| [
[
[
1,
45
]
]
]
|
ab10134b1068427e2935da982e1af19a2fe6619e | ab41c2c63e554350ca5b93e41d7321ca127d8d3a | /glm/ext.hpp | 1f1051beea3392418e3762d2cf980fe2ce26d481 | []
| no_license | burner/e3rt | 2dc3bac2b7face3b1606ee1430e7ecfd4523bf2e | 775470cc9b912a8c1199dd1069d7e7d4fc997a52 | refs/heads/master | 2021-01-11T08:08:00.665300 | 2010-04-26T11:42:42 | 2010-04-26T11:42:42 | 337,021 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 971 | hpp | ///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2009-05-01
// Updated : 2009-05-01
// Licence : This source is under MIT License
// File : glm/ext.hpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef glm_ext
#define glm_ext
#include "glm.hpp"
#include "gtc.hpp"
#include "gtx.hpp"
//const float goldenRatio = 1.618033988749894848f;
//const float pi = 3.141592653589793238f;
#if(defined(GLM_MESSAGE) && (GLM_MESSAGE & (GLM_MESSAGE_EXTS | GLM_MESSAGE_NOTIFICATION)))
# pragma message("GLM message: Extensions library included")
#endif//GLM_MESSAGE
#define GLM_EXTENSION(extension) namespace glm{using extension;}
#endif //glm_glmext
| [
"[email protected]"
]
| [
[
[
1,
26
]
]
]
|
5f4c41d7c2855c0c64d4316c5e8dcd50aa3dd534 | fcf03ead74f6dc103ec3b07ffe3bce81c820660d | /AppFramework/Apparc/Server Application/server_application/server.cpp | e42e3a1aae248bd2cd1a0fb3a35cfeeca11fbc0c | []
| no_license | huellif/symbian-example | 72097c9aec6d45d555a79a30d576dddc04a65a16 | 56f6c5e67a3d37961408fc51188d46d49bddcfdc | refs/heads/master | 2016-09-06T12:49:32.021854 | 2010-10-14T06:31:20 | 2010-10-14T06:31:20 | 38,062,421 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 851 | cpp | // server.cpp
//
// Copyright (c) Symbian Software Ltd 2006. All rights reserved.
//
#include "server.h"
#include "definitions.h"
#include "serv_app_minimal.h"
// Constructor
EXPORT_C CServAppServer::CServAppServer()
{
}
// Destructor
EXPORT_C CServAppServer::~CServAppServer()
{
}
// Identifies the type of service (through the UID input parameter)
// the client has requested and creates an instance of the session
// that implements this service. In case of unidentified service type,
// the base class implementation of this method is called.
EXPORT_C CApaAppServiceBase* CServAppServer::CreateServiceL(TUid aServiceType) const
{
if (aServiceType==KServiceType)
return new(ELeave) CMinimalSession();
else
return CEikAppServer::CreateServiceL(aServiceType);
}
| [
"liuxk99@bdc341c6-17c0-11de-ac9f-1d9250355bca"
]
| [
[
[
1,
32
]
]
]
|
6f9b2c58ba7a3ffb4166616f827850b6c23ca9c1 | 53ee90fbc1011cb17ba013d0a49812697d4e6130 | /MootoritePlaat/MootoriteJaam/CWheels.h | c1eb4c4b62c37d990a8d993b3d02cd1280a70696 | []
| no_license | janoschtraumstunde/Robin | c3f68667c37c44e19473119b4b9b9be0fe2fb57f | bd691cbd2a0091e5100df5dfe1268d27c99b39f6 | refs/heads/master | 2021-01-12T14:06:44.095094 | 2010-12-09T14:34:27 | 2010-12-09T14:34:27 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,395 | h | #pragma once
#include "CMotor.h"
#include "CPid.h"
#define RADIUS 1
// Rataste andmed:
// 12cm - Ratta keskkoha kaugus roboti keskpunktist
// 12.5cm - Ratta välimiste rullikute keskkoha kaugus roboti keskpunktist
// 2.54cm - Ratta raadius (1 toll)
// ~4.73 - Ratta poolt tehtud ringide arv roboti 360-kraadise pöörde puhul (12cm / 2.54cm)
// ~1700 - Ratta poolt läbitud kraadid roboti 360-kraadise pöörde puhul
// 17001 - Ratta poolt läbitud detsikraadid roboti 360-kraadise pöörde puhul
// ~16cm - Ratta poolt läbitud distants ühe täispöörde jooksul
// 22.5 - koefitsient magnetanduri näitude ja millimeetrite vaheliseks teisendamiseks
// * nt. 270 kraadi puhul: 2700 / 22.5 = 120(mm)
// * nt. 10cm puhul: 100mm * 22.5 = 2250
// 1.745 - koefitsient magnetanduri näitude (0..3600) ja radiaanide lookup tabeli (0..6283) vaheliseks teisendamiseks
// * nt. 270 kraadi puhul: 2700 * 1.745 = 4711
// * nt. 4.0 radiaani puhul: 4000 / 1.745 = 2292
#define DECIDEGREES_TO_MILLIMETERS_DIVISOR 22.5
#define WHEEL_TO_ROBOT_ROTATION_MULTIPLIER 0.21175225
#define WHEEL_DECIDEGREES_TO_MILLIMETERS_DIVISOR 22.5573935
class Wheels {
int speedLeft;
int speedRight;
int speedBack;
//static const int MAX_RPM = 400;
//static const int MAX_DISTANCE = 3600;
public:
double worldCurrentX; // millimeters
double worldCurrentY; // millimeters
int localFinalX; // millimeters
int localFinalY; // millimeters
int globalFinalTheta; // decidegrees
int localCurrentX; // millimeters
int localCurrentY; // millimeters
int globalCurrentTheta; // decidegrees
void moveDistance(int localDirection, int distance); // direction in "decidegrees" (0..3600), distance in millimeters (0..3500)
void turnDistance(int localRotation); // decidegrees, 1 turn = 3600
void moveAndTurnDistance(int localDirection, int distance, int localRotation); // decidegrees, millimeters, decidegrees
void stop();
void resetGlobalPosition(int gyroAngle);
void updateGlobalPosition(long leftWheel, long rightWheel, long backWheel, double gyroAngle);
void getDesiredWheelPositions(long &desiredLeft, long &desiredRight, long &desiredBack); // desired: decidegrees
static void forwardKinematics(long left, long right, long back, double &x, double &y, double &theta);
static void inverseKinematics(long x, long y, long theta, long &left, long &right, long &back);
};
| [
"[email protected]"
]
| [
[
[
1,
59
]
]
]
|
0fb6580649e84da46f68950e54b54d8f4e31e44c | ea12fed4c32e9c7992956419eb3e2bace91f063a | /zombie/code/nebula2/src/gui/nguibrushlabel_main.cc | 1dfe8580e5b26770d91d007c49a8cbec5fa2e886 | []
| 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 | 7,032 | cc | #include "precompiled/pchngui.h"
//------------------------------------------------------------------------------
// nguibrushlabel_main.cc
// (C) 2006 Conjurer Services, S.A.
//------------------------------------------------------------------------------
#include "gui/nguibrushlabel.h"
#include "gfx2/ngfxserver2.h"
#include "gui/nguiserver.h"
nNebulaScriptClass(nGuiBrushLabel, "nguilabel");
//------------------------------------------------------------------------------
/**
*/
nGuiBrushLabel::nGuiBrushLabel() :
align(Center),
brushSizeX(0),
brushSizeY(0)
{
// empty
}
//------------------------------------------------------------------------------
/**
*/
nGuiBrushLabel::~nGuiBrushLabel()
{
// empty
}
//------------------------------------------------------------------------------
/**
*/
void
nGuiBrushLabel::SetText(const char* text)
{
n_assert(text);
this->text = text;
}
//------------------------------------------------------------------------------
/**
*/
const char*
nGuiBrushLabel::GetText() const
{
return this->text.Get();
}
//------------------------------------------------------------------------------
/**
*/
vector2
nGuiBrushLabel::GetTextExtent()
{
n_assert( this->brushSizeX > 0 && this->brushSizeY > 0 );
vector2 brushScreenSize( float(this->brushSizeX / nGfxServer2::Instance()->GetDisplayMode().GetWidth()),
float(this->brushSizeY / nGfxServer2::Instance()->GetDisplayMode().GetHeight()) );
float aspect = brushScreenSize.x / brushScreenSize.y;
brushScreenSize.y = this->rect.height();
brushScreenSize.x = brushScreenSize.y * aspect;
brushScreenSize.x *= this->text.Length();
return brushScreenSize;
}
//------------------------------------------------------------------------------
/**
@brief Render the character brushes
*/
void
nGuiBrushLabel::RenderCharacters()
{
if (this->text.IsEmpty())
{
// no text, nothing to render
return;
}
vector4 drawColor;
if (this->blinking)
{
nTime time = nGuiServer::Instance()->GetTime();
if (fmod(time, this->blinkRate) > this->blinkRate/3.0)
{
drawColor = this->blinkColor;
}
else
{
drawColor = this->color;
}
}
else
{
drawColor = this->color;
}
n_assert( this->brushSizeX > 0 && this->brushSizeY > 0 );
rectangle screenSpaceRect = this->GetScreenSpaceRect();
vector2 brushScreenSize( float(this->brushSizeX / nGfxServer2::Instance()->GetViewport().width),
float(this->brushSizeY / nGfxServer2::Instance()->GetViewport().height) );
float aspect = brushScreenSize.x / brushScreenSize.y;
brushScreenSize.y = screenSpaceRect.height();
brushScreenSize.x = brushScreenSize.y * aspect;
rectangle brushRect( screenSpaceRect.v0, vector2( screenSpaceRect.v0 + brushScreenSize ) );
for ( int charIndex = 0; charIndex < this->text.Length(); charIndex++ )
{
char character = this->text[ charIndex ];
for ( int charDef = 0; charDef < this->brushesDefinitions.Size(); charDef ++ )
{
CharacterDefinitionSet & charDefInfo = brushesDefinitions[ charDef ];
if ( charDefInfo.startChar <= character && charDefInfo.endChar >= character )
{
if ( this->colorSet )
{
nGuiServer::Instance()->DrawBrush( brushRect, charDefInfo.characterBrushes[ character - charDefInfo.startChar ], drawColor );
}
else
{
nGuiServer::Instance()->DrawBrush( brushRect, charDefInfo.characterBrushes[ character - charDefInfo.startChar ] );
}
brushRect.v0.x += brushScreenSize.x * ( 1.0f + this->charSeparation);
brushRect.v1.x += brushScreenSize.x * ( 1.0f + this->charSeparation);
break;
}
}
}
}
//------------------------------------------------------------------------------
/**
*/
bool
nGuiBrushLabel::Render()
{
if (this->IsShown())
{
// render the background image, if defined
nGuiLabel::Render();
// render the text
this->RenderCharacters();
return true;
}
return false;
}
//------------------------------------------------------------------------------
/**
@brief set size of character brush in pixels
*/
void
nGuiBrushLabel::SetBrushSize(int xs, int ys)
{
this->brushSizeX = xs;
this->brushSizeY = ys;
}
//------------------------------------------------------------------------------
/**
@brief get size of character brush in pixels
*/
void
nGuiBrushLabel::GetBrushSize(int & xs, int & ys)
{
xs = this->brushSizeX;
ys = this->brushSizeY;
}
//------------------------------------------------------------------------------
/**
@brief Add character brushes definitions
*/
void
nGuiBrushLabel::AddBrushDefinition(const char * startChar, const char * endChar, vector2 uvPos, vector2 uvSize, const char * imageFile)
{
n_assert( brushSizeX > 0 && brushSizeY );
n_assert( startChar && endChar && *startChar <= *endChar );
n_assert( imageFile && * imageFile );
CharacterDefinitionSet & charDef = brushesDefinitions.At( brushesDefinitions.Size() );
charDef.startChar = *startChar;
charDef.endChar = *endChar;
charDef.uvPos = uvPos;
charDef.uvSize = uvSize;
charDef.imageFile = imageFile;
int numChars = int(charDef.endChar) - int(charDef.startChar) + 1;
charDef.characterBrushes.SetFixedSize( numChars );
nGuiSkin* sysSkin = nGuiServer::Instance()->GetSkin();
char currentChar = charDef.startChar;
vector2 pos = charDef.uvPos;
for ( int i = 0; i < numChars; i++ )
{
nString brushName = "( )";
brushName[1] = currentChar;
brushName = this->typeFaceName + "_" + currentChar + brushName;
if ( !sysSkin->FindBrush( brushName.Get() ) )
{
sysSkin->AddBrush( brushName.Get(), charDef.imageFile.Get(), pos, charDef.uvSize, vector4(1.0f,1.0f,1.0f,1.0f) );
}
nGuiBrush & brush = charDef.characterBrushes[ i ];
brush.SetName( brushName.Get() );
pos.x += charDef.uvSize.x;
currentChar ++;
}
sysSkin->EndBrushes();
}
//------------------------------------------------------------------------------
/**
@brief set fake type face name
*/
void
nGuiBrushLabel::SetTypeFaceName(const char * name)
{
this->typeFaceName = name;
}
//------------------------------------------------------------------------------
/**
@brief Get fake type face name
*/
const char *
nGuiBrushLabel::GetTypeFaceName()
{
return this->typeFaceName.Get();
}
| [
"magarcias@c1fa4281-9647-0410-8f2c-f027dd5e0a91"
]
| [
[
[
1,
235
]
]
]
|
3b16004c3e30303fc801ff67d08455d7e16f4241 | 9c62af23e0a1faea5aaa8dd328ba1d82688823a5 | /rl/trunk/engine/rules/include/Container.h | 6d2b264a646f6488aa619240bb02208fe3862b2b | [
"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 | 4,283 | h | /* 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.
*/
#ifndef __CONTAINER_H__
#define __CONTAINER_H__
#include "RulesPrerequisites.h"
#include "Item.h"
namespace rl
{
typedef std::set<Item*> ItemSet;
/// Behaelter fr Items.
class _RlRulesExport Container : public Item
{
public:
static const Ogre::String CLASS_NAME;
static const Ogre::String PROPERTY_VOLUME;
static const Ogre::String PROPERTY_CAPACITY;
static const Ogre::String PROPERTY_CONTENT;
static const Ogre::String PROPERTY_CONTENT_OBJECTS;
static const Ogre::String PROPERTY_CONTENT_POSITIONS;
/** Creates a new container
* @param id the gameobject ID
*/
Container(int id);
virtual ~Container(void);
/// Get the weight capacity (in Stein)
Ogre::Real getCapacity() const;
/// Set the weight capacity (in Stein)
void setCapacity(Ogre::Real capacity);
/// Set the "volume" to x (width) * y (height) spaces
void setVolume(int x, int y);
/// Get the container's "volume" spaces
IntPair getVolume() const;
/** Returns whether this item is a container
* @return always <code>true</code>
*/
virtual bool isContainer() const;
/// Liefert Gesamtgewicht des Inhalts.
Ogre::Real getContentWeight() const;
virtual Ogre::Real getMass() const;
/**
* Add an item to the container's content
* @param item the item
* @return <code>true</code> if adding was successful, <code>false</code> otherwise (e.g. not enough space)
*/
bool addItem(Item* item, IntPair position = IntPair(0,0));
/**
* Remove an item from the container
*
* @param item the item
*/
void removeItem(Item* item);
/**
* Remove an item from the container
* Note: This method must only be called by Item, use removeItem in all other cases
*
* @param item the item
*/
void _doRemoveItem(Item* item);
ItemSet getItems() const;
int getItemCount() const;
bool isFree(int x, int y) const;
Item* getItemAt(int x, int y) const;
void putItemAt(Item* item, int x, int y);
bool canPlaceAt(Item* item, int xPos, int yPos) const;
void setItemPosition(Item* item, int xPos, int yPos);
IntPair getItemPosition(Item* item) const;
virtual const Property getProperty(const CeGuiString& key) const;
virtual void setProperty(const CeGuiString& key, const Property& value);
virtual PropertyKeys getAllPropertyKeys() const;
bool canHold(Item* item) const;
// in order to set the owner of the items in this container correctly override this function
void setOwner(GameObject *go);
private:
static const IntPair NO_SPACE_FOR_ITEM;
Ogre::Real mCapacity;
IntPair mVolume;
// Speichert, wo die Items sich im Container befinden.
// Speichert also die IDs der Objekte in die einzelnen Volumenfelder
int objIDMap [1][1];
ItemSet mItems;
std::map<Item*, IntPair> mItemPositions;
IntPair findPositionWithEnoughSpace(IntPair space) const;
bool checkSpace(
int xStart,
int yStart,
IntPair space) const;
/*
* recursive function
* @param cont a container
* @return true, if cont is this container or any of his parents
*/
bool isParent(Container* cont) const;
};
}
#endif //__CONTAINER_H__
| [
"tanis@4c79e8ff-cfd4-0310-af45-a38c79f83013",
"blakharaz@4c79e8ff-cfd4-0310-af45-a38c79f83013",
"sawagi@4c79e8ff-cfd4-0310-af45-a38c79f83013",
"melven@4c79e8ff-cfd4-0310-af45-a38c79f83013",
"no22@4c79e8ff-cfd4-0310-af45-a38c79f83013"
]
| [
[
[
1,
1
],
[
3,
4
],
[
6,
9
],
[
11,
11
],
[
13,
13
],
[
15,
16
]
],
[
[
2,
2
],
[
5,
5
],
[
10,
10
],
[
12,
12
],
[
14,
14
],
[
17,
28
],
[
30,
53
],
[
55,
61
],
[
63,
72
],
[
74,
92
],
[
94,
105
],
[
110,
114
],
[
118,
118
],
[
120,
128
],
[
132,
133
],
[
135,
138
]
],
[
[
29,
29
],
[
54,
54
],
[
62,
62
],
[
115,
117
],
[
119,
119
]
],
[
[
73,
73
],
[
106,
109
],
[
129,
131
],
[
134,
134
]
],
[
[
93,
93
],
[
139,
139
]
]
]
|
89c168fd692bb920d1c577b8efb14d45627abbf4 | 6d7b85cb2b2655ecede756d19e5c1e43fd31cf13 | /sources/filehandler.cpp | 630f641417cbed420ca8d7663c2ed09e10d97dde | []
| no_license | s-jonas/MT.Copy | b44fe22627e3a4394692199846032b64416281b8 | abdbaa7cb175921d69dcbb887ce80f55dd9f7481 | refs/heads/master | 2021-01-10T22:05:34.098859 | 2011-08-18T09:49:05 | 2011-08-18T09:49:05 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 965 | cpp | #include "filehandler.h"
FileHandler::FileHandler(const QString filename)
{
this->_filename = filename;
}
void FileHandler::openFile()
{
if(this->_filename==NULL)
{
return;
}
this->file = new QFile(this->_filename);
this->file->open(QIODevice::ReadOnly | QIODevice::Text);
while(!file->isReadable())
{
QTime dieTime = QTime::currentTime().addSecs(2);
while( QTime::currentTime() < dieTime )
QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
this->file->open(QIODevice::ReadOnly | QIODevice::Text);
}
}
void FileHandler::closeFile()
{
if(this->file==NULL)
{
return;
}
this->file->close();
delete(this->file);
}
QString FileHandler::readFile()
{
if(this->file==NULL)
{
return NULL;
}
openFile();
QString val(this->file->readAll());
closeFile();
return val;
}
| [
"[email protected]"
]
| [
[
[
1,
47
]
]
]
|
43ac8dfdd5169d8f04fe7f2d50cf95da326bc579 | 1e3964623d0f90069bc963bb878069ce70ddd52f | /source/gui/Compass.cpp | e1f6273fcbf081e6b34fe7789ff8fff22b10306b | []
| no_license | randomMesh/katastrophe | fbe7f608cc115d517656a53bdb9cdbc66a728b56 | 2131afc50ee5fd7a15aae6149061ef81c356b74b | refs/heads/master | 2020-04-19T19:19:17.553317 | 2009-12-03T19:05:25 | 2009-12-03T19:05:25 | 168,385,525 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,603 | cpp | // Copyright (C) 2009 randomMesh
// This file is part of the "Flocking boids" demo.
// For conditions of distribution and use, see copyright notice in main.cpp
#include "Compass.h"
#include <IGUIEnvironment.h>
#include <IVideoDriver.h>
namespace irr
{
namespace gui
{
Compass::Compass(const core::rect<s32>& rect, IGUIEnvironment* const env, IGUIElement* const parent) :
IGUIElement(EGUIET_ELEMENT, env, parent, -1, rect)
{
SetupQuadMesh(BodyMesh, 1.0f);
SetupQuadMesh(NeedleMesh, 1.0f);
}
//! render the compass
void Compass::draw()
{
if (!IsVisible)
return;
video::IVideoDriver* const driver = Environment->getVideoDriver();
const core::rect<irr::s32> oldViewPort = driver->getViewPort();
driver->setViewPort(AbsoluteRect);
// clear the projection matrix
const core::matrix4& oldProjMat = driver->getTransform(video::ETS_PROJECTION);
driver->setTransform(video::ETS_PROJECTION, core::matrix4());
// clear the view matrix
const core::matrix4& oldViewMat = driver->getTransform(video::ETS_VIEW);
driver->setTransform(video::ETS_VIEW, core::matrix4());
driver->setTransform(video::ETS_WORLD, Matrix);
// draw compass body
driver->setMaterial(BodyMesh.Material);
driver->drawMeshBuffer(&BodyMesh);
driver->setTransform(video::ETS_WORLD, core::matrix4());
// draw the needle
driver->setMaterial(NeedleMesh.Material);
driver->drawMeshBuffer(&NeedleMesh);
// restore view matrix, projection matrix and viewport
driver->setTransform(video::ETS_VIEW, oldViewMat);
driver->setTransform(video::ETS_PROJECTION, oldProjMat);
driver->setViewPort(oldViewPort);
}
void Compass::SetupQuadMesh(scene::SMeshBuffer& mesh, const f32 f32Width) const
{
const f32 f32HalfWidth = f32Width/2.0f;
mesh.Vertices.set_used(4);
mesh.Indices .set_used(6);
const video::SColor white(255, 255, 255, 255);
mesh.Vertices[0] = video::S3DVertex(-f32HalfWidth, -f32HalfWidth, 0.0f, 0.0f, 0.0f, 1.0f, white, 0.0f, 1.0f);
mesh.Vertices[1] = video::S3DVertex(-f32HalfWidth, f32HalfWidth, 0.0f, 0.0f, 0.0f, 1.0f, white, 0.0f, 0.0f);
mesh.Vertices[2] = video::S3DVertex( f32HalfWidth, f32HalfWidth, 0.0f, 0.0f, 0.0f, 1.0f, white, 1.0f, 0.0f);
mesh.Vertices[3] = video::S3DVertex( f32HalfWidth, -f32HalfWidth, 0.0f, 0.0f, 0.0f, 1.0f, white, 1.0f, 1.0f);
mesh.Indices[0] = 0;
mesh.Indices[1] = 1;
mesh.Indices[2] = 2;
mesh.Indices[3] = 2;
mesh.Indices[4] = 3;
mesh.Indices[5] = 0;
mesh.getMaterial().Lighting = false;
mesh.getMaterial().MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
}
}
}
| [
"randomMesh@5fd19fba-185a-4fba-8bb7-5f051f5e5bbc"
]
| [
[
[
1,
85
]
]
]
|
75166eea10fd6984de2c2a98d22a17582dfdf26f | 0b55a33f4df7593378f58b60faff6bac01ec27f3 | /Konstruct/Client/Dimensions/PlayerPetAI.cpp | 4d7b6f5c62d5174f934d526843d417b795e7045f | []
| no_license | RonOHara-GG/dimgame | 8d149ffac1b1176432a3cae4643ba2d07011dd8e | bbde89435683244133dca9743d652dabb9edf1a4 | refs/heads/master | 2021-01-10T21:05:40.480392 | 2010-09-01T20:46:40 | 2010-09-01T20:46:40 | 32,113,739 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,268 | cpp | #include "StdAfx.h"
#include "PlayerPetAI.h"
#include "PlayerPet.h"
#include "Level.h"
#include "Grid.h"
#include "PlayerCharacter.h"
#include "Common/Utility/kpuVector.h"
#include "Common/Utility/kpuQuadTree.h"
PlayerPetAI::PlayerPetAI(PlayerPet* pPet)
{
m_pTheMindless = pPet;
}
PlayerPetAI::~PlayerPetAI(void)
{
}
void PlayerPetAI::Update(float fDeltaTime)
{
switch( m_eCurrentState )
{
case eST_Aggro:
{
if( !m_pTheMindless->GetTarget() )
{
//find target in range
float fAggroRange = m_pTheMindless->GetAggroRange();
kpuBoundingSphere sphere(fAggroRange, m_pTheMindless->GetLocation());
kpuArrayList<kpuCollisionData> collidedObjects;
g_pGameState->GetLevel()->GetQuadTree()->GetPossibleCollisions(sphere, &collidedObjects);
Actor* pClosest = 0;
float m_fClosest = fAggroRange * fAggroRange;
for(int i = 0; i < collidedObjects.Count(); i++)
{
kpuCollisionData* pNext = &collidedObjects[i];
if( pNext->m_pObject->HasFlag(ENEMY) )
{
//get distance to the object
float fDist = kpuVector::DistanceSquared(pNext->m_pObject->GetLocation(), m_pTheMindless->GetLocation());
if( fDist < m_fClosest )
{
m_fClosest = fDist;
pClosest = (Actor*)pNext->m_pObject;
}
}
}
m_pTheMindless->SetTarget(pClosest);
}
else
{
Grid* pGrid = g_pGameState->GetLevel()->GetGrid();
//Charge toward target until within attack range
if( !m_pTheMindless->IsInRange(m_pTheMindless->GetTarget(), m_pTheMindless->GetRange()) )
{
kpuVector vLocation = m_pTheMindless->GetLocation();
kpuVector vTarget = m_pTheMindless->GetTarget()->GetLocation();
//if greater than aggro range * 5 then mob breaks
if( !m_pTheMindless->IsInRange(m_pTheMindless->GetTarget(), m_pTheMindless->GetAggroRange() * 5) )
{
m_pTheMindless->SetTarget(0);
int iTile = pGrid->GetTileAtLocation(vLocation);
m_pTheMindless->SetMoveTarget(iTile);
m_eCurrentState = eST_Wait;
break;
}
int iCurrentTile = pGrid->GetTileAtLocation(vLocation);
//Only move if at destination
if( m_pTheMindless->AtDestination() )
{
kpuVector vDirection, vCurrentToTarget;
vDirection = vTarget - vLocation;
vCurrentToTarget = vDirection;
vDirection.Normalize();
int iTile = pGrid->BestMove(vDirection, iCurrentTile);
if( iTile == m_iPreviousTile )
{
//see if it is possible to get next to target
//if not just get close and wait
iTile = pGrid->BestMove(vDirection * -1 , pGrid->GetTileAtLocation(vTarget));
if( iTile > 0 )
{
m_pTheMindless->SetMoveTarget(iTile);
m_pTheMindless->BuildPathToDestination();
break;
}
}
if( iTile > 0 )
{
m_pTheMindless->SetNextMove(iTile);
m_iPreviousTile = iCurrentTile;
}
else
m_pTheMindless->SetNextMove(iCurrentTile);
}
else if( pGrid->GetActor(m_pTheMindless->GetDestinationTile()) && pGrid->GetActor(m_pTheMindless->GetDestinationTile()) != m_pTheMindless)
{
//if not at destination but it is occupied change destination to current tile
m_pTheMindless->SetNextMove(iCurrentTile);
}
}
else
{
int iTile = pGrid->GetTileAtLocation(m_pTheMindless->GetLocation());
m_pTheMindless->SetNextMove(iTile);
m_iPreviousTile = -1;
m_eCurrentState = eST_Attack;
}
}
break;
}
case eST_Attack:
{
if( !m_pTheMindless->IsInRange(m_pTheMindless->GetTarget(), m_pTheMindless->GetRange()) )
{
m_eCurrentState = eST_Aggro;
break;
}
float fHealth = m_pTheMindless->GetCurrentHealth() / (float)(m_pTheMindless->GetMaxHealth()) ;
if( fHealth > 0.10f )
{
m_pTheMindless->UseDefaultAttack(m_pTheMindless->GetTarget(), g_pGameState->GetLevel()->GetGrid() );
}
break;
}
case eST_Defend:
{
//if the player gets attack then attack his attacker
break;
}
case eST_Wait:
{
break;
}
}
} | [
"bflassing@0c57dbdb-4d19-7b8c-568b-3fe73d88484e"
]
| [
[
[
1,
160
]
]
]
|
dd7c2e9a0d9f5c26f57c30376ba1c09028a55712 | 3d9e738c19a8796aad3195fd229cdacf00c80f90 | /src/gui/app/Settings_dialog.cpp | bbdda14175d602cb8eb8af3c585ffad1e4c1e2ab | []
| no_license | mrG7/mesecina | 0cd16eb5340c72b3e8db5feda362b6353b5cefda | d34135836d686a60b6f59fa0849015fb99164ab4 | refs/heads/master | 2021-01-17T10:02:04.124541 | 2011-03-05T17:29:40 | 2011-03-05T17:29:40 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,091 | cpp | /* This source file is part of Mesecina, a software for visualization and studying of
* the medial axis and related computational geometry structures.
* More info: http://www.agg.ethz.ch/~miklosb/mesecina
* Copyright Balint Miklos, Applied Geometry Group, ETH Zurich
*
* $Id: Settings_dialog.cpp 123 2007-07-01 21:43:01Z miklosb $
*/
#include <gui/app/Settings_dialog.h>
#include <QtGui/QVBoxLayout>
Settings_dialog::Settings_dialog(QWidget* parent, QString name): QDialog(parent) {
setModal(false);
setWindowTitle("Application settings");
QVBoxLayout *layout = new QVBoxLayout(this);
layout->setSpacing(2);
layout->setMargin(0);
settings_list_widget = new Settings_list_widget(this, "Statistics");
layout->addWidget(settings_list_widget);
setLayout(layout);
}
void Settings_dialog::closeEvent(QCloseEvent* e) {
emit closing(false);
QDialog::closeEvent(e);
}
void Settings_dialog::keyPressEvent(QKeyEvent *e) {
switch (e->key()) {
case Qt::Key_E:
if (e->modifiers() == Qt::ControlModifier)
close();
break;
}
} | [
"balint.miklos@localhost"
]
| [
[
[
1,
40
]
]
]
|
d403b970ee350eece60a8232d3971126f89bb695 | 74b0667a0585cfef6eca1ddc0e31424cce1031a1 | /officevillagers/_Source/LevelLogic/actorItem.h | 115863ca31a06054048c44f493f135c3e3316367 | []
| no_license | IPv6/officevillagers | 14e599f27beba5023dd89d28d5c5ad2c10b814ae | 94ab3660c71e59099fd6a2d9c0465c0a9ef905e0 | refs/heads/master | 2020-05-20T11:29:17.509396 | 2008-09-19T02:00:31 | 2008-09-19T02:00:31 | 32,118,932 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,363 | h | #ifndef _H_PROTECTOR_LEVELACTORITEM
#define _H_PROTECTOR_LEVELACTORITEM
#include "../engineBindings.h"
#include "navigation.h"
class CActor;
class CActorItemDesc: public StorageNamed::CXmlStruct
{
public:
CActorItemDesc();
CString sName;
CString sDefaultSpr;
long bFake;
long bAutoArrange;
long iInSprParent;
long bAsPocket;
long bSaveItemInSaves;
CString sHideWhileItem;
CString sScriptOnAttach;
CString sScriptOnSpawn;
CString sScriptOnDetach;
CString sAutoClearTypes;
long lSkipInFF;
MAP2XML_BEGIN("ItemDescription")
MAP2XML (&sName, "Name")
MAP2XML_DEF (&sDefaultSpr, "DefaultSpr", "")
MAP2XML_DEF (&bFake, "Fake",0)
MAP2XML_DEF (&bAutoArrange, "AutoArrange",0)
MAP2XML_DEF (&iInSprParent, "InSprParent",-1)
MAP2XML_DEF (&bAsPocket, "AsPocket",0)
MAP2XML_DEF (&sHideWhileItem, "HideIf", "")
MAP2XML_DEF (&bSaveItemInSaves, "SaveInSaves", 1)
MAP2XML_DEF (&sAutoClearTypes, "DeleteOnEvent", "")
MAP2XML_DEF (&sScriptOnAttach, "ScriptOnAttach", "")
MAP2XML_DEF (&sScriptOnSpawn, "ScriptOnSpawn", "")
MAP2XML_DEF (&sScriptOnDetach, "ScriptOnDetach", "")
MAP2XML_DEF (&lSkipInFF, "SkipInFF", 0)
MAP2XML_END()
};
typedef core::array<CActorItemDesc*> _array_CItemDscP;
class CActorItem: public StorageNamed::CXmlStruct
{
public:
BOOL bCheckHideIf;
CActorItem();
~CActorItem();
CString sName;
CString sCorrespondingSprFile;
CString sCustomParam;
CString sHideWhileItem;
u32 lCreationTime;
SquirrelObject sqoItem;
CUniOptionsHolder attribs;
CString sAttribsAsStr;
MAP2XML_BEGIN("Item")
MAP2XML (&sName, "Name")
MAP2XML (&sCorrespondingSprFile, "ItemSpr")
MAP2XML_DEF (&sCustomParam, "ItemCustomParam", "")
MAP2XML_DEF (&sAttribsAsStr, "Params", "")
MAP2XML_DEF (&sHideWhileItem, "HideIf", "")
MAP2XML_END()
CSpriteNode* itemNode;
CActorItemDesc* itemDsc;
void ApplySerialization();
void PrepareSerialization();
BOOL OnItemAttach(CActor* who);
BOOL OnDetach(CActor* who);
BOOL Think(CActor* who);
BOOL ThinkHideIf(CActor* who);
static BOOL SpawnItemUI(CActorItem* item, CActor* who);
BOOL IsSerializableAsArrayItem(StorageNamed::CIrrXmlStorage* storage)
{
if(itemDsc && !itemDsc->bSaveItemInSaves){
return FALSE;
}
return TRUE;
}
};
typedef core::array<CActorItem*> _array_CItemP;
#endif | [
"wplabs@5873e4e3-2a54-0410-bc5d-d38544d033f4"
]
| [
[
[
1,
87
]
]
]
|
b67cc7cbf8c36c72ae4af1b2f1f14ba41ec299b2 | 1e01b697191a910a872e95ddfce27a91cebc57dd | /cs/src/DOTNET.cpp | ec37e816924bf282654e9188d6e3f19c3b81abb1 | []
| no_license | canercandan/codeworker | 7c9871076af481e98be42bf487a9ec1256040d08 | a68851958b1beef3d40114fd1ceb655f587c49ad | refs/heads/master | 2020-05-31T22:53:56.492569 | 2011-01-29T19:12:59 | 2011-01-29T19:12:59 | 1,306,254 | 7 | 5 | null | null | null | null | IBM852 | C++ | false | false | 98,966 | cpp | /* "CodeWorker": a scripting language for parsing and generating text.
Copyright (C) 1996-1997, 1999-2004 CÚdric Lemaire
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
To contact the author: [email protected]
*/
#ifdef WIN32
#pragma warning(disable : 4786)
#endif
#include "UtlException.h"
#include "ScpStream.h"
#include "CGRuntime.h"
#include "DtaScriptVariable.h"
#include "ExprScriptVariable.h"
#include "DtaScript.h"
#include "CGCompiler.h"
#include "DOTNET.h"
#define CW_STRING_TO_CHARARRAY(s) \
const char* tc##s = NULL;\
try {\
tc##s = static_cast<const char*>(const_cast<void*>(static_cast<const void*>(System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi(s))));\
} catch(System::ArgumentException* /*exceptArg*/) {\
std::cout << "ArgumentException*" << std::endl;\
} catch(System::OutOfMemoryException* /*exceptOOM*/) {\
std::cout << "OutOfMemoryException*" << std::endl;\
}
#define CW_FREE_CHARARRAY(s) System::Runtime::InteropServices::Marshal::FreeHGlobal(static_cast<System::IntPtr>(const_cast<void*>(static_cast<const void*>(tc##s))));
#define CW_CHARARRAY_TO_STRING(tcText) System::Runtime::InteropServices::Marshal::PtrToStringAnsi(static_cast<System::IntPtr>(const_cast<void*>(static_cast<const void*>(tcText))))
#define CW_STL_TO_STRING(sText) System::Runtime::InteropServices::Marshal::PtrToStringAnsi(static_cast<System::IntPtr>(const_cast<void*>(static_cast<const void*>(sText.c_str()))), (int) sText.size())
namespace CodeWorker {
ParseTree::ParseTree() : cppInstance_(NULL), owner_(true) {
cppInstance_ = new DtaScriptVariable;
}
ParseTree::ParseTree(ParseTree* pCopy) : cppInstance_(NULL), owner_(false) {
if (pCopy != NULL) cppInstance_ = pCopy->cppInstance_;
}
ParseTree::~ParseTree() {
if (owner_) delete cppInstance_;
}
ParseTree* ParseTree::get_reference() {
DtaScriptVariable* pRef = cppInstance_->getReferencedVariable();
if (pRef == NULL) return NULL;
ParseTree* pResult = new ParseTree(NULL);
pResult->cppInstance_ = pRef;
return pResult;
}
void ParseTree::set_reference(ParseTree* pRef) {
if (pRef == NULL) {
cppInstance_->setValue((DtaScriptVariable*) NULL);
} else {
cppInstance_->setValue(pRef->cppInstance_);
}
}
System::String* ParseTree::get_name() {
const char* tcValue = cppInstance_->getName();
if (tcValue == NULL) return NULL;
return CW_CHARARRAY_TO_STRING(tcValue);
}
System::String* ParseTree::get_text() {
const char* tcValue = cppInstance_->getValue();
if (tcValue == NULL) return NULL;
return CW_CHARARRAY_TO_STRING(tcValue);
}
void ParseTree::set_text(System::String* pValue) {
CW_STRING_TO_CHARARRAY(pValue);
cppInstance_->setValue(tcpValue);
CW_FREE_CHARARRAY(pValue);
}
ParseTree* ParseTree::get_array()[] {
ParseTree* pResult[];
const std::list<DtaScriptVariable*>* pArray = cppInstance_->getArray();
if (pArray == NULL) {
pResult = NULL;
} else {
pResult = new ParseTree*[(int) pArray->size()];
int i = 0;
for (std::list<DtaScriptVariable*>::const_iterator it = pArray->begin(); it != pArray->end(); ++it) {
pResult[i] = new ParseTree(NULL);
pResult[i]->cppInstance_ = *it;
++i;
}
}
return pResult;
}
System::String* ParseTree::get_attributeNames()[] {
DtaScriptVariableList* pAttributes = cppInstance_->getAttributes();
if (pAttributes == NULL) return NULL;
std::vector<const char*> tsAttributes;
while (pAttributes != NULL) {
DtaScriptVariable* pNode = pAttributes->getNode();
tsAttributes.push_back(pNode->getName());
pAttributes = pAttributes->getNext();
}
System::String* pResult[] = new System::String*[(int) tsAttributes.size()];
for (unsigned int i = 0; i < tsAttributes.size(); ++i) {
pResult[i] = CW_CHARARRAY_TO_STRING(tsAttributes[i]);
}
return pResult;
}
ParseTree* ParseTree::getNode(System::String* pAttribute) {
CW_STRING_TO_CHARARRAY(pAttribute);
DtaScriptVariable* pNode = cppInstance_->getNode(tcpAttribute);
if (pNode == NULL) return NULL;
ParseTree* pResult = new ParseTree(NULL);
pResult->cppInstance_ = pNode;
CW_FREE_CHARARRAY(pAttribute);
return pResult;
}
ParseTree* ParseTree::insertNode(System::String* pAttribute) {
CW_STRING_TO_CHARARRAY(pAttribute);
DtaScriptVariable* pNode = cppInstance_->insertNode(tcpAttribute);
if (pNode == NULL) return NULL;
ParseTree* pResult = new ParseTree(NULL);
pResult->cppInstance_ = pNode;
CW_FREE_CHARARRAY(pAttribute);
return pResult;
}
ParseTree* ParseTree::addItem(System::String* pKey) {
CW_STRING_TO_CHARARRAY(pKey);
DtaScriptVariable* pNode = cppInstance_->addElement(tcpKey);
if (pNode == NULL) return NULL;
ParseTree* pResult = new ParseTree(NULL);
pResult->cppInstance_ = pNode;
CW_FREE_CHARARRAY(pKey);
return pResult;
}
CompiledCommonScript::CompiledCommonScript() : _pScript(NULL) {
_pScript = __nogc new CGCompiledCommonScript;
}
CompiledCommonScript::~CompiledCommonScript() {
delete _pScript;
}
void CompiledCommonScript::buildFromFile(System::String* pFilename) {
CW_STRING_TO_CHARARRAY(pFilename);
try {
_pScript->buildFromFile(tcpFilename);
} catch(std::exception& exception) {
CW_FREE_CHARARRAY(pFilename);
System::String* pMessage = System::Runtime::InteropServices::Marshal::PtrToStringAnsi(static_cast<System::IntPtr>(const_cast<void*>(static_cast<const void*>(exception.what()))));
throw new System::Exception(pMessage);
} catch(...) {
CW_FREE_CHARARRAY(pFilename);
throw new System::Exception(L"an ellipsis exception has occured in CompiledCommonScript::buildFromFile(...)");
}
CW_FREE_CHARARRAY(pFilename);
}
void CompiledCommonScript::buildFromString(System::String* pText) {
CW_STRING_TO_CHARARRAY(pText);
std::string sScriptText = tcpText;
try {
_pScript->buildFromString(sScriptText);
} catch(std::exception& exception) {
CW_FREE_CHARARRAY(pText);
System::String* pMessage = System::Runtime::InteropServices::Marshal::PtrToStringAnsi(static_cast<System::IntPtr>(const_cast<void*>(static_cast<const void*>(exception.what()))));
throw new System::Exception(pMessage);
} catch(...) {
CW_FREE_CHARARRAY(pText);
throw new System::Exception(L"an ellipsis exception has occured in CompiledCommonScript::buildFromString(...)");
}
CW_FREE_CHARARRAY(pText);
}
void CompiledCommonScript::execute(ParseTree* pContext) {
try {
_pScript->execute(pContext->cppInstance_);
} catch(std::exception& exception) {
System::String* pMessage = System::Runtime::InteropServices::Marshal::PtrToStringAnsi(static_cast<System::IntPtr>(const_cast<void*>(static_cast<const void*>(exception.what()))));
throw new System::Exception(pMessage);
} catch(...) {
throw new System::Exception(L"an ellipsis exception has occured in CompiledCommonScript::execute(...)");
}
}
CompiledTemplateScript::CompiledTemplateScript() : _pScript(NULL) {
_pScript = new CGCompiledTemplateScript;
}
CompiledTemplateScript::~CompiledTemplateScript() {
delete _pScript;
}
void CompiledTemplateScript::buildFromFile(System::String* pFilename) {
CW_STRING_TO_CHARARRAY(pFilename);
try {
_pScript->buildFromFile(tcpFilename);
} catch(std::exception& exception) {
CW_FREE_CHARARRAY(pFilename);
System::String* pMessage = System::Runtime::InteropServices::Marshal::PtrToStringAnsi(static_cast<System::IntPtr>(const_cast<void*>(static_cast<const void*>(exception.what()))));
throw new System::Exception(pMessage);
} catch(...) {
CW_FREE_CHARARRAY(pFilename);
throw new System::Exception(L"an ellipsis exception has occured in CompiledTemplateScript::buildFromFile(...)");
}
CW_FREE_CHARARRAY(pFilename);
}
void CompiledTemplateScript::buildFromString(System::String* pText) {
CW_STRING_TO_CHARARRAY(pText);
std::string sScriptText = tcpText;
try {
_pScript->buildFromString(sScriptText);
} catch(std::exception& exception) {
CW_FREE_CHARARRAY(pText);
System::String* pMessage = System::Runtime::InteropServices::Marshal::PtrToStringAnsi(static_cast<System::IntPtr>(const_cast<void*>(static_cast<const void*>(exception.what()))));
throw new System::Exception(pMessage);
} catch(...) {
CW_FREE_CHARARRAY(pText);
throw new System::Exception(L"an ellipsis exception has occured in CompiledTemplateScript::buildFromString(...)");
}
CW_FREE_CHARARRAY(pText);
}
void CompiledTemplateScript::generate(ParseTree* pContext, System::String* sOutputFile) {
CW_STRING_TO_CHARARRAY(sOutputFile);
try {
_pScript->generate(pContext->cppInstance_, tcsOutputFile);
} catch(std::exception& exception) {
CW_FREE_CHARARRAY(sOutputFile);
System::String* pMessage = System::Runtime::InteropServices::Marshal::PtrToStringAnsi(static_cast<System::IntPtr>(const_cast<void*>(static_cast<const void*>(exception.what()))));
throw new System::Exception(pMessage);
} catch(...) {
CW_FREE_CHARARRAY(sOutputFile);
throw new System::Exception(L"an ellipsis exception has occured in CompiledTemplateScript::generate(...)");
}
CW_FREE_CHARARRAY(sOutputFile);
}
System::String* CompiledTemplateScript::generateString(ParseTree* pContext, System::String* sOutputText) {
CW_STRING_TO_CHARARRAY(sOutputText);
std::string sSTDText = tcsOutputText;
try {
_pScript->generateString(pContext->cppInstance_, sSTDText);
sSTDText = tcsOutputText;
} catch(std::exception& exception) {
CW_FREE_CHARARRAY(sOutputText);
System::String* pMessage = System::Runtime::InteropServices::Marshal::PtrToStringAnsi(static_cast<System::IntPtr>(const_cast<void*>(static_cast<const void*>(exception.what()))));
throw new System::Exception(pMessage);
} catch(...) {
CW_FREE_CHARARRAY(sOutputText);
throw new System::Exception(L"an ellipsis exception has occured in CompiledTemplateScript::generateString(...)");
}
CW_FREE_CHARARRAY(sOutputText);
return CW_STL_TO_STRING(sSTDText);
}
void CompiledTemplateScript::expand(ParseTree* pContext, System::String* sOutputFile) {
CW_STRING_TO_CHARARRAY(sOutputFile);
try {
_pScript->expand(pContext->cppInstance_, tcsOutputFile);
} catch(std::exception& exception) {
CW_FREE_CHARARRAY(sOutputFile);
System::String* pMessage = System::Runtime::InteropServices::Marshal::PtrToStringAnsi(static_cast<System::IntPtr>(const_cast<void*>(static_cast<const void*>(exception.what()))));
throw new System::Exception(pMessage);
} catch(...) {
CW_FREE_CHARARRAY(sOutputFile);
throw new System::Exception(L"an ellipsis exception has occured in CompiledTemplateScript::expand(...)");
}
CW_FREE_CHARARRAY(sOutputFile);
}
CompiledBNFScript::CompiledBNFScript() : _pScript(NULL) {
_pScript = new CGCompiledBNFScript;
}
CompiledBNFScript::~CompiledBNFScript() {
delete _pScript;
}
void CompiledBNFScript::buildFromFile(System::String* pFilename) {
CW_STRING_TO_CHARARRAY(pFilename);
try {
_pScript->buildFromFile(tcpFilename);
} catch(std::exception& exception) {
CW_FREE_CHARARRAY(pFilename);
System::String* pMessage = System::Runtime::InteropServices::Marshal::PtrToStringAnsi(static_cast<System::IntPtr>(const_cast<void*>(static_cast<const void*>(exception.what()))));
throw new System::Exception(pMessage);
} catch(...) {
CW_FREE_CHARARRAY(pFilename);
throw new System::Exception(L"an ellipsis exception has occured in CompiledBNFScript::buildFromFile(...)");
}
CW_FREE_CHARARRAY(pFilename);
}
void CompiledBNFScript::buildFromString(System::String* pText) {
CW_STRING_TO_CHARARRAY(pText);
std::string sScriptText = tcpText;
try {
_pScript->buildFromString(sScriptText);
} catch(std::exception& exception) {
CW_FREE_CHARARRAY(pText);
System::String* pMessage = System::Runtime::InteropServices::Marshal::PtrToStringAnsi(static_cast<System::IntPtr>(const_cast<void*>(static_cast<const void*>(exception.what()))));
throw new System::Exception(pMessage);
} catch(...) {
CW_FREE_CHARARRAY(pText);
throw new System::Exception(L"an ellipsis exception has occured in CompiledBNFScript::buildFromString(...)");
}
CW_FREE_CHARARRAY(pText);
}
void CompiledBNFScript::parse(ParseTree* pContext, System::String* sParsedFile) {
CW_STRING_TO_CHARARRAY(sParsedFile);
try {
_pScript->parse(pContext->cppInstance_, tcsParsedFile);
} catch(std::exception& exception) {
CW_FREE_CHARARRAY(sParsedFile);
System::String* pMessage = System::Runtime::InteropServices::Marshal::PtrToStringAnsi(static_cast<System::IntPtr>(const_cast<void*>(static_cast<const void*>(exception.what()))));
throw new System::Exception(pMessage);
} catch(...) {
CW_FREE_CHARARRAY(sParsedFile);
throw new System::Exception(L"an ellipsis exception has occured in CompiledBNFScript::parse(...)");
}
CW_FREE_CHARARRAY(sParsedFile);
}
void CompiledBNFScript::parseString(ParseTree* pContext, System::String* sText) {
CW_STRING_TO_CHARARRAY(sText);
std::string sSTDText = tcsText;
try {
_pScript->parseString(pContext->cppInstance_, sSTDText);
} catch(std::exception& exception) {
CW_FREE_CHARARRAY(sText);
System::String* pMessage = System::Runtime::InteropServices::Marshal::PtrToStringAnsi(static_cast<System::IntPtr>(const_cast<void*>(static_cast<const void*>(exception.what()))));
throw new System::Exception(pMessage);
} catch(...) {
CW_FREE_CHARARRAY(sText);
throw new System::Exception(L"an ellipsis exception has occured in CompiledBNFScript::parseString(...)");
}
CW_FREE_CHARARRAY(sText);
}
CompiledTranslationScript::CompiledTranslationScript() : _pScript(NULL) {
_pScript = new CGCompiledTranslationScript;
}
CompiledTranslationScript::~CompiledTranslationScript() {
delete _pScript;
}
void CompiledTranslationScript::buildFromFile(System::String* pFilename) {
CW_STRING_TO_CHARARRAY(pFilename);
try {
_pScript->buildFromFile(tcpFilename);
} catch(std::exception& exception) {
CW_FREE_CHARARRAY(pFilename);
System::String* pMessage = System::Runtime::InteropServices::Marshal::PtrToStringAnsi(static_cast<System::IntPtr>(const_cast<void*>(static_cast<const void*>(exception.what()))));
throw new System::Exception(pMessage);
} catch(...) {
CW_FREE_CHARARRAY(pFilename);
throw new System::Exception(L"an ellipsis exception has occured in CompiledTranslationScript::buildFromFile(...)");
}
CW_FREE_CHARARRAY(pFilename);
}
void CompiledTranslationScript::buildFromString(System::String* pText) {
CW_STRING_TO_CHARARRAY(pText);
std::string sScriptText = tcpText;
try {
_pScript->buildFromString(sScriptText);
} catch(std::exception& exception) {
CW_FREE_CHARARRAY(pText);
System::String* pMessage = System::Runtime::InteropServices::Marshal::PtrToStringAnsi(static_cast<System::IntPtr>(const_cast<void*>(static_cast<const void*>(exception.what()))));
throw new System::Exception(pMessage);
} catch(...) {
CW_FREE_CHARARRAY(pText);
throw new System::Exception(L"an ellipsis exception has occured in CompiledTranslationScript::buildFromString(...)");
}
CW_FREE_CHARARRAY(pText);
}
void CompiledTranslationScript::translate(ParseTree* pContext, System::String* sParsedFile, System::String* sOutputFile) {
CW_STRING_TO_CHARARRAY(sParsedFile);
CW_STRING_TO_CHARARRAY(sOutputFile);
try {
_pScript->translate(pContext->cppInstance_, tcsParsedFile, tcsOutputFile);
} catch(std::exception& exception) {
CW_FREE_CHARARRAY(sOutputFile);
CW_FREE_CHARARRAY(sParsedFile);
System::String* pMessage = System::Runtime::InteropServices::Marshal::PtrToStringAnsi(static_cast<System::IntPtr>(const_cast<void*>(static_cast<const void*>(exception.what()))));
throw new System::Exception(pMessage);
} catch(...) {
CW_FREE_CHARARRAY(sOutputFile);
CW_FREE_CHARARRAY(sParsedFile);
throw new System::Exception(L"an ellipsis exception has occured in CompiledTranslationScript::translate(...)");
}
CW_FREE_CHARARRAY(sOutputFile);
CW_FREE_CHARARRAY(sParsedFile);
}
System::String* CompiledTranslationScript::translateString(ParseTree* pContext, System::String* sInputText) {
CW_STRING_TO_CHARARRAY(sInputText);
std::string sOutputText;
try {
_pScript->translateString(pContext->cppInstance_, tcsInputText, sOutputText);
} catch(std::exception& exception) {
CW_FREE_CHARARRAY(sInputText);
System::String* pMessage = System::Runtime::InteropServices::Marshal::PtrToStringAnsi(static_cast<System::IntPtr>(const_cast<void*>(static_cast<const void*>(exception.what()))));
throw new System::Exception(pMessage);
} catch(...) {
CW_FREE_CHARARRAY(sInputText);
throw new System::Exception(L"an ellipsis exception has occured in CompiledTranslationScript::translateString(...)");
}
CW_FREE_CHARARRAY(sInputText);
return CW_STL_TO_STRING(sOutputText);
}
//##markup##"C++ body"
//##begin##"C++ body"
void Runtime::appendFile(System::String* hFilename, System::String* hContent) {
std::string sFilename;
CW_STRING_TO_CHARARRAY(hFilename);
sFilename = tchFilename;
std::string sContent;
CW_STRING_TO_CHARARRAY(hContent);
sContent = tchContent;
CGRuntime::appendFile(sFilename, sContent);
CW_FREE_CHARARRAY(hContent);
CW_FREE_CHARARRAY(hFilename);
}
void Runtime::clearVariable(ParseTree* hNode) {
CodeWorker::DtaScriptVariable* pNode;
pNode = ((hNode == NULL) ? NULL : hNode->cppInstance_);
CGRuntime::clearVariable(pNode);
}
void Runtime::compileToCpp(System::String* hScriptFileName, System::String* hProjectDirectory, System::String* hCodeWorkerDirectory) {
std::string sScriptFileName;
CW_STRING_TO_CHARARRAY(hScriptFileName);
sScriptFileName = tchScriptFileName;
std::string sProjectDirectory;
CW_STRING_TO_CHARARRAY(hProjectDirectory);
sProjectDirectory = tchProjectDirectory;
std::string sCodeWorkerDirectory;
CW_STRING_TO_CHARARRAY(hCodeWorkerDirectory);
sCodeWorkerDirectory = tchCodeWorkerDirectory;
CGRuntime::compileToCpp(sScriptFileName, sProjectDirectory, sCodeWorkerDirectory);
CW_FREE_CHARARRAY(hCodeWorkerDirectory);
CW_FREE_CHARARRAY(hProjectDirectory);
CW_FREE_CHARARRAY(hScriptFileName);
}
void Runtime::copyFile(System::String* hSourceFileName, System::String* hDestinationFileName) {
std::string sSourceFileName;
CW_STRING_TO_CHARARRAY(hSourceFileName);
sSourceFileName = tchSourceFileName;
std::string sDestinationFileName;
CW_STRING_TO_CHARARRAY(hDestinationFileName);
sDestinationFileName = tchDestinationFileName;
CGRuntime::copyFile(sSourceFileName, sDestinationFileName);
CW_FREE_CHARARRAY(hDestinationFileName);
CW_FREE_CHARARRAY(hSourceFileName);
}
void Runtime::copyGenerableFile(System::String* hSourceFileName, System::String* hDestinationFileName) {
std::string sSourceFileName;
CW_STRING_TO_CHARARRAY(hSourceFileName);
sSourceFileName = tchSourceFileName;
std::string sDestinationFileName;
CW_STRING_TO_CHARARRAY(hDestinationFileName);
sDestinationFileName = tchDestinationFileName;
CGRuntime::copyGenerableFile(sSourceFileName, sDestinationFileName);
CW_FREE_CHARARRAY(hDestinationFileName);
CW_FREE_CHARARRAY(hSourceFileName);
}
void Runtime::copySmartDirectory(System::String* hSourceDirectory, System::String* hDestinationPath) {
std::string sSourceDirectory;
CW_STRING_TO_CHARARRAY(hSourceDirectory);
sSourceDirectory = tchSourceDirectory;
std::string sDestinationPath;
CW_STRING_TO_CHARARRAY(hDestinationPath);
sDestinationPath = tchDestinationPath;
CGRuntime::copySmartDirectory(sSourceDirectory, sDestinationPath);
CW_FREE_CHARARRAY(hDestinationPath);
CW_FREE_CHARARRAY(hSourceDirectory);
}
void Runtime::cutString(System::String* hText, System::String* hSeparator, ParseTree* hList) {
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
std::string sSeparator;
CW_STRING_TO_CHARARRAY(hSeparator);
sSeparator = tchSeparator;
std::list<std::string> slList;
// NOT HANDLED YET!
CGRuntime::cutString(sText, sSeparator, slList);
CW_FREE_CHARARRAY(hSeparator);
CW_FREE_CHARARRAY(hText);
}
void Runtime::environTable(ParseTree* hTable) {
CodeWorker::DtaScriptVariable* pTable;
pTable = ((hTable == NULL) ? NULL : hTable->cppInstance_);
CGRuntime::environTable(pTable);
}
void Runtime::extendExecutedScript(System::String* hScriptContent) {
std::string sScriptContent;
CW_STRING_TO_CHARARRAY(hScriptContent);
sScriptContent = tchScriptContent;
CGRuntime::extendExecutedScript(sScriptContent);
CW_FREE_CHARARRAY(hScriptContent);
}
void Runtime::insertElementAt(ParseTree* hList, System::String* hKey, int hPosition) {
CodeWorker::DtaScriptVariable* pList;
pList = ((hList == NULL) ? NULL : hList->cppInstance_);
std::string sKey;
CW_STRING_TO_CHARARRAY(hKey);
sKey = tchKey;
int iPosition;
iPosition = hPosition;
CGRuntime::insertElementAt(pList, sKey, iPosition);
CW_FREE_CHARARRAY(hKey);
}
void Runtime::invertArray(ParseTree* hArray) {
CodeWorker::DtaScriptVariable* pArray;
pArray = ((hArray == NULL) ? NULL : hArray->cppInstance_);
CGRuntime::invertArray(pArray);
}
void Runtime::listAllGeneratedFiles(ParseTree* hFiles) {
CodeWorker::DtaScriptVariable* pFiles;
pFiles = ((hFiles == NULL) ? NULL : hFiles->cppInstance_);
CGRuntime::listAllGeneratedFiles(pFiles);
}
void Runtime::loadProject(System::String* hXMLorTXTFileName, ParseTree* hNodeToLoad) {
std::string sXMLorTXTFileName;
CW_STRING_TO_CHARARRAY(hXMLorTXTFileName);
sXMLorTXTFileName = tchXMLorTXTFileName;
CodeWorker::DtaScriptVariable* pNodeToLoad;
pNodeToLoad = ((hNodeToLoad == NULL) ? NULL : hNodeToLoad->cppInstance_);
CGRuntime::loadProject(sXMLorTXTFileName, pNodeToLoad);
CW_FREE_CHARARRAY(hXMLorTXTFileName);
}
void Runtime::openLogFile(System::String* hFilename) {
std::string sFilename;
CW_STRING_TO_CHARARRAY(hFilename);
sFilename = tchFilename;
CGRuntime::openLogFile(sFilename);
CW_FREE_CHARARRAY(hFilename);
}
void Runtime::produceHTML(System::String* hScriptFileName, System::String* hHTMLFileName) {
std::string sScriptFileName;
CW_STRING_TO_CHARARRAY(hScriptFileName);
sScriptFileName = tchScriptFileName;
std::string sHTMLFileName;
CW_STRING_TO_CHARARRAY(hHTMLFileName);
sHTMLFileName = tchHTMLFileName;
CGRuntime::produceHTML(sScriptFileName, sHTMLFileName);
CW_FREE_CHARARRAY(hHTMLFileName);
CW_FREE_CHARARRAY(hScriptFileName);
}
void Runtime::putEnv(System::String* hName, System::String* hValue) {
std::string sName;
CW_STRING_TO_CHARARRAY(hName);
sName = tchName;
std::string sValue;
CW_STRING_TO_CHARARRAY(hValue);
sValue = tchValue;
CGRuntime::putEnv(sName, sValue);
CW_FREE_CHARARRAY(hValue);
CW_FREE_CHARARRAY(hName);
}
void Runtime::randomSeed(int hSeed) {
int iSeed;
iSeed = hSeed;
CGRuntime::randomSeed(iSeed);
}
void Runtime::removeAllElements(ParseTree* hVariable) {
CodeWorker::DtaScriptVariable* pVariable;
pVariable = ((hVariable == NULL) ? NULL : hVariable->cppInstance_);
CGRuntime::removeAllElements(pVariable);
}
void Runtime::removeElement(ParseTree* hVariable, System::String* hKey) {
CodeWorker::DtaScriptVariable* pVariable;
pVariable = ((hVariable == NULL) ? NULL : hVariable->cppInstance_);
std::string sKey;
CW_STRING_TO_CHARARRAY(hKey);
sKey = tchKey;
CGRuntime::removeElement(pVariable, sKey);
CW_FREE_CHARARRAY(hKey);
}
void Runtime::removeFirstElement(ParseTree* hList) {
CodeWorker::DtaScriptVariable* pList;
pList = ((hList == NULL) ? NULL : hList->cppInstance_);
CGRuntime::removeFirstElement(pList);
}
void Runtime::removeLastElement(ParseTree* hList) {
CodeWorker::DtaScriptVariable* pList;
pList = ((hList == NULL) ? NULL : hList->cppInstance_);
CGRuntime::removeLastElement(pList);
}
void Runtime::removeRecursive(ParseTree* hVariable, System::String* hAttribute) {
CodeWorker::DtaScriptVariable* pVariable;
pVariable = ((hVariable == NULL) ? NULL : hVariable->cppInstance_);
std::string sAttribute;
CW_STRING_TO_CHARARRAY(hAttribute);
sAttribute = tchAttribute;
CGRuntime::removeRecursive(pVariable, sAttribute);
CW_FREE_CHARARRAY(hAttribute);
}
void Runtime::removeVariable(ParseTree* hNode) {
CodeWorker::DtaScriptVariable* pNode;
pNode = ((hNode == NULL) ? NULL : hNode->cppInstance_);
CGRuntime::removeVariable(pNode);
}
void Runtime::saveBinaryToFile(System::String* hFilename, System::String* hContent) {
std::string sFilename;
CW_STRING_TO_CHARARRAY(hFilename);
sFilename = tchFilename;
std::string sContent;
CW_STRING_TO_CHARARRAY(hContent);
sContent = tchContent;
CGRuntime::saveBinaryToFile(sFilename, sContent);
CW_FREE_CHARARRAY(hContent);
CW_FREE_CHARARRAY(hFilename);
}
void Runtime::saveProject(System::String* hXMLorTXTFileName, ParseTree* hNodeToSave) {
std::string sXMLorTXTFileName;
CW_STRING_TO_CHARARRAY(hXMLorTXTFileName);
sXMLorTXTFileName = tchXMLorTXTFileName;
CodeWorker::DtaScriptVariable* pNodeToSave;
pNodeToSave = ((hNodeToSave == NULL) ? NULL : hNodeToSave->cppInstance_);
CGRuntime::saveProject(sXMLorTXTFileName, pNodeToSave);
CW_FREE_CHARARRAY(hXMLorTXTFileName);
}
void Runtime::saveProjectTypes(System::String* hXMLFileName) {
std::string sXMLFileName;
CW_STRING_TO_CHARARRAY(hXMLFileName);
sXMLFileName = tchXMLFileName;
CGRuntime::saveProjectTypes(sXMLFileName);
CW_FREE_CHARARRAY(hXMLFileName);
}
void Runtime::saveToFile(System::String* hFilename, System::String* hContent) {
std::string sFilename;
CW_STRING_TO_CHARARRAY(hFilename);
sFilename = tchFilename;
std::string sContent;
CW_STRING_TO_CHARARRAY(hContent);
sContent = tchContent;
CGRuntime::saveToFile(sFilename, sContent);
CW_FREE_CHARARRAY(hContent);
CW_FREE_CHARARRAY(hFilename);
}
void Runtime::setCommentBegin(System::String* hCommentBegin) {
std::string sCommentBegin;
CW_STRING_TO_CHARARRAY(hCommentBegin);
sCommentBegin = tchCommentBegin;
CGRuntime::setCommentBegin(sCommentBegin);
CW_FREE_CHARARRAY(hCommentBegin);
}
void Runtime::setCommentEnd(System::String* hCommentEnd) {
std::string sCommentEnd;
CW_STRING_TO_CHARARRAY(hCommentEnd);
sCommentEnd = tchCommentEnd;
CGRuntime::setCommentEnd(sCommentEnd);
CW_FREE_CHARARRAY(hCommentEnd);
}
void Runtime::setGenerationHeader(System::String* hComment) {
std::string sComment;
CW_STRING_TO_CHARARRAY(hComment);
sComment = tchComment;
CGRuntime::setGenerationHeader(sComment);
CW_FREE_CHARARRAY(hComment);
}
void Runtime::setIncludePath(System::String* hPath) {
std::string sPath;
CW_STRING_TO_CHARARRAY(hPath);
sPath = tchPath;
CGRuntime::setIncludePath(sPath);
CW_FREE_CHARARRAY(hPath);
}
void Runtime::setNow(System::String* hConstantDateTime) {
std::string sConstantDateTime;
CW_STRING_TO_CHARARRAY(hConstantDateTime);
sConstantDateTime = tchConstantDateTime;
CGRuntime::setNow(sConstantDateTime);
CW_FREE_CHARARRAY(hConstantDateTime);
}
void Runtime::setProperty(System::String* hDefine, System::String* hValue) {
std::string sDefine;
CW_STRING_TO_CHARARRAY(hDefine);
sDefine = tchDefine;
std::string sValue;
CW_STRING_TO_CHARARRAY(hValue);
sValue = tchValue;
CGRuntime::setProperty(sDefine, sValue);
CW_FREE_CHARARRAY(hValue);
CW_FREE_CHARARRAY(hDefine);
}
void Runtime::setTextMode(System::String* hTextMode) {
std::string sTextMode;
CW_STRING_TO_CHARARRAY(hTextMode);
sTextMode = tchTextMode;
CGRuntime::setTextMode(sTextMode);
CW_FREE_CHARARRAY(hTextMode);
}
void Runtime::setVersion(System::String* hVersion) {
std::string sVersion;
CW_STRING_TO_CHARARRAY(hVersion);
sVersion = tchVersion;
CGRuntime::setVersion(sVersion);
CW_FREE_CHARARRAY(hVersion);
}
void Runtime::setWriteMode(System::String* hMode) {
std::string sMode;
CW_STRING_TO_CHARARRAY(hMode);
sMode = tchMode;
CGRuntime::setWriteMode(sMode);
CW_FREE_CHARARRAY(hMode);
}
void Runtime::setWorkingPath(System::String* hPath) {
std::string sPath;
CW_STRING_TO_CHARARRAY(hPath);
sPath = tchPath;
CGRuntime::setWorkingPath(sPath);
CW_FREE_CHARARRAY(hPath);
}
void Runtime::sleep(int hMillis) {
int iMillis;
iMillis = hMillis;
CGRuntime::sleep(iMillis);
}
void Runtime::slideNodeContent(ParseTree* hOrgNode, System::String* hDestNode) {
CodeWorker::DtaScriptVariable* pOrgNode;
pOrgNode = ((hOrgNode == NULL) ? NULL : hOrgNode->cppInstance_);
ExprScriptVariable* exprdestNode;
{
CW_STRING_TO_CHARARRAY(hDestNode);
DtaScript theEmptyScript(NULL);
GrfBlock* pBlock = NULL;
GrfBlock& myNullBlock = *pBlock;
ScpStream myStream(tchDestNode);
exprdestNode = theEmptyScript.parseVariableExpression(myNullBlock, myStream);
CW_FREE_CHARARRAY(hDestNode);
}
std::auto_ptr<ExprScriptVariable> treexprdestNode(exprdestNode);
CodeWorker::ExprScriptVariable& xDestNode = *treexprdestNode;
CGRuntime::slideNodeContent(pOrgNode, xDestNode);
}
void Runtime::sortArray(ParseTree* hArray) {
CodeWorker::DtaScriptVariable* pArray;
pArray = ((hArray == NULL) ? NULL : hArray->cppInstance_);
CGRuntime::sortArray(pArray);
}
void Runtime::traceEngine() {
CGRuntime::traceEngine();
}
void Runtime::traceLine(System::String* hLine) {
std::string sLine;
CW_STRING_TO_CHARARRAY(hLine);
sLine = tchLine;
CGRuntime::traceLine(sLine);
CW_FREE_CHARARRAY(hLine);
}
void Runtime::traceObject(ParseTree* hObject, int hDepth) {
CodeWorker::DtaScriptVariable* pObject;
pObject = ((hObject == NULL) ? NULL : hObject->cppInstance_);
int iDepth;
iDepth = hDepth;
CGRuntime::traceObject(pObject, iDepth);
}
void Runtime::traceText(System::String* hText) {
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
CGRuntime::traceText(sText);
CW_FREE_CHARARRAY(hText);
}
void Runtime::attachInputToSocket(int hSocket) {
int iSocket;
iSocket = hSocket;
CGRuntime::attachInputToSocket(iSocket);
}
void Runtime::detachInputFromSocket(int hSocket) {
int iSocket;
iSocket = hSocket;
CGRuntime::detachInputFromSocket(iSocket);
}
void Runtime::goBack() {
CGRuntime::goBack();
}
void Runtime::setInputLocation(int hLocation) {
int iLocation;
iLocation = hLocation;
CGRuntime::setInputLocation(iLocation);
}
void Runtime::allFloatingLocations(ParseTree* hList) {
CodeWorker::DtaScriptVariable* pList;
pList = ((hList == NULL) ? NULL : hList->cppInstance_);
CGRuntime::allFloatingLocations(pList);
}
void Runtime::attachOutputToSocket(int hSocket) {
int iSocket;
iSocket = hSocket;
CGRuntime::attachOutputToSocket(iSocket);
}
void Runtime::detachOutputFromSocket(int hSocket) {
int iSocket;
iSocket = hSocket;
CGRuntime::detachOutputFromSocket(iSocket);
}
void Runtime::incrementIndentLevel(int hLevel) {
int iLevel;
iLevel = hLevel;
CGRuntime::incrementIndentLevel(iLevel);
}
void Runtime::insertText(int hLocation, System::String* hText) {
int iLocation;
iLocation = hLocation;
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
CGRuntime::insertText(iLocation, sText);
CW_FREE_CHARARRAY(hText);
}
void Runtime::insertTextOnce(int hLocation, System::String* hText) {
int iLocation;
iLocation = hLocation;
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
CGRuntime::insertTextOnce(iLocation, sText);
CW_FREE_CHARARRAY(hText);
}
void Runtime::insertTextToFloatingLocation(System::String* hLocation, System::String* hText) {
std::string sLocation;
CW_STRING_TO_CHARARRAY(hLocation);
sLocation = tchLocation;
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
CGRuntime::insertTextToFloatingLocation(sLocation, sText);
CW_FREE_CHARARRAY(hText);
CW_FREE_CHARARRAY(hLocation);
}
void Runtime::insertTextOnceToFloatingLocation(System::String* hLocation, System::String* hText) {
std::string sLocation;
CW_STRING_TO_CHARARRAY(hLocation);
sLocation = tchLocation;
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
CGRuntime::insertTextOnceToFloatingLocation(sLocation, sText);
CW_FREE_CHARARRAY(hText);
CW_FREE_CHARARRAY(hLocation);
}
void Runtime::overwritePortion(int hLocation, System::String* hText, int hSize) {
int iLocation;
iLocation = hLocation;
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
int iSize;
iSize = hSize;
CGRuntime::overwritePortion(iLocation, sText, iSize);
CW_FREE_CHARARRAY(hText);
}
void Runtime::populateProtectedArea(System::String* hProtectedAreaName, System::String* hContent) {
std::string sProtectedAreaName;
CW_STRING_TO_CHARARRAY(hProtectedAreaName);
sProtectedAreaName = tchProtectedAreaName;
std::string sContent;
CW_STRING_TO_CHARARRAY(hContent);
sContent = tchContent;
CGRuntime::populateProtectedArea(sProtectedAreaName, sContent);
CW_FREE_CHARARRAY(hContent);
CW_FREE_CHARARRAY(hProtectedAreaName);
}
void Runtime::resizeOutputStream(int hNewSize) {
int iNewSize;
iNewSize = hNewSize;
CGRuntime::resizeOutputStream(iNewSize);
}
void Runtime::setFloatingLocation(System::String* hKey, int hLocation) {
std::string sKey;
CW_STRING_TO_CHARARRAY(hKey);
sKey = tchKey;
int iLocation;
iLocation = hLocation;
CGRuntime::setFloatingLocation(sKey, iLocation);
CW_FREE_CHARARRAY(hKey);
}
void Runtime::setOutputLocation(int hLocation) {
int iLocation;
iLocation = hLocation;
CGRuntime::setOutputLocation(iLocation);
}
void Runtime::setProtectedArea(System::String* hProtectedAreaName) {
std::string sProtectedAreaName;
CW_STRING_TO_CHARARRAY(hProtectedAreaName);
sProtectedAreaName = tchProtectedAreaName;
CGRuntime::setProtectedArea(sProtectedAreaName);
CW_FREE_CHARARRAY(hProtectedAreaName);
}
void Runtime::writeBytes(System::String* hBytes) {
std::string sBytes;
CW_STRING_TO_CHARARRAY(hBytes);
sBytes = tchBytes;
CGRuntime::writeBytes(sBytes);
CW_FREE_CHARARRAY(hBytes);
}
void Runtime::writeText(System::String* hText) {
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
CGRuntime::writeText(sText);
CW_FREE_CHARARRAY(hText);
}
void Runtime::writeTextOnce(System::String* hText) {
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
CGRuntime::writeTextOnce(sText);
CW_FREE_CHARARRAY(hText);
}
void Runtime::closeSocket(int hSocket) {
int iSocket;
iSocket = hSocket;
CGRuntime::closeSocket(iSocket);
}
bool Runtime::flushOutputToSocket(int hSocket) {
bool result;
int iSocket;
iSocket = hSocket;
bool cppResult = CGRuntime::flushOutputToSocket(iSocket);
result = cppResult;
return result;
}
int Runtime::acceptSocket(int hServerSocket) {
int result;
int iServerSocket;
iServerSocket = hServerSocket;
int cppResult = CGRuntime::acceptSocket(iServerSocket);
result = cppResult;
return result;
}
double Runtime::add(double hLeft, double hRight) {
double result;
double dLeft;
dLeft = hLeft;
double dRight;
dRight = hRight;
double cppResult = CGRuntime::add(dLeft, dRight);
result = cppResult;
return result;
}
System::String* Runtime::addToDate(System::String* hDate, System::String* hFormat, System::String* hShifting) {
System::String* result;
std::string sDate;
CW_STRING_TO_CHARARRAY(hDate);
sDate = tchDate;
std::string sFormat;
CW_STRING_TO_CHARARRAY(hFormat);
sFormat = tchFormat;
std::string sShifting;
CW_STRING_TO_CHARARRAY(hShifting);
sShifting = tchShifting;
std::string cppResult = CGRuntime::addToDate(sDate, sFormat, sShifting);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hShifting);
CW_FREE_CHARARRAY(hFormat);
CW_FREE_CHARARRAY(hDate);
return result;
}
System::String* Runtime::byteToChar(System::String* hByte) {
System::String* result;
std::string sByte;
CW_STRING_TO_CHARARRAY(hByte);
sByte = tchByte;
std::string cppResult = CGRuntime::byteToChar(sByte);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hByte);
return result;
}
unsigned long Runtime::bytesToLong(System::String* hBytes) {
unsigned long result;
std::string sBytes;
CW_STRING_TO_CHARARRAY(hBytes);
sBytes = tchBytes;
unsigned long cppResult = CGRuntime::bytesToLong(sBytes);
result = cppResult;
CW_FREE_CHARARRAY(hBytes);
return result;
}
unsigned short Runtime::bytesToShort(System::String* hBytes) {
unsigned short result;
std::string sBytes;
CW_STRING_TO_CHARARRAY(hBytes);
sBytes = tchBytes;
unsigned short cppResult = CGRuntime::bytesToShort(sBytes);
result = cppResult;
CW_FREE_CHARARRAY(hBytes);
return result;
}
System::String* Runtime::canonizePath(System::String* hPath) {
System::String* result;
std::string sPath;
CW_STRING_TO_CHARARRAY(hPath);
sPath = tchPath;
std::string cppResult = CGRuntime::canonizePath(sPath);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hPath);
return result;
}
bool Runtime::changeDirectory(System::String* hPath) {
bool result;
std::string sPath;
CW_STRING_TO_CHARARRAY(hPath);
sPath = tchPath;
bool cppResult = CGRuntime::changeDirectory(sPath);
result = cppResult;
CW_FREE_CHARARRAY(hPath);
return result;
}
int Runtime::changeFileTime(System::String* hFilename, System::String* hAccessTime, System::String* hModificationTime) {
int result;
std::string sFilename;
CW_STRING_TO_CHARARRAY(hFilename);
sFilename = tchFilename;
std::string sAccessTime;
CW_STRING_TO_CHARARRAY(hAccessTime);
sAccessTime = tchAccessTime;
std::string sModificationTime;
CW_STRING_TO_CHARARRAY(hModificationTime);
sModificationTime = tchModificationTime;
int cppResult = CGRuntime::changeFileTime(sFilename, sAccessTime, sModificationTime);
result = cppResult;
CW_FREE_CHARARRAY(hModificationTime);
CW_FREE_CHARARRAY(hAccessTime);
CW_FREE_CHARARRAY(hFilename);
return result;
}
System::String* Runtime::charAt(System::String* hText, int hIndex) {
System::String* result;
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
int iIndex;
iIndex = hIndex;
std::string cppResult = CGRuntime::charAt(sText, iIndex);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hText);
return result;
}
System::String* Runtime::charToByte(System::String* hChar) {
System::String* result;
std::string sChar;
CW_STRING_TO_CHARARRAY(hChar);
sChar = tchChar;
std::string cppResult = CGRuntime::charToByte(sChar);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hChar);
return result;
}
int Runtime::charToInt(System::String* hChar) {
int result;
std::string sChar;
CW_STRING_TO_CHARARRAY(hChar);
sChar = tchChar;
int cppResult = CGRuntime::charToInt(sChar);
result = cppResult;
CW_FREE_CHARARRAY(hChar);
return result;
}
bool Runtime::chmod(System::String* hFilename, System::String* hMode) {
bool result;
std::string sFilename;
CW_STRING_TO_CHARARRAY(hFilename);
sFilename = tchFilename;
std::string sMode;
CW_STRING_TO_CHARARRAY(hMode);
sMode = tchMode;
bool cppResult = CGRuntime::chmod(sFilename, sMode);
result = cppResult;
CW_FREE_CHARARRAY(hMode);
CW_FREE_CHARARRAY(hFilename);
return result;
}
int Runtime::ceil(double hNumber) {
int result;
double dNumber;
dNumber = hNumber;
int cppResult = CGRuntime::ceil(dNumber);
result = cppResult;
return result;
}
int Runtime::compareDate(System::String* hDate1, System::String* hDate2) {
int result;
std::string sDate1;
CW_STRING_TO_CHARARRAY(hDate1);
sDate1 = tchDate1;
std::string sDate2;
CW_STRING_TO_CHARARRAY(hDate2);
sDate2 = tchDate2;
int cppResult = CGRuntime::compareDate(sDate1, sDate2);
result = cppResult;
CW_FREE_CHARARRAY(hDate2);
CW_FREE_CHARARRAY(hDate1);
return result;
}
System::String* Runtime::completeDate(System::String* hDate, System::String* hFormat) {
System::String* result;
std::string sDate;
CW_STRING_TO_CHARARRAY(hDate);
sDate = tchDate;
std::string sFormat;
CW_STRING_TO_CHARARRAY(hFormat);
sFormat = tchFormat;
std::string cppResult = CGRuntime::completeDate(sDate, sFormat);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hFormat);
CW_FREE_CHARARRAY(hDate);
return result;
}
System::String* Runtime::completeLeftSpaces(System::String* hText, int hLength) {
System::String* result;
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
int iLength;
iLength = hLength;
std::string cppResult = CGRuntime::completeLeftSpaces(sText, iLength);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hText);
return result;
}
System::String* Runtime::completeRightSpaces(System::String* hText, int hLength) {
System::String* result;
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
int iLength;
iLength = hLength;
std::string cppResult = CGRuntime::completeRightSpaces(sText, iLength);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hText);
return result;
}
System::String* Runtime::composeAdaLikeString(System::String* hText) {
System::String* result;
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
std::string cppResult = CGRuntime::composeAdaLikeString(sText);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hText);
return result;
}
System::String* Runtime::composeCLikeString(System::String* hText) {
System::String* result;
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
std::string cppResult = CGRuntime::composeCLikeString(sText);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hText);
return result;
}
System::String* Runtime::composeHTMLLikeString(System::String* hText) {
System::String* result;
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
std::string cppResult = CGRuntime::composeHTMLLikeString(sText);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hText);
return result;
}
System::String* Runtime::composeSQLLikeString(System::String* hText) {
System::String* result;
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
std::string cppResult = CGRuntime::composeSQLLikeString(sText);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hText);
return result;
}
System::String* Runtime::computeMD5(System::String* hText) {
System::String* result;
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
std::string cppResult = CGRuntime::computeMD5(sText);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hText);
return result;
}
bool Runtime::copySmartFile(System::String* hSourceFileName, System::String* hDestinationFileName) {
bool result;
std::string sSourceFileName;
CW_STRING_TO_CHARARRAY(hSourceFileName);
sSourceFileName = tchSourceFileName;
std::string sDestinationFileName;
CW_STRING_TO_CHARARRAY(hDestinationFileName);
sDestinationFileName = tchDestinationFileName;
bool cppResult = CGRuntime::copySmartFile(sSourceFileName, sDestinationFileName);
result = cppResult;
CW_FREE_CHARARRAY(hDestinationFileName);
CW_FREE_CHARARRAY(hSourceFileName);
return result;
}
System::String* Runtime::coreString(System::String* hText, int hPos, int hLastRemoved) {
System::String* result;
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
int iPos;
iPos = hPos;
int iLastRemoved;
iLastRemoved = hLastRemoved;
std::string cppResult = CGRuntime::coreString(sText, iPos, iLastRemoved);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hText);
return result;
}
int Runtime::countStringOccurences(System::String* hString, System::String* hText) {
int result;
std::string sString;
CW_STRING_TO_CHARARRAY(hString);
sString = tchString;
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
int cppResult = CGRuntime::countStringOccurences(sString, sText);
result = cppResult;
CW_FREE_CHARARRAY(hText);
CW_FREE_CHARARRAY(hString);
return result;
}
bool Runtime::createDirectory(System::String* hPath) {
bool result;
std::string sPath;
CW_STRING_TO_CHARARRAY(hPath);
sPath = tchPath;
bool cppResult = CGRuntime::createDirectory(sPath);
result = cppResult;
CW_FREE_CHARARRAY(hPath);
return result;
}
int Runtime::createINETClientSocket(System::String* hRemoteAddress, int hPort) {
int result;
std::string sRemoteAddress;
CW_STRING_TO_CHARARRAY(hRemoteAddress);
sRemoteAddress = tchRemoteAddress;
int iPort;
iPort = hPort;
int cppResult = CGRuntime::createINETClientSocket(sRemoteAddress, iPort);
result = cppResult;
CW_FREE_CHARARRAY(hRemoteAddress);
return result;
}
int Runtime::createINETServerSocket(int hPort, int hBackLog) {
int result;
int iPort;
iPort = hPort;
int iBackLog;
iBackLog = hBackLog;
int cppResult = CGRuntime::createINETServerSocket(iPort, iBackLog);
result = cppResult;
return result;
}
bool Runtime::createIterator(ParseTree* hI, ParseTree* hList) {
bool result;
CodeWorker::DtaScriptVariable* pI;
pI = ((hI == NULL) ? NULL : hI->cppInstance_);
CodeWorker::DtaScriptVariable* pList;
pList = ((hList == NULL) ? NULL : hList->cppInstance_);
bool cppResult = CGRuntime::createIterator(pI, pList);
result = cppResult;
return result;
}
bool Runtime::createReverseIterator(ParseTree* hI, ParseTree* hList) {
bool result;
CodeWorker::DtaScriptVariable* pI;
pI = ((hI == NULL) ? NULL : hI->cppInstance_);
CodeWorker::DtaScriptVariable* pList;
pList = ((hList == NULL) ? NULL : hList->cppInstance_);
bool cppResult = CGRuntime::createReverseIterator(pI, pList);
result = cppResult;
return result;
}
bool Runtime::createVirtualFile(System::String* hHandle, System::String* hContent) {
bool result;
std::string sHandle;
CW_STRING_TO_CHARARRAY(hHandle);
sHandle = tchHandle;
std::string sContent;
CW_STRING_TO_CHARARRAY(hContent);
sContent = tchContent;
bool cppResult = CGRuntime::createVirtualFile(sHandle, sContent);
result = cppResult;
CW_FREE_CHARARRAY(hContent);
CW_FREE_CHARARRAY(hHandle);
return result;
}
System::String* Runtime::createVirtualTemporaryFile(System::String* hContent) {
System::String* result;
std::string sContent;
CW_STRING_TO_CHARARRAY(hContent);
sContent = tchContent;
std::string cppResult = CGRuntime::createVirtualTemporaryFile(sContent);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hContent);
return result;
}
System::String* Runtime::decodeURL(System::String* hURL) {
System::String* result;
std::string sURL;
CW_STRING_TO_CHARARRAY(hURL);
sURL = tchURL;
std::string cppResult = CGRuntime::decodeURL(sURL);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hURL);
return result;
}
double Runtime::decrement(DoubleRef* hNumber) {
double result;
double dNumber;
// NOT HANDLED YET!
double cppResult = CGRuntime::decrement(dNumber);
result = cppResult;
return result;
}
bool Runtime::deleteFile(System::String* hFilename) {
bool result;
std::string sFilename;
CW_STRING_TO_CHARARRAY(hFilename);
sFilename = tchFilename;
bool cppResult = CGRuntime::deleteFile(sFilename);
result = cppResult;
CW_FREE_CHARARRAY(hFilename);
return result;
}
bool Runtime::deleteVirtualFile(System::String* hHandle) {
bool result;
std::string sHandle;
CW_STRING_TO_CHARARRAY(hHandle);
sHandle = tchHandle;
bool cppResult = CGRuntime::deleteVirtualFile(sHandle);
result = cppResult;
CW_FREE_CHARARRAY(hHandle);
return result;
}
double Runtime::div(double hDividend, double hDivisor) {
double result;
double dDividend;
dDividend = hDividend;
double dDivisor;
dDivisor = hDivisor;
double cppResult = CGRuntime::div(dDividend, dDivisor);
result = cppResult;
return result;
}
bool Runtime::duplicateIterator(ParseTree* hOldIt, ParseTree* hNewIt) {
bool result;
CodeWorker::DtaScriptVariable* pOldIt;
pOldIt = ((hOldIt == NULL) ? NULL : hOldIt->cppInstance_);
CodeWorker::DtaScriptVariable* pNewIt;
pNewIt = ((hNewIt == NULL) ? NULL : hNewIt->cppInstance_);
bool cppResult = CGRuntime::duplicateIterator(pOldIt, pNewIt);
result = cppResult;
return result;
}
System::String* Runtime::encodeURL(System::String* hURL) {
System::String* result;
std::string sURL;
CW_STRING_TO_CHARARRAY(hURL);
sURL = tchURL;
std::string cppResult = CGRuntime::encodeURL(sURL);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hURL);
return result;
}
System::String* Runtime::endl() {
System::String* result;
std::string cppResult = CGRuntime::endl();
result = CW_STL_TO_STRING(cppResult);
return result;
}
bool Runtime::endString(System::String* hText, System::String* hEnd) {
bool result;
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
std::string sEnd;
CW_STRING_TO_CHARARRAY(hEnd);
sEnd = tchEnd;
bool cppResult = CGRuntime::endString(sText, sEnd);
result = cppResult;
CW_FREE_CHARARRAY(hEnd);
CW_FREE_CHARARRAY(hText);
return result;
}
bool Runtime::equal(double hLeft, double hRight) {
bool result;
double dLeft;
dLeft = hLeft;
double dRight;
dRight = hRight;
bool cppResult = CGRuntime::equal(dLeft, dRight);
result = cppResult;
return result;
}
bool Runtime::equalsIgnoreCase(System::String* hLeft, System::String* hRight) {
bool result;
std::string sLeft;
CW_STRING_TO_CHARARRAY(hLeft);
sLeft = tchLeft;
std::string sRight;
CW_STRING_TO_CHARARRAY(hRight);
sRight = tchRight;
bool cppResult = CGRuntime::equalsIgnoreCase(sLeft, sRight);
result = cppResult;
CW_FREE_CHARARRAY(hRight);
CW_FREE_CHARARRAY(hLeft);
return result;
}
bool Runtime::equalTrees(ParseTree* hFirstTree, ParseTree* hSecondTree) {
bool result;
CodeWorker::DtaScriptVariable* pFirstTree;
pFirstTree = ((hFirstTree == NULL) ? NULL : hFirstTree->cppInstance_);
CodeWorker::DtaScriptVariable* pSecondTree;
pSecondTree = ((hSecondTree == NULL) ? NULL : hSecondTree->cppInstance_);
bool cppResult = CGRuntime::equalTrees(pFirstTree, pSecondTree);
result = cppResult;
return result;
}
System::String* Runtime::executeStringQuiet(ParseTree* hThis, System::String* hCommand) {
System::String* result;
CodeWorker::DtaScriptVariable* pThis;
pThis = ((hThis == NULL) ? NULL : hThis->cppInstance_);
std::string sCommand;
CW_STRING_TO_CHARARRAY(hCommand);
sCommand = tchCommand;
std::string cppResult = CGRuntime::executeStringQuiet(pThis, sCommand);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hCommand);
return result;
}
bool Runtime::existDirectory(System::String* hPath) {
bool result;
std::string sPath;
CW_STRING_TO_CHARARRAY(hPath);
sPath = tchPath;
bool cppResult = CGRuntime::existDirectory(sPath);
result = cppResult;
CW_FREE_CHARARRAY(hPath);
return result;
}
bool Runtime::existEnv(System::String* hVariable) {
bool result;
std::string sVariable;
CW_STRING_TO_CHARARRAY(hVariable);
sVariable = tchVariable;
bool cppResult = CGRuntime::existEnv(sVariable);
result = cppResult;
CW_FREE_CHARARRAY(hVariable);
return result;
}
bool Runtime::existFile(System::String* hFileName) {
bool result;
std::string sFileName;
CW_STRING_TO_CHARARRAY(hFileName);
sFileName = tchFileName;
bool cppResult = CGRuntime::existFile(sFileName);
result = cppResult;
CW_FREE_CHARARRAY(hFileName);
return result;
}
bool Runtime::existVirtualFile(System::String* hHandle) {
bool result;
std::string sHandle;
CW_STRING_TO_CHARARRAY(hHandle);
sHandle = tchHandle;
bool cppResult = CGRuntime::existVirtualFile(sHandle);
result = cppResult;
CW_FREE_CHARARRAY(hHandle);
return result;
}
bool Runtime::existVariable(ParseTree* hVariable) {
bool result;
CodeWorker::DtaScriptVariable* pVariable;
pVariable = ((hVariable == NULL) ? NULL : hVariable->cppInstance_);
bool cppResult = CGRuntime::existVariable(pVariable);
result = cppResult;
return result;
}
double Runtime::exp(double hX) {
double result;
double dX;
dX = hX;
double cppResult = CGRuntime::exp(dX);
result = cppResult;
return result;
}
bool Runtime::exploreDirectory(ParseTree* hDirectory, System::String* hPath, bool hSubfolders) {
bool result;
CodeWorker::DtaScriptVariable* pDirectory;
pDirectory = ((hDirectory == NULL) ? NULL : hDirectory->cppInstance_);
std::string sPath;
CW_STRING_TO_CHARARRAY(hPath);
sPath = tchPath;
bool bSubfolders;
bSubfolders = hSubfolders;
bool cppResult = CGRuntime::exploreDirectory(pDirectory, sPath, bSubfolders);
result = cppResult;
CW_FREE_CHARARRAY(hPath);
return result;
}
System::String* Runtime::extractGenerationHeader(System::String* hFilename, System::Text::StringBuilder* hGenerator, System::Text::StringBuilder* hVersion, System::Text::StringBuilder* hDate) {
System::String* result;
std::string sFilename;
CW_STRING_TO_CHARARRAY(hFilename);
sFilename = tchFilename;
std::string sGenerator;
// NOT HANDLED YET!
std::string sVersion;
// NOT HANDLED YET!
std::string sDate;
// NOT HANDLED YET!
std::string cppResult = CGRuntime::extractGenerationHeader(sFilename, sGenerator, sVersion, sDate);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hFilename);
return result;
}
System::String* Runtime::fileCreation(System::String* hFilename) {
System::String* result;
std::string sFilename;
CW_STRING_TO_CHARARRAY(hFilename);
sFilename = tchFilename;
std::string cppResult = CGRuntime::fileCreation(sFilename);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hFilename);
return result;
}
System::String* Runtime::fileLastAccess(System::String* hFilename) {
System::String* result;
std::string sFilename;
CW_STRING_TO_CHARARRAY(hFilename);
sFilename = tchFilename;
std::string cppResult = CGRuntime::fileLastAccess(sFilename);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hFilename);
return result;
}
System::String* Runtime::fileLastModification(System::String* hFilename) {
System::String* result;
std::string sFilename;
CW_STRING_TO_CHARARRAY(hFilename);
sFilename = tchFilename;
std::string cppResult = CGRuntime::fileLastModification(sFilename);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hFilename);
return result;
}
int Runtime::fileLines(System::String* hFilename) {
int result;
std::string sFilename;
CW_STRING_TO_CHARARRAY(hFilename);
sFilename = tchFilename;
int cppResult = CGRuntime::fileLines(sFilename);
result = cppResult;
CW_FREE_CHARARRAY(hFilename);
return result;
}
System::String* Runtime::fileMode(System::String* hFilename) {
System::String* result;
std::string sFilename;
CW_STRING_TO_CHARARRAY(hFilename);
sFilename = tchFilename;
std::string cppResult = CGRuntime::fileMode(sFilename);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hFilename);
return result;
}
int Runtime::fileSize(System::String* hFilename) {
int result;
std::string sFilename;
CW_STRING_TO_CHARARRAY(hFilename);
sFilename = tchFilename;
int cppResult = CGRuntime::fileSize(sFilename);
result = cppResult;
CW_FREE_CHARARRAY(hFilename);
return result;
}
bool Runtime::findElement(System::String* hValue, ParseTree* hVariable) {
bool result;
std::string sValue;
CW_STRING_TO_CHARARRAY(hValue);
sValue = tchValue;
CodeWorker::DtaScriptVariable* pVariable;
pVariable = ((hVariable == NULL) ? NULL : hVariable->cppInstance_);
bool cppResult = CGRuntime::findElement(sValue, pVariable);
result = cppResult;
CW_FREE_CHARARRAY(hValue);
return result;
}
int Runtime::findFirstChar(System::String* hText, System::String* hSomeChars) {
int result;
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
std::string sSomeChars;
CW_STRING_TO_CHARARRAY(hSomeChars);
sSomeChars = tchSomeChars;
int cppResult = CGRuntime::findFirstChar(sText, sSomeChars);
result = cppResult;
CW_FREE_CHARARRAY(hSomeChars);
CW_FREE_CHARARRAY(hText);
return result;
}
int Runtime::findFirstSubstringIntoKeys(System::String* hSubstring, ParseTree* hArray) {
int result;
std::string sSubstring;
CW_STRING_TO_CHARARRAY(hSubstring);
sSubstring = tchSubstring;
CodeWorker::DtaScriptVariable* pArray;
pArray = ((hArray == NULL) ? NULL : hArray->cppInstance_);
int cppResult = CGRuntime::findFirstSubstringIntoKeys(sSubstring, pArray);
result = cppResult;
CW_FREE_CHARARRAY(hSubstring);
return result;
}
int Runtime::findLastString(System::String* hText, System::String* hFind) {
int result;
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
std::string sFind;
CW_STRING_TO_CHARARRAY(hFind);
sFind = tchFind;
int cppResult = CGRuntime::findLastString(sText, sFind);
result = cppResult;
CW_FREE_CHARARRAY(hFind);
CW_FREE_CHARARRAY(hText);
return result;
}
int Runtime::findNextString(System::String* hText, System::String* hFind, int hPosition) {
int result;
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
std::string sFind;
CW_STRING_TO_CHARARRAY(hFind);
sFind = tchFind;
int iPosition;
iPosition = hPosition;
int cppResult = CGRuntime::findNextString(sText, sFind, iPosition);
result = cppResult;
CW_FREE_CHARARRAY(hFind);
CW_FREE_CHARARRAY(hText);
return result;
}
int Runtime::findNextSubstringIntoKeys(System::String* hSubstring, ParseTree* hArray, int hNext) {
int result;
std::string sSubstring;
CW_STRING_TO_CHARARRAY(hSubstring);
sSubstring = tchSubstring;
CodeWorker::DtaScriptVariable* pArray;
pArray = ((hArray == NULL) ? NULL : hArray->cppInstance_);
int iNext;
iNext = hNext;
int cppResult = CGRuntime::findNextSubstringIntoKeys(sSubstring, pArray, iNext);
result = cppResult;
CW_FREE_CHARARRAY(hSubstring);
return result;
}
int Runtime::findString(System::String* hText, System::String* hFind) {
int result;
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
std::string sFind;
CW_STRING_TO_CHARARRAY(hFind);
sFind = tchFind;
int cppResult = CGRuntime::findString(sText, sFind);
result = cppResult;
CW_FREE_CHARARRAY(hFind);
CW_FREE_CHARARRAY(hText);
return result;
}
int Runtime::floor(double hNumber) {
int result;
double dNumber;
dNumber = hNumber;
int cppResult = CGRuntime::floor(dNumber);
result = cppResult;
return result;
}
System::String* Runtime::formatDate(System::String* hDate, System::String* hFormat) {
System::String* result;
std::string sDate;
CW_STRING_TO_CHARARRAY(hDate);
sDate = tchDate;
std::string sFormat;
CW_STRING_TO_CHARARRAY(hFormat);
sFormat = tchFormat;
std::string cppResult = CGRuntime::formatDate(sDate, sFormat);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hFormat);
CW_FREE_CHARARRAY(hDate);
return result;
}
int Runtime::getArraySize(ParseTree* hVariable) {
int result;
CodeWorker::DtaScriptVariable* pVariable;
pVariable = ((hVariable == NULL) ? NULL : hVariable->cppInstance_);
int cppResult = CGRuntime::getArraySize(pVariable);
result = cppResult;
return result;
}
System::String* Runtime::getCommentBegin() {
System::String* result;
std::string cppResult = CGRuntime::getCommentBegin();
result = CW_STL_TO_STRING(cppResult);
return result;
}
System::String* Runtime::getCommentEnd() {
System::String* result;
std::string cppResult = CGRuntime::getCommentEnd();
result = CW_STL_TO_STRING(cppResult);
return result;
}
System::String* Runtime::getCurrentDirectory() {
System::String* result;
std::string cppResult = CGRuntime::getCurrentDirectory();
result = CW_STL_TO_STRING(cppResult);
return result;
}
System::String* Runtime::getEnv(System::String* hVariable) {
System::String* result;
std::string sVariable;
CW_STRING_TO_CHARARRAY(hVariable);
sVariable = tchVariable;
std::string cppResult = CGRuntime::getEnv(sVariable);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hVariable);
return result;
}
System::String* Runtime::getGenerationHeader() {
System::String* result;
std::string cppResult = CGRuntime::getGenerationHeader();
result = CW_STL_TO_STRING(cppResult);
return result;
}
System::String* Runtime::getHTTPRequest(System::String* hURL, ParseTree* hHTTPSession, ParseTree* hArguments) {
System::String* result;
std::string sURL;
CW_STRING_TO_CHARARRAY(hURL);
sURL = tchURL;
CodeWorker::DtaScriptVariable* pHTTPSession;
pHTTPSession = ((hHTTPSession == NULL) ? NULL : hHTTPSession->cppInstance_);
CodeWorker::DtaScriptVariable* pArguments;
pArguments = ((hArguments == NULL) ? NULL : hArguments->cppInstance_);
std::string cppResult = CGRuntime::getHTTPRequest(sURL, pHTTPSession, pArguments);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hURL);
return result;
}
System::String* Runtime::getIncludePath() {
System::String* result;
std::string cppResult = CGRuntime::getIncludePath();
result = CW_STL_TO_STRING(cppResult);
return result;
}
double Runtime::getLastDelay() {
double result;
double cppResult = CGRuntime::getLastDelay();
result = cppResult;
return result;
}
System::String* Runtime::getNow() {
System::String* result;
std::string cppResult = CGRuntime::getNow();
result = CW_STL_TO_STRING(cppResult);
return result;
}
System::String* Runtime::getProperty(System::String* hDefine) {
System::String* result;
std::string sDefine;
CW_STRING_TO_CHARARRAY(hDefine);
sDefine = tchDefine;
std::string cppResult = CGRuntime::getProperty(sDefine);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hDefine);
return result;
}
System::String* Runtime::getShortFilename(System::String* hPathFilename) {
System::String* result;
std::string sPathFilename;
CW_STRING_TO_CHARARRAY(hPathFilename);
sPathFilename = tchPathFilename;
std::string cppResult = CGRuntime::getShortFilename(sPathFilename);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hPathFilename);
return result;
}
System::String* Runtime::getTextMode() {
System::String* result;
std::string cppResult = CGRuntime::getTextMode();
result = CW_STL_TO_STRING(cppResult);
return result;
}
int Runtime::getVariableAttributes(ParseTree* hVariable, ParseTree* hList) {
int result;
CodeWorker::DtaScriptVariable* pVariable;
pVariable = ((hVariable == NULL) ? NULL : hVariable->cppInstance_);
CodeWorker::DtaScriptVariable* pList;
pList = ((hList == NULL) ? NULL : hList->cppInstance_);
int cppResult = CGRuntime::getVariableAttributes(pVariable, pList);
result = cppResult;
return result;
}
System::String* Runtime::getVersion() {
System::String* result;
std::string cppResult = CGRuntime::getVersion();
result = CW_STL_TO_STRING(cppResult);
return result;
}
System::String* Runtime::getWorkingPath() {
System::String* result;
std::string cppResult = CGRuntime::getWorkingPath();
result = CW_STL_TO_STRING(cppResult);
return result;
}
System::String* Runtime::getWriteMode() {
System::String* result;
std::string cppResult = CGRuntime::getWriteMode();
result = CW_STL_TO_STRING(cppResult);
return result;
}
int Runtime::hexaToDecimal(System::String* hHexaNumber) {
int result;
std::string sHexaNumber;
CW_STRING_TO_CHARARRAY(hHexaNumber);
sHexaNumber = tchHexaNumber;
int cppResult = CGRuntime::hexaToDecimal(sHexaNumber);
result = cppResult;
CW_FREE_CHARARRAY(hHexaNumber);
return result;
}
System::String* Runtime::hostToNetworkLong(System::String* hBytes) {
System::String* result;
std::string sBytes;
CW_STRING_TO_CHARARRAY(hBytes);
sBytes = tchBytes;
std::string cppResult = CGRuntime::hostToNetworkLong(sBytes);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hBytes);
return result;
}
System::String* Runtime::hostToNetworkShort(System::String* hBytes) {
System::String* result;
std::string sBytes;
CW_STRING_TO_CHARARRAY(hBytes);
sBytes = tchBytes;
std::string cppResult = CGRuntime::hostToNetworkShort(sBytes);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hBytes);
return result;
}
double Runtime::increment(DoubleRef* hNumber) {
double result;
double dNumber;
// NOT HANDLED YET!
double cppResult = CGRuntime::increment(dNumber);
result = cppResult;
return result;
}
bool Runtime::indentFile(System::String* hFile, System::String* hMode) {
bool result;
std::string sFile;
CW_STRING_TO_CHARARRAY(hFile);
sFile = tchFile;
std::string sMode;
CW_STRING_TO_CHARARRAY(hMode);
sMode = tchMode;
bool cppResult = CGRuntime::indentFile(sFile, sMode);
result = cppResult;
CW_FREE_CHARARRAY(hMode);
CW_FREE_CHARARRAY(hFile);
return result;
}
bool Runtime::inf(double hLeft, double hRight) {
bool result;
double dLeft;
dLeft = hLeft;
double dRight;
dRight = hRight;
bool cppResult = CGRuntime::inf(dLeft, dRight);
result = cppResult;
return result;
}
System::String* Runtime::inputKey(bool hEcho) {
System::String* result;
bool bEcho;
bEcho = hEcho;
std::string cppResult = CGRuntime::inputKey(bEcho);
result = CW_STL_TO_STRING(cppResult);
return result;
}
System::String* Runtime::inputLine(bool hEcho, System::String* hPrompt) {
System::String* result;
bool bEcho;
bEcho = hEcho;
std::string sPrompt;
CW_STRING_TO_CHARARRAY(hPrompt);
sPrompt = tchPrompt;
std::string cppResult = CGRuntime::inputLine(bEcho, sPrompt);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hPrompt);
return result;
}
bool Runtime::isEmpty(ParseTree* hArray) {
bool result;
CodeWorker::DtaScriptVariable* pArray;
pArray = ((hArray == NULL) ? NULL : hArray->cppInstance_);
bool cppResult = CGRuntime::isEmpty(pArray);
result = cppResult;
return result;
}
bool Runtime::isIdentifier(System::String* hIdentifier) {
bool result;
std::string sIdentifier;
CW_STRING_TO_CHARARRAY(hIdentifier);
sIdentifier = tchIdentifier;
bool cppResult = CGRuntime::isIdentifier(sIdentifier);
result = cppResult;
CW_FREE_CHARARRAY(hIdentifier);
return result;
}
bool Runtime::isNegative(double hNumber) {
bool result;
double dNumber;
dNumber = hNumber;
bool cppResult = CGRuntime::isNegative(dNumber);
result = cppResult;
return result;
}
bool Runtime::isNumeric(System::String* hNumber) {
bool result;
std::string sNumber;
CW_STRING_TO_CHARARRAY(hNumber);
sNumber = tchNumber;
bool cppResult = CGRuntime::isNumeric(sNumber);
result = cppResult;
CW_FREE_CHARARRAY(hNumber);
return result;
}
bool Runtime::isPositive(double hNumber) {
bool result;
double dNumber;
dNumber = hNumber;
bool cppResult = CGRuntime::isPositive(dNumber);
result = cppResult;
return result;
}
System::String* Runtime::joinStrings(ParseTree* hList, System::String* hSeparator) {
System::String* result;
CodeWorker::DtaScriptVariable* pList;
pList = ((hList == NULL) ? NULL : hList->cppInstance_);
std::string sSeparator;
CW_STRING_TO_CHARARRAY(hSeparator);
sSeparator = tchSeparator;
std::string cppResult = CGRuntime::joinStrings(pList, sSeparator);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hSeparator);
return result;
}
System::String* Runtime::leftString(System::String* hText, int hLength) {
System::String* result;
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
int iLength;
iLength = hLength;
std::string cppResult = CGRuntime::leftString(sText, iLength);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hText);
return result;
}
int Runtime::lengthString(System::String* hText) {
int result;
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
int cppResult = CGRuntime::lengthString(sText);
result = cppResult;
CW_FREE_CHARARRAY(hText);
return result;
}
System::String* Runtime::loadBinaryFile(System::String* hFile, int hLength) {
System::String* result;
std::string sFile;
CW_STRING_TO_CHARARRAY(hFile);
sFile = tchFile;
int iLength;
iLength = hLength;
std::string cppResult = CGRuntime::loadBinaryFile(sFile, iLength);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hFile);
return result;
}
System::String* Runtime::loadFile(System::String* hFile, int hLength) {
System::String* result;
std::string sFile;
CW_STRING_TO_CHARARRAY(hFile);
sFile = tchFile;
int iLength;
iLength = hLength;
std::string cppResult = CGRuntime::loadFile(sFile, iLength);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hFile);
return result;
}
System::String* Runtime::loadVirtualFile(System::String* hHandle) {
System::String* result;
std::string sHandle;
CW_STRING_TO_CHARARRAY(hHandle);
sHandle = tchHandle;
std::string cppResult = CGRuntime::loadVirtualFile(sHandle);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hHandle);
return result;
}
double Runtime::log(double hX) {
double result;
double dX;
dX = hX;
double cppResult = CGRuntime::log(dX);
result = cppResult;
return result;
}
System::String* Runtime::longToBytes(unsigned long hLong) {
System::String* result;
unsigned long ulLong;
ulLong = hLong;
std::string cppResult = CGRuntime::longToBytes(ulLong);
result = CW_STL_TO_STRING(cppResult);
return result;
}
System::String* Runtime::midString(System::String* hText, int hPos, int hLength) {
System::String* result;
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
int iPos;
iPos = hPos;
int iLength;
iLength = hLength;
std::string cppResult = CGRuntime::midString(sText, iPos, iLength);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hText);
return result;
}
int Runtime::mod(int hDividend, int hDivisor) {
int result;
int iDividend;
iDividend = hDividend;
int iDivisor;
iDivisor = hDivisor;
int cppResult = CGRuntime::mod(iDividend, iDivisor);
result = cppResult;
return result;
}
double Runtime::mult(double hLeft, double hRight) {
double result;
double dLeft;
dLeft = hLeft;
double dRight;
dRight = hRight;
double cppResult = CGRuntime::mult(dLeft, dRight);
result = cppResult;
return result;
}
System::String* Runtime::networkLongToHost(System::String* hBytes) {
System::String* result;
std::string sBytes;
CW_STRING_TO_CHARARRAY(hBytes);
sBytes = tchBytes;
std::string cppResult = CGRuntime::networkLongToHost(sBytes);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hBytes);
return result;
}
System::String* Runtime::networkShortToHost(System::String* hBytes) {
System::String* result;
std::string sBytes;
CW_STRING_TO_CHARARRAY(hBytes);
sBytes = tchBytes;
std::string cppResult = CGRuntime::networkShortToHost(sBytes);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hBytes);
return result;
}
int Runtime::octalToDecimal(System::String* hOctalNumber) {
int result;
std::string sOctalNumber;
CW_STRING_TO_CHARARRAY(hOctalNumber);
sOctalNumber = tchOctalNumber;
int cppResult = CGRuntime::octalToDecimal(sOctalNumber);
result = cppResult;
CW_FREE_CHARARRAY(hOctalNumber);
return result;
}
System::String* Runtime::pathFromPackage(System::String* hPackage) {
System::String* result;
std::string sPackage;
CW_STRING_TO_CHARARRAY(hPackage);
sPackage = tchPackage;
std::string cppResult = CGRuntime::pathFromPackage(sPackage);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hPackage);
return result;
}
System::String* Runtime::postHTTPRequest(System::String* hURL, ParseTree* hHTTPSession, ParseTree* hArguments) {
System::String* result;
std::string sURL;
CW_STRING_TO_CHARARRAY(hURL);
sURL = tchURL;
CodeWorker::DtaScriptVariable* pHTTPSession;
pHTTPSession = ((hHTTPSession == NULL) ? NULL : hHTTPSession->cppInstance_);
CodeWorker::DtaScriptVariable* pArguments;
pArguments = ((hArguments == NULL) ? NULL : hArguments->cppInstance_);
std::string cppResult = CGRuntime::postHTTPRequest(sURL, pHTTPSession, pArguments);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hURL);
return result;
}
double Runtime::pow(double hX, double hY) {
double result;
double dX;
dX = hX;
double dY;
dY = hY;
double cppResult = CGRuntime::pow(dX, dY);
result = cppResult;
return result;
}
int Runtime::randomInteger() {
int result;
int cppResult = CGRuntime::randomInteger();
result = cppResult;
return result;
}
System::String* Runtime::receiveBinaryFromSocket(int hSocket, int hLength) {
System::String* result;
int iSocket;
iSocket = hSocket;
int iLength;
iLength = hLength;
std::string cppResult = CGRuntime::receiveBinaryFromSocket(iSocket, iLength);
result = CW_STL_TO_STRING(cppResult);
return result;
}
System::String* Runtime::receiveFromSocket(int hSocket, BooleanRef* hIsText) {
System::String* result;
int iSocket;
iSocket = hSocket;
bool bIsText;
// NOT HANDLED YET!
std::string cppResult = CGRuntime::receiveFromSocket(iSocket, bIsText);
result = CW_STL_TO_STRING(cppResult);
return result;
}
System::String* Runtime::receiveTextFromSocket(int hSocket, int hLength) {
System::String* result;
int iSocket;
iSocket = hSocket;
int iLength;
iLength = hLength;
std::string cppResult = CGRuntime::receiveTextFromSocket(iSocket, iLength);
result = CW_STL_TO_STRING(cppResult);
return result;
}
System::String* Runtime::relativePath(System::String* hPath, System::String* hReference) {
System::String* result;
std::string sPath;
CW_STRING_TO_CHARARRAY(hPath);
sPath = tchPath;
std::string sReference;
CW_STRING_TO_CHARARRAY(hReference);
sReference = tchReference;
std::string cppResult = CGRuntime::relativePath(sPath, sReference);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hReference);
CW_FREE_CHARARRAY(hPath);
return result;
}
bool Runtime::removeDirectory(System::String* hPath) {
bool result;
std::string sPath;
CW_STRING_TO_CHARARRAY(hPath);
sPath = tchPath;
bool cppResult = CGRuntime::removeDirectory(sPath);
result = cppResult;
CW_FREE_CHARARRAY(hPath);
return result;
}
bool Runtime::removeGenerationTagsHandler(System::String* hKey) {
bool result;
std::string sKey;
CW_STRING_TO_CHARARRAY(hKey);
sKey = tchKey;
bool cppResult = CGRuntime::removeGenerationTagsHandler(sKey);
result = cppResult;
CW_FREE_CHARARRAY(hKey);
return result;
}
System::String* Runtime::repeatString(System::String* hText, int hOccurrences) {
System::String* result;
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
int iOccurrences;
iOccurrences = hOccurrences;
std::string cppResult = CGRuntime::repeatString(sText, iOccurrences);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hText);
return result;
}
System::String* Runtime::replaceString(System::String* hOld, System::String* hNew, System::String* hText) {
System::String* result;
std::string sOld;
CW_STRING_TO_CHARARRAY(hOld);
sOld = tchOld;
std::string sNew;
CW_STRING_TO_CHARARRAY(hNew);
sNew = tchNew;
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
std::string cppResult = CGRuntime::replaceString(sOld, sNew, sText);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hText);
CW_FREE_CHARARRAY(hNew);
CW_FREE_CHARARRAY(hOld);
return result;
}
System::String* Runtime::replaceTabulations(System::String* hText, int hTab) {
System::String* result;
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
int iTab;
iTab = hTab;
std::string cppResult = CGRuntime::replaceTabulations(sText, iTab);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hText);
return result;
}
System::String* Runtime::resolveFilePath(System::String* hFilename) {
System::String* result;
std::string sFilename;
CW_STRING_TO_CHARARRAY(hFilename);
sFilename = tchFilename;
std::string cppResult = CGRuntime::resolveFilePath(sFilename);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hFilename);
return result;
}
System::String* Runtime::rightString(System::String* hText, int hLength) {
System::String* result;
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
int iLength;
iLength = hLength;
std::string cppResult = CGRuntime::rightString(sText, iLength);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hText);
return result;
}
System::String* Runtime::rsubString(System::String* hText, int hPos) {
System::String* result;
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
int iPos;
iPos = hPos;
std::string cppResult = CGRuntime::rsubString(sText, iPos);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hText);
return result;
}
bool Runtime::scanDirectories(ParseTree* hDirectory, System::String* hPath, System::String* hPattern) {
bool result;
CodeWorker::DtaScriptVariable* pDirectory;
pDirectory = ((hDirectory == NULL) ? NULL : hDirectory->cppInstance_);
std::string sPath;
CW_STRING_TO_CHARARRAY(hPath);
sPath = tchPath;
std::string sPattern;
CW_STRING_TO_CHARARRAY(hPattern);
sPattern = tchPattern;
bool cppResult = CGRuntime::scanDirectories(pDirectory, sPath, sPattern);
result = cppResult;
CW_FREE_CHARARRAY(hPattern);
CW_FREE_CHARARRAY(hPath);
return result;
}
bool Runtime::scanFiles(ParseTree* hFiles, System::String* hPath, System::String* hPattern, bool hSubfolders) {
bool result;
CodeWorker::DtaScriptVariable* pFiles;
pFiles = ((hFiles == NULL) ? NULL : hFiles->cppInstance_);
std::string sPath;
CW_STRING_TO_CHARARRAY(hPath);
sPath = tchPath;
std::string sPattern;
CW_STRING_TO_CHARARRAY(hPattern);
sPattern = tchPattern;
bool bSubfolders;
bSubfolders = hSubfolders;
bool cppResult = CGRuntime::scanFiles(pFiles, sPath, sPattern, bSubfolders);
result = cppResult;
CW_FREE_CHARARRAY(hPattern);
CW_FREE_CHARARRAY(hPath);
return result;
}
bool Runtime::sendBinaryToSocket(int hSocket, System::String* hBytes) {
bool result;
int iSocket;
iSocket = hSocket;
std::string sBytes;
CW_STRING_TO_CHARARRAY(hBytes);
sBytes = tchBytes;
bool cppResult = CGRuntime::sendBinaryToSocket(iSocket, sBytes);
result = cppResult;
CW_FREE_CHARARRAY(hBytes);
return result;
}
System::String* Runtime::sendHTTPRequest(System::String* hURL, ParseTree* hHTTPSession) {
System::String* result;
std::string sURL;
CW_STRING_TO_CHARARRAY(hURL);
sURL = tchURL;
CodeWorker::DtaScriptVariable* pHTTPSession;
pHTTPSession = ((hHTTPSession == NULL) ? NULL : hHTTPSession->cppInstance_);
std::string cppResult = CGRuntime::sendHTTPRequest(sURL, pHTTPSession);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hURL);
return result;
}
bool Runtime::sendTextToSocket(int hSocket, System::String* hText) {
bool result;
int iSocket;
iSocket = hSocket;
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
bool cppResult = CGRuntime::sendTextToSocket(iSocket, sText);
result = cppResult;
CW_FREE_CHARARRAY(hText);
return result;
}
bool Runtime::selectGenerationTagsHandler(System::String* hKey) {
bool result;
std::string sKey;
CW_STRING_TO_CHARARRAY(hKey);
sKey = tchKey;
bool cppResult = CGRuntime::selectGenerationTagsHandler(sKey);
result = cppResult;
CW_FREE_CHARARRAY(hKey);
return result;
}
System::String* Runtime::shortToBytes(unsigned short hShort) {
System::String* result;
unsigned short ulShort;
ulShort = hShort;
std::string cppResult = CGRuntime::shortToBytes(ulShort);
result = CW_STL_TO_STRING(cppResult);
return result;
}
double Runtime::sqrt(double hX) {
double result;
double dX;
dX = hX;
double cppResult = CGRuntime::sqrt(dX);
result = cppResult;
return result;
}
bool Runtime::startString(System::String* hText, System::String* hStart) {
bool result;
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
std::string sStart;
CW_STRING_TO_CHARARRAY(hStart);
sStart = tchStart;
bool cppResult = CGRuntime::startString(sText, sStart);
result = cppResult;
CW_FREE_CHARARRAY(hStart);
CW_FREE_CHARARRAY(hText);
return result;
}
double Runtime::sub(double hLeft, double hRight) {
double result;
double dLeft;
dLeft = hLeft;
double dRight;
dRight = hRight;
double cppResult = CGRuntime::sub(dLeft, dRight);
result = cppResult;
return result;
}
System::String* Runtime::subString(System::String* hText, int hPos) {
System::String* result;
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
int iPos;
iPos = hPos;
std::string cppResult = CGRuntime::subString(sText, iPos);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hText);
return result;
}
bool Runtime::sup(double hLeft, double hRight) {
bool result;
double dLeft;
dLeft = hLeft;
double dRight;
dRight = hRight;
bool cppResult = CGRuntime::sup(dLeft, dRight);
result = cppResult;
return result;
}
System::String* Runtime::system(System::String* hCommand) {
System::String* result;
std::string sCommand;
CW_STRING_TO_CHARARRAY(hCommand);
sCommand = tchCommand;
std::string cppResult = CGRuntime::system(sCommand);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hCommand);
return result;
}
System::String* Runtime::toLowerString(System::String* hText) {
System::String* result;
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
std::string cppResult = CGRuntime::toLowerString(sText);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hText);
return result;
}
System::String* Runtime::toUpperString(System::String* hText) {
System::String* result;
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
std::string cppResult = CGRuntime::toUpperString(sText);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hText);
return result;
}
int Runtime::trimLeft(System::Text::StringBuilder* hString) {
int result;
std::string sString;
// NOT HANDLED YET!
int cppResult = CGRuntime::trimLeft(sString);
result = cppResult;
return result;
}
int Runtime::trimRight(System::Text::StringBuilder* hString) {
int result;
std::string sString;
// NOT HANDLED YET!
int cppResult = CGRuntime::trimRight(sString);
result = cppResult;
return result;
}
int Runtime::trim(System::Text::StringBuilder* hString) {
int result;
std::string sString;
// NOT HANDLED YET!
int cppResult = CGRuntime::trim(sString);
result = cppResult;
return result;
}
System::String* Runtime::truncateAfterString(ParseTree* hVariable, System::String* hText) {
System::String* result;
CodeWorker::DtaScriptVariable* pVariable;
pVariable = ((hVariable == NULL) ? NULL : hVariable->cppInstance_);
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
std::string cppResult = CGRuntime::truncateAfterString(pVariable, sText);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hText);
return result;
}
System::String* Runtime::truncateBeforeString(ParseTree* hVariable, System::String* hText) {
System::String* result;
CodeWorker::DtaScriptVariable* pVariable;
pVariable = ((hVariable == NULL) ? NULL : hVariable->cppInstance_);
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
std::string cppResult = CGRuntime::truncateBeforeString(pVariable, sText);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hText);
return result;
}
System::String* Runtime::UUID() {
System::String* result;
std::string cppResult = CGRuntime::UUID();
result = CW_STL_TO_STRING(cppResult);
return result;
}
int Runtime::countInputCols() {
int result;
int cppResult = CGRuntime::countInputCols();
result = cppResult;
return result;
}
int Runtime::countInputLines() {
int result;
int cppResult = CGRuntime::countInputLines();
result = cppResult;
return result;
}
System::String* Runtime::getInputFilename() {
System::String* result;
std::string cppResult = CGRuntime::getInputFilename();
result = CW_STL_TO_STRING(cppResult);
return result;
}
System::String* Runtime::getLastReadChars(int hLength) {
System::String* result;
int iLength;
iLength = hLength;
std::string cppResult = CGRuntime::getLastReadChars(iLength);
result = CW_STL_TO_STRING(cppResult);
return result;
}
int Runtime::getInputLocation() {
int result;
int cppResult = CGRuntime::getInputLocation();
result = cppResult;
return result;
}
bool Runtime::lookAhead(System::String* hText) {
bool result;
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
bool cppResult = CGRuntime::lookAhead(sText);
result = cppResult;
CW_FREE_CHARARRAY(hText);
return result;
}
System::String* Runtime::peekChar() {
System::String* result;
std::string cppResult = CGRuntime::peekChar();
result = CW_STL_TO_STRING(cppResult);
return result;
}
bool Runtime::readAdaString(System::Text::StringBuilder* hText) {
bool result;
std::string sText;
// NOT HANDLED YET!
bool cppResult = CGRuntime::readAdaString(sText);
result = cppResult;
return result;
}
System::String* Runtime::readByte() {
System::String* result;
std::string cppResult = CGRuntime::readByte();
result = CW_STL_TO_STRING(cppResult);
return result;
}
System::String* Runtime::readBytes(int hLength) {
System::String* result;
int iLength;
iLength = hLength;
std::string cppResult = CGRuntime::readBytes(iLength);
result = CW_STL_TO_STRING(cppResult);
return result;
}
System::String* Runtime::readCChar() {
System::String* result;
std::string cppResult = CGRuntime::readCChar();
result = CW_STL_TO_STRING(cppResult);
return result;
}
System::String* Runtime::readChar() {
System::String* result;
std::string cppResult = CGRuntime::readChar();
result = CW_STL_TO_STRING(cppResult);
return result;
}
int Runtime::readCharAsInt() {
int result;
int cppResult = CGRuntime::readCharAsInt();
result = cppResult;
return result;
}
System::String* Runtime::readChars(int hLength) {
System::String* result;
int iLength;
iLength = hLength;
std::string cppResult = CGRuntime::readChars(iLength);
result = CW_STL_TO_STRING(cppResult);
return result;
}
System::String* Runtime::readIdentifier() {
System::String* result;
std::string cppResult = CGRuntime::readIdentifier();
result = CW_STL_TO_STRING(cppResult);
return result;
}
bool Runtime::readIfEqualTo(System::String* hText) {
bool result;
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
bool cppResult = CGRuntime::readIfEqualTo(sText);
result = cppResult;
CW_FREE_CHARARRAY(hText);
return result;
}
bool Runtime::readIfEqualToIgnoreCase(System::String* hText) {
bool result;
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
bool cppResult = CGRuntime::readIfEqualToIgnoreCase(sText);
result = cppResult;
CW_FREE_CHARARRAY(hText);
return result;
}
bool Runtime::readIfEqualToIdentifier(System::String* hIdentifier) {
bool result;
std::string sIdentifier;
CW_STRING_TO_CHARARRAY(hIdentifier);
sIdentifier = tchIdentifier;
bool cppResult = CGRuntime::readIfEqualToIdentifier(sIdentifier);
result = cppResult;
CW_FREE_CHARARRAY(hIdentifier);
return result;
}
bool Runtime::readLine(System::Text::StringBuilder* hText) {
bool result;
std::string sText;
// NOT HANDLED YET!
bool cppResult = CGRuntime::readLine(sText);
result = cppResult;
return result;
}
bool Runtime::readNextText(System::String* hText) {
bool result;
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
bool cppResult = CGRuntime::readNextText(sText);
result = cppResult;
CW_FREE_CHARARRAY(hText);
return result;
}
bool Runtime::readNumber(DoubleRef* hNumber) {
bool result;
double dNumber;
// NOT HANDLED YET!
bool cppResult = CGRuntime::readNumber(dNumber);
result = cppResult;
return result;
}
bool Runtime::readPythonString(System::Text::StringBuilder* hText) {
bool result;
std::string sText;
// NOT HANDLED YET!
bool cppResult = CGRuntime::readPythonString(sText);
result = cppResult;
return result;
}
bool Runtime::readString(System::Text::StringBuilder* hText) {
bool result;
std::string sText;
// NOT HANDLED YET!
bool cppResult = CGRuntime::readString(sText);
result = cppResult;
return result;
}
System::String* Runtime::readUptoJustOneChar(System::String* hOneAmongChars) {
System::String* result;
std::string sOneAmongChars;
CW_STRING_TO_CHARARRAY(hOneAmongChars);
sOneAmongChars = tchOneAmongChars;
std::string cppResult = CGRuntime::readUptoJustOneChar(sOneAmongChars);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hOneAmongChars);
return result;
}
System::String* Runtime::readWord() {
System::String* result;
std::string cppResult = CGRuntime::readWord();
result = CW_STL_TO_STRING(cppResult);
return result;
}
bool Runtime::skipBlanks() {
bool result;
bool cppResult = CGRuntime::skipBlanks();
result = cppResult;
return result;
}
bool Runtime::skipSpaces() {
bool result;
bool cppResult = CGRuntime::skipSpaces();
result = cppResult;
return result;
}
bool Runtime::skipEmptyCpp() {
bool result;
bool cppResult = CGRuntime::skipEmptyCpp();
result = cppResult;
return result;
}
bool Runtime::skipEmptyCppExceptDoxygen() {
bool result;
bool cppResult = CGRuntime::skipEmptyCppExceptDoxygen();
result = cppResult;
return result;
}
bool Runtime::skipEmptyHTML() {
bool result;
bool cppResult = CGRuntime::skipEmptyHTML();
result = cppResult;
return result;
}
bool Runtime::skipEmptyLaTeX() {
bool result;
bool cppResult = CGRuntime::skipEmptyLaTeX();
result = cppResult;
return result;
}
int Runtime::countOutputCols() {
int result;
int cppResult = CGRuntime::countOutputCols();
result = cppResult;
return result;
}
int Runtime::countOutputLines() {
int result;
int cppResult = CGRuntime::countOutputLines();
result = cppResult;
return result;
}
bool Runtime::decrementIndentLevel(int hLevel) {
bool result;
int iLevel;
iLevel = hLevel;
bool cppResult = CGRuntime::decrementIndentLevel(iLevel);
result = cppResult;
return result;
}
bool Runtime::equalLastWrittenChars(System::String* hText) {
bool result;
std::string sText;
CW_STRING_TO_CHARARRAY(hText);
sText = tchText;
bool cppResult = CGRuntime::equalLastWrittenChars(sText);
result = cppResult;
CW_FREE_CHARARRAY(hText);
return result;
}
bool Runtime::existFloatingLocation(System::String* hKey, bool hParent) {
bool result;
std::string sKey;
CW_STRING_TO_CHARARRAY(hKey);
sKey = tchKey;
bool bParent;
bParent = hParent;
bool cppResult = CGRuntime::existFloatingLocation(sKey, bParent);
result = cppResult;
CW_FREE_CHARARRAY(hKey);
return result;
}
int Runtime::getFloatingLocation(System::String* hKey) {
int result;
std::string sKey;
CW_STRING_TO_CHARARRAY(hKey);
sKey = tchKey;
int cppResult = CGRuntime::getFloatingLocation(sKey);
result = cppResult;
CW_FREE_CHARARRAY(hKey);
return result;
}
System::String* Runtime::getLastWrittenChars(int hNbChars) {
System::String* result;
int iNbChars;
iNbChars = hNbChars;
std::string cppResult = CGRuntime::getLastWrittenChars(iNbChars);
result = CW_STL_TO_STRING(cppResult);
return result;
}
System::String* Runtime::getMarkupKey() {
System::String* result;
std::string cppResult = CGRuntime::getMarkupKey();
result = CW_STL_TO_STRING(cppResult);
return result;
}
System::String* Runtime::getMarkupValue() {
System::String* result;
std::string cppResult = CGRuntime::getMarkupValue();
result = CW_STL_TO_STRING(cppResult);
return result;
}
System::String* Runtime::getOutputFilename() {
System::String* result;
std::string cppResult = CGRuntime::getOutputFilename();
result = CW_STL_TO_STRING(cppResult);
return result;
}
int Runtime::getOutputLocation() {
int result;
int cppResult = CGRuntime::getOutputLocation();
result = cppResult;
return result;
}
System::String* Runtime::getProtectedArea(System::String* hProtection) {
System::String* result;
std::string sProtection;
CW_STRING_TO_CHARARRAY(hProtection);
sProtection = tchProtection;
std::string cppResult = CGRuntime::getProtectedArea(sProtection);
result = CW_STL_TO_STRING(cppResult);
CW_FREE_CHARARRAY(hProtection);
return result;
}
int Runtime::getProtectedAreaKeys(ParseTree* hKeys) {
int result;
CodeWorker::DtaScriptVariable* pKeys;
pKeys = ((hKeys == NULL) ? NULL : hKeys->cppInstance_);
int cppResult = CGRuntime::getProtectedAreaKeys(pKeys);
result = cppResult;
return result;
}
bool Runtime::indentText(System::String* hMode) {
bool result;
std::string sMode;
CW_STRING_TO_CHARARRAY(hMode);
sMode = tchMode;
bool cppResult = CGRuntime::indentText(sMode);
result = cppResult;
CW_FREE_CHARARRAY(hMode);
return result;
}
bool Runtime::newFloatingLocation(System::String* hKey) {
bool result;
std::string sKey;
CW_STRING_TO_CHARARRAY(hKey);
sKey = tchKey;
bool cppResult = CGRuntime::newFloatingLocation(sKey);
result = cppResult;
CW_FREE_CHARARRAY(hKey);
return result;
}
int Runtime::remainingProtectedAreas(ParseTree* hKeys) {
int result;
CodeWorker::DtaScriptVariable* pKeys;
pKeys = ((hKeys == NULL) ? NULL : hKeys->cppInstance_);
int cppResult = CGRuntime::remainingProtectedAreas(pKeys);
result = cppResult;
return result;
}
int Runtime::removeFloatingLocation(System::String* hKey) {
int result;
std::string sKey;
CW_STRING_TO_CHARARRAY(hKey);
sKey = tchKey;
int cppResult = CGRuntime::removeFloatingLocation(sKey);
result = cppResult;
CW_FREE_CHARARRAY(hKey);
return result;
}
bool Runtime::removeProtectedArea(System::String* hProtectedAreaName) {
bool result;
std::string sProtectedAreaName;
CW_STRING_TO_CHARARRAY(hProtectedAreaName);
sProtectedAreaName = tchProtectedAreaName;
bool cppResult = CGRuntime::removeProtectedArea(sProtectedAreaName);
result = cppResult;
CW_FREE_CHARARRAY(hProtectedAreaName);
return result;
}
//##end##"C++ body"
}
namespace CodeWorker {
public __gc class Main {
public:
static int initialize() {
int iRetval = 0;
try {
__crt_dll_initialize();
} catch(System::Exception* e) {
System::Console::WriteLine(e);
iRetval = 1;
}
return iRetval;
}
static int terminate() {
int iRetval = 0;
try {
__crt_dll_terminate();
} catch(System::Exception* e) {
System::Console::WriteLine(e);
iRetval = 1;
}
return iRetval;
}
};
}
BOOL WINAPI DllMain(HINSTANCE hModule, DWORD dwReason, LPVOID lpvReserved) {
return TRUE;
}
| [
"cedric.p.r.lemaire@28b3f5f3-d42e-7560-b87f-5f53cf622bc4"
]
| [
[
[
1,
3222
]
]
]
|
6e22560b189bff5785ed24a40395de83051a360e | 11916febd7cf1bf31f029791171ed60ad8bbefcb | /network.hpp | 25a88386e8f16cd0dedf97e3cb75d7f3373cd1df | []
| no_license | guopengwei/worm_sim | 18d8b321744ed32c2ab4ca38f89723c835ef40de | 260a7288fca3731fd082684ea3ca2ba243c951a2 | refs/heads/master | 2021-01-25T08:55:28.133828 | 2011-01-19T02:10:01 | 2011-01-19T02:10:01 | 1,269,438 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,637 | hpp | /************************************************************************
Author: Jingcao Hu ([email protected])
File name: network.hpp
Date Created: <Tue Oct 14 14:05:10 2003>
Last Modified: <Wed Jan 19 12:08:30 2005>
Description: Class that implements the whole network.
************************************************************************/
#ifndef NETWORK_HPP_
#define NETWORK_HPP_
#include "common.hpp"
#include "router.hpp"
#include "link.hpp"
#include "traffic.hpp"
typedef class Network {
private:
bool success;
// configuration parameters
Topology topology;
unsigned int n_of_rows;
unsigned int n_of_cols;
unsigned int n_of_ports;
unsigned int n_of_extra_links; // UYO
unsigned int n_of_switch_ports;
unsigned int n_of_vcs;
vector<class Router *> routers;
vector<class Link *> links;
vector<class Traffic_source *> sources;
vector<class Traffic_sink *> sinks;
private:
void calc_channel_load(void);
// void perf_anal_init_lambdas(double * n_lambda);
// void perf_anal_init_probs(double * n_prob);
bool overloaded(double * n_lambda);
public:
void reset(void);
Network(void);
~Network(void);
class Router * get_router(Position & p);
class Router * get_router(int index) { return routers[index]; }
class Traffic_source * get_traffic_source(Position & p);
class Traffic_source * get_traffic_source(int index) { return sources[index]; }
class Traffic_sink * get_traffic_sink(Position & p);
class Traffic_sink * get_traffic_sink(int index) { return sinks[index]; }
class Link * connect(class Connector * src, class Connector * dst, int delay=0);
Topology get_topology(void) const { return topology; }
vector<class Repeater *> repeaters; // UYO
unsigned int get_num_of_rows(void) const { return n_of_rows; }
unsigned int get_num_of_cols(void) const { return n_of_cols; }
unsigned int get_num_of_ports(void) const { return n_of_ports; }
unsigned int get_num_of_vcs(void) const { return n_of_vcs; }
unsigned int get_num_of_traffic_sources(void) const { return sources.size(); }
unsigned int get_num_of_traffic_sinks(void) const { return sinks.size(); }
double get_total_injection_rate(void) const;
void tick(void);
bool get_success_flag(void) { return success; }
// double analyze_latency(void);
bool dump_equation_file(void);
bool dump_perf_anal_lib_equation_file(void);
bool dump_config_file(void);
};
typedef Network *pNetwork;
#endif // NETWORK_HPP_
| [
"[email protected]"
]
| [
[
[
1,
76
]
]
]
|
89fcafafc045d1a5389320fde0b9e6aba31142d8 | 1d6dcdeddc2066f451338361dc25196157b8b45c | /tp2/Visualizacion/Luz.cpp | 4310ff1bdc5eb0ce3dbe51d36e06195a51c6a02b | []
| no_license | nicohen/ssgg2009 | 1c105811837f82aaa3dd1f55987acaf8f62f16bb | 467e4f475ef04d59740fa162ac10ee51f1f95f83 | refs/heads/master | 2020-12-24T08:16:36.476182 | 2009-08-15T00:43:57 | 2009-08-15T00:43:57 | 34,405,608 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 457 | cpp | #include "Luz.h"
Luz::Luz(){
this->light_color[0] = 1.0f;
this->light_color[1] = 1.0f;
this->light_color[2] = 1.0f;
this->light_color[3] = 1.0f;
this->light_position[0] = 10.0f;
this->light_position[1] = 10.0f;
this->light_position[2] = 8.0f;
this->light_ambient[0] = 0.05f;
this->light_ambient[1] = 0.05f;
this->light_ambient[2] = 0.05f;
this->light_ambient[3] = 1.0f;
}
Luz::~Luz()
{
//dtor
}
| [
"rodvar@6da81292-15a5-11de-a4db-e31d5fa7c4f0"
]
| [
[
[
1,
20
]
]
]
|
8b96ce6563ac08d4ab972c475e07e5c9d34a8fd2 | 478570cde911b8e8e39046de62d3b5966b850384 | /apicompatanamdw/bcdrivers/mw/classicui/uifw/apps/S60_SDK3.0/bctestsettingpage/inc/bctestslidersettingpage.h | e664debc5510eed457a3b0b518170980c910edf0 | []
| no_license | SymbianSource/oss.FCL.sftools.ana.compatanamdw | a6a8abf9ef7ad71021d43b7f2b2076b504d4445e | 1169475bbf82ebb763de36686d144336fcf9d93b | refs/heads/master | 2020-12-24T12:29:44.646072 | 2010-11-11T14:03:20 | 2010-11-11T14:03:20 | 72,994,432 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,786 | h | /*
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "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: test case
*
*/
#ifndef BCTEST_SLIDERSETTINGPAGE_H
#define BCTEST_SLIDERSETTINGPAGE_H
#include <AknSliderSettingPage.h>
class CBCTestSliderSettingPage : public CAknSliderSettingPage
{
public:
/**
* Simple constructor depending only on a single resource Id. Editor resource is given via
* the link in the setting page resource.
*
* @param aSettingPageResourceId Setting Page to use (if present)
* @param aSliderValue ref. to external slider value
*/
IMPORT_C CBCTestSliderSettingPage(TInt aResourceID, TInt& aSliderValue);
/**
* Constructor that allows separate setting page and editor resources
*
* This constructor allows the use of setting page using only the editor resource. Other combinations are also possible
*
* In all cases the number (if supplied i.e. <> 0 ) is used.
*
* Editor Resource Setting Page Resource
* present present Both are used (but text & number overridden)
* = 0 present Editor resource is used via SP resource (Effectively like the other constructor)
* present = 0 Default Avkon SP resource if used + this editor resource
* = 0 = 0 uses default resource for both SP and editor. This is OK if:
* i) control type is present,
* ii) a default resource exists ( OK for text, integer, date, time, duration )
*
* Note: THe first argument is a TDesC* (rather than TDesC&) because the other constructor
* cannot initialize such a member without allocation or having an internal dummy buffer.
*
* Rules for text and numbers: The rules are the same for both: (non-zero length) text or number other
* than EAknSettingPageNoOrdinalDisplayed if given in this constructor will not override resource
* (unless that is zero length or EAknSettingPageNoOrdinalDisplayed). Note, however, that text or number given via the
* specific API for setting them, WILL override resource.
* It is assumed that number from resource is very rare. Special text is somewhat more likely.
*
*
* @param aSettingTitleText Text at top of setting pane (not copied to object until ExecuteLD is called)
* @param aSettingNumber Number at top left (if present)
* @param aControlType Determines the type constructed and how its resource is read
* @param aEditorResourceId Editor resource to use in the setting page (if present)
* @param aSettingPageResourceId Setting Page to use (if present)
* @param aSliderValue Reference to integer holding the slider value
*/
IMPORT_C CBCTestSliderSettingPage( const TDesC* aSettingTitleText,
TInt aSettingNumber,
TInt aControlType,
TInt aEditorResourceId,
TInt aSettingPageResourceId,
TInt& aSliderValue );
IMPORT_C virtual void SizeChanged();
IMPORT_C virtual void Draw(const TRect &aRect) const;
/**
* Writes the internal state of the control and its components to aStream.
* Does nothing in release mode.
* Designed to be overidden and base called by subclasses.
*
* @param aWriteSteam A connected write stream
*/
IMPORT_C virtual void WriteInternalStateL(RWriteStream& aWriteStream) const;
//
// Framework methods derived from CAknSettingPage
//
/**
* C++ destructor
*
*/
IMPORT_C virtual ~CBCTestSliderSettingPage();
/**
* Called when something has changed and the client's object needs to have its value updated
*
*/
IMPORT_C virtual void UpdateSettingL();
/**
* Called when the user accepts a setting and the setting page is about to be dismissed. The latest value of the
* setting is written to the client's object
*/
IMPORT_C virtual void AcceptSettingL();
/**
* Called when the user rejects the setting. A backup copy may need to be restored if UpdateWhenChanged flag was set
*
*/
IMPORT_C virtual void RestoreOriginalSettingL();
};
#endif
| [
"none@none"
]
| [
[
[
1,
120
]
]
]
|
b09939f6069a1c437a6cbca6d11eaec9662ce3dc | 1092bd6dc9b728f3789ba96e37e51cdfb9e19301 | /loci/application.h | 3c8e58fc87d6d1aaaa2dca147e0628784c76898c | []
| no_license | dtbinh/loci-extended | 772239e63b4e3e94746db82d0e23a56d860b6f0d | f4b5ad6c4412e75324d19b71559a66dd20f4f23f | refs/heads/master | 2021-01-10T12:23:52.467480 | 2011-03-15T22:03:06 | 2011-03-15T22:03:06 | 36,032,427 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,811 | h | #ifndef LOCI_APPLICATION_H_
#define LOCI_APPLICATION_H_
/**
* A utility interface for simple loci applications.
* Provides an interface that can be used to create simple loci applications,
* this is only a utility however. There is also a default implementation
* provided that creates an application that executes a script.
*
* @file application.h
* @author David Gill
* @date 03/05/2010
*/
#include <string>
#include <iostream>
#include <boost/bind.hpp>
#include <boost/shared_ptr.hpp>
#include "loci/platform/tstring.h"
#include "loci/platform/win32/dispatch.h"
#include "loci/video/render_view.h"
#include "loci/crowd.h"
#include "loci/control/xml_controller.h"
namespace loci
{
class application
{
protected:
application() : first(0), last(1000), delta(100), temporal(false)
{
}
void start(const platform::tstring & name, unsigned int width, unsigned int height,
const std::string & scene_path = "",
float scale = 1.0f)
{
canvas = boost::make_shared<video::render_view>(name, width, height, scene_path, scale);
canvas->input_event_handler(boost::bind(&application::key_handler, this, _1));
while (!loci::platform::win32::dispatch_messages())
{
if (temporal)
{
canvas->render(update(), first, last, delta);
continue;
}
canvas->render(update());
}
}
bool up_key() const { return inputs.up; }
bool down_key() const { return inputs.down; }
bool left_key() const { return inputs.left; }
bool right_key() const { return inputs.right; }
bool home_key() const { return inputs.home; }
bool end_key() const { return inputs.end; }
bool space_key() const { return inputs.space; }
bool f1_key() const { return inputs.f1; }
bool f2_key() const { return inputs.f2; }
bool esc_key() const { return inputs.esc; }
bool lshift_key() const { return inputs.lshift; }
bool rshift_key() const { return inputs.rshift; }
bool lctrl_key() const { return inputs.lctrl; }
bool rctrl_key() const { return inputs.rctrl; }
bool x_key() const { return inputs.x; }
bool z_key() const { return inputs.z; }
bool r_key() const { return inputs.r; }
bool n1_key() const { return inputs.n1; }
bool n2_key() const { return inputs.n2; }
bool n3_key() const { return inputs.n3; }
void move_camera(float yrot, float zoom, float height)
{
if (canvas) { canvas->move_camera(yrot, zoom, height); }
}
void adjust_temporal_window(crowd::time_type first, crowd::time_type last, crowd::time_type delta)
{
this->first += first;
this->first = this->first < 0 ? 0 : this->first;
this->first = this->first > this->last ? this->last : this->first;
this->last += last;
this->last = this->last < this->first ? this->first : this->last;
this->delta += delta;
this->delta -= (this->delta <= 0 ? delta : 0);
}
void temporal_view(bool flag) { temporal = flag; }
bool temporal_view() const { return temporal; }
private:
virtual crowd & update() = 0;
void key_handler(const video::render_view::input_event & e)
{
if (e.keydown)
{
inputs.up |= e.up;
inputs.down |= e.down;
inputs.left |= e.left;
inputs.right |= e.right;
inputs.home |= e.home;
inputs.end |= e.end;
inputs.space |= e.space;
inputs.f1 |= e.f1;
inputs.f2 |= e.f2;
inputs.esc |= e.esc;
inputs.lshift |= e.lshift;
inputs.rshift |= e.rshift;
inputs.lctrl |= e.lctrl;
inputs.rctrl |= e.rctrl;
inputs.x |= e.x;
inputs.z |= e.z;
inputs.r |= e.r;
inputs.n1 |= e.n1;
inputs.n2 |= e.n2;
inputs.n3 |= e.n3;
}
else
{
inputs.up &= !e.up;
inputs.down &= !e.down;
inputs.left &= !e.left;
inputs.right &= !e.right;
inputs.home &= !e.home;
inputs.end &= !e.end;
inputs.space &= !e.space;
inputs.f1 &= e.f1;
inputs.f2 &= e.f2;
inputs.esc &= e.esc;
inputs.lshift &= e.lshift;
inputs.rshift &= e.rshift;
inputs.lctrl &= e.lctrl;
inputs.rctrl &= e.rctrl;
inputs.x &= e.x;
inputs.z &= e.z;
inputs.r &= e.r;
inputs.n1 &= e.n1;
inputs.n2 &= e.n2;
inputs.n3 &= e.n3;
}
}
private:
boost::shared_ptr<video::render_view> canvas;
video::render_view::input_event inputs;
crowd::time_type first, last, delta;
bool temporal;
};
class script_view_application : public application
{
public:
script_view_application() : controller_(new control::xml_crowd_controller()), updateInterval(10) { }
script_view_application(const platform::tstring & name, unsigned int width, unsigned int height,
const std::string & script_path,
const std::string & scene_path = "", float scale = 1.0f)
: controller_(new control::xml_crowd_controller(script_path)), updateInterval(10)
{
application::start(name, width, height, scene_path, scale);
}
script_view_application(const platform::tstring & name, unsigned int width, unsigned int height,
const boost::shared_ptr<control::xml_crowd_controller> & controller,
const std::string & scene_path = "", float scale = 1.0f)
: controller_(controller), updateInterval(10)
{
application::start(name, width, height, scene_path, scale);
}
void start(const platform::tstring & name, unsigned int width, unsigned int height,
const std::string & script_path,
const std::string & scene_path = "", float scale = 1.0f)
{
controller_->parse(script_path);
application::start(name, width, height, scene_path, scale);
}
boost::shared_ptr<control::xml_crowd_controller> controller() const { return controller_; }
private:
int updateInterval;
crowd & update()
{
// camera controls
if (left_key()) { move_camera(5, 0, 0); }
if (right_key()) { move_camera(-5, 0, 0); }
if (up_key()) { move_camera(0, 0, 10); }
if (down_key()) { move_camera(0, 0, -10); }
if (home_key()) { move_camera(0, -0.05, 0); }
if (end_key()) { move_camera(0, 0.05, 0); }
// resetting
if (space_key()) { controller_->reset(); }
if (r_key()) { controller_->reset(); }
// temporal view on/off
if (f2_key()) { temporal_view(true); }
if (f1_key()) { temporal_view(false); }
if (esc_key()) { std::cout << "esc pressed: Quitting" << std::endl; ::PostQuitMessage(0); }
// temporal window
if (lshift_key()) { adjust_temporal_window(100, 0, 0); }
if (lctrl_key()) { adjust_temporal_window(-100, 0, 0); }
if (rshift_key()) { adjust_temporal_window(0, 100, 0); }
if (rctrl_key()) { adjust_temporal_window(0, -100, 0); }
if (x_key()) { adjust_temporal_window(0, 0, 10); }
if (z_key()) { adjust_temporal_window(0, 0, -10); }
if (n1_key()) { updateInterval = 10; }
if (n2_key()) { updateInterval = 20; }
if (n3_key()) { updateInterval = 30; }
std::cout << updateInterval << std::endl;
return controller_->update(updateInterval);
}
boost::shared_ptr<control::xml_crowd_controller> controller_;
};
} // namespace loci
#endif // LOCI_APPLICATION_H_ | [
"[email protected]@0e8bac56-0901-9d1a-f0c4-3841fc69e132",
"[email protected]@0e8bac56-0901-9d1a-f0c4-3841fc69e132"
]
| [
[
[
1,
72
],
[
76,
122
],
[
126,
145
],
[
149,
161
],
[
163,
166
],
[
168,
174
],
[
176,
190
],
[
192,
218
],
[
224,
230
]
],
[
[
73,
75
],
[
123,
125
],
[
146,
148
],
[
162,
162
],
[
167,
167
],
[
175,
175
],
[
191,
191
],
[
219,
223
]
]
]
|
1964991418b7d08291fffb89cc2b7bdc02372ca7 | be9c97ff4cabe03aa30f5bc5c537f45881f6ac74 | /win32/stdafx.cpp | 5d7b0076c8b228225870fbe9120cb0ffd946cb1c | []
| no_license | anaisbetts/zapped | 4fd653f6e42e35802ec3b956bdd509d66f3ecd5d | 8c7fd400a4b42c925f60edc8850b671cd5633dcc | refs/heads/master | 2021-05-27T02:43:31.350729 | 2009-03-23T19:57:17 | 2009-03-23T19:57:17 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 293 | cpp | // stdafx.cpp : source file that includes just the standard includes
// Zapped.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
| [
"[email protected]"
]
| [
[
[
1,
8
]
]
]
|
8951021fb3c906b8ca91f8102ac236510fcd0977 | b411e4861bc1478147bfc289c868b961a6136ead | /tags/DownhillRacing/main.cpp | 66faf2b8b05489edae7c791e1f93e152af26796f | []
| no_license | mvm9289/downhill-racing | d05df2e12384d8012d5216bc0b976bc7df9ff345 | 038ec4875db17a7898282d6ced057d813a0243dc | refs/heads/master | 2021-01-20T12:20:31.383595 | 2010-12-19T23:29:02 | 2010-12-19T23:29:02 | 32,334,476 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,928 | cpp | #include <windows.h>
#include <gl\glut.h>
#include "Game.h"
// Delete console
#pragma comment(linker, "/subsystem:\"windows\" /entry:\"mainCRTStartup\"")
#pragma comment(lib, "fmod/fmodex_vc.lib")
Game game;
void AppRender()
{
game.Render();
}
void AppReshape(int width, int height)
{
game.Reshape(width, height);
}
void AppKeyboard(unsigned char key, int x, int y)
{
game.ReadKeyboard(key,x,y,true);
}
void AppKeyboardUp(unsigned char key, int x, int y)
{
game.ReadKeyboard(key,x,y,false);
}
void AppSpecialKeys(int key, int x, int y)
{
game.ReadKeyboard(key,x,y,true);
}
void AppSpecialKeysUp(int key, int x, int y)
{
game.ReadKeyboard(key,x,y,false);
}
void AppMouse(int button, int state, int x, int y)
{
game.ReadMouse(button,state,x,y);
}
void AppIdle()
{
if(!game.Loop()) exit(0);
}
void main(int argc, char** argv)
{
int res_x,res_y,pos_x,pos_y;
// GLUT initialization
glutInit(&argc, argv);
// RGBA with double buffer
glutInitDisplayMode(GLUT_RGBA | GLUT_ALPHA | GLUT_DOUBLE);
// Create centered window
res_x = glutGet(GLUT_SCREEN_WIDTH);
res_y = glutGet(GLUT_SCREEN_HEIGHT);
pos_x = (res_x>>1)-(GAME_WIDTH>>1);
pos_y = (res_y>>1)-(GAME_HEIGHT>>1);
glutInitWindowPosition(pos_x, pos_y);
glutInitWindowSize(GAME_WIDTH,GAME_HEIGHT);
glutCreateWindow("Downhill Racing");
glutFullScreen();
//glutGameModeString("1024x768:32");
//glutEnterGameMode();
// Make the default cursor disappear
glutSetCursor(GLUT_CURSOR_NONE);
// Register callback functions
glutDisplayFunc(AppRender);
glutReshapeFunc(AppReshape);
glutKeyboardFunc(AppKeyboard);
glutKeyboardUpFunc(AppKeyboardUp);
glutSpecialFunc(AppSpecialKeys);
glutSpecialUpFunc(AppSpecialKeysUp);
glutMouseFunc(AppMouse);
glutIdleFunc(AppIdle);
// Game initializations
game.Init();
// Application loop
glutMainLoop();
}
| [
"mvm9289@06676c28-b993-0703-7cf1-698017e0e3c1"
]
| [
[
[
1,
94
]
]
]
|
6c06e32232130c9eebe1c3aec954c99fa908bb80 | 629a19cbebc2034047b6445717771b7341a5e025 | /src/app.h | 1107b172996954db2506d75baab5f4f6fe8d1c09 | []
| no_license | gejza/prahistorie | 56a63e4e89f54128f9987e5111f7a5c0d8089e22 | d5b808845a664a7652814f206c69ab788ef66625 | refs/heads/master | 2016-09-05T13:56:49.313633 | 2007-05-01T18:30:14 | 2007-05-01T18:30:14 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 397 | h |
#ifndef _PRAHISTORIE_LIDA_APP_H_
#define _PRAHISTORIE_LIDA_APP_H_
class Pra : public HoeGame::HoeApp, public XHoe2DCallback
{
HoeGame::Adventure::Theatre m_theat;
public:
Pra(HOE_INSTANCE hInst,HoeGame::Console * con);
virtual const char * GetAppName();
void HOEAPI _Paint(IHoe2D *h);
};
extern HoeGame::Adventure::Kulission * fig;
#endif // _PRAHISTORIE_LIDA_APP_H_
| [
"[email protected]"
]
| [
[
[
1,
19
]
]
]
|
a46b906229e563dda6378454e771441ee1004043 | 3d7d8969d540b99a1e53e00c8690e32e4d155749 | /EngSrc/IESensorMonitor.cpp | 2e721536f991948c137e640c65b8cddb172a67a8 | []
| no_license | SymbianSource/oss.FCL.sf.incubator.photobrowser | 50c4ea7142102068f33fc62e36baab9d14f348f9 | 818b5857895d2153c4cdd653eb0e10ba6477316f | refs/heads/master | 2021-01-11T02:45:51.269916 | 2010-10-15T01:18:29 | 2010-10-15T01:18:29 | 70,931,013 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,362 | cpp | /*
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "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: Juha Kauppinen, Mika Hokkanen
*
* Description: Photo Browser
*
*/
#include "IESensorMonitor.h"
#include "debug.h"
#ifdef _ACCELEROMETER_SUPPORTED_
#ifdef _S60_3x_ACCELEROMETER_
const TInt KAccelerometerSensorUID = 0x10273024;
#endif
CIESensorMonitor* CIESensorMonitor::NewL(MIESensorMonitorObserver& aSensorObserver)
{
DP0_IMAGIC(_L("CIESensorMonitor::NewL++"));
CIESensorMonitor* self=new (ELeave) CIESensorMonitor(aSensorObserver);
CleanupStack::PushL(self);
self->ConstructL();
CleanupStack::Pop();
DP0_IMAGIC(_L("CIESensorMonitor::NewL--"));
return self;
}
void CIESensorMonitor::ConstructL()
{
DP0_IMAGIC(_L("CIESensorMonitor::ConstructL++"));
#ifdef _S60_3x_ACCELEROMETER_
// Noise filter for the accelerometer;
iAccSensorDataX = 0;
iAccSensorDataY = 0;
iAccSensorDataZ = 0;
#ifdef SENSOR_API_LOAD_DYNAMICALLY
_LIT( KSensorApiDll, "RRSensorApi" );
TUidType dllUid( KDynamicLibraryUid );
TInt error = iSensorApi.Load( KSensorApiDll, dllUid );
User::LeaveIfError(error);
#endif
iSensorDataFilterX = CIESensorDataFilter::NewL();
iSensorDataFilterY = CIESensorDataFilter::NewL();
iSensorDataFilterZ = CIESensorDataFilter::NewL();
#ifdef SENSOR_API_LOAD_DYNAMICALLY
// If Sensor API library is dynamically linked
typedef void ( *TFindSensorsLFunction )( RArray<TRRSensorInfo>& );
TFindSensorsLFunction findSensorsLFunction = ( TFindSensorsLFunction )iSensorApi.Lookup( 1 );
findSensorsLFunction( iSensorList );
#else
TRAPD( error , CRRSensorApi::FindSensorsL(iSensorList));
if (error)
{
// Error found in sensors
}
#endif
TInt sensorCount = iSensorList.Count();
for (TInt i = 0; i < sensorCount; i++ )
{
if (iSensorList[i].iSensorId == KAccelerometerSensorUID)
{
iAccelerometerSensorIndex = i;
break;
}
}
#endif _S60_3x_ACCELEROMETER_
#ifdef _S60_5x_ACCELEROMETER_
DP0_IMAGIC(_L("CIESensorMonitor::ConstructL - create CSensrvChannelFinder"));
iSensrvChannelFinder = CSensrvChannelFinder::NewL();
DP1_IMAGIC(_L("CIESensorMonitor::ConstructL - CSensrvChannelFinder created: %d"),iSensrvChannelFinder);
iChannelInfoList.Reset();
TSensrvChannelInfo mySearchConditions; // none, so matches all.
DP0_IMAGIC(_L("CIESensorMonitor::ConstructL - iSensrvChannelFinder->FindChannelsL"));
TRAPD(err, iSensrvChannelFinder->FindChannelsL(iChannelInfoList, mySearchConditions));
if(err != KErrNone)
{
DP1_IMAGIC(_L("CIESensorMonitor::ConstructL - iSensrvChannelFinder->FindChannelsL ERROR: %d"), err);
User::Leave(err);
}
DP0_IMAGIC(_L("CIESensorMonitor::ConstructL - iSensrvChannelFinder->FindChannelsL - OK"));
TInt senIndex(0); // Sensor Selection
TBuf<256> text;
text.Append(_L(" ----------------------------FOUND SENSOR=" ));
text.AppendNum(iChannelInfoList.Count());
DP0_IMAGIC(text);
if(senIndex >= 0 && senIndex < iChannelInfoList.Count())
{
DP0_IMAGIC(_L("CIESensorMonitor::ConstructL++"));
iSensrvSensorChannel = CSensrvChannel::NewL( iChannelInfoList[senIndex] );
iSensrvSensorChannel->OpenChannelL();
}
#endif //_S60_5x_ACCELEROMETER_
DP0_IMAGIC(_L("CIESensorMonitor::ConstructL++"));
}
CIESensorMonitor::CIESensorMonitor(MIESensorMonitorObserver& aSensorObserver)
:iSensorObserver(aSensorObserver)
{
}
CIESensorMonitor::~CIESensorMonitor()
{
DP0_IMAGIC(_L("CIESensorMonitor::~CIESensorMonitor"));
StopMonitoring();
#ifdef _S60_3x_ACCELEROMETER_
#ifdef SENSOR_API_LOAD_DYNAMICALLY
// Close dynamically loaded library
iSensorApi.Close();
#endif //SENSOR_API_LOAD_DYNAMICALLY
delete iAccelerometerSensor;
iAccelerometerSensor = NULL;
#endif
#ifdef _S60_5x_ACCELEROMETER_
if(iSensrvSensorChannel)
iSensrvSensorChannel->CloseChannel();
delete iSensrvSensorChannel;
iChannelInfoList.Reset();
delete iSensrvChannelFinder;
#endif
}
void CIESensorMonitor::StartMonitoring()
{
DP0_IMAGIC(_L("CIESensorMonitor::StartMonitoring+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"));
#ifdef _S60_3x_ACCELEROMETER_
#ifdef SENSOR_API_LOAD_DYNAMICALLY
// If Sensor API library is dynamically linked
typedef CRRSensorApi* ( *TNewLFunction )( TRRSensorInfo );
TNewLFunction newLFunction = ( TNewLFunction )iSensorApi.Lookup( 2 );
iAccelerometerSensor = newLFunction( iSensorList[iAccelerometerSensorIndex] );
#else
iAccelerometerSensor = CRRSensorApi::NewL(iSensorList[iAccelerometerSensorIndex]);
#endif
if (iAccelerometerSensor)
iAccelerometerSensor->AddDataListener(this);
#endif
#ifdef _S60_5x_ACCELEROMETER_
if(iSensrvSensorChannel)
iSensrvSensorChannel->StartDataListeningL( this, 1,1,iUpdateInterval);
#endif
}
void CIESensorMonitor::StopMonitoring()
{
DP0_IMAGIC(_L("CSensorMonitor::StopMonitoring++"));
#ifdef _S60_3x_ACCELEROMETER_
if(iAccelerometerSensor)
iAccelerometerSensor->RemoveDataListener();
#endif
#ifdef _S60_5x_ACCELEROMETER_
if(iSensrvSensorChannel)
iSensrvSensorChannel->StopDataListening();
#endif
}
#ifdef _S60_3x_ACCELEROMETER_
void CIESensorMonitor::HandleDataEventL(TRRSensorInfo aSensor, TRRSensorEvent aEvent)
{
TImagicDeviceOrientation deviceOrientation;
// Axis Data
switch (aSensor.iSensorId)
{
case KAccelerometerSensorUID:
{
iAccSensorDataX = iSensorDataFilterX->FilterSensorData(aEvent.iSensorData1); // X
iAccSensorDataY = iSensorDataFilterY->FilterSensorData(aEvent.iSensorData2); // Y
iAccSensorDataZ = iSensorDataFilterZ->FilterSensorData(aEvent.iSensorData3); // Z
TInt x = Abs(iAccSensorDataX);
TInt y = Abs(iAccSensorDataY);
TInt z = Abs(iAccSensorDataZ);
// Calculate the orientation of the screen
if (x>z && x>z) // Landscape
{
if (iAccSensorDataX > 0)
deviceOrientation = EOrientationDisplayRigthUp;
else
deviceOrientation = EOrientationDisplayLeftUp;
}
if (y>x && y>z) // Portrait Mode
{
if (iAccSensorDataY > 0)
deviceOrientation = EOrientationDisplayUp;
else
deviceOrientation = EOrientationDisplayDown;
}
//if (z>x && z>y)
// {
// if (iAccSensorDataZ)
//Not used deviceOrientation = EOrientationDisplayDownwards;
// else
//Not used deviceOrientation = EOrientationDisplayUpwards;
// }
iSensorObserver.SensorDataAvailable(deviceOrientation, EFalse);
}
break;
default:
break;
}
}
#endif
#ifdef _S60_5x_ACCELEROMETER_
_LIT( KTimeString, "%-B%:0%J%:1%T%:2%S%.%*C4%:3%+B" );
void CIESensorMonitor::DataReceived( CSensrvChannel& aChannel, TInt aCount, TInt aDataLost )
{
DP0_IMAGIC(_L("CSensorMonitor::DataReceived"));
TBuf<250> progressBuf;
TInt errErr(KErrNone);
//iDataLostCount = iDataLostCount + aDataLost;
//iDataCount = iDataCount + aCount;
if( aChannel.GetChannelInfo().iChannelType == KSensrvChannelTypeIdOrientationData )
{
TSensrvOrientationData data;
//TRAP(errErr,
for( TInt i = 0; i < aCount; i++ )
{
TPckgBuf<TSensrvOrientationData> dataBuf;
aChannel.GetData( dataBuf );
data = dataBuf();
data.iTimeStamp.FormatL(progressBuf, KTimeString );
}
if(errErr != KErrNone)
{
progressBuf.Zero();
}
switch ( data.iDeviceOrientation )
{
case EOrientationDisplayUp:
{
progressBuf.Append( _L( "Display up" ) );
DP1_IMAGIC( _L( "Display up: %d" ),data.iDeviceOrientation );
break;
}
case EOrientationDisplayDown:
{
progressBuf.Append( _L( "Display down" ) );
DP1_IMAGIC( _L( "Display down: %d" ),data.iDeviceOrientation );
break;
}
case EOrientationDisplayLeftUp:
{
progressBuf.Append( _L( "Display left up" ) );
DP1_IMAGIC( _L( "Display left up: %d" ),data.iDeviceOrientation );
break;
}
case EOrientationDisplayRigthUp:
{
progressBuf.Append( _L( "Display right up" ) );
DP1_IMAGIC( _L( "Display right up: %d" ),data.iDeviceOrientation );
break;
}
default:
{
progressBuf.Append( _L( "Unknown orientation" ) );
DP1_IMAGIC( _L( "Unknown orientation: %d" ),data.iDeviceOrientation );
break;
}
}
iSensorObserver.SensorDataAvailable(TImagicDeviceOrientation(data.iDeviceOrientation), EFalse);
}
else
{
progressBuf.Copy(_L("Channel = " ));
progressBuf.AppendNum(aChannel.GetChannelInfo().iChannelType,EHex);
}
DP0_IMAGIC(progressBuf);
}
void CIESensorMonitor::DataError( CSensrvChannel& /*aChannel*/, TSensrvErrorSeverity /*aError*/)
{
DP0_IMAGIC(_L("CIESensorMonitor::DataReceived"));
}
#endif //_S60_5x_ACCELEROMETER_
#endif //_ACCELEROMETER_SUPPORTED_
// End of File
| [
"none@none"
]
| [
[
[
1,
334
]
]
]
|
f8c85dd24ce1f1b421cab9b32b7d65f5fd839c5e | 75e14152e74cb27f8391b797aaa774f22a68de1a | /spoj/6219 edist/main.cpp | 6a55ed2769d362ec4cc1c79ca149108117f82c5f | []
| no_license | HerrSchakal/bai-projects | 69170845ee2c0832728420f5071cf1ef6ad785f1 | 10ac5dec550fb0a66b990d5d7c7bf2242c7020eb | refs/heads/master | 2021-01-10T17:49:48.363707 | 2010-08-23T03:15:49 | 2010-08-23T03:15:49 | 36,030,230 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,132 | cpp | #include <iostream>
#include <string>
using namespace std;
// Edit distance between two character arrays using insertion,
// deletion, and substitution. Ignores case.
int editdist(string a, string b){
// Use a dynamic programming algorithm.
int dp[a.size()+1][b.size()+1];
// Fill up first row and column
for(int i=0; i<=a.size(); i++) dp[i][0] = i;
for(int i=0; i<=b.size(); i++) dp[0][i] = i;
// Fill up dp array
for(int i=1; i<=a.size(); i++)
for(int j=1; j<=b.size(); j++){
bool same = a[i-1] == b[j-1];
// Substitution
int su = dp[i-1][j-1];
if(!same) su++;
// Insertion and deletion
int in = dp[i-1][j]+1;
int de = dp[i][j-1]+1;
// Least of the three
int ce = su;
if(in < ce) ce = in;
if(de < ce) ce = de;
// Write to array
dp[i][j] = ce;
}
return dp[a.size()][b.size()];
}
int main(){
int cases;
cin >> cases;
for(int i=0; i<cases; i++){
string a;
string b;
cin >> a;
cin >> b;
cout << editdist(a,b) << endl;
}
return 0;
}
| [
"bai.li.2005@cb48527c-d972-11de-a65c-977ad3277207"
]
| [
[
[
1,
56
]
]
]
|
a88913a220f4f8211daa8d2f4f2009144fa62f41 | 58496be10ead81e2531e995f7d66017ffdfc6897 | /Sources/System/Nix/ThreadImpl.cpp | b1c7cf710c16dc7c8669ba9cb452034123357687 | []
| no_license | Diego160289/cross-fw | ba36fc6c3e3402b2fff940342315596e0365d9dd | 532286667b0fd05c9b7f990945f42279bac74543 | refs/heads/master | 2021-01-10T19:23:43.622578 | 2011-01-09T14:54:12 | 2011-01-09T14:54:12 | 38,457,864 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 831 | cpp | //============================================================================
// Date : 22.12.2010
// Author : Tkachenko Dmitry
// Copyright : (c) Tkachenko Dmitry ([email protected])
//============================================================================
#include "ThreadImpl.h"
namespace System
{
Thread::ThreadImpl::ThreadImpl(Common::ICallback *callback)
: ThreadHandle(0)
{
if (pthread_create(&ThreadHandle, 0, &ThreadImpl::ThreadProc, callback))
throw ThreadException("Can't create thread");
}
Thread::ThreadImpl::~ThreadImpl()
{
pthread_join(ThreadHandle, 0);
pthread_detach(ThreadHandle);
}
void* Thread::ThreadImpl::ThreadProc(void *prm)
{
reinterpret_cast<Common::ICallback *>(prm)->Do();
return 0;
}
}
| [
"TkachenkoDmitryV@d548627a-540d-11de-936b-e9512c4d2277"
]
| [
[
[
1,
32
]
]
]
|
f25b29108747409f95f6bd9bf8bdc9629f165d67 | a7a890e753c6f69e8067d16a8cd94ce8327f80b7 | /tclient/BaseApplication.h | afa2efc5b1fc97568ce74e86ee30024aef067ce6 | []
| no_license | jbreslin33/breslinservergame | 684ca8b97f36e265f30ae65e1a65435b2e7a3d8b | 292285f002661c3d9483fb080845564145d47999 | refs/heads/master | 2021-01-21T13:11:50.223394 | 2011-03-14T11:33:30 | 2011-03-14T11:33:30 | 37,391,245 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,529 | h | /*
-----------------------------------------------------------------------------
Filename: BaseApplication.h
-----------------------------------------------------------------------------
This source file is generated by the
___ _ __ __ _ _
/___\__ _ _ __ ___ /_\ _ __ _ __/ / /\ \ (_)______ _ _ __ __| |
// // _` | '__/ _ \ //_\\| '_ \| '_ \ \/ \/ / |_ / _` | '__/ _` |
/ \_// (_| | | | __/ / _ \ |_) | |_) \ /\ /| |/ / (_| | | | (_| |
\___/ \__, |_| \___| \_/ \_/ .__/| .__/ \/ \/ |_/___\__,_|_| \__,_|
|___/ |_| |_|
Ogre 1.7.x Application Wizard for VC9 (August 2010)
http://code.google.com/p/ogreappwizards/
-----------------------------------------------------------------------------
*/
#ifndef __BaseApplication_h_
#define __BaseApplication_h_
#include <OgreCamera.h>
#include <OgreEntity.h>
#include <OgreLogManager.h>
#include <OgreRoot.h>
#include <OgreViewport.h>
#include <OgreSceneManager.h>
#include <OgreRenderWindow.h>
#include <OgreConfigFile.h>
#include <OISEvents.h>
#include <OISInputManager.h>
#include <OISKeyboard.h>
#include <OISMouse.h>
#include <SdkTrays.h>
#include <SdkCameraMan.h>
class BaseApplication : public Ogre::FrameListener, public Ogre::WindowEventListener, public OIS::KeyListener, public OIS::MouseListener, OgreBites::SdkTrayListener
{
public:
BaseApplication(void);
virtual ~BaseApplication(void);
virtual void go(void);
OIS::Keyboard* getKeyboard () { return mKeyboard; }
protected:
virtual bool setup();
virtual bool configure(void);
virtual void chooseSceneManager(void);
virtual void createCamera(void);
virtual void createFrameListener(void);
virtual void createScene(void) = 0; // Override me!
virtual void destroyScene(void);
virtual void createViewports(void);
virtual void setupResources(void);
virtual void createResourceListener(void);
virtual void loadResources(void);
// Ogre::FrameListener
virtual bool frameRenderingQueued(const Ogre::FrameEvent& evt);
// OIS::KeyListener
virtual bool keyPressed( const OIS::KeyEvent &arg );
virtual bool keyReleased( const OIS::KeyEvent &arg );
// OIS::MouseListener
virtual bool mouseMoved( const OIS::MouseEvent &arg );
virtual bool mousePressed( const OIS::MouseEvent &arg, OIS::MouseButtonID id );
virtual bool mouseReleased( const OIS::MouseEvent &arg, OIS::MouseButtonID id );
// Ogre::WindowEventListener
//Adjust mouse clipping area
virtual void windowResized(Ogre::RenderWindow* rw);
//Unattach OIS before window shutdown (very important under Linux)
virtual void windowClosed(Ogre::RenderWindow* rw);
Ogre::Root *mRoot;
Ogre::Camera* mCamera;
Ogre::SceneManager* mSceneMgr;
Ogre::RenderWindow* mWindow;
Ogre::String mResourcesCfg;
Ogre::String mPluginsCfg;
// OgreBites
OgreBites::SdkTrayManager* mTrayMgr;
OgreBites::SdkCameraMan* mCameraMan; // basic camera controller
OgreBites::ParamsPanel* mDetailsPanel; // sample details panel
bool mCursorWasVisible; // was cursor visible before dialog appeared
bool mShutDown;
//OIS Input devices
OIS::InputManager* mInputManager;
OIS::Mouse* mMouse;
OIS::Keyboard* mKeyboard;
};
#endif // #ifndef __BaseApplication_h_
| [
"jbreslin33@localhost"
]
| [
[
[
1,
96
]
]
]
|
b0ac3450dc919d53282be476348f703cc7010e6f | b7c505dcef43c0675fd89d428e45f3c2850b124f | /Src/SimulatorQt/Util/qt/Win32/include/Qt/qstring.h | a7623c497ce4257ee7b8b4673593343284288471 | [
"BSD-2-Clause"
]
| permissive | pranet/bhuman2009fork | 14e473bd6e5d30af9f1745311d689723bfc5cfdb | 82c1bd4485ae24043aa720a3aa7cb3e605b1a329 | refs/heads/master | 2021-01-15T17:55:37.058289 | 2010-02-28T13:52:56 | 2010-02-28T13:52:56 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 59,931 | h | /****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information ([email protected])
**
** This file is part of the QtCore module 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.0, 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 are unsure which license is appropriate for your use, please
** contact the sales department at [email protected].
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QSTRING_H
#define QSTRING_H
#include <QtCore/qchar.h>
#include <QtCore/qbytearray.h>
#include <QtCore/qatomic.h>
#include <QtCore/qnamespace.h>
#ifdef QT_INCLUDE_COMPAT
#include <Qt3Support/q3cstring.h>
#endif
#ifndef QT_NO_STL
# if defined (Q_CC_MSVC_NET) && _MSC_VER < 1310 // Avoids nasty warning for xlocale, line 450
# pragma warning (push)
# pragma warning (disable : 4189)
# include <string>
# pragma warning (pop)
# else
# include <string>
# endif
# ifndef QT_NO_STL_WCHAR
// workaround for some headers not typedef'ing std::wstring
typedef std::basic_string<wchar_t> QStdWString;
# endif // QT_NO_STL_WCHAR
#endif // QT_NO_STL
#include <stdarg.h>
#ifdef truncate
#error qstring.h must be included before any header file that defines truncate
#endif
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Core)
class QCharRef;
class QRegExp;
class QStringList;
class QTextCodec;
class QLatin1String;
class QStringRef;
template <typename T> class QVector;
class Q_CORE_EXPORT QString
{
public:
inline QString();
QString(const QChar *unicode, int size);
QString(QChar c);
QString(int size, QChar c);
inline QString(const QLatin1String &latin1);
inline QString(const QString &);
inline ~QString();
QString &operator=(QChar c);
QString &operator=(const QString &);
inline QString &operator=(const QLatin1String &);
inline int size() const { return d->size; }
inline int count() const { return d->size; }
inline int length() const;
inline bool isEmpty() const;
void resize(int size);
QString &fill(QChar c, int size = -1);
void truncate(int pos);
void chop(int n);
int capacity() const;
inline void reserve(int size);
inline void squeeze() { if (d->size < d->alloc) realloc(); d->capacity = 0;}
inline const QChar *unicode() const;
inline QChar *data();
inline const QChar *data() const;
inline const QChar *constData() const;
inline void detach();
inline bool isDetached() const;
void clear();
inline const QChar at(int i) const;
const QChar operator[](int i) const;
QCharRef operator[](int i);
const QChar operator[](uint i) const;
QCharRef operator[](uint i);
QString arg(qlonglong a, int fieldwidth=0, int base=10,
const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;
QString arg(qulonglong a, int fieldwidth=0, int base=10,
const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;
QString arg(long a, int fieldwidth=0, int base=10,
const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;
QString arg(ulong a, int fieldwidth=0, int base=10,
const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;
QString arg(int a, int fieldWidth = 0, int base = 10,
const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;
QString arg(uint a, int fieldWidth = 0, int base = 10,
const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;
QString arg(short a, int fieldWidth = 0, int base = 10,
const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;
QString arg(ushort a, int fieldWidth = 0, int base = 10,
const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;
QString arg(double a, int fieldWidth = 0, char fmt = 'g', int prec = -1,
const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;
QString arg(char a, int fieldWidth = 0,
const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;
QString arg(QChar a, int fieldWidth = 0,
const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;
QString arg(const QString &a, int fieldWidth = 0,
const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;
QString arg(const QString &a1, const QString &a2) const Q_REQUIRED_RESULT;
QString arg(const QString &a1, const QString &a2, const QString &a3) const Q_REQUIRED_RESULT;
QString arg(const QString &a1, const QString &a2, const QString &a3,
const QString &a4) const Q_REQUIRED_RESULT;
QString arg(const QString &a1, const QString &a2, const QString &a3,
const QString &a4, const QString &a5) const Q_REQUIRED_RESULT;
QString arg(const QString &a1, const QString &a2, const QString &a3,
const QString &a4, const QString &a5, const QString &a6) const Q_REQUIRED_RESULT;
QString arg(const QString &a1, const QString &a2, const QString &a3,
const QString &a4, const QString &a5, const QString &a6,
const QString &a7) const Q_REQUIRED_RESULT;
QString arg(const QString &a1, const QString &a2, const QString &a3,
const QString &a4, const QString &a5, const QString &a6,
const QString &a7, const QString &a8) const Q_REQUIRED_RESULT;
QString arg(const QString &a1, const QString &a2, const QString &a3,
const QString &a4, const QString &a5, const QString &a6,
const QString &a7, const QString &a8, const QString &a9) const Q_REQUIRED_RESULT;
QString &vsprintf(const char *format, va_list ap)
#if defined(Q_CC_GNU) && !defined(__INSURE__)
__attribute__ ((format (printf, 2, 0)))
#endif
;
QString &sprintf(const char *format, ...)
#if defined(Q_CC_GNU) && !defined(__INSURE__)
__attribute__ ((format (printf, 2, 3)))
#endif
;
int indexOf(QChar c, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
int indexOf(const QString &s, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
int indexOf(const QLatin1String &s, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
int lastIndexOf(QChar c, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
int lastIndexOf(const QString &s, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
int lastIndexOf(const QLatin1String &s, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
inline QBool contains(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
inline QBool contains(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
int count(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
int count(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
#ifndef QT_NO_REGEXP
int indexOf(const QRegExp &, int from = 0) const;
int lastIndexOf(const QRegExp &, int from = -1) const;
inline QBool contains(const QRegExp &rx) const { return QBool(indexOf(rx) != -1); }
int count(const QRegExp &) const;
int indexOf(QRegExp &, int from = 0) const;
int lastIndexOf(QRegExp &, int from = -1) const;
inline QBool contains(QRegExp &rx) const { return QBool(indexOf(rx) != -1); }
#endif
enum SectionFlag {
SectionDefault = 0x00,
SectionSkipEmpty = 0x01,
SectionIncludeLeadingSep = 0x02,
SectionIncludeTrailingSep = 0x04,
SectionCaseInsensitiveSeps = 0x08
};
Q_DECLARE_FLAGS(SectionFlags, SectionFlag)
QString section(QChar sep, int start, int end = -1, SectionFlags flags = SectionDefault) const;
QString section(const QString &in_sep, int start, int end = -1, SectionFlags flags = SectionDefault) const;
#ifndef QT_NO_REGEXP
QString section(const QRegExp ®, int start, int end = -1, SectionFlags flags = SectionDefault) const;
#endif
QString left(int n) const Q_REQUIRED_RESULT;
QString right(int n) const Q_REQUIRED_RESULT;
QString mid(int position, int n = -1) const Q_REQUIRED_RESULT;
QStringRef leftRef(int n) const Q_REQUIRED_RESULT;
QStringRef rightRef(int n) const Q_REQUIRED_RESULT;
QStringRef midRef(int position, int n = -1) const Q_REQUIRED_RESULT;
bool startsWith(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
bool startsWith(const QLatin1String &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
bool startsWith(const QChar &c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
bool endsWith(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
bool endsWith(const QLatin1String &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
bool endsWith(const QChar &c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
QString leftJustified(int width, QChar fill = QLatin1Char(' '), bool trunc = false) const Q_REQUIRED_RESULT;
QString rightJustified(int width, QChar fill = QLatin1Char(' '), bool trunc = false) const Q_REQUIRED_RESULT;
QString toLower() const Q_REQUIRED_RESULT;
QString toUpper() const Q_REQUIRED_RESULT;
QString toCaseFolded() const Q_REQUIRED_RESULT;
QString trimmed() const Q_REQUIRED_RESULT;
QString simplified() const Q_REQUIRED_RESULT;
QString &insert(int i, QChar c);
QString &insert(int i, const QChar *uc, int len);
inline QString &insert(int i, const QString &s) { return insert(i, s.constData(), s.length()); }
QString &insert(int i, const QLatin1String &s);
QString &append(QChar c);
QString &append(const QString &s);
QString &append(const QStringRef &s);
QString &append(const QLatin1String &s);
inline QString &prepend(QChar c) { return insert(0, c); }
inline QString &prepend(const QString &s) { return insert(0, s); }
inline QString &prepend(const QLatin1String &s) { return insert(0, s); }
inline QString &operator+=(QChar c) {
if (d->ref != 1 || d->size + 1 > d->alloc)
realloc(grow(d->size + 1));
d->data[d->size++] = c.unicode();
d->data[d->size] = '\0';
return *this;
}
inline QString &operator+=(QChar::SpecialCharacter c) { return append(QChar(c)); }
inline QString &operator+=(const QString &s) { return append(s); }
inline QString &operator+=(const QStringRef &s) { return append(s); }
inline QString &operator+=(const QLatin1String &s) { return append(s); }
QString &remove(int i, int len);
QString &remove(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive);
QString &remove(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive);
QString &replace(int i, int len, QChar after);
QString &replace(int i, int len, const QChar *s, int slen);
QString &replace(int i, int len, const QString &after);
QString &replace(QChar before, QChar after, Qt::CaseSensitivity cs = Qt::CaseSensitive);
QString &replace(const QChar *before, int blen, const QChar *after, int alen, Qt::CaseSensitivity cs = Qt::CaseSensitive);
QString &replace(const QLatin1String &before, const QLatin1String &after, Qt::CaseSensitivity cs = Qt::CaseSensitive);
QString &replace(const QLatin1String &before, const QString &after, Qt::CaseSensitivity cs = Qt::CaseSensitive);
QString &replace(const QString &before, const QLatin1String &after, Qt::CaseSensitivity cs = Qt::CaseSensitive);
QString &replace(const QString &before, const QString &after,
Qt::CaseSensitivity cs = Qt::CaseSensitive);
QString &replace(QChar c, const QString &after, Qt::CaseSensitivity cs = Qt::CaseSensitive);
QString &replace(QChar c, const QLatin1String &after, Qt::CaseSensitivity cs = Qt::CaseSensitive);
#ifndef QT_NO_REGEXP
QString &replace(const QRegExp &rx, const QString &after);
inline QString &remove(const QRegExp &rx)
{ return replace(rx, QString()); }
#endif
enum SplitBehavior { KeepEmptyParts, SkipEmptyParts };
QStringList split(const QString &sep, SplitBehavior behavior = KeepEmptyParts,
Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_REQUIRED_RESULT;
QStringList split(const QChar &sep, SplitBehavior behavior = KeepEmptyParts,
Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_REQUIRED_RESULT;
#ifndef QT_NO_REGEXP
QStringList split(const QRegExp &sep, SplitBehavior behavior = KeepEmptyParts) const Q_REQUIRED_RESULT;
#endif
enum NormalizationForm {
NormalizationForm_D,
NormalizationForm_C,
NormalizationForm_KD,
NormalizationForm_KC
};
QString normalized(NormalizationForm mode) const Q_REQUIRED_RESULT;
QString normalized(NormalizationForm mode, QChar::UnicodeVersion version) const Q_REQUIRED_RESULT;
QString repeated(int times) const;
const ushort *utf16() const;
QByteArray toAscii() const Q_REQUIRED_RESULT;
QByteArray toLatin1() const Q_REQUIRED_RESULT;
QByteArray toUtf8() const Q_REQUIRED_RESULT;
QByteArray toLocal8Bit() const Q_REQUIRED_RESULT;
QVector<uint> toUcs4() const Q_REQUIRED_RESULT;
static QString fromAscii(const char *, int size = -1);
static QString fromLatin1(const char *, int size = -1);
static QString fromUtf8(const char *, int size = -1);
static QString fromLocal8Bit(const char *, int size = -1);
static QString fromUtf16(const ushort *, int size = -1);
static QString fromUcs4(const uint *, int size = -1);
static QString fromRawData(const QChar *, int size);
int toWCharArray(wchar_t *array) const;
static QString fromWCharArray(const wchar_t *, int size = -1);
QString &setUnicode(const QChar *unicode, int size);
inline QString &setUtf16(const ushort *utf16, int size);
// ### Qt 5: merge these two functions
int compare(const QString &s) const;
int compare(const QString &s, Qt::CaseSensitivity cs) const;
int compare(const QLatin1String &other, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
// ### Qt 5: merge these two functions
static inline int compare(const QString &s1, const QString &s2)
{ return s1.compare(s2); }
static inline int compare(const QString &s1, const QString &s2, Qt::CaseSensitivity cs)
{ return s1.compare(s2, cs); }
static inline int compare(const QString& s1, const QLatin1String &s2,
Qt::CaseSensitivity cs = Qt::CaseSensitive)
{ return s1.compare(s2, cs); }
static inline int compare(const QLatin1String& s1, const QString &s2,
Qt::CaseSensitivity cs = Qt::CaseSensitive)
{ return -s2.compare(s1, cs); }
int compare(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
static int compare(const QString &s1, const QStringRef &s2,
Qt::CaseSensitivity = Qt::CaseSensitive);
int localeAwareCompare(const QString& s) const;
static int localeAwareCompare(const QString& s1, const QString& s2)
{ return s1.localeAwareCompare(s2); }
int localeAwareCompare(const QStringRef &s) const;
static int localeAwareCompare(const QString& s1, const QStringRef& s2);
short toShort(bool *ok=0, int base=10) const;
ushort toUShort(bool *ok=0, int base=10) const;
int toInt(bool *ok=0, int base=10) const;
uint toUInt(bool *ok=0, int base=10) const;
long toLong(bool *ok=0, int base=10) const;
ulong toULong(bool *ok=0, int base=10) const;
qlonglong toLongLong(bool *ok=0, int base=10) const;
qulonglong toULongLong(bool *ok=0, int base=10) const;
float toFloat(bool *ok=0) const;
double toDouble(bool *ok=0) const;
QString &setNum(short, int base=10);
QString &setNum(ushort, int base=10);
QString &setNum(int, int base=10);
QString &setNum(uint, int base=10);
QString &setNum(long, int base=10);
QString &setNum(ulong, int base=10);
QString &setNum(qlonglong, int base=10);
QString &setNum(qulonglong, int base=10);
QString &setNum(float, char f='g', int prec=6);
QString &setNum(double, char f='g', int prec=6);
static QString number(int, int base=10);
static QString number(uint, int base=10);
static QString number(long, int base=10);
static QString number(ulong, int base=10);
static QString number(qlonglong, int base=10);
static QString number(qulonglong, int base=10);
static QString number(double, char f='g', int prec=6);
bool operator==(const QString &s) const;
bool operator<(const QString &s) const;
inline bool operator>(const QString &s) const { return s < *this; }
inline bool operator!=(const QString &s) const { return !operator==(s); }
inline bool operator<=(const QString &s) const { return !operator>(s); }
inline bool operator>=(const QString &s) const { return !operator<(s); }
bool operator==(const QLatin1String &s) const;
bool operator<(const QLatin1String &s) const;
bool operator>(const QLatin1String &s) const;
inline bool operator!=(const QLatin1String &s) const { return !operator==(s); }
inline bool operator<=(const QLatin1String &s) const { return !operator>(s); }
inline bool operator>=(const QLatin1String &s) const { return !operator<(s); }
// ASCII compatibility
#ifndef QT_NO_CAST_FROM_ASCII
inline QT_ASCII_CAST_WARN_CONSTRUCTOR QString(const char *ch) : d(fromAscii_helper(ch))
{}
inline QT_ASCII_CAST_WARN_CONSTRUCTOR QString(const QByteArray &a)
: d(fromAscii_helper(a.constData(), qstrnlen(a.constData(), a.size())))
{}
inline QT_ASCII_CAST_WARN QString &operator=(const char *ch)
{ return (*this = fromAscii(ch)); }
inline QT_ASCII_CAST_WARN QString &operator=(const QByteArray &a)
{ return (*this = fromAscii(a.constData(), qstrnlen(a.constData(), a.size()))); }
inline QT_ASCII_CAST_WARN QString &operator=(char c)
{ return (*this = QChar::fromAscii(c)); }
// these are needed, so it compiles with STL support enabled
inline QT_ASCII_CAST_WARN QString &prepend(const char *s)
{ return prepend(QString::fromAscii(s)); }
inline QT_ASCII_CAST_WARN QString &prepend(const QByteArray &s)
{ return prepend(QString::fromAscii(s.constData(), qstrnlen(s.constData(), s.size()))); }
inline QT_ASCII_CAST_WARN QString &append(const char *s)
{ return append(QString::fromAscii(s)); }
inline QT_ASCII_CAST_WARN QString &append(const QByteArray &s)
{ return append(QString::fromAscii(s.constData(), qstrnlen(s.constData(), s.size()))); }
inline QT_ASCII_CAST_WARN QString &operator+=(const char *s)
{ return append(QString::fromAscii(s)); }
inline QT_ASCII_CAST_WARN QString &operator+=(const QByteArray &s)
{ return append(QString::fromAscii(s.constData(), qstrnlen(s.constData(), s.size()))); }
inline QT_ASCII_CAST_WARN QString &operator+=(char c)
{ return append(QChar::fromAscii(c)); }
inline QT_ASCII_CAST_WARN bool operator==(const char *s) const;
inline QT_ASCII_CAST_WARN bool operator!=(const char *s) const;
inline QT_ASCII_CAST_WARN bool operator<(const char *s) const;
inline QT_ASCII_CAST_WARN bool operator<=(const char *s2) const;
inline QT_ASCII_CAST_WARN bool operator>(const char *s2) const;
inline QT_ASCII_CAST_WARN bool operator>=(const char *s2) const;
inline QT_ASCII_CAST_WARN bool operator==(const QByteArray &s) const;
inline QT_ASCII_CAST_WARN bool operator!=(const QByteArray &s) const;
inline QT_ASCII_CAST_WARN bool operator<(const QByteArray &s) const
{ return *this < QString::fromAscii(s.constData(), s.size()); }
inline QT_ASCII_CAST_WARN bool operator>(const QByteArray &s) const
{ return *this > QString::fromAscii(s.constData(), s.size()); }
inline QT_ASCII_CAST_WARN bool operator<=(const QByteArray &s) const
{ return *this <= QString::fromAscii(s.constData(), s.size()); }
inline QT_ASCII_CAST_WARN bool operator>=(const QByteArray &s) const
{ return *this >= QString::fromAscii(s.constData(), s.size()); }
#endif
typedef QChar *iterator;
typedef const QChar *const_iterator;
typedef iterator Iterator;
typedef const_iterator ConstIterator;
iterator begin();
const_iterator begin() const;
const_iterator constBegin() const;
iterator end();
const_iterator end() const;
const_iterator constEnd() const;
// STL compatibility
inline void push_back(QChar c) { append(c); }
inline void push_back(const QString &s) { append(s); }
inline void push_front(QChar c) { prepend(c); }
inline void push_front(const QString &s) { prepend(s); }
#ifndef QT_NO_STL
static inline QString fromStdString(const std::string &s);
inline std::string toStdString() const;
# ifdef qdoc
static inline QString fromStdWString(const std::wstring &s);
inline std::wstring toStdWString() const;
# else
# ifndef QT_NO_STL_WCHAR
static inline QString fromStdWString(const QStdWString &s);
inline QStdWString toStdWString() const;
# endif // QT_NO_STL_WCHAR
# endif // qdoc
#endif
// compatibility
struct Null { };
static const Null null;
inline QString(const Null &): d(&shared_null) { d->ref.ref(); }
inline QString &operator=(const Null &) { *this = QString(); return *this; }
inline bool isNull() const { return d == &shared_null; }
#ifdef QT3_SUPPORT
inline QT3_SUPPORT const char *ascii() const { return ascii_helper(); }
inline QT3_SUPPORT const char *latin1() const { return latin1_helper(); }
inline QT3_SUPPORT QByteArray utf8() const { return toUtf8(); }
inline QT3_SUPPORT QByteArray local8Bit() const{ return toLocal8Bit(); }
inline QT3_SUPPORT void setLength(int nl) { resize(nl); }
inline QT3_SUPPORT QString copy() const { return *this; }
inline QT3_SUPPORT QString &remove(QChar c, bool cs)
{ return remove(c, cs?Qt::CaseSensitive:Qt::CaseInsensitive); }
inline QT3_SUPPORT QString &remove(const QString &s, bool cs)
{ return remove(s, cs?Qt::CaseSensitive:Qt::CaseInsensitive); }
inline QT3_SUPPORT QString &replace(QChar c, const QString &after, bool cs)
{ return replace(c, after, cs?Qt::CaseSensitive:Qt::CaseInsensitive); }
inline QT3_SUPPORT QString &replace(const QString &before, const QString &after, bool cs)
{ return replace(before, after, cs?Qt::CaseSensitive:Qt::CaseInsensitive); }
#ifndef QT_NO_CAST_FROM_ASCII
inline QT3_SUPPORT QString &replace(char c, const QString &after, bool cs)
{ return replace(QChar::fromAscii(c), after, cs ? Qt::CaseSensitive : Qt::CaseInsensitive); }
// strange overload, required to avoid GCC 3.3 error
inline QT3_SUPPORT QString &replace(char c, const QString &after, Qt::CaseSensitivity cs)
{ return replace(QChar::fromAscii(c), after, cs ? Qt::CaseSensitive : Qt::CaseInsensitive); }
#endif
inline QT3_SUPPORT int find(QChar c, int i = 0, bool cs = true) const
{ return indexOf(c, i, cs?Qt::CaseSensitive:Qt::CaseInsensitive); }
inline QT3_SUPPORT int find(const QString &s, int i = 0, bool cs = true) const
{ return indexOf(s, i, cs?Qt::CaseSensitive:Qt::CaseInsensitive); }
inline QT3_SUPPORT int findRev(QChar c, int i = -1, bool cs = true) const
{ return lastIndexOf(c, i, cs?Qt::CaseSensitive:Qt::CaseInsensitive); }
inline QT3_SUPPORT int findRev(const QString &s, int i = -1, bool cs = true) const
{ return lastIndexOf(s, i, cs?Qt::CaseSensitive:Qt::CaseInsensitive); }
#ifndef QT_NO_REGEXP
inline QT3_SUPPORT int find(const QRegExp &rx, int i=0) const
{ return indexOf(rx, i); }
inline QT3_SUPPORT int findRev(const QRegExp &rx, int i=-1) const
{ return lastIndexOf(rx, i); }
inline QT3_SUPPORT int find(QRegExp &rx, int i=0) const
{ return indexOf(rx, i); }
inline QT3_SUPPORT int findRev(QRegExp &rx, int i=-1) const
{ return lastIndexOf(rx, i); }
#endif
inline QT3_SUPPORT QBool contains(QChar c, bool cs) const
{ return contains(c, cs?Qt::CaseSensitive:Qt::CaseInsensitive); }
inline QT3_SUPPORT QBool contains(const QString &s, bool cs) const
{ return contains(s, cs?Qt::CaseSensitive:Qt::CaseInsensitive); }
inline QT3_SUPPORT bool startsWith(const QString &s, bool cs) const
{ return startsWith(s, cs?Qt::CaseSensitive:Qt::CaseInsensitive); }
inline QT3_SUPPORT bool endsWith(const QString &s, bool cs) const
{ return endsWith(s, cs?Qt::CaseSensitive:Qt::CaseInsensitive); }
inline QT3_SUPPORT QChar constref(uint i) const
{ return at(i); }
QT3_SUPPORT QChar &ref(uint i);
inline QT3_SUPPORT QString leftJustify(int width, QChar aFill = QLatin1Char(' '), bool trunc=false) const
{ return leftJustified(width, aFill, trunc); }
inline QT3_SUPPORT QString rightJustify(int width, QChar aFill = QLatin1Char(' '), bool trunc=false) const
{ return rightJustified(width, aFill, trunc); }
inline QT3_SUPPORT QString lower() const { return toLower(); }
inline QT3_SUPPORT QString upper() const { return toUpper(); }
inline QT3_SUPPORT QString stripWhiteSpace() const { return trimmed(); }
inline QT3_SUPPORT QString simplifyWhiteSpace() const { return simplified(); }
inline QT3_SUPPORT QString &setUnicodeCodes(const ushort *unicode_as_ushorts, int aSize)
{ return setUtf16(unicode_as_ushorts, aSize); }
inline QT3_SUPPORT const ushort *ucs2() const { return utf16(); }
inline static QT3_SUPPORT QString fromUcs2(const ushort *unicode, int size = -1)
{ return fromUtf16(unicode, size); }
inline QT3_SUPPORT QString &setAscii(const char *str, int len = -1)
{ *this = fromAscii(str, len); return *this; }
inline QT3_SUPPORT QString &setLatin1(const char *str, int len = -1)
{ *this = fromLatin1(str, len); return *this; }
protected:
friend class QObject;
const char *ascii_helper() const;
const char *latin1_helper() const;
public:
#ifndef QT_NO_CAST_TO_ASCII
inline QT3_SUPPORT operator const char *() const { return ascii_helper(); }
private:
QT3_SUPPORT operator QNoImplicitBoolCast() const;
public:
#endif
#endif
bool isSimpleText() const { if (!d->clean) updateProperties(); return d->simpletext; }
bool isRightToLeft() const { if (!d->clean) updateProperties(); return d->righttoleft; }
private:
#if defined(QT_NO_CAST_FROM_ASCII) && !defined(Q_NO_DECLARED_NOT_DEFINED)
QString &operator+=(const char *s);
QString &operator+=(const QByteArray &s);
QString(const char *ch);
QString(const QByteArray &a);
QString &operator=(const char *ch);
QString &operator=(const QByteArray &a);
#endif
struct Data {
QBasicAtomicInt ref;
int alloc, size;
ushort *data;
ushort clean : 1;
ushort simpletext : 1;
ushort righttoleft : 1;
ushort asciiCache : 1;
ushort capacity : 1;
ushort reserved : 11;
ushort array[1];
};
static Data shared_null;
static Data shared_empty;
Data *d;
QString(Data *dd, int /*dummy*/) : d(dd) {}
#ifndef QT_NO_TEXTCODEC
static QTextCodec *codecForCStrings;
#endif
static int grow(int);
static void free(Data *);
void realloc();
void realloc(int alloc);
void expand(int i);
void updateProperties() const;
QString multiArg(int numArgs, const QString **args) const;
static int compare_helper(const QChar *data1, int length1,
const QChar *data2, int length2,
Qt::CaseSensitivity cs = Qt::CaseSensitive);
static int compare_helper(const QChar *data1, int length1,
QLatin1String s2,
Qt::CaseSensitivity cs = Qt::CaseSensitive);
static int localeAwareCompare_helper(const QChar *data1, int length1,
const QChar *data2, int length2);
static Data *fromLatin1_helper(const char *str, int size = -1);
static Data *fromAscii_helper(const char *str, int size = -1);
void replace_helper(uint *indices, int nIndices, int blen, const QChar *after, int alen);
friend class QCharRef;
friend class QTextCodec;
friend class QStringRef;
friend inline bool qStringComparisonHelper(const QString &s1, const char *s2);
friend inline bool qStringComparisonHelper(const QStringRef &s1, const char *s2);
public:
typedef Data * DataPtr;
inline DataPtr &data_ptr() { return d; }
};
class Q_CORE_EXPORT QLatin1String
{
public:
inline explicit QLatin1String(const char *s) : chars(s) {}
inline QLatin1String &operator=(const QLatin1String &other)
{ chars = other.chars; return *this; }
inline const char *latin1() const { return chars; }
inline bool operator==(const QString &s) const
{ return s == *this; }
inline bool operator!=(const QString &s) const
{ return s != *this; }
inline bool operator>(const QString &s) const
{ return s < *this; }
inline bool operator<(const QString &s) const
{ return s > *this; }
inline bool operator>=(const QString &s) const
{ return s <= *this; }
inline bool operator<=(const QString &s) const
{ return s >= *this; }
inline QT_ASCII_CAST_WARN bool operator==(const char *s) const
{ return QString::fromAscii(s) == *this; }
inline QT_ASCII_CAST_WARN bool operator!=(const char *s) const
{ return QString::fromAscii(s) != *this; }
inline QT_ASCII_CAST_WARN bool operator<(const char *s) const
{ return QString::fromAscii(s) > *this; }
inline QT_ASCII_CAST_WARN bool operator>(const char *s) const
{ return QString::fromAscii(s) < *this; }
inline QT_ASCII_CAST_WARN bool operator<=(const char *s) const
{ return QString::fromAscii(s) >= *this; }
inline QT_ASCII_CAST_WARN bool operator>=(const char *s) const
{ return QString::fromAscii(s) <= *this; }
private:
const char *chars;
};
inline QString::QString(const QLatin1String &aLatin1) : d(fromLatin1_helper(aLatin1.latin1()))
{ }
inline int QString::length() const
{ return d->size; }
inline const QChar QString::at(int i) const
{ Q_ASSERT(i >= 0 && i < size()); return d->data[i]; }
inline const QChar QString::operator[](int i) const
{ Q_ASSERT(i >= 0 && i < size()); return d->data[i]; }
inline const QChar QString::operator[](uint i) const
{ Q_ASSERT(i < uint(size())); return d->data[i]; }
inline bool QString::isEmpty() const
{ return d->size == 0; }
inline const QChar *QString::unicode() const
{ return reinterpret_cast<const QChar*>(d->data); }
inline const QChar *QString::data() const
{ return reinterpret_cast<const QChar*>(d->data); }
inline QChar *QString::data()
{ detach(); return reinterpret_cast<QChar*>(d->data); }
inline const QChar *QString::constData() const
{ return reinterpret_cast<const QChar*>(d->data); }
inline void QString::detach()
{ if (d->ref != 1 || d->data != d->array) realloc(); }
inline bool QString::isDetached() const
{ return d->ref == 1; }
inline QString &QString::operator=(const QLatin1String &s)
{
*this = fromLatin1(s.latin1());
return *this;
}
inline void QString::clear()
{ if (!isNull()) *this = QString(); }
inline QString::QString(const QString &other) : d(other.d)
{ Q_ASSERT(&other != this); d->ref.ref(); }
inline int QString::capacity() const
{ return d->alloc; }
inline QString &QString::setNum(short n, int base)
{ return setNum(qlonglong(n), base); }
inline QString &QString::setNum(ushort n, int base)
{ return setNum(qulonglong(n), base); }
inline QString &QString::setNum(int n, int base)
{ return setNum(qlonglong(n), base); }
inline QString &QString::setNum(uint n, int base)
{ return setNum(qulonglong(n), base); }
inline QString &QString::setNum(long n, int base)
{ return setNum(qlonglong(n), base); }
inline QString &QString::setNum(ulong n, int base)
{ return setNum(qulonglong(n), base); }
inline QString &QString::setNum(float n, char f, int prec)
{ return setNum(double(n),f,prec); }
inline QString QString::arg(int a, int fieldWidth, int base, const QChar &fillChar) const
{ return arg(qlonglong(a), fieldWidth, base, fillChar); }
inline QString QString::arg(uint a, int fieldWidth, int base, const QChar &fillChar) const
{ return arg(qulonglong(a), fieldWidth, base, fillChar); }
inline QString QString::arg(long a, int fieldWidth, int base, const QChar &fillChar) const
{ return arg(qlonglong(a), fieldWidth, base, fillChar); }
inline QString QString::arg(ulong a, int fieldWidth, int base, const QChar &fillChar) const
{ return arg(qulonglong(a), fieldWidth, base, fillChar); }
inline QString QString::arg(short a, int fieldWidth, int base, const QChar &fillChar) const
{ return arg(qlonglong(a), fieldWidth, base, fillChar); }
inline QString QString::arg(ushort a, int fieldWidth, int base, const QChar &fillChar) const
{ return arg(qulonglong(a), fieldWidth, base, fillChar); }
inline QString QString::arg(const QString &a1, const QString &a2) const
{ const QString *args[2] = { &a1, &a2 }; return multiArg(2, args); }
inline QString QString::arg(const QString &a1, const QString &a2, const QString &a3) const
{ const QString *args[3] = { &a1, &a2, &a3 }; return multiArg(3, args); }
inline QString QString::arg(const QString &a1, const QString &a2, const QString &a3,
const QString &a4) const
{ const QString *args[4] = { &a1, &a2, &a3, &a4 }; return multiArg(4, args); }
inline QString QString::arg(const QString &a1, const QString &a2, const QString &a3,
const QString &a4, const QString &a5) const
{ const QString *args[5] = { &a1, &a2, &a3, &a4, &a5 }; return multiArg(5, args); }
inline QString QString::arg(const QString &a1, const QString &a2, const QString &a3,
const QString &a4, const QString &a5, const QString &a6) const
{ const QString *args[6] = { &a1, &a2, &a3, &a4, &a5, &a6 }; return multiArg(6, args); }
inline QString QString::arg(const QString &a1, const QString &a2, const QString &a3,
const QString &a4, const QString &a5, const QString &a6,
const QString &a7) const
{ const QString *args[7] = { &a1, &a2, &a3, &a4, &a5, &a6, &a7 }; return multiArg(7, args); }
inline QString QString::arg(const QString &a1, const QString &a2, const QString &a3,
const QString &a4, const QString &a5, const QString &a6,
const QString &a7, const QString &a8) const
{ const QString *args[8] = { &a1, &a2, &a3, &a4, &a5, &a6, &a7, &a8 }; return multiArg(8, args); }
inline QString QString::arg(const QString &a1, const QString &a2, const QString &a3,
const QString &a4, const QString &a5, const QString &a6,
const QString &a7, const QString &a8, const QString &a9) const
{ const QString *args[9] = { &a1, &a2, &a3, &a4, &a5, &a6, &a7, &a8, &a9 }; return multiArg(9, args); }
inline QString QString::section(QChar asep, int astart, int aend, SectionFlags aflags) const
{ return section(QString(asep), astart, aend, aflags); }
class Q_CORE_EXPORT QCharRef {
QString &s;
int i;
inline QCharRef(QString &str, int idx)
: s(str),i(idx) {}
friend class QString;
public:
// most QChar operations repeated here
// all this is not documented: We just say "like QChar" and let it be.
inline operator QChar() const
{ return i < s.d->size ? s.d->data[i] : 0; }
inline QCharRef &operator=(const QChar &c)
{ if (i >= s.d->size) s.expand(i); else s.detach();
s.d->data[i] = c.unicode(); return *this; }
// An operator= for each QChar cast constructors
#ifndef QT_NO_CAST_FROM_ASCII
inline QT_ASCII_CAST_WARN QCharRef &operator=(char c)
{ return operator=(QChar::fromAscii(c)); }
inline QT_ASCII_CAST_WARN QCharRef &operator=(uchar c)
{ return operator=(QChar::fromAscii(c)); }
#endif
inline QCharRef &operator=(const QCharRef &c) { return operator=(QChar(c)); }
inline QCharRef &operator=(ushort rc) { return operator=(QChar(rc)); }
inline QCharRef &operator=(short rc) { return operator=(QChar(rc)); }
inline QCharRef &operator=(uint rc) { return operator=(QChar(rc)); }
inline QCharRef &operator=(int rc) { return operator=(QChar(rc)); }
// each function...
inline bool isNull() const { return QChar(*this).isNull(); }
inline bool isPrint() const { return QChar(*this).isPrint(); }
inline bool isPunct() const { return QChar(*this).isPunct(); }
inline bool isSpace() const { return QChar(*this).isSpace(); }
inline bool isMark() const { return QChar(*this).isMark(); }
inline bool isLetter() const { return QChar(*this).isLetter(); }
inline bool isNumber() const { return QChar(*this).isNumber(); }
inline bool isLetterOrNumber() { return QChar(*this).isLetterOrNumber(); }
inline bool isDigit() const { return QChar(*this).isDigit(); }
inline bool isLower() const { return QChar(*this).isLower(); }
inline bool isUpper() const { return QChar(*this).isUpper(); }
inline bool isTitleCase() const { return QChar(*this).isTitleCase(); }
inline int digitValue() const { return QChar(*this).digitValue(); }
QChar toLower() const { return QChar(*this).toLower(); }
QChar toUpper() const { return QChar(*this).toUpper(); }
QChar toTitleCase () const { return QChar(*this).toTitleCase(); }
QChar::Category category() const { return QChar(*this).category(); }
QChar::Direction direction() const { return QChar(*this).direction(); }
QChar::Joining joining() const { return QChar(*this).joining(); }
bool hasMirrored() const { return QChar(*this).hasMirrored(); }
QChar mirroredChar() const { return QChar(*this).mirroredChar(); }
QString decomposition() const { return QChar(*this).decomposition(); }
QChar::Decomposition decompositionTag() const { return QChar(*this).decompositionTag(); }
uchar combiningClass() const { return QChar(*this).combiningClass(); }
QChar::UnicodeVersion unicodeVersion() const { return QChar(*this).unicodeVersion(); }
inline uchar cell() const { return QChar(*this).cell(); }
inline uchar row() const { return QChar(*this).row(); }
inline void setCell(uchar cell);
inline void setRow(uchar row);
#ifdef Q_COMPILER_MANGLES_RETURN_TYPE
const char toAscii() const { return QChar(*this).toAscii(); }
const char toLatin1() const { return QChar(*this).toLatin1(); }
const ushort unicode() const { return QChar(*this).unicode(); }
#else
char toAscii() const { return QChar(*this).toAscii(); }
char toLatin1() const { return QChar(*this).toLatin1(); }
ushort unicode() const { return QChar(*this).unicode(); }
#endif
ushort& unicode() { return s.data()[i].unicode(); }
#ifdef QT3_SUPPORT
inline QT3_SUPPORT bool mirrored() const { return hasMirrored(); }
inline QT3_SUPPORT QChar lower() const { return QChar(*this).toLower(); }
inline QT3_SUPPORT QChar upper() const { return QChar(*this).toUpper(); }
#ifdef Q_COMPILER_MANGLES_RETURN_TYPE
const QT3_SUPPORT char latin1() const { return QChar(*this).toLatin1(); }
const QT3_SUPPORT char ascii() const { return QChar(*this).toAscii(); }
#else
QT3_SUPPORT char latin1() const { return QChar(*this).toLatin1(); }
QT3_SUPPORT char ascii() const { return QChar(*this).toAscii(); }
#endif
#endif
};
inline void QCharRef::setRow(uchar arow) { QChar(*this).setRow(arow); }
inline void QCharRef::setCell(uchar acell) { QChar(*this).setCell(acell); }
inline QString::QString() : d(&shared_null) { d->ref.ref(); }
inline QString::~QString() { if (!d->ref.deref()) free(d); }
inline void QString::reserve(int asize) { if (d->ref != 1 || asize > d->alloc) realloc(asize); d->capacity = 1;}
inline QString &QString::setUtf16(const ushort *autf16, int asize)
{ return setUnicode(reinterpret_cast<const QChar *>(autf16), asize); }
inline QCharRef QString::operator[](int i)
{ Q_ASSERT(i >= 0); return QCharRef(*this, i); }
inline QCharRef QString::operator[](uint i)
{ return QCharRef(*this, i); }
inline QString::iterator QString::begin()
{ detach(); return reinterpret_cast<QChar*>(d->data); }
inline QString::const_iterator QString::begin() const
{ return reinterpret_cast<const QChar*>(d->data); }
inline QString::const_iterator QString::constBegin() const
{ return reinterpret_cast<const QChar*>(d->data); }
inline QString::iterator QString::end()
{ detach(); return reinterpret_cast<QChar*>(d->data + d->size); }
inline QString::const_iterator QString::end() const
{ return reinterpret_cast<const QChar*>(d->data + d->size); }
inline QString::const_iterator QString::constEnd() const
{ return reinterpret_cast<const QChar*>(d->data + d->size); }
inline QBool QString::contains(const QString &s, Qt::CaseSensitivity cs) const
{ return QBool(indexOf(s, 0, cs) != -1); }
inline QBool QString::contains(QChar c, Qt::CaseSensitivity cs) const
{ return QBool(indexOf(c, 0, cs) != -1); }
inline bool operator==(QString::Null, QString::Null) { return true; }
inline bool operator==(QString::Null, const QString &s) { return s.isNull(); }
inline bool operator==(const QString &s, QString::Null) { return s.isNull(); }
inline bool operator!=(QString::Null, QString::Null) { return false; }
inline bool operator!=(QString::Null, const QString &s) { return !s.isNull(); }
inline bool operator!=(const QString &s, QString::Null) { return !s.isNull(); }
#ifndef QT_NO_CAST_FROM_ASCII
inline bool qStringComparisonHelper(const QString &s1, const char *s2)
{
# ifndef QT_NO_TEXTCODEC
if (QString::codecForCStrings) return (s1 == QString::fromAscii(s2));
# endif
return (s1 == QLatin1String(s2));
}
inline bool QString::operator==(const char *s) const
{ return qStringComparisonHelper(*this, s); }
inline bool QString::operator!=(const char *s) const
{ return !qStringComparisonHelper(*this, s); }
inline bool QString::operator<(const char *s) const
{ return *this < QString::fromAscii(s); }
inline bool QString::operator>(const char *s) const
{ return *this > QString::fromAscii(s); }
inline bool QString::operator<=(const char *s) const
{ return *this <= QString::fromAscii(s); }
inline bool QString::operator>=(const char *s) const
{ return *this >= QString::fromAscii(s); }
inline QT_ASCII_CAST_WARN bool operator==(const char *s1, const QString &s2)
{ return qStringComparisonHelper(s2, s1); }
inline QT_ASCII_CAST_WARN bool operator!=(const char *s1, const QString &s2)
{ return !qStringComparisonHelper(s2, s1); }
inline QT_ASCII_CAST_WARN bool operator<(const char *s1, const QString &s2)
{ return (QString::fromAscii(s1) < s2); }
inline QT_ASCII_CAST_WARN bool operator>(const char *s1, const QString &s2)
{ return (QString::fromAscii(s1) > s2); }
inline QT_ASCII_CAST_WARN bool operator<=(const char *s1, const QString &s2)
{ return (QString::fromAscii(s1) <= s2); }
inline QT_ASCII_CAST_WARN bool operator>=(const char *s1, const QString &s2)
{ return (QString::fromAscii(s1) >= s2); }
inline QT_ASCII_CAST_WARN bool operator==(const char *s1, const QLatin1String &s2)
{ return QString::fromAscii(s1) == s2; }
inline QT_ASCII_CAST_WARN bool operator!=(const char *s1, const QLatin1String &s2)
{ return QString::fromAscii(s1) != s2; }
inline QT_ASCII_CAST_WARN bool operator<(const char *s1, const QLatin1String &s2)
{ return (QString::fromAscii(s1) < s2); }
inline QT_ASCII_CAST_WARN bool operator>(const char *s1, const QLatin1String &s2)
{ return (QString::fromAscii(s1) > s2); }
inline QT_ASCII_CAST_WARN bool operator<=(const char *s1, const QLatin1String &s2)
{ return (QString::fromAscii(s1) <= s2); }
inline QT_ASCII_CAST_WARN bool operator>=(const char *s1, const QLatin1String &s2)
{ return (QString::fromAscii(s1) >= s2); }
inline bool operator==(const QLatin1String &s1, const QLatin1String &s2)
{ return (qstrcmp(s1.latin1(), s2.latin1()) == 0); }
inline bool operator!=(const QLatin1String &s1, const QLatin1String &s2)
{ return (qstrcmp(s1.latin1(), s2.latin1()) != 0); }
inline bool operator<(const QLatin1String &s1, const QLatin1String &s2)
{ return (qstrcmp(s1.latin1(), s2.latin1()) < 0); }
inline bool operator<=(const QLatin1String &s1, const QLatin1String &s2)
{ return (qstrcmp(s1.latin1(), s2.latin1()) <= 0); }
inline bool operator>(const QLatin1String &s1, const QLatin1String &s2)
{ return (qstrcmp(s1.latin1(), s2.latin1()) > 0); }
inline bool operator>=(const QLatin1String &s1, const QLatin1String &s2)
{ return (qstrcmp(s1.latin1(), s2.latin1()) >= 0); }
inline bool QString::operator==(const QByteArray &s) const
{ return qStringComparisonHelper(*this, s.constData()); }
inline bool QString::operator!=(const QByteArray &s) const
{ return !qStringComparisonHelper(*this, s.constData()); }
inline bool QByteArray::operator==(const QString &s) const
{ return qStringComparisonHelper(s, constData()); }
inline bool QByteArray::operator!=(const QString &s) const
{ return !qStringComparisonHelper(s, constData()); }
inline bool QByteArray::operator<(const QString &s) const
{ return QString::fromAscii(constData(), size()) < s; }
inline bool QByteArray::operator>(const QString &s) const
{ return QString::fromAscii(constData(), size()) > s; }
inline bool QByteArray::operator<=(const QString &s) const
{ return QString::fromAscii(constData(), size()) <= s; }
inline bool QByteArray::operator>=(const QString &s) const
{ return QString::fromAscii(constData(), size()) >= s; }
#endif // QT_NO_CAST_FROM_ASCII
#ifndef QT_NO_CAST_TO_ASCII
inline QByteArray &QByteArray::append(const QString &s)
{ return append(s.toAscii()); }
inline QByteArray &QByteArray::insert(int i, const QString &s)
{ return insert(i, s.toAscii()); }
inline QByteArray &QByteArray::replace(char c, const QString &after)
{ return replace(c, after.toAscii()); }
inline QByteArray &QByteArray::replace(const QString &before, const char *after)
{ return replace(before.toAscii(), after); }
inline QByteArray &QByteArray::replace(const QString &before, const QByteArray &after)
{ return replace(before.toAscii(), after); }
inline QByteArray &QByteArray::operator+=(const QString &s)
{ return operator+=(s.toAscii()); }
inline int QByteArray::indexOf(const QString &s, int from) const
{ return indexOf(s.toAscii(), from); }
inline int QByteArray::lastIndexOf(const QString &s, int from) const
{ return lastIndexOf(s.toAscii(), from); }
# ifdef QT3_SUPPORT
inline int QByteArray::find(const QString &s, int from) const
{ return indexOf(s.toAscii(), from); }
inline int QByteArray::findRev(const QString &s, int from) const
{ return lastIndexOf(s.toAscii(), from); }
# endif // QT3_SUPPORT
#endif // QT_NO_CAST_TO_ASCII
inline const QString operator+(const QString &s1, const QString &s2)
{ QString t(s1); t += s2; return t; }
inline const QString operator+(const QString &s1, QChar s2)
{ QString t(s1); t += s2; return t; }
inline const QString operator+(QChar s1, const QString &s2)
{ QString t(s1); t += s2; return t; }
#ifndef QT_NO_CAST_FROM_ASCII
inline QT_ASCII_CAST_WARN const QString operator+(const QString &s1, const char *s2)
{ QString t(s1); t += QString::fromAscii(s2); return t; }
inline QT_ASCII_CAST_WARN const QString operator+(const char *s1, const QString &s2)
{ QString t = QString::fromAscii(s1); t += s2; return t; }
inline QT_ASCII_CAST_WARN const QString operator+(char c, const QString &s)
{ QString t = s; t.prepend(QChar::fromAscii(c)); return t; }
inline QT_ASCII_CAST_WARN const QString operator+(const QString &s, char c)
{ QString t = s; t += QChar::fromAscii(c); return t; }
inline QT_ASCII_CAST_WARN const QString operator+(const QByteArray &ba, const QString &s)
{ QString t = QString::fromAscii(ba.constData(), qstrnlen(ba.constData(), ba.size())); t += s; return t; }
inline QT_ASCII_CAST_WARN const QString operator+(const QString &s, const QByteArray &ba)
{ QString t(s); t += QString::fromAscii(ba.constData(), qstrnlen(ba.constData(), ba.size())); return t; }
#endif
#ifndef QT_NO_STL
inline std::string QString::toStdString() const
{ const QByteArray asc = toAscii(); return std::string(asc.constData(), asc.length()); }
inline QString QString::fromStdString(const std::string &s)
{ return fromAscii(s.data(), int(s.size())); }
# ifndef QT_NO_STL_WCHAR
inline QStdWString QString::toStdWString() const
{
QStdWString str;
str.resize(length());
#if defined(_MSC_VER) && _MSC_VER >= 1400
// VS2005 crashes if the string is empty
if (!length())
return str;
#endif
str.resize(toWCharArray(&(*str.begin())));
return str;
}
inline QString QString::fromStdWString(const QStdWString &s)
{ return fromWCharArray(s.data(), int(s.size())); }
# endif
#endif
#ifdef QT3_SUPPORT
inline QChar &QString::ref(uint i)
{
if (int(i) > d->size || d->ref != 1)
resize(qMax(int(i), d->size));
return reinterpret_cast<QChar&>(d->data[i]);
}
#endif
#ifndef QT_NO_DATASTREAM
Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QString &);
Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QString &);
#endif
#ifdef QT3_SUPPORT
class QConstString : public QString
{
public:
inline QT3_SUPPORT_CONSTRUCTOR QConstString(const QChar *aUnicode, int aSize)
:QString(aUnicode, aSize){} // cannot use fromRawData() due to changed semantics
inline QT3_SUPPORT const QString &string() const { return *this; }
};
#endif
Q_DECLARE_TYPEINFO(QString, Q_MOVABLE_TYPE);
Q_DECLARE_SHARED(QString)
Q_DECLARE_OPERATORS_FOR_FLAGS(QString::SectionFlags)
#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
extern Q_CORE_EXPORT QByteArray qt_winQString2MB(const QString& s, int len=-1);
extern Q_CORE_EXPORT QByteArray qt_winQString2MB(const QChar *ch, int len);
extern Q_CORE_EXPORT QString qt_winMB2QString(const char* mb, int len=-1);
#endif
class Q_CORE_EXPORT QStringRef {
const QString *m_string;
int m_position;
int m_size;
public:
inline QStringRef():m_string(0), m_position(0), m_size(0){}
inline QStringRef(const QString *string, int position, int size);
inline QStringRef(const QString *string);
inline QStringRef(const QStringRef &other)
:m_string(other.m_string), m_position(other.m_position), m_size(other.m_size)
{}
inline ~QStringRef(){}
inline const QString *string() const { return m_string; }
inline int position() const { return m_position; }
inline int size() const { return m_size; }
inline int count() const { return m_size; }
inline int length() const { return m_size; }
inline QStringRef &operator=(const QStringRef &other) {
m_string = other.m_string; m_position = other.m_position;
m_size = other.m_size; return *this;
}
inline QStringRef &operator=(const QString *string);
inline const QChar *unicode() const {
if (!m_string)
return reinterpret_cast<const QChar *>(QString::shared_null.data);
return m_string->unicode() + m_position;
}
inline const QChar *data() const { return unicode(); }
inline const QChar *constData() const { return unicode(); }
inline void clear() { m_string = 0; m_position = m_size = 0; }
QString toString() const;
inline bool isEmpty() const { return m_size == 0; }
inline bool isNull() const { return m_string == 0 || m_string->isNull(); }
QStringRef appendTo(QString *string) const;
inline const QChar at(int i) const
{ Q_ASSERT(i >= 0 && i < size()); return m_string->at(i + m_position); }
int compare(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
int compare(const QStringRef &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
int compare(QLatin1String s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
static int compare(const QStringRef &s1, const QString &s2,
Qt::CaseSensitivity = Qt::CaseSensitive);
static int compare(const QStringRef &s1, const QStringRef &s2,
Qt::CaseSensitivity = Qt::CaseSensitive);
static int compare(const QStringRef &s1, QLatin1String s2,
Qt::CaseSensitivity cs = Qt::CaseSensitive);
int localeAwareCompare(const QString &s) const;
int localeAwareCompare(const QStringRef &s) const;
static int localeAwareCompare(const QStringRef &s1, const QString &s2);
static int localeAwareCompare(const QStringRef &s1, const QStringRef &s2);
};
inline QStringRef &QStringRef::operator=(const QString *aString)
{ m_string = aString; m_position = 0; m_size = aString?aString->size():0; return *this; }
inline QStringRef::QStringRef(const QString *aString, int aPosition, int aSize)
:m_string(aString), m_position(aPosition), m_size(aSize){}
inline QStringRef::QStringRef(const QString *aString)
:m_string(aString), m_position(0), m_size(aString?aString->size() : 0){}
Q_CORE_EXPORT bool operator==(const QStringRef &s1,const QStringRef &s2);
inline bool operator!=(const QStringRef &s1,const QStringRef &s2)
{ return !(s1 == s2); }
Q_CORE_EXPORT bool operator==(const QString &s1,const QStringRef &s2);
inline bool operator!=(const QString &s1,const QStringRef &s2)
{ return !(s1 == s2); }
inline bool operator==(const QStringRef &s1,const QString &s2)
{ return s2 == s1; }
inline bool operator!=(const QStringRef &s1,const QString &s2)
{ return s2 != s1; }
Q_CORE_EXPORT bool operator==(const QLatin1String &s1, const QStringRef &s2);
inline bool operator!=(const QLatin1String &s1,const QStringRef &s2)
{ return !(s1 == s2); }
inline bool operator==(const QStringRef &s1,const QLatin1String &s2)
{ return s2 == s1; }
inline bool operator!=(const QStringRef &s1,const QLatin1String &s2)
{ return s2 != s1; }
Q_CORE_EXPORT bool operator<(const QStringRef &s1,const QStringRef &s2);
inline bool operator>(const QStringRef &s1, const QStringRef &s2)
{ return s2 < s1; }
inline bool operator<=(const QStringRef &s1, const QStringRef &s2)
{ return !(s1 > s2); }
inline bool operator>=(const QStringRef &s1, const QStringRef &s2)
{ return !(s1 < s2); }
inline bool qStringComparisonHelper(const QStringRef &s1, const char *s2)
{
# ifndef QT_NO_TEXTCODEC
if (QString::codecForCStrings) return (s1 == QString::fromAscii(s2));
# endif
return (s1 == QLatin1String(s2));
}
inline QT_ASCII_CAST_WARN bool operator==(const char *s1, const QStringRef &s2)
{ return qStringComparisonHelper(s2, s1); }
inline QT_ASCII_CAST_WARN bool operator==(const QStringRef &s1, const char *s2)
{ return qStringComparisonHelper(s1, s2); }
inline QT_ASCII_CAST_WARN bool operator!=(const char *s1, const QStringRef &s2)
{ return !qStringComparisonHelper(s2, s1); }
inline QT_ASCII_CAST_WARN bool operator!=(const QStringRef &s1, const char *s2)
{ return !qStringComparisonHelper(s1, s2); }
inline int QString::compare(const QStringRef &s, Qt::CaseSensitivity cs) const
{ return QString::compare_helper(constData(), length(), s.constData(), s.length(), cs); }
inline int QString::compare(const QString &s1, const QStringRef &s2, Qt::CaseSensitivity cs)
{ return QString::compare_helper(s1.constData(), s1.length(), s2.constData(), s2.length(), cs); }
inline int QStringRef::compare(const QString &s, Qt::CaseSensitivity cs) const
{ return QString::compare_helper(constData(), length(), s.constData(), s.length(), cs); }
inline int QStringRef::compare(const QStringRef &s, Qt::CaseSensitivity cs) const
{ return QString::compare_helper(constData(), length(), s.constData(), s.length(), cs); }
inline int QStringRef::compare(QLatin1String s, Qt::CaseSensitivity cs) const
{ return QString::compare_helper(constData(), length(), s, cs); }
inline int QStringRef::compare(const QStringRef &s1, const QString &s2, Qt::CaseSensitivity cs)
{ return QString::compare_helper(s1.constData(), s1.length(), s2.constData(), s2.length(), cs); }
inline int QStringRef::compare(const QStringRef &s1, const QStringRef &s2, Qt::CaseSensitivity cs)
{ return QString::compare_helper(s1.constData(), s1.length(), s2.constData(), s2.length(), cs); }
inline int QStringRef::compare(const QStringRef &s1, QLatin1String s2, Qt::CaseSensitivity cs)
{ return QString::compare_helper(s1.constData(), s1.length(), s2, cs); }
inline int QString::localeAwareCompare(const QStringRef &s) const
{ return localeAwareCompare_helper(constData(), length(), s.constData(), s.length()); }
inline int QString::localeAwareCompare(const QString& s1, const QStringRef& s2)
{ return localeAwareCompare_helper(s1.constData(), s1.length(), s2.constData(), s2.length()); }
inline int QStringRef::localeAwareCompare(const QString &s) const
{ return QString::localeAwareCompare_helper(constData(), length(), s.constData(), s.length()); }
inline int QStringRef::localeAwareCompare(const QStringRef &s) const
{ return QString::localeAwareCompare_helper(constData(), length(), s.constData(), s.length()); }
inline int QStringRef::localeAwareCompare(const QStringRef &s1, const QString &s2)
{ return QString::localeAwareCompare_helper(s1.constData(), s1.length(), s2.constData(), s2.length()); }
inline int QStringRef::localeAwareCompare(const QStringRef &s1, const QStringRef &s2)
{ return QString::localeAwareCompare_helper(s1.constData(), s1.length(), s2.constData(), s2.length()); }
QT_END_NAMESPACE
QT_END_HEADER
#endif // QSTRING_H
| [
"alon@rogue.(none)"
]
| [
[
[
1,
1234
]
]
]
|
7121ae49e0d9e36d9b5e4c70446ee7839eeb1592 | e7c45d18fa1e4285e5227e5984e07c47f8867d1d | /Scada/ScdOPC/Client/ItemPropertiesDlg.h | 4d99837aeebd3df73831f514257efbc9d815bd94 | []
| 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 | 1,861 | h | //**************************************************************************
//
// Copyright (c) FactorySoft, INC. 1996-1998, All Rights Reserved
//
//**************************************************************************
//
// Filename : ItemProperties.h
// $Author : Jim Hansen
//
// Description: This dialog displays the OPC 2.0 Item properties.
//
//**************************************************************************
#if !defined(AFX_ITEMPARAMETERSDLG_H__E23B9331_EE16_11D1_A27E_00E098013D8D__INCLUDED_)
#define AFX_ITEMPARAMETERSDLG_H__E23B9331_EE16_11D1_A27E_00E098013D8D__INCLUDED_
/////////////////////////////////////////////////////////////////////////////
// CItemPropertiesDlg dialog
class CItemPropertiesDlg : public CDialog
{
// Construction
public:
CItemPropertiesDlg(LPCTSTR itemID, CWnd* pParent = NULL); // standard constructor
void SetOPCPointer( IUnknown* pUnk ) {m_OPCItemProps.Attach(pUnk);}
// Dialog Data
//{{AFX_DATA(CItemPropertiesDlg)
enum { IDD = IDD_ITEM_QUERY_PROPERTIES };
CListCtrl m_list;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CItemPropertiesDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
OPCItemProperties m_OPCItemProps;
CString m_ItemID;
// Generated message map functions
//{{AFX_MSG(CItemPropertiesDlg)
virtual BOOL OnInitDialog();
afx_msg void OnRefresh();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_ITEMPARAMETERSDLG_H__E23B9331_EE16_11D1_A27E_00E098013D8D__INCLUDED_)
| [
"[email protected]"
]
| [
[
[
1,
56
]
]
]
|
763ac31eb4486f2652b4df94c6d16685bea37c49 | 20cf43a2e1854d71696a6264dea4ea8cbfdb16f2 | /WinNT/comm_nt/Socket.cpp | 6e71e059d899180f0642af08a8e5456ee1bdfa98 | []
| no_license | thebruno/comm-nt | fb0ece0a8d36715a8f0199ba3ce9f37859170ee3 | 6ba36941b123c272efe8d81b55555d561d8842f4 | refs/heads/master | 2016-09-07T19:00:59.817929 | 2010-01-14T20:38:58 | 2010-01-14T20:38:58 | 32,205,785 | 0 | 0 | null | null | null | null | WINDOWS-1250 | C++ | false | false | 5,739 | cpp | #include "stdafx.h"
#include "Socket.h"
#define RECEIVE_BUFFER_SIZE 1024
int Socket::SocketsCount = 0;
void Socket::Start() {
if (!SocketsCount) {
WSADATA info;
if (WSAStartup(MAKEWORD(2,0), &info)) {
throw SocketException("Could not start WSA");
}
}
++SocketsCount;
}
void Socket::End() {
WSACleanup();
}
Socket::Socket() : SocketHandle(0) {
Start();
// UDP: use SOCK_DGRAM instead of SOCK_STREAM
SocketHandle = socket(AF_INET, SOCK_STREAM, 0);
if (SocketHandle == INVALID_SOCKET) {
throw SocketException("INVALID_SOCKET\nCannot create socket.");
}
RefCount = new int(1);
}
Socket::Socket(SOCKET s) : SocketHandle(s) {
Start();
RefCount = new int(1);
};
Socket::~Socket() {
if (! --(*RefCount)) {
Close();
delete RefCount;
RefCount = 0;
}
if (!(--SocketsCount))
{
End();
}
}
Socket::Socket(const Socket& s) {
RefCount = s.RefCount;
(*RefCount)++;
SocketHandle = s.SocketHandle;
SocketsCount++;
}
Socket& Socket::operator=(Socket& s) {
(*s.RefCount)++;
RefCount = s.RefCount;
SocketHandle = s.SocketHandle;
SocketsCount++;
return *this;
}
void Socket::Close() {
closesocket(SocketHandle);
}
Result Socket::ReceiveBytes(std::string &s) {
char buf[RECEIVE_BUFFER_SIZE];
while (1) {
u_long arg = 0;
if (ioctlsocket(SocketHandle, FIONREAD, &arg) != 0)
return FAILED;
if (arg == 0)
return EMPTY;
if (arg > RECEIVE_BUFFER_SIZE)
arg = RECEIVE_BUFFER_SIZE;
int rv = recv (SocketHandle, buf, arg, 0);
if (rv == 0)
return DISCONNECTED;
if (rv < 0)
return FAILED;
std::string temp;
temp.assign (buf, rv);
s += temp;
}
return OK;
}
Result Socket::ReceiveBytes(std::string &s, char delimiter ) {
while (1) {
char c;
switch(recv(SocketHandle, &c, 1, 0)) {
case 0:
return DISCONNECTED;
case -1:
return FAILED;
// if (errno == EAGAIN) {
// return ret;
// } else {
// // not connected anymore
// return "";
// }
}
if (c != delimiter)
s += c;
else
return OK;
}
return OK;
}
Result Socket::ReceiveLine(std::string &s) {
return ReceiveBytes(s, '\n');
}
Result Socket::SendLine(std::string s) {
if (s[s.length() - 1] != '\n')
s += '\n';
if (send(SocketHandle, s.c_str(), s.length(), 0) == SOCKET_ERROR)
return FAILED;
return OK;
}
Result Socket::SendBytes(const std::string& s) {
if (send(SocketHandle, s.c_str(), s.length(), 0) == SOCKET_ERROR)
return FAILED;
return OK;
}
Result Socket::SendBytes(const std::string& s, char delimiter) {
std::string temp = s;
temp += delimiter;
if (send(SocketHandle, temp.c_str(), temp.length(), 0) == SOCKET_ERROR)
return FAILED;
return OK;
}
// wywołanie z klasy bazowej, niepotrzebne utworzenie bazowego socketa?
ServerSocket::ServerSocket(int port, int connections, bool blocking) {
sockaddr_in address;
//memset(&address, 0, sizeof(address));
address.sin_family = AF_INET;
address.sin_addr.s_addr = INADDR_ANY;
address.sin_port = htons(port);
SocketHandle = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (SocketHandle == INVALID_SOCKET) {
throw SocketException("INVALID_SOCKET\nCannot create server socket.");
}
if(!blocking) {
u_long arg = 1;
ioctlsocket(SocketHandle, FIONBIO, &arg);
}
/* bind the socket to the internet address */
if (bind(SocketHandle, (sockaddr *)&address, sizeof(address)) == SOCKET_ERROR) {
this->Close();
throw SocketException("INVALID_SOCKET\nCannot bind the socket to the internet address.");
}
listen(SocketHandle, connections);
}
Socket* ServerSocket::Accept() {
SOCKET newSocket = accept(SocketHandle, 0, 0);
if (newSocket == INVALID_SOCKET) {
int rc = WSAGetLastError();
if(rc == WSAEWOULDBLOCK) {
return 0; // non-blocking call, no request pending
}
else {
throw SocketException("Invalid Socket");
}
}
Socket* temp = new Socket(newSocket);
return temp;
}
ClientSocket::ClientSocket(const std::string& host, int port) : Socket() {
std::string error;
std::cout << host << std::endl;
hostent *hostInfo;
struct in_addr addr;
addr.s_addr = inet_addr(host.c_str() );
if (host.size () > 1) {
if ( isalpha(host[0]) && (hostInfo = gethostbyname(host.c_str())) == 0 ) {
throw SocketException(strerror(errno));
} else if (isdigit(host[0]) &&(hostInfo = gethostbyaddr((char *) &addr, 4, AF_INET))==0){
throw SocketException(strerror(errno));
}
}
sockaddr_in address;
address.sin_family = AF_INET;
address.sin_port = htons(port);
address.sin_addr = *((in_addr *)hostInfo->h_addr);
//memset(&(address.sin_zero), 0, 8);
if (::connect(SocketHandle, (sockaddr *) &address, sizeof(sockaddr))) {
throw SocketException(strerror(WSAGetLastError()));
}
}
bool SelectSocket::CanRead(Socket const* const s, bool blocking) {
fd_set SocketArray;
FD_ZERO(&SocketArray);
FD_SET(const_cast<Socket*>(s)->SocketHandle, &SocketArray);
TIMEVAL tval;
tval.tv_sec = 2;
tval.tv_usec = 0;
TIMEVAL *ptval;
if(!blocking) {
ptval = &tval;
}
else {
ptval = 0;
}
if (select (0, &SocketArray, (fd_set*) 0, (fd_set*) 0, ptval) == SOCKET_ERROR)
throw SocketException("Error in select");
if (FD_ISSET(s->SocketHandle, &SocketArray))
return true;
return false;
}
std::string GetHostName(std::string host){
hostent *hostInfo;
if ((hostInfo = gethostbyname(host.c_str())) == 0) {
throw SocketException(strerror(errno));
}
std::string toReturn(hostInfo->h_name);
return toReturn;
}
| [
"konrad.balys@08f01046-b83b-11de-9b33-83dc4fd2bb11"
]
| [
[
[
1,
247
]
]
]
|
560c781d35dc6fc429f335fc99c9158423b11373 | 12ea67a9bd20cbeed3ed839e036187e3d5437504 | /winxgui/WTLHelper/InsertPoint.cpp | db0526960413313fbbd463654b092ff664116e75 | []
| no_license | cnsuhao/winxgui | e0025edec44b9c93e13a6c2884692da3773f9103 | 348bb48994f56bf55e96e040d561ec25642d0e46 | refs/heads/master | 2021-05-28T21:33:54.407837 | 2008-09-13T19:43:38 | 2008-09-13T19:43:38 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 11,566 | cpp | ////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2004 Sergey Solozhentsev
// Author: Sergey Solozhentsev e-mail: [email protected]
// Product: WTL Helper
// File: InsertPoint.cpp
// Created: 17.01.2005 9:58
//
// Using this software in commercial applications requires an author
// permission. The permission will be granted to everyone excluding the cases
// when someone simply tries to resell the code.
// This file may be redistributed by any means PROVIDING it is not sold for
// profit without the authors written consent, and providing that this notice
// and the authors name is included.
// This file is provided "as is" with no expressed or implied warranty. The
// author accepts no liability if it causes any damage to you or your computer
// whatsoever.
//
////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "InsertPoint.h"
//////////////////////////////////////////////////////////////////////////
InsertPointFunc::InsertPointFunc(int iType) : InsertionPoint(iType)
{
}
HRESULT InsertPointFunc::Insert(VSClass* pClass, int Step)
{
if (Step == INSERT_STEP_ENVDTE)
{
return pClass->InsertFunction((VSFunction*)pElement, Body);
}
return S_OK;
}
//////////////////////////////////////////////////////////////////////////
InsertPointVariable::InsertPointVariable(int iType) : InsertionPoint(iType)
{
}
HRESULT InsertPointVariable::Insert(VSClass* pClass, int Step)
{
if (Step == INSERT_STEP_ENVDTE)
{
return pClass->InsertVariable((VSVariable*)pElement);
}
return S_OK;
}
//////////////////////////////////////////////////////////////////////////
InsertPointMap::InsertPointMap(int iType) : InsertionPoint(iType)
{
}
HRESULT InsertPointMap::Insert(VSClass* pClass, int Step)
{
if (Step == INSERT_STEP_GLOBAL)
{
return pClass->InsertMap((VSMap*)pElement);
}
return S_OK;
}
//////////////////////////////////////////////////////////////////////////
InsertPointAltMap::InsertPointAltMap(int iType) : InsertionPoint(iType)
{
}
HRESULT InsertPointAltMap::Insert(VSClass* pClass, int Step)
{
VSMessageMap* pMesMap = (VSMessageMap*)pElement;
if (Step == INSERT_STEP_ENVDTE && !DefineName.IsEmpty())
{
EnvDTE::ProjectItemPtr pProjItem;
pClass->pElement->get_ProjectItem(&pProjItem);
if (pProjItem != NULL)
{
EnvDTE::FileCodeModelPtr pCodeModel;
pProjItem->get_FileCodeModel(&pCodeModel);
if (pCodeModel != NULL)
{
VCCodeModelLibrary::VCFileCodeModelPtr pVCCodeModel = pCodeModel;
if (pVCCodeModel != NULL)
{
pVCCodeModel->AddMacro(_bstr_t(pElement->Name), _bstr_t(DefineName));
}
}
}
}
if (Step == INSERT_STEP_GLOBAL)
{
pParentMap->InsertAltMap(pMesMap);
}
return S_OK;
}
//////////////////////////////////////////////////////////////////////////
InsertPointMapEntry::InsertPointMapEntry(int iType) : InsertionPoint(iType)
{
}
HRESULT InsertPointMapEntry::Insert(VSClass* pClass, int Step)
{
if (Step == INSERT_STEP_MAP_ENTRY)
{
return pParentMap->InsertMapEntry((VSMapEntry*)pElement);
}
return S_OK;
}
//////////////////////////////////////////////////////////////////////////
InsertPointHandler::InsertPointHandler(int iType) : InsertPointMapEntry(iType)
{
}
HRESULT InsertPointHandler::Insert(VSClass* pClass, int Step)
{
if (Step == INSERT_STEP_ENVDTE && pFunction && (pFunction->pElement == NULL))
{
return pClass->InsertFunction(pFunction, Body);
}
if (Step == INSERT_STEP_MAP_ENTRY)
{
return pParentMap->InsertMapEntry((VSMapEntry*)pElement);
}
return S_OK;
}
//////////////////////////////////////////////////////////////////////////
InsertPointDDX::InsertPointDDX(int iType) : InsertPointMapEntry(iType)
{
}
HRESULT InsertPointDDX::Insert(VSClass* pClass, int Step)
{
if (Step == INSERT_STEP_MAP_ENTRY)
{
return pParentMap->InsertMapEntry((VSMapEntry*)pElement);
}
if (Step == INSERT_STEP_ENVDTE)
{
HRESULT hr = pClass->InsertVariable(pVariable);
if (hr != S_OK)
{
return hr;
}
if (!Initializer.IsEmpty())
{
bool bFindConstructor = false;
for (size_t i = 0; i < pClass->Functions.GetCount(); i++)
{
VSFunction* pFunc = pClass->Functions[i];
if (pFunc->Kind == EnvDTE::vsCMFunctionConstructor)
{
if ((pClass->Functions[i]->pElement != NULL))
{
bFindConstructor = true;
hr = AddInitializer(pClass->Functions[i]);
if (FAILED(hr))
return hr;
}
}
}
if (!bFindConstructor)
{
VSFunction* pFunc = new VSFunction;
pFunc->pParent = pClass;
pFunc->Access = EnvDTE::vsCMAccessPublic;
pClass->Functions.Add(pFunc);
EnvDTE::CodeFunctionPtr pCodeFunc;
_bstr_t ClassName;
pClass->pElement->get_Name(ClassName.GetAddress());
pFunc->Name = (LPCTSTR)ClassName;
pClass->InsertFunction(pFunc, CString(), EnvDTE::vsCMFunctionConstructor, _variant_t(0));
if (pFunc->pElement != NULL)
{
pFunc->RetriveType();
return AddInitializer(pFunc);
}
return S_OK;
}
}
}
return S_OK;
}
HRESULT InsertPointDDX::AddInitializer(VSFunction* pFunc)
{
VCCodeModelLibrary::VCCodeFunctionPtr pVCFunc = pFunc->pElement;
ATLASSERT(pVCFunc != NULL);
CString InitString;
InitString.Format(_T("%s(%s)"), pVariable->Name, Initializer);
return pVCFunc->AddInitializer(_bstr_t(InitString));
}
//////////////////////////////////////////////////////////////////////////
InsertSpecFunction::InsertSpecFunction(int iType /* = INSERT_POINT_SPEC_FUNC */) :
InsertPointFunc(iType)
{
}
HRESULT InsertSpecFunction::Insert(VSClass* pClass, int Step)
{
if (Step == INSERT_STEP_ENVDTE)
{
HRESULT hr = pClass->InsertFunction((VSFunction*)pElement, Body);
if (hr != S_OK)
return hr;
if (pBase)
return pClass->InsertBase(pBase);
else
return S_OK;
}
if (Step == INSERT_STEP_GLOBAL)
{
if (!OnCreateBody.IsEmpty())
{
VSMessageMap* pMap = (VSMessageMap*)pClass->GetMap(_T("MSG"));
if (!pMap)
return E_FAIL;
CAtlArray<VSMapEntry*> MapEntries;
CString CreateMessage;
if (bInitDialog)
{
CreateMessage = _T("WM_INITDIALOG");
}
else
{
CreateMessage = _T("WM_CREATE");
}
VSMessageMap::FindMapEntryByMessage(CreateMessage, pMap, MapEntries);
for (size_t i = 0; i < pMap->AltMaps.GetCount(); i++)
{
VSMessageMap::FindMapEntryByMessage(CreateMessage, pMap->AltMaps[i], MapEntries);
}
if (MapEntries.GetCount())
{
VSFunction* pFunc;
for (size_t i = 0; i < MapEntries.GetCount(); i++)
{
pFunc = (VSFunction*)MapEntries[i]->pData;
VCCodeModelLibrary::VCCodeFunctionPtr pVCFunc = pFunc->pElement;
ATLASSERT(pVCFunc != NULL);
_bstr_t FuncBody;
pVCFunc->get_BodyText(FuncBody.GetAddress());
FuncBody = _bstr_t(OnCreateBody) + FuncBody;
pVCFunc->put_BodyText(FuncBody);
}
}
}
if (!OnDestroyBody.IsEmpty())
{
VSMessageMap* pMap = (VSMessageMap*)pClass->GetMap(_T("MSG"));
if (!pMap)
return E_FAIL;
CAtlArray<VSMapEntry*> MapEntries;
VSMessageMap::FindMapEntryByMessage(_T("WM_DESTROY"), pMap, MapEntries);
for (size_t i = 0; i < pMap->AltMaps.GetCount(); i++)
{
VSMessageMap::FindMapEntryByMessage(_T("WM_DESTROY"), pMap->AltMaps[i], MapEntries);
}
if (MapEntries.GetCount())
{
VSFunction* pFunc;
for (size_t i = 0; i < MapEntries.GetCount(); i++)
{
pFunc = (VSFunction*)MapEntries[i]->pData;
VCCodeModelLibrary::VCCodeFunctionPtr pVCFunc = pFunc->pElement;
ATLASSERT(pVCFunc != NULL);
_bstr_t FuncBody;
pVCFunc->get_BodyText(FuncBody.GetAddress());
FuncBody = _bstr_t(OnDestroyBody) + FuncBody;
pVCFunc->put_BodyText(FuncBody);
}
}
}
return S_OK;
}
return S_OK;
}
//////////////////////////////////////////////////////////////////////////
InsertInclude::InsertInclude(int iType /* = INSERT_POINT_INCLUDE */):
InsertionPoint(iType), Pos(-1)
{
}
InsertInclude::~InsertInclude()
{
if (pElement)
{
delete pElement;
}
}
HRESULT InsertInclude::Insert(VSClass* pClass, int Step)
{
if (Step == INSERT_STEP_ENVDTE)
{
EnvDTE::ProjectItemPtr pProjectItem;
if (pProjectFile != NULL)
{
pProjectItem = pProjectFile;
}
else
{
pClass->pElement->get_ProjectItem(&pProjectItem);
}
EnvDTE::FileCodeModelPtr pFileCodeModel;
pProjectItem->get_FileCodeModel(&pFileCodeModel);
VCCodeModelLibrary::VCFileCodeModelPtr pVCFileCodeModel = pFileCodeModel;
pInclude = pVCFileCodeModel->AddInclude(_bstr_t(pElement->Name), Pos);
}
if (Step == INSERT_STEP_GLOBAL)
{
if (pInclude != NULL && !AdditionalMacro.IsEmpty())
{
EnvDTE::TextPointPtr pTextPoint;
EnvDTE::EditPointPtr pEditPoint;
pInclude->get_StartPoint(&pTextPoint);
pTextPoint->CreateEditPoint(&pEditPoint);
_bstr_t MacroText = CString(_T("#define ")) + AdditionalMacro + _T("\r\n");
pEditPoint->Insert(MacroText);
}
}
return S_OK;
}
//////////////////////////////////////////////////////////////////////////
InsertPointDDXSupport::InsertPointDDXSupport(int Type /* = INSERT_POINT_DDXSUPPORT */):
InsertionPoint(Type)
{
}
InsertPointDDXSupport::~InsertPointDDXSupport()
{
if (pElement)
{
delete pElement;
}
}
HRESULT InsertPointDDXSupport::Insert(VSClass* pClass, int Step)
{
if (Step == INSERT_STEP_ENVDTE)
{
EnvDTE::ProjectItemPtr pProjectItem;
pClass->pElement->get_ProjectItem(&pProjectItem);
EnvDTE::FileCodeModelPtr pFileCodeModel;
pProjectItem->get_FileCodeModel(&pFileCodeModel);
VCCodeModelLibrary::VCFileCodeModelPtr pVCFileCodeModel = pFileCodeModel;
ATLASSERT(pVCFileCodeModel != NULL);
EnvDTE::CodeElementPtr pElem;
if (pElement)
{
ATLASSERT(pElement->ElementType == EnvDTE::vsCMElementIncludeStmt);
pElem = pElement->pElement = pVCFileCodeModel->AddInclude(_bstr_t(pElement->Name));
}
else
{
EnvDTE::CodeElementsPtr pIncludes = pVCFileCodeModel->Includes;
HRESULT hr = pIncludes->Item(_variant_t(L"<atlddx.h>"), &pElem);
if (FAILED(hr))
return hr;
}
if (bUseFloat)
{
ATLASSERT(pElem != NULL);
EnvDTE::TextPointPtr pTextPoint;
pElem->GetStartPoint(EnvDTE::vsCMPartWholeWithAttributes, &pTextPoint);
ATLASSERT(pTextPoint != NULL);
pTextPoint->CreateEditPoint(&pFloatPoint);
}
if (pBase)
{
VCCodeModelLibrary::VCCodeClassPtr pVCClass = pClass->pElement;
ATLASSERT(pVCClass != NULL);
HRESULT hr = pVCClass->raw_AddBase(_variant_t(pBase->Name), _variant_t(-1), &pBase->pElement);
return hr;
}
}
if (Step == INSERT_STEP_GLOBAL)
{
if (bUseFloat)
{
if (pFloatPoint != NULL)
{
pFloatPoint->CharLeft(1);
_bstr_t Macro = L"\r\n#define _ATL_USE_DDX_FLOAT";
pFloatPoint->Insert(Macro);
}
else
{
return E_INVALIDARG;
}
}
}
return S_OK;
}
//////////////////////////////////////////////////////////////////////////
InsertPointReplaceEndMap::InsertPointReplaceEndMap() : InsertionPoint(INSERT_POINT_REPLACE_END_MSG_MAP)
{
}
HRESULT InsertPointReplaceEndMap::Insert(VSClass* pClass, int Step)
{
if (Step == INSERT_STEP_GLOBAL)
{
VSMessageMap* pMesMap = (VSMessageMap*)pElement;
return pMesMap->ReplacePrefixEnd();
}
return S_OK;
} | [
"xushiweizh@86f14454-5125-0410-a45d-e989635d7e98"
]
| [
[
[
1,
418
]
]
]
|
42b3bb6658b624e040c7a9ffdb34304499615576 | 110f8081090ba9591d295d617a55a674467d127e | /tests/FontGrapherTest.cpp | ba3b2a015deda398fd53feb372d81430f8a15052 | []
| no_license | rayfill/cpplib | 617bcf04368a2db70aea8b9418a45d7fd187d8c2 | bc37fbf0732141d0107dd93bcf5e0b31f0d078ca | refs/heads/master | 2021-01-25T03:49:26.965162 | 2011-07-17T15:19:11 | 2011-07-17T15:19:11 | 783,979 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 955 | cpp | #include <cppunit/extensions/HelperMacros.h>
#include <Win32/FontGrapher.hpp>
#include <iostream>
class FontGrapherTest : public CppUnit::TestFixture
{
private:
CPPUNIT_TEST_SUITE(FontGrapherTest);
CPPUNIT_TEST(callbackTest);
CPPUNIT_TEST_SUITE_END();
public:
void callbackTest()
{
HDC hDC = GetDC(NULL);
FontGrapher::FontCollection collection =
FontGrapher::EnumerateFonts(hDC);
// std::cout << std::endl << "enum font count: " <<
// collection.size() << std::endl;
for (FontGrapher::FontCollection::iterator itor =
collection.begin();
itor != collection.end();
++itor)
{
if (itor->first.elfLogFont.lfCharSet == SHIFTJIS_CHARSET &&
itor->first.elfFullName[0] != '@')
// std::cout << itor->first.elfFullName << ": " <<
// itor->first.elfLogFont.lfFaceName << std::endl;
;
}
ReleaseDC(NULL, hDC);
}
};
CPPUNIT_TEST_SUITE_REGISTRATION( FontGrapherTest );
| [
"alfeim@287b3242-7fab-264f-8401-8509467ab285",
"bpokazakijr@287b3242-7fab-264f-8401-8509467ab285"
]
| [
[
[
1,
1
]
],
[
[
2,
37
]
]
]
|
c8fe5fb6c03758c719d2817a4986fbab59c6426e | 13613feed38f491488f4d5c45e273bc984bff4d9 | /c/msnemo/prog_blc.cpp | 40aa5dbdd94a8d25ff31de1dcf0871112254a9bf | []
| no_license | guillaume7/griflet | 93fb1c2e3d9b600c3391a3b4a0dc52c32326690e | 24adda02dd9857b20cbc2984cb010271a28cdbe0 | refs/heads/master | 2016-08-11T02:09:43.741569 | 2011-12-09T00:26:59 | 2011-12-09T00:26:59 | 44,432,686 | 0 | 0 | null | null | null | null | ISO-8859-1 | C++ | false | false | 27,699 | cpp | /*****************routines sur les s_memory_blocs*****************/
#include "stdafx.h"
#ifdef BLOC_DIM_2D //////////////////////////////////////////////
//---------------------------------------------------------------
#define ALL_FILL t->x.P,t->y.P,ALL_INC
#define FREE_FILL t->x.P,ALL_INC
#define BLC_ALLOC table_alloc(ALL_FILL)
#define B_BLC_ALLOC b_table_alloc(ALL_FILL)
#define BLC_FREE(s) table_free(s,FREE_FILL)
#define B_BLC_FREE(s) b_table_free(s,FREE_FILL)
#define BLC_OLD b->C_old[i][j]
#define BLC_SO b->C_so[i][j]
#define BLC_FR b->C_fr[i][j]
#define BLC_U(s) b->V_u[i][s]
#define BLC_V(s) b->V_v[s][j]
#define DEC_BLC(s) dec_table(t->x.P,&(s))
#define DEC_B_BLC(s) b_dec_table(t->x.P,&(s))
#define INC_BLC(s) inc_table(t->x.P,&(s))
#define INC_B_BLC(s) b_inc_table(t->x.P,&(s))
#define IJ [g->i][g->j]
#define IPJ [g->ip][g->j]
#define INJ [g->in][g->j]
#define IJP [g->i][g->jp]
#define IJN [g->i][g->jn]
//---------------------------------------------------------------
#endif ////////////////////////////////////////////////////////////
#ifdef BLOC_DIM_3D /////////////////////////////////////////////////
//---------------------------------------------------------------
#define ALL_FILL t->z.P,t->x.P,t->y.P,ALL_INC
#define FREE_FILL t->z.P,t->x.P,ALL_INC
#define BLC_ALLOC cube_alloc(ALL_FILL)
#define B_BLC_ALLOC b_cube_alloc(ALL_FILL)
#define BLC_FREE(s) cube_free(s,FREE_FILL)
#define B_BLC_FREE(s) b_cube_free(s,FREE_FILL)
#define BLC_OLD b->C_old[k][i][j]
#define BLC_SO b->C_so[k][i][j]
#define BLC_FR b->C_fr[k][i][j]
#define BLC_U(s) b->V_u[k][i][s]
#define BLC_V(s) b->V_v[k][s][j]
#define BLC_W b->V_w[k][i][j]
#define DEC_BLC(s) dec_cube(t->z.P,t->x.P,&(s))
#define DEC_B_BLC(s) b_dec_cube(t->z.P,t->x.P,&(s))
#define INC_BLC(s) inc_cube(t->z.P,t->x.P,&(s))
#define INC_B_BLC(s) b_inc_cube(t->z.P,t->x.P,&(s))
#define IJ [g->k][g->i][g->j]
#define IPJ [g->k][g->ip][g->j]
#define INJ [g->k][g->in][g->j]
#define IJP [g->k][g->i][g->jp]
#define IJN [g->k][g->i][g->jn]
#define KP [g->kp][g->i][g->j]
#define KN [g->kn][g->i][g->j]
//---------------------------------------------------------------
#endif////////////////////////////////////////////////////////////
#define P_I_UP t->x.a*b->u_p[g->j]
#define C_I_UP t->x.a*b->u_p[g->j]
#define C_I_U t->x.a*u
#define N_I_U t->x.a*u
#define P_I_DIFF t->x.b
#define C_I_DIFF t->x.b
#define N_I_DIFF t->x.b
#define P_J_VP b->j.a[g->jp]*v_p
#define C_J_VP b->j.a[g->j]*v_p
#define C_J_V b->j.a[g->j]*v
#define N_J_V b->j.a[g->jn]*v
#define P_J_DIFF b->j.b[g->jp]
#define C_J_DIFF b->j.b[g->j]
#define N_J_DIFF b->j.b[g->jn]
#define P_K_WP b->k.a[g->kp]*b->w_p[g->j]
#define C_K_WP b->k.a[g->k]*b->w_p[g->j]
#define C_K_W b->k.a[g->k]*w
#define N_K_W b->k.a[g->kn]*w
#define P_K_DIFF b->k.b[g->kp]
#define C_K_DIFF b->k.b[g->k]
#define N_K_DIFF b->k.b[g->kn]
#define INDEXSET(index,i,x) if(((int)index[0]=((int)t->so.i)-STAINSIZE)<0) index[0]=0;if((index[1]=t->so.i+STAINSIZE)>=t->x.P) index[1]=t->x.P-1;
#define CDF_GET_VAR1_DOUBLE(p,s) nc_get_var1_double(c->file.ncid, c->var.id, p, &(s))
#define CDF_GET_VAR1_FLOAT(p,s) nc_get_var1_float(c->file.ncid, c->var.id, p, &(s))
#define CDF_GET_DIM1_FLOAT(p,q,s) nc_get_var1_float(c->p.file.ncid, c->p.q.varid, ip, &(s))
//**********************Cree des blocs de memoire pour contenir l'information.*************
void create_blocs( s_all_parameters *t, s_memory_blocs *b){ //*
//*****************************************************************************************
b->C_old = BLC_ALLOC;
b->C_new = BLC_ALLOC;
b->C_so = B_BLC_ALLOC; //Ce n'est pas si important s'il s'agit d'une source ponctuelle.
b->C_fr = B_BLC_ALLOC;
b->V_u = BLC_ALLOC; //Je vais reemployer les blocs de vitesses pour les coeffs p,c,n.
b->V_v = BLC_ALLOC; //idem
#ifdef BLOC_DIM_3D//////////////////////////////////////////////
//---------------------------------------------------------------
b->V_w = BLC_ALLOC; //idem ibidem
b->k.a = array_alloc(t->z.P,ALL_INC);
b->k.b = array_alloc(t->z.P,ALL_INC);
b->k.g = array_alloc(t->z.P,ALL_INC);
b->w_p = array_alloc(t->y.P,ALL_INC);
b->u_p = array_alloc(t->y.P,ALL_INC);
b->j.a = array_alloc(t->y.P,ALL_INC);
b->j.b = array_alloc(t->y.P,ALL_INC);
b->i.p = b->V_u;
b->i.c = b->V_v;
b->i.n = b->V_w;
b->j.p = BLC_ALLOC;
b->j.c = b->i.c; //Pour i, il suffit de copier l'addresse de i.
b->j.n = BLC_ALLOC;
b->k.p = BLC_ALLOC;
b->k.c = BLC_ALLOC;
b->k.n = BLC_ALLOC;
//---------------------------------------------------------------
#else///////////////////////////////////////////////////////////
//---------------------------------------------------------------
b->u_p = array_alloc(t->y.P,ALL_INC);
b->j.a = array_alloc(t->y.P,ALL_INC);
b->j.b = array_alloc(t->y.P,ALL_INC);
b->i.p = BLC_ALLOC;
b->i.c = BLC_ALLOC;
b->i.n = BLC_ALLOC;
b->j.p = BLC_ALLOC;
b->j.c = b->i.c; //Pour i, il suffit de copier l'addresse de i.
b->j.n = BLC_ALLOC;
//---------------------------------------------------------------
#endif///////////////////////////////////////////////////////////
return;
}
//***************Remplit la matrice masque de la source de traceur dans l'ocean.*********
void fill_stain(s_all_parameters *t, s_memory_blocs *b){ // *
//***************************************************************************************
#ifdef POINTSOURCE_OFF //////////////////////////////////////////////////////////////////
//-----------------Si la source est une tache qui occupe plusieurs cases-----------------
int inde_x[2], inde_y[2]; //Les indices delimitant la gauche et la droite.
index_t i, j;
#ifdef BLOC_DIM_3D
int inde_z[2];
index_t k;
#endif
#ifdef BLOC_DIM_3D
INDEXSET(inde_z,k,z)
for(k=inde_z[0];k<=inde_z[1];k++){
#endif
INDEXSET(inde_x, i,x)
for(i=inde_x[0];i<=inde_x[1];i++){
INDEXSET(inde_y, j,y)
for(j=inde_y[0];j<=inde_y[1];j++) BLC_SO = TRUE;
}
#ifdef BLOC_DIM_3D
}
#endif
//--------------------------------------------------------------------------------------
#endif//////////////////////////////////////////////////////////////////////////////////
#ifdef POINTSOURCE_ON //////////////////////////////////////////////////////////////////
//-------------------Si la source n'occupe qu'une case de la grille---------------------
index_t i,j;
#ifdef BLOC_DIM_3D
index_t k;
k=t->so.k;
#endif
i=t->so.i;
j=t->so.j;
BLC_SO=TRUE;
//--------------------------------------------------------------------------------------
#endif//////////////////////////////////////////////////////////////////////////////////
//----------------------On remplit la condition initiale du traceur (à t=0)-------------
#ifdef BLOC_DIM_3D
for(k=0;k<t->z.P;k++){
#endif
for(i=0;i<t->x.P;i++){
for(j=0;j<t->y.P;j++){
BLC_OLD = (double) BLC_SO*t->so.coninit;
}
}
#ifdef BLOC_DIM_3D
}
#endif
//----------------------------------------------------------------------------------------
return;
}
//*************Remplit les matrices d'advection et le masque des frontieres.****************
void fill_adv(s_nc_all_files *n, s_all_parameters *t, s_memory_blocs *b){ // *
//******************************************************************************************
index_t i, j;
#ifdef BLOC_DIM_3D
index_t k;
#endif
double aux1, aux2;
//-----------Decremente le pointeur des blocs frontieres et vitesses------------------------
DEC_B_BLC(b->C_fr);
DEC_BLC(b->V_u);
DEC_BLC(b->V_v);
#ifdef BLOC_DIM_3D
DEC_BLC(b->V_w);
#endif
//------------------------------------------------------------------------------------------
//--------Remplit les blocs des vitesses et des frontieres----------------------------------
cdf_dataread(&(n->u), b->V_u, b->C_fr, t); //Remplit u et les frontieres.
cdf_dataread(&(n->v), b->V_v, NULL, t); //Remplit v seulement.
#ifdef BLOC_DIM_3D
cdf_dataread(&(n->w), b->V_w, NULL, t); //Remplit w seulement.
#endif
cdf_toporead(&(n->topo), b->C_fr, t); //Remplit les frontieres.
//------------------------------------------------------------------------------------------
//---------Transforme les vitesses des cellules U en vitesses traitables par notre modele----
#ifdef BLOC_DIM_3D
for(k=1;k<t->z.P+B_K_INC;k++){ //Atention: ceci n'est valable qu'en dessous de la surface.
#endif
//ReRemplissage du bloc u.
for(i=0;i<t->x.P+B_INC;i++){
aux2=0.5*(BLC_U(1)+BLC_U(0));
for(j=1;j<t->y.P+B_INC;j++){
aux1=aux2;
aux2=0.5*(BLC_U(j+1)+BLC_U(j));
BLC_U(j)=aux1;
}
}
//ReRemplissage du bloc v.
for(j=0;j<t->y.P+B_INC;j++){
aux2=0.5*(BLC_V(1)+BLC_V(0));
for(i=1;i<t->x.P+B_INC;i++){
aux1=aux2;
aux2=0.5*(BLC_V(i+1)+BLC_V(i));
BLC_V(i)=aux1;
}
}
#ifdef BLOC_DIM_3D
}
#endif
//------------------------------------------------------------------------------------------
//------Incremente les pointeurs des blocs frontieres et vitesses---------------------------
#ifdef BLOC_DIM_3D
INC_BLC(b->V_w);
#endif
INC_BLC(b->V_v);
INC_BLC(b->V_u);
INC_B_BLC(b->C_fr);
//------------------------------------------------------------------------------------------
return;
}
//*****************************************************************************************
//Doit lire les champs de vitesses et remplir les blocs de memoire
//des vitesses et des frontieres.
//U(TIME,DEPTH,LATITUDE,LONGITUDE), NVDIM=nbre de dims.
void cdf_dataread(s_nc_input* c, bloc_t v, b_bloc_t fr, s_all_parameters* p){
//*****************************************************************************************
double value;
double aux;
size_t i,j;
#ifdef BLOC_DIM_3D
size_t k;
#endif
//-------Ici on fait l'integration et la moyenne des vitesses-----------------------------
cdf_adv_integration(c, v, p);
//-----------------------------------------------------------------------------------------
//-------Ici on applique les frontieres aux blocs des vitesses et des frontieres------
#ifdef BLOC_DIM_3D
for(k=1;k<p->z.P+B_K_INC;k++){
#endif
for(i=0;i<p->x.P+B_INC; i++){
for(j=0;j<p->y.P+B_INC; j++){
value=V_BLC;
aux=FILLVALUE + value;
if(aux<COMP_FILL){
if(fr!= NULL)FR_BLC = TRUE;
V_BLC = MYFILL; //Ici on doit avoir zero.
}
else{
if(fr!= NULL) FR_BLC = TRUE;
V_BLC = value; //Garde la valeur dans le bloc.
}
}
}
#ifdef BLOC_DIM_3D
}
#endif
//-----------------------------------------------------------------------------------------
return;
}
//*****************************************************************************************
//Doit lire les champs de vitesses et remplir les blocs de memoire
//des vitesses et des frontières.
//landmask(DEPTH,LATITUDE,LONGITUDE), 3 = nbre de dims.
void cdf_toporead(s_nc_input_t* t_p, b_bloc_t fr, s_all_parameters* p){
//*****************************************************************************************
int status;
short int value; //Attention tu vas lire un float que tu vas mettre dans un double!
size_t ip[3]; //Index pointer pour le netcdf.
size_t i,j;
#ifdef BLOC_DIM_3D
size_t k;
#endif
//-------Ici on remplit le bloc -----------------------------------------------------------
ip[0]=p->user.subindL.depth_p[0];
#ifdef BLOC_DIM_3D
for( k=1; k<p->z.P + B_K_INC; k++){
#endif
ip[1]=p->user.subindL.lat_p[0]-1;
for( j=0; j<p->y.P + B_INC; j++){
ip[2]=(p->user.subindL.lon_p[0]-1)%t_p->x.length;
for( i=0; i<p->x.P + B_INC; i++){
status = nc_get_var1_short(t_p->file.ncid, t_p->var.id, ip, &value);
CDF_ERROR
if(value != -32767){
if(value == WATER) FR_BLC = TRUE;
else FR_BLC = FALSE;
}
else FR_BLC = TRUE;
ip[2]=(ip[2]+1) % t_p->x.length;
}
ip[1]++;
}
#ifdef BLOC_DIM_3D
ip[0]++;
}
#endif
//-----------------------------------------------------------------------------------------
return;
}
//*****************************************************************************************
//Doit lire les champs de vitesses et faire l'integration puis la moyenne
//U(TIME,DEPTH,LATITUDE,LONGITUDE), NVDIM = nbre de dims.
void cdf_adv_integration(s_nc_input* c, bloc_t v, s_all_parameters* p){
//*****************************************************************************************
int status;
float value; //Attention tu vas lire un float que tu vas mettre dans un double!
size_t ip[NVIDIM]; //Index pointer pour le netcdf.
size_t count; //compteur des integrations.
size_t i,j;
//-------Ici on remplit le bloc avec les vitesses integrees------
ip[I_TIME]=p->user.subindL.date_p[0]-1;
if(p->user.annual == ON){
for(count=0;count<12;count++){
ip[I_DEPTH]=p->user.subindL.depth_p[0];
ip[I_LON]=(p->user.subindL.lon_p[0]-1)%c->x.length;
for(i=0;i<p->x.P+B_INC;i++){
ip[I_LAT]=p->user.subindL.lat_p[0]-1;
for(j=0;j<p->y.P+B_INC;j++){
H(CDF_GET_VAR1_FLOAT(ip,value))
if(c==0) V_BLC = value; //somme la valeur dans le bloc.
else V_BLC += value; //somme la valeur dans le bloc.
ip[I_LAT]++;
}
ip[I_LON]=(ip[I_LON]+1)%c->x.length;
}
ip[I_TIME]++;
}
//---------------Ici on prend la moyenne des vitesses integrees----------------------------
for(i=0;i<p->x.P+B_INC;i++){
for(j=0;j<p->y.P+B_INC;j++){
V_BLC /= 12; //Divise pour avoir une moyenne.
}
}
//-----------------------------------------------------------------------------------------
}
else{
ip[I_DEPTH]=p->user.subindL.depth_p[0];
ip[I_LON]=(p->user.subindL.lon_p[0]-1)%c->x.length;
for(i=0;i<p->x.P+B_INC;i++){
ip[I_LAT]=p->user.subindL.lat_p[0]-1;
for(j=0;j<p->y.P+B_INC;j++){
H(CDF_GET_VAR1_FLOAT(ip,value))
V_BLC = value;
ip[I_LAT]++;
}
ip[I_LON]=(ip[I_LON]+1)%c->x.length;
}
}
//-----------------------------------------------------------------------------------------
return;
}
//*******Remplit les coefficients a et b pour les lats et la profondeur; puis n,c et p******
void fill_coefs(s_nc_all_files *c, s_all_parameters *t, s_memory_blocs *b){
//*****************************************************************************************
int status;
float value1, value2;
float u;
float v_p, v;
#ifdef BLOC_DIM_3D
float w;
#endif
size_t ip[NDDIM];
s_indexes ind;
s_indexes *g;
g=&ind;
//----------------Remplit les coefs a et b des lats-----------------------------------------------
ip[0]=t->user.subindL.lat_p[0]+1;
for(g->i=0;g->i<t->y.P;g->i++){
H(CDF_GET_DIM1_FLOAT(w,y_edges,value1));
ip[0]++;
H(CDF_GET_DIM1_FLOAT(w,y_edges,value2));
#ifdef VOLUME_FIXE_OFF
value2=fabs(value2-value1)*LONGUEUR;
#else
value2=LONGUEUR*1.; //Un degre de resolution horizontale.
#endif
b->j.a[g->i]=TEMPS/t->x.N/((double)value2)*VITESSE; //res_t/res_j*vitesse
b->j.b[g->i]=COEFDIFF_H*TEMPS/t->x.N/((double)value2)/((double)value2); //K_h*res_t/res_j/res_j
}
//-----------------------------------------------------------------------------------------
#ifdef BLOC_DIM_3D ///////////////////////////////////////////////////////////////////////
//----------------Remplit les coefs a et b de la profondeur---------------------------------------
ip[0]=t->user.subindL.depth_p[0];
for(g->i=0;g->i<t->z.P;g->i++){
H(CDF_GET_DIM1_FLOAT(u,z_edges,value1));
ip[0]++;
H(CDF_GET_DIM1_FLOAT(u,z_edges,value2));
#ifdef VOLUME_FIXE_OFF
value2-=value1;
#else
value2=10.; //Dix metres de resolution verticale.
#endif
b->k.a[g->i]=TEMPS/t->x.N/((double)value2)*VITESSE; //res_t/res_k*vitesse
b->k.b[g->i]=COEFDIFF_V*TEMPS/t->x.N/((double)value2)/((double)value2); //K_v*res_t/res_k/res_k
}
//-----------------------------------------------------------------------------------------
#endif ///////////////////////////////////////////////////////////////////////////////////
//--------------Remplit les coefs p,c et n de la matrice tridiagonale----------------------
// !!!! VOIR FICHIER EXCEL parametrisations pour les coefs!!!!
//-----Ceci est TRES DELICAT. Si le schema ne fonctionne pas alors l'erreur est ici!!!-----
#ifdef BLOC_DIM_3D
for(g->k=0; g->k<t->z.P; g->k++){
g->kp=g->k-1;
g->kn=g->k+1;
#endif
for(g->i=0; g->i<t->x.P; g->i++){
g->ip=g->i-1;
g->in=g->i+1;
for(g->j=0; g->j<t->y.P; g->j++){
g->jp=g->j-1;
g->jn=g->j+1;
//-----------------Gardons les vitesses------------------------------------------------------
if(g->i==0) b->u_p[g->j]=U(ip);
u=U(i);
if(g->j==0) v_p=V(jp);
else v_p=v;
v=V(j);
#ifdef BLOC_DIM_3D
if(g->k==0) b->w_p[g->j]=W(kp);
w=W(k);
#endif
//-------------------------------------------------------------------------------------------
//-----------------IF SCH_UP OU HY-----------------------------------------------------------
if((t->schema==SCH_UP) || (t->schema==SCH_HY) ){
//----------Concernant la coordonnee i---------------------------
//advection i
if(b->u_p[g->j]<0.0){
if(u<0.0){
P(i)=P_I_UP*0;
C(i)=C_I_UP*1;
C(i)+=C_I_U*0;
N(i)=N_I_U*(-1);
}
else{
P(i)=P_I_UP*0;
C(i)=C_I_UP*1;
C(i)+=C_I_U*(-1);
N(i)=N_I_U*0;
}
}
else{
if(u<0.0){
P(i)=P_I_UP*1;
C(i)=C_I_UP*0;
C(i)+=C_I_U*0;
N(i)=N_I_U*(-1);
}
else{
P(i)=P_I_UP*1;
C(i)=C_I_UP*0;
C(i)+=C_I_U*(-1);
N(i)=N_I_U*0;
}
}
//---------------------------------------------------------------
//----------Concernant la coordonnee j---------------------------
//advection j
if(v_p<0.0){
if(v<0.0){
P(j)=P_J_VP*0;
C(j)+=C_J_VP*1;
C(j)+=C_J_V*0;
N(j)=N_J_V*(-1);
}
else{
P(j)=P_J_VP*0;
C(j)+=C_J_VP*1;
C(j)+=C_J_V*(-1);
N(j)=N_J_V*0;
}
}
else{
if(v<0.0){
P(j)=P_J_VP*1;
C(j)+=C_J_VP*0;
C(j)+=C_J_V*0;
N(j)=N_J_V*(-1);
}
else{
P(j)=P_J_VP*1;
C(j)+=C_J_VP*0;
C(j)+=C_J_V*(-1);
N(j)=N_J_V*0;
}
}
//---------------------------------------------------------------
#ifdef BLOC_DIM_3D///////////////////////////////////////////////////
//----------Concernant la coordonnee k---------------------------
//advection k
if(b->w_p[g->j]<0.0){
if(w<0.0){
P(k)=P_K_WP*0;
C(k)=C_K_WP*1;
C(k)+=C_K_W*0;
N(k)=N_K_W*(-1);
}
else{
P(k)=P_K_WP*0;
C(k)=C_K_WP*1;
C(k)+=C_K_W*(-1);
N(k)=N_K_W*0;
}
}
else{
if(w<0.0){
P(k)=P_K_WP*1;
C(k)=C_K_WP*0;
C(k)+=C_K_W*0;
N(k)=N_K_W*(-1);
}
else{
P(k)=P_K_WP*1;
C(k)=C_K_WP*0;
C(k)+=C_K_W*(-1);
N(k)=N_K_W*0;
}
}
//---------------------------------------------------------------
#endif///////////////////////////////////////////////////////////////
}
//-------------------------------------------------------------------------------------------
//----------------------IF SCH_DI------------------------------------------------------------
if(t->schema==SCH_DI){
//----------Concernant la coordonnee i---------------------------
//diffusion i
if(C_FR_i(ip)==0){
if(C_FR_i(in)==0){
P(i)=P_I_DIFF*0;
C(i)=C_I_DIFF*0;
N(i)=N_I_DIFF*0;
}
else{
P(i)=P_I_DIFF*0;
C(i)=C_I_DIFF*(-1);
N(i)=N_I_DIFF*1;
}
}
else{
if(C_FR_i(in)==0){
P(i)=P_I_DIFF*1;
C(i)=C_I_DIFF*(-1);
N(i)=N_I_DIFF*0;
}
else{
P(i)=P_I_DIFF*1;
C(i)=C_I_DIFF*(-2);
N(i)=N_I_DIFF*1;
}
}
//---------------------------------------------------------------
//----------Concernant la coordonnee j---------------------------
//diffusion j
if(C_FR_j(jp)==0){
if(C_FR_j(jn)==0){
P(j)=P_J_DIFF*0;
C(j)+=C_J_DIFF*0;
N(j)=N_J_DIFF*0;
}
else{
P(j)=P_J_DIFF*0;
C(j)+=C_J_DIFF*(-1);
N(j)=N_J_DIFF*1;
}
}
else{
if(C_FR_j(jn)==0){
P(j)=P_J_DIFF*1;
C(j)+=C_J_DIFF*(-1);
N(j)=N_J_DIFF*0;
}
else{
P(j)=P_J_DIFF*1;
C(j)+=C_J_DIFF*(-2);
N(j)=N_J_DIFF*1;
}
}
//---------------------------------------------------------------
#ifdef BLOC_DIM_3D///////////////////////////////////////////////////
//----------Concernant la coordonnee k---------------------------
//diffusion k
if(C_FR_k(kp)==0){
if(C_FR_k(kn)==0){
P(k)=P_K_DIFF*0;
C(k)=C_K_DIFF*0;
N(k)=N_K_DIFF*0;
}
else{
P(k)=P_K_DIFF*0;
C(k)=C_K_DIFF*(-1);
N(k)=N_K_DIFF*1;
}
}
else{
if(C_FR_k(kn)==0){
P(k)=P_K_DIFF*1;
C(k)=C_K_DIFF*(-1);
N(k)=N_K_DIFF*0;
}
else{
P(k)=P_K_DIFF*1;
C(k)=C_K_DIFF*(-2);
N(k)=N_K_DIFF*1;
}
}
//---------------------------------------------------------------
#endif///////////////////////////////////////////////////////////////
}
//-------------------------------------------------------------------------------------------
//-----------------IF SCH_UP|SCH_DI OU SCH_HY|SCH_DI-----------------------------------------
if( (t->schema==(SCH_UP|SCH_DI)) || (t->schema==(SCH_HY|SCH_DI)) ){
//----------Concernant la coordonnee i---------------------------
//advection i
if(b->u_p[g->j]<0.0){
if(u<0.0){
P(i)=P_I_UP*0;
C(i)=C_I_UP*1;
C(i)+=C_I_U*0;
N(i)=N_I_U*(-1);
}
else{
P(i)=P_I_UP*0;
C(i)=C_I_UP*1;
C(i)+=C_I_U*(-1);
N(i)=N_I_U*0;
}
}
else{
if(u<0.0){
P(i)=P_I_UP*1;
C(i)=C_I_UP*0;
C(i)+=C_I_U*0;
N(i)=N_I_U*(-1);
}
else{
P(i)=P_I_UP*1;
C(i)=C_I_UP*0;
C(i)+=C_I_U*(-1);
N(i)=N_I_U*0;
}
}
//diffusion i
if(C_FR_i(ip)==0){
if(C_FR_i(in)==0){
P(i)+=P_I_DIFF*0;
C(i)+=C_I_DIFF*0;
N(i)+=N_I_DIFF*0;
}
else{
P(i)+=P_I_DIFF*0;
C(i)+=C_I_DIFF*(-1);
N(i)+=N_I_DIFF*1;
}
}
else{
if(C_FR_i(in)==0){
P(i)+=P_I_DIFF*1;
C(i)+=C_I_DIFF*(-1);
N(i)+=N_I_DIFF*0;
}
else{
P(i)+=P_I_DIFF*1;
C(i)+=C_I_DIFF*(-2);
N(i)+=N_I_DIFF*1;
}
}
//---------------------------------------------------------------
//----------Concernant la coordonnee j---------------------------
//advection j
if(v_p<0.0){
if(v<0.0){
P(j)=P_J_VP*0;
C(j)+=C_J_VP*1;
C(j)+=C_J_V*0;
N(j)=N_J_V*(-1);
}
else{
P(j)=P_J_VP*0;
C(j)+=C_J_VP*1;
C(j)+=C_J_V*(-1);
N(j)=N_J_V*0;
}
}
else{
if(v<0.0){
P(j)=P_J_VP*1;
C(j)+=C_J_VP*0;
C(j)+=C_J_V*0;
N(j)=N_J_V*(-1);
}
else{
P(j)=P_J_VP*1;
C(j)+=C_J_VP*0;
C(j)+=C_J_V*(-1);
N(j)=N_J_V*0;
}
}
//diffusion j
if(C_FR_j(jp)==0){
if(C_FR_j(jn)==0){
P(j)+=P_J_DIFF*0;
C(j)+=C_J_DIFF*0;
N(j)+=N_J_DIFF*0;
}
else{
P(j)+=P_J_DIFF*0;
C(j)+=C_J_DIFF*(-1);
N(j)+=N_J_DIFF*1;
}
}
else{
if(C_FR_j(jn)==0){
P(j)+=P_J_DIFF*1;
C(j)+=C_J_DIFF*(-1);
N(j)+=N_J_DIFF*0;
}
else{
P(j)+=P_J_DIFF*1;
C(j)+=C_J_DIFF*(-2);
N(j)+=N_J_DIFF*1;
}
}
//---------------------------------------------------------------
#ifdef BLOC_DIM_3D///////////////////////////////////////////////////
//----------Concernant la coordonnee k---------------------------
//advection k
if(b->w_p[g->j]<0.0){
if(w<0.0){
P(k)=P_K_WP*0;
C(k)=C_K_WP*1;
C(k)+=C_K_W*0;
N(k)=N_K_W*(-1);
}
else{
P(k)=P_K_WP*0;
C(k)=C_K_WP*1;
C(k)+=C_K_W*(-1);
N(k)=N_K_W*0;
}
}
else{
if(w<0.0){
P(k)=P_K_WP*1;
C(k)=C_K_WP*0;
C(k)+=C_K_W*0;
N(k)=N_K_W*(-1);
}
else{
P(k)=P_K_WP*1;
C(k)=C_K_WP*0;
C(k)+=C_K_W*(-1);
N(k)=N_K_W*0;
}
}
//diffusion k
if(C_FR_k(kp)==0){
if(C_FR_k(kn)==0){
P(k)+=P_K_DIFF*0;
C(k)+=C_K_DIFF*0;
N(k)+=N_K_DIFF*0;
}
else{
P(k)+=P_K_DIFF*0;
C(k)+=C_K_DIFF*(-1);
N(k)+=N_K_DIFF*1;
}
}
else{
if(C_FR_k(kn)==0){
P(k)+=P_K_DIFF*1;
C(k)+=C_K_DIFF*(-1);
N(k)+=N_K_DIFF*0;
}
else{
P(k)+=P_K_DIFF*1;
C(k)+=C_K_DIFF*(-2);
N(k)+=N_K_DIFF*1;
}
}
//---------------------------------------------------------------
#endif///////////////////////////////////////////////////////////////
}
//-------------------------------------------------------------------------------------------
//---------------------------------Gardons les vitesses--------------------------------------
b->u_p[g->j]=u;
#ifdef BLOC_DIM_3D
b->w_p[g->j]=w;
#endif
//-------------------------------------------------------------------------------------------
//----------------Ici on fait une derniere optimization pour l'algo--------------------------
//Multiplier par la frontiere est tjrs une bonne methode de garantir une bonne
//robustesse de l'algo.
// P(j)*=C_FR_j(j);
// P(i)*=C_FR_i(i);
C(i)=(C(i)+1.);//*C_FR_i(i);
// N(i)*=C_FR_i(i);
// N(j)*=C_FR_j(j);
//-------------------------------------------------------------------------------------------
#ifdef BLOC_DIM_3D //////////////////////////////////////////////////////////////////////////
//---------------Ici on arranje la verticale pour le calcul implicite------------------------
// VOIR LE DOCUMENT ThomasAlgorithm
P(k)=-1.*P(k);//*C_FR_k(k);
C(k)=(1.-C(k));//*C_FR_k(k);
N(k)=-1.*N(k);//*C_FR_k(k);
if(g->k!=0){
P(k)=P(k)/b->k.c[g->kp][g->i][g->j];
C(k)=C(k)-P(k)*(b->k.n[g->kp][g->i][g->j]);
}
//-------------------------------------------------------------------------------------------
#endif //////////////////////////////////////////////////////////////////////////////////////
}
}
#ifdef BLOC_DIM_3D
}
#endif
//-----------------------------------------------------------------------------------------
#ifdef TEST_MASS_ON//////////////////////////////////////////////////////////////////////////
//--------------------------Test de la conservativite 2D du schema----------------------------
#ifdef BLOC_DIM_3D
for(g->k=0; g->k<t->z.P; g->k++){
g->kp=g->k-1;
g->kn=g->k+1;
#endif
for(g->i=0; g->i<t->x.P; g->i++){
g->ip=g->i-1;
g->in=g->i+1;
for(g->j=0; g->j<t->y.P; g->j++){
g->jp=g->j-1;
g->jn=g->j+1;
b->i.c IJ =
b->i.n IPJ + b->j.n IJP
+ b->i.c IJ
+ b->i.p INJ + b->j.p IJN;
}
}
#ifdef BLOC_DIM_3D
}
#endif
//------------------------------------------------------------------------------------------
#endif//////////////////////////////////////////////////////////////////////////////////////
return;
}
//********************Libere de memoire les blocs crees par create_blocs.******************
void free_blocs(s_memory_blocs *b, s_all_parameters *t){ //*
//*****************************************************************************************
BLC_FREE(b->C_old);
BLC_FREE(b->C_new);
B_BLC_FREE(b->C_so);
B_BLC_FREE(b->C_fr);
BLC_FREE(b->V_u);
BLC_FREE(b->V_v);
#ifdef BLOC_DIM_3D
BLC_FREE(b->V_w);
free(b->k.a-ALL_INC);
free(b->k.b-ALL_INC);
BLC_FREE(b->k.p);
BLC_FREE(b->k.c);
BLC_FREE(b->k.n);
free(b->w_p-ALL_INC);
#endif
free(b->j.a-ALL_INC);
free(b->j.b-ALL_INC);
free(b->u_p-ALL_INC);
// BLC_FREE(b->i.p);
// BLC_FREE(b->i.c);
// BLC_FREE(b->i.n);
BLC_FREE(b->j.p);
// BLC_FREE(b->j.c);
BLC_FREE(b->j.n);
return;
} | [
"[email protected]"
]
| [
[
[
1,
966
]
]
]
|
52a600477a5e1a0b280ecf2781300c0b625a1cca | cc946ca4fb4831693af2c6f252100b9a83cfc7d0 | /uCash.Cybos/uCash.Cybos.Define.h | 029bb733b9c7d428117e66917f2284da896d5ec5 | []
| no_license | primespace/ucash-cybos | 18b8b324689516e08cf6d0124d8ad19c0f316d68 | 1ccece53844fad0ef8f3abc8bbb51dadafc75ab7 | refs/heads/master | 2021-01-10T04:42:53.966915 | 2011-10-14T07:15:33 | 2011-10-14T07:15:33 | 52,243,596 | 7 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,457 | h | /*
* uCash.Cybos Copyright (c) 2011 Taeyoung Park ([email protected])
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
* PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
#pragma once
#define FUTURETRADEMONITOR_EVENT_ID 1
#define FUTUREHOGAMONITOR_EVENT_ID 2
#define MARKETWATCHMONITOR_EVENT_ID 3
namespace uCash { namespace Cybos {
enum {
EVENT_ID = 0,
MARKET_WATCH_EVENT_ID,
FUTURE_TRADE_EVENT_ID,
FUTURE_HOGA_EVENT_ID
};
}} | [
"[email protected]"
]
| [
[
[
1,
39
]
]
]
|
94ea9dc5435f8986d33dc82d332c6d87926165b6 | d22b77645ee83ee72fed70cb2a3ca4fb268ada4a | /servers/login_srv/LoginDatabaseClient.hpp | 6b1a65042fc8fc4a32e934544525462ea0f97151 | []
| no_license | catid/Splane | 8f94f7d8983cf994955e599fc53ce6f763157486 | c9f79f0034d1762948b7c26e42f50f58793067ac | refs/heads/master | 2020-04-26T00:28:48.571474 | 2010-06-02T05:37:43 | 2010-06-02T05:37:43 | 628,653 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,926 | hpp | /*
Copyright (c) 2009-2010 Christopher A. Taylor. 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 LibCat 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.
*/
#ifndef CAT_LOGIN_DATABASE_CLIENT_HPP
#define CAT_LOGIN_DATABASE_CLIENT_HPP
#include <cat/AllFramework.hpp>
namespace cat {
class LoginServer;
typedef fastdelegate::FastDelegate4<ThreadPoolLocalStorage *, bool, BufferStream , u32> TransactionCallback;
class LoginTransaction
{
friend class LoginDatabaseClient;
LoginDatabaseClient *_client; // Client object with a reference held
u32 _id; // Identifier for this transaction
LoginTransaction *_next, *_prev; // Linked list neighbors
TransactionCallback _callback; // Callback for completion success or failure
public:
LoginTransaction(); // Ctor
~LoginTransaction(); // Dtor: Releases held reference and unlinks
void Release(); // Release held reference and unlink self
// Does not invoke callback
};
enum LDC_DisconnectReasons
{
LDC_DISCO_WRONG_KEY, // Database Server rejected our access key!
LDC_DISCO_BAD_SIGNATURE, // Database Server rejected our signature!
LDC_DISCO_CANNOT_SIGN, // Couldn't generate signature
};
class LoginDatabaseClient : public sphynx::Client
{
LoginServer *_owner;
enum SessionState
{
CS_CHALLENGE,
CS_LOGIN_WAIT,
CS_READY
} _state;
Mutex _transaction_lock;
LoginTransaction *_transaction_head, *_transaction_tail;
u32 _next_transaction_id;
public:
LoginDatabaseClient(LoginServer *owner);
virtual ~LoginDatabaseClient();
void ConnectToDatabase(ThreadPoolLocalStorage *tls);
CAT_INLINE bool IsReady() { return _state == CS_READY; }
public:
// Request should have DB_OVERHEAD_BYTES of space at the start, bytes includes this overhead
bool Query(LoginTransaction *transaction, u8 *request, int bytes, const TransactionCallback &);
void ForgetQuery(LoginTransaction *transaction);
protected:
void OnClose();
void OnConnectFail(sphynx::HandshakeError err);
void OnConnect(ThreadPoolLocalStorage *tls);
void OnDisconnect(u8 reason);
void OnTimestampDeltaUpdate(u32 rtt, s32 delta);
void OnMessage(ThreadPoolLocalStorage *tls, BufferStream msg, u32 bytes);
void OnTick(ThreadPoolLocalStorage *tls, u32 now);
bool OnChallenge(ThreadPoolLocalStorage *tls, u8 *msg, u32 bytes);
void AnswerQuery(ThreadPoolLocalStorage *tls, u32 id, BufferStream request, int bytes);
};
} // namespace cat
#endif // CAT_LOGIN_DATABASE_CLIENT_HPP
| [
"kuang@.(none)",
"[email protected]"
]
| [
[
[
1,
59
],
[
68,
97
],
[
99,
99
],
[
101,
113
]
],
[
[
60,
67
],
[
98,
98
],
[
100,
100
]
]
]
|
ed5b253d91297a88c1a8410857436c27fbf4c840 | d68cb60f24cc3aae8a9ea0455664a2c8aafacef1 | /spu.hpp | 1633be600310d092a38c1d78d95d4a0502a6d263 | [
"MIT"
]
| permissive | mrwicked/ida-spu | d17844e7f880d226e630d7d5498298819b1958db | 09b25dfece92258643000f87d56937775963f300 | refs/heads/master | 2020-05-17T22:37:53.965091 | 2011-02-07T07:06:31 | 2011-02-07T07:06:31 | 32,441,880 | 4 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 6,227 | hpp | /*
* IDA SPU Module - IBM Cell Synergistic Processor Unit (SPU)
*
* Copyright (c) 2011 by respective authors.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef _SPU_HPP
#define _SPU_HPP
#include "../idaidp.hpp"
#include "ins.hpp"
#define UAS_NOSPA 0x0001 // no space after comma
//------------------------------------------------------------------------
#define IAS_FRGPR 0x0001 // Friendly GPR registers. For ex. $LP, $SP
#define DEFAULT_LSLR 0x0003ffff
//------------------------------------------------------------------
enum RegNo
{
// 128 general-purpose registers (GPRs)
gpr0, gpr1, gpr2, gpr3, gpr4, gpr5, gpr6, gpr7,
gpr8, gpr9, gpr10, gpr11, gpr12, gpr13, gpr14, gpr15,
gpr16, gpr17, gpr18, gpr19, gpr20, gpr21, gpr22, gpr23,
gpr24, gpr25, gpr26, gpr27, gpr28, gpr29, gpr30, gpr31,
gpr32, gpr33, gpr34, gpr35, gpr36, gpr37, gpr38, gpr39,
gpr40, gpr41, gpr42, gpr43, gpr44, gpr45, gpr46, gpr47,
gpr48, gpr49, gpr50, gpr51, gpr52, gpr53, gpr54, gpr55,
gpr56, gpr57, gpr58, gpr59, gpr60, gpr61, gpr62, gpr63,
gpr64, gpr65, gpr66, gpr67, gpr68, gpr69, gpr70, gpr71,
gpr72, gpr73, gpr74, gpr75, gpr76, gpr77, gpr78, gpr79,
gpr80, gpr81, gpr82, gpr83, gpr84, gpr85, gpr86, gpr87,
gpr88, gpr89, gpr90, gpr91, gpr92, gpr93, gpr94, gpr95,
gpr96, gpr97, gpr98, gpr99, gpr100, gpr101, gpr102, gpr103,
gpr104, gpr105, gpr106, gpr107, gpr108, gpr109, gpr110, gpr111,
gpr112, gpr113, gpr114, gpr115, gpr116, gpr117, gpr118, gpr119,
gpr120, gpr121, gpr122, gpr123, gpr124, gpr125, gpr126, gpr127,
// 128 channels registers
rch0, rch1, rch2, rch3, rch4, rch5, rch6, rch7,
rch8, rch9, rch10, rch11, rch12, rch13, rch14, rch15,
rch16, rch17, rch18, rch19, rch20, rch21, rch22, rch23,
rch24, rch25, rch26, rch27, rch28, rch29, rch30, rch31,
rch32, rch33, rch34, rch35, rch36, rch37, rch38, rch39,
rch40, rch41, rch42, rch43, rch44, rch45, rch46, rch47,
rch48, rch49, rch50, rch51, rch52, rch53, rch54, rch55,
rch56, rch57, rch58, rch59, rch60, rch61, rch62, rch63,
rch64, rch65, rch66, rch67, rch68, rch69, rch70, rch71,
rch72, rch73, rch74, rch75, rch76, rch77, rch78, rch79,
rch80, rch81, rch82, rch83, rch84, rch85, rch86, rch87,
rch88, rch89, rch90, rch91, rch92, rch93, rch94, rch95,
rch96, rch97, rch98, rch99, rch100, rch101, rch102, rch103,
rch104, rch105, rch106, rch107, rch108, rch109, rch110, rch111,
rch112, rch113, rch114, rch115, rch116, rch117, rch118, rch119,
rch120, rch121, rch122, rch123, rch124, rch125, rch126, rch127,
// Save-and-Restore Register 0 holds the address used by the Interrupt Return instruction
srr0,
// 128 special-purpose registers (SPRs)
spr0, spr1, spr2, spr3, spr4, spr5, spr6, spr7,
spr8, spr9, spr10, spr11, spr12, spr13, spr14, spr15,
spr16, spr17, spr18, spr19, spr20, spr21, spr22, spr23,
spr24, spr25, spr26, spr27, spr28, spr29, spr30, spr31,
spr32, spr33, spr34, spr35, spr36, spr37, spr38, spr39,
spr40, spr41, spr42, spr43, spr44, spr45, spr46, spr47,
spr48, spr49, spr50, spr51, spr52, spr53, spr54, spr55,
spr56, spr57, spr58, spr59, spr60, spr61, spr62, spr63,
spr64, spr65, spr66, spr67, spr68, spr69, spr70, spr71,
spr72, spr73, spr74, spr75, spr76, spr77, spr78, spr79,
spr80, spr81, spr82, spr83, spr84, spr85, spr86, spr87,
spr88, spr89, spr90, spr91, spr92, spr93, spr94, spr95,
spr96, spr97, spr98, spr99, spr100, spr101, spr102, spr103,
spr104, spr105, spr106, spr107, spr108, spr109, spr110, spr111,
spr112, spr113, spr114, spr115, spr116, spr117, spr118, spr119,
spr120, spr121, spr122, spr123, spr124, spr125, spr126, spr127,
// virtual registers for code and data segments
rVcs,
rVds,
};
//------------------------------------------------------------------
// specific device name
extern char device[MAXSTR];
//------------------------------------------------------------------
// processor types
typedef uchar proctype_t;
const proctype_t SONY_PS3 = 0;
extern proctype_t ptype; // contains processor type
extern netnode helper;
extern ushort idpflags;
extern uint32 lslr_size;
//------------------------------------------------------------------
void header(void);
void footer(void);
void segstart(ea_t ea);
void segend(ea_t ea);
void assumes(ea_t ea); // function to produce assume directives
void out(void);
int outspec(ea_t ea,uchar segtype);
int ana(void);
int emu(void);
bool outop(op_t &op);
void data(ea_t ea);
int is_align_insn(ea_t ea);
#endif // _SPU_HPP
| [
"[email protected]@e74d8827-4242-54a7-4a26-1daa00ab3ef9"
]
| [
[
[
1,
143
]
]
]
|
20e9e9144fdd7fef9f1a8cb0435766a7896e8445 | 9dad473629c94d45041d51ae6c21ca2b477bd913 | /sources/rotation.cpp | 9e9df914992e5ae25186ab76d59da930a5a8e001 | []
| no_license | Mefteg/cheshire-csg | 26ed5682277beb6993f60da1604ddfe298f8caae | b12daf345c22065f5b30247d4b6c3395372849fb | refs/heads/master | 2021-01-10T20:13:34.474876 | 2011-10-03T21:57:49 | 2011-10-03T21:57:49 | 32,360,524 | 0 | 0 | null | null | null | null | WINDOWS-1252 | C++ | false | false | 2,128 | cpp | #include "rotation.h"
#include <math.h>
#define M_PI 3.14159265358979323846
Rotation::Rotation(void)
{
}
Rotation::Rotation(Node * left,const Vector v,float angle) : Transfo(left)
{
double rad = angle * M_PI / 180;
Normalized(v);
double c = cos(rad);
double s = sin(rad);
//construire la matrice de rotation autour de l'axe v
m(0,0) = v.x*v.x + (1-v.x*v.x)*c; m(0,1) = v.x*v.y*(1-c)-v.z*s; m(0,2) = v.x*v.z*(1-c)+v.y*s;
m(1,0) = v.x*v.y*(1-c)+v.z*s; m(1,1) = v.y*v.y+(1-v.y*v.y)*c; m(1,2) = v.y*v.z*(1-c)-v.x*s;
m(2,0) = v.x*v.z*(1-c)-v.y*s; m(2,1) = v.y*v.z*(1-c)+v.x*s; m(2,2) = v.z*v.z+(1-v.z*v.z)*c;
//garder la matrice de rotation pure
mRotate = m;
mRotateInv = mRotate.Invert(mRotate);
//matrice de translation de l'objet à l'origine
Matrix4Df tr;tr.SetIdentity();
Vector p = left->getPosition();
tr(0,3) = -1*p[0];
tr(1,3) = -1*p[1];
tr(2,3) = -1*p[2];
//matrice de translation inverse
Matrix4Df trInv;trInv.SetIdentity();
trInv = tr.Invert(tr);
m = trInv*m*tr;
//inverse de la matrice de rotation
mInv = m.Invert(m);
}
Rotation::~Rotation(void)
{
delete left;
}
int Rotation::Intersect(const Ray& ray, Intersection& t)
{
Intersection tt;
Ray r = Ray( mInv.MulPt(Vector(ray.Origin()[0],ray.Origin()[1],ray.Origin()[2])),
mInv.MulDir(ray.Direction()));
if(left->Intersect(r,tt)){
t=tt;
t.pos = m.MulPt(t.pos);
t.normal = m.MulPt(t.normal);
t.obj = this->left;
return 1;
}
return 0;
}
int Rotation::Intersect(const Ray& ray, Intersection& t, Intersection& t2)
{
Intersection tt,tt2;
Ray r = Ray( mInv.MulPt(Vector(ray.Origin()[0],ray.Origin()[1],ray.Origin()[2])),
mInv.MulDir(ray.Direction()));
if(left->Intersect(r,tt,tt2)){
//premiere intersection
t=tt;
t.pos = m.MulPt(t.pos);
t.normal = mRotate.MulDir(t.normal);
//deuxieme intersection
t2=tt2;
t2.pos = m.MulPt(t2.pos);
t2.normal = mRotate.MulDir(t2.normal);
return 1;
}
return 0;
}
int Rotation::PMC(const Vector& u)
{
return left->PMC(mInv.MulPt(u));
}
| [
"[email protected]@3040dc66-f2c5-6624-7679-62bdbddada0d",
"[email protected]@3040dc66-f2c5-6624-7679-62bdbddada0d"
]
| [
[
[
1,
44
],
[
47,
61
],
[
64,
83
],
[
86,
87
]
],
[
[
45,
46
],
[
62,
63
],
[
84,
85
]
]
]
|
850d1f19a351e7fb17cdb519c78d16729df11fc5 | 28aa891f07cc2240c771b5fb6130b1f4025ddc84 | /src/pbr_ctrl/pbr_ctrl.cpp | 226a5e37d37f0117292b067ee5c0a71e942df34c | []
| no_license | Hincoin/mid-autumn | e7476d8c9826db1cc775028573fc01ab3effa8fe | 5271496fb820f8ab1d613a1c2355504251997fef | refs/heads/master | 2021-01-10T19:17:01.479703 | 2011-12-19T14:32:51 | 2011-12-19T14:32:51 | 34,730,620 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 735 | cpp |
#include "oolua.h"
#include "pbr_ctrl.hpp"
#include "rpc_ctrl.hpp"
namespace ma{
void render_scene(const char* scene_file,int b,int e)
{
pbr_ctrl::get_controller().render_scene(scene_file,b,e);
}
}
namespace OOLUA{
using namespace ma;
LUA_EXPORT_FUNC(void(const char*,int,int), render_scene)
}
namespace ma
{
pbr_ctrl* pbr_ctrl::self_ = 0;
void pbr_ctrl::render_scene(const char* scene,int b,int e)
{
printf("render_scene %s\n",scene);
rpc::send_rpc<rpc::c2s::rpc_render_scene>(net::connection_write_handler_ptr(new rpc::rpc_null_handler()),connection_,std::string(scene),b,e);
}
void register_functions(lua_State* l)
{
using namespace OOLUA;
REGISTER_FUNC(l,render_scene);
}
}
| [
"luozhiyuan@ea6f400c-e855-0410-84ee-31f796524d81"
]
| [
[
[
1,
31
]
]
]
|
96e7961811ff4cc7537c8dba5bb57cb5744a0517 | 0f40e36dc65b58cc3c04022cf215c77ae31965a8 | /src/apps/vis/tasks/vis_tag_sampletask.cpp | fe8690c7e7acfc43cc25895c379eddb61bc66a0d | [
"MIT",
"BSD-3-Clause"
]
| permissive | venkatarajasekhar/shawn-1 | 08e6cd4cf9f39a8962c1514aa17b294565e849f8 | d36c90dd88f8460e89731c873bb71fb97da85e82 | refs/heads/master | 2020-06-26T18:19:01.247491 | 2010-10-26T17:40:48 | 2010-10-26T17:40:48 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,395 | cpp | /************************************************************************
** This file is part of the network simulator Shawn. **
** Copyright (C) 2004,2005 by SwarmNet (www.swarmnet.de) **
** and SWARMS (www.swarms.de) **
** Shawn is free software; you can redistribute it and/or modify it **
** under the terms of the GNU General Public License, version 2. **
************************************************************************/
#include "../buildfiles/_apps_enable_cmake.h"
#ifdef ENABLE_VIS
#include "apps/vis/tasks/vis_tag_sampletask.h"
#include "sys/world.h"
#include "sys/taggings/basic_tags.h"
#include "sys/tag.h"
#include <stdlib.h>
using namespace shawn;
namespace vis
{
TagSampleTask::
TagSampleTask()
{}
// ----------------------------------------------------------------------
TagSampleTask::
~TagSampleTask()
{}
// ----------------------------------------------------------------------
std::string TagSampleTask::
name( void )
const throw()
{ return "vis_tag_sample"; }
// ----------------------------------------------------------------------
std::string TagSampleTask::
description( void )
const throw()
{ return "Adds some sample string tags to nodes."; }
// ----------------------------------------------------------------------
void TagSampleTask::
run( SimulationController &sc )
throw( std::runtime_error )
{
VisualizationTask::run(sc);
World::node_iterator it = sc.world_w().begin_nodes_w();
World::node_iterator endit = sc.world_w().end_nodes_w();
bool second = true;
shawn::TagHandle tag = NULL;
shawn::TagHandle tag2 = NULL;
while(it != endit)
{
if(second)
{
tag = new shawn::StringTag("VisTestTag", "VisTagSecond");
}
else
{
tag = new shawn::StringTag("VisTestTag", "VisTagFirst");
}
double randomVal = (double)rand()/RAND_MAX;
tag2 = new shawn::DoubleTag("VisBattery", randomVal);
it->add_tag(tag);
it->add_tag(tag2);
second = !second;
++it;
}
std::cout << "Tags attached" << std::endl;
}
}
#endif
| [
"[email protected]"
]
| [
[
[
1,
81
]
]
]
|
a60aca19eb6cf425d7ce9c125f622862f66eb88c | d7ede0bd8c18e5f96a5f7eb4f15cd49526551dda | /trunk/libenet/ethread_win.h | d9efc0aedda30a0a2e2826ad0ad59b57a60195de | []
| no_license | BackupTheBerlios/enet-svn | 393a7af07228b060a6f4b27f695e819461a8bf2c | cf642cc9eb52be88b0c3d6702614e7088d6635a8 | refs/heads/master | 2020-05-31T18:31:51.496291 | 2009-09-27T16:36:06 | 2009-09-27T16:36:06 | 40,664,327 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 992 | h | #if defined(__WINDOWS__)
#ifndef __ethread_win_h__
#define __ethread_win_h__
#include <windows.h>
typedef unsigned int eThreadId;
class eThread;
/**
* \class eThreadImpl
* \author Eran
* \date 08/10/08
* \file ethread.h
* \brief Windows implemenation
*/
class eThreadImpl
{
HANDLE m_handle;
HANDLE m_stopEvent;
eThreadId m_tid;
public:
eThreadImpl();
virtual ~eThreadImpl();
/**
* \brief user calls this function to start the thread execution
*/
void run(eThread *thread);
// test the internal flag to see if a 'stop' request has been
// requested by caller
bool testDestroy();
// notify the running thread to termiante. note that this does not mean that the
// thread terminates instantly
void requestStop();
// wait for thread to terminate (wait for timeout milliseconds
void wait(long timeout);
eThreadId getThreadId() {return m_tid;}
};
#endif // __ethread_win_h__
#endif // __WINDOWS__
| [
"eranif@3d9df747-5a54-0410-aaa4-ef901a837724"
]
| [
[
[
1,
52
]
]
]
|
9ba296ccbfa88129227588f7e3446448fd298e1f | 724cded0e31f5fd52296d516b4c3d496f930fd19 | /source/Bittorrent/tools/libtorrenttest/libtorrent/Bittorrent.cpp | a06505c4778607a7ba82b4584f3e1c9791d3244b | []
| 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 | 11,872 | cpp | #include "stdafx.h"
#include ".\bittorrent.h"
#include "resource.h"
#include <objbase.h>
using std::pair;
using std::sort;
using std::vector;
using std::string;
using std::string;
using std::auto_ptr;
using std::exception;
using boost::filesystem::path;
using namespace boost::spirit;
using libtorrent::entry;
static const UINT columns[]={
IDS_NAME, IDS_SIZE, IDS_DOWNLOADED, IDS_UPLOADED,
IDS_STATUS, IDS_PROGRESS, IDS_DOWNSPEED, IDS_UPSPEED,
IDS_HEALTH, IDS_SEEDS, IDS_PEERS
};
static const size_t columncount=sizeof(columns)/sizeof(UINT);
struct Torrent {
std::string file;
libtorrent::torrent_handle handle;
string cols[columncount];
bool operator<(const Torrent &t) const {
return stricmp(cols[0].c_str(), t.cols[0].c_str())<0;
}
};
class Configuration {
public:
int uplimit, downlimit;
int firstport, lastport;
int maxcon, torrentmaxcon, maxup;
boost::filesystem::path savepath;
Configuration::Configuration() :
uplimit(-1),downlimit(-1),firstport(6881),lastport(6889),maxup(13),
maxcon(200),torrentmaxcon(140) {
char folder[MAX_PATH];
SHGetFolderPathA(NULL, CSIDL_PERSONAL|CSIDL_FLAG_CREATE, NULL, SHGFP_TYPE_CURRENT, folder);
boost::filesystem::path::default_name_check(boost::filesystem::native);
this->savepath=folder;
this->savepath/="btdowns";
}
bool Configuration::Load() {
try {
entry config=bdecode(getmodulepath()/"libtorrent.conf");
entry::dictionary_type &config_d=config.dict();
for(entry::dictionary_type::const_iterator iter=config_d.begin(); iter!=config_d.end(); iter++) {
if(iter->first=="network") {
const entry::dictionary_type &network=iter->second.dict();
for(entry::dictionary_type::const_iterator niter=network.begin(); niter!=network.end(); niter++) {
if(niter->first=="uplimit") this->uplimit=(int)niter->second.integer();
else if(niter->first=="downlimit") this->downlimit=(int)niter->second.integer();
else if(niter->first=="firstport") this->firstport=(int)niter->second.integer();
else if(niter->first=="lastport") this->lastport=(int)niter->second.integer();
}
}
else if(iter->first=="filesystem") {
const entry::dictionary_type &filesystem=iter->second.dict();
for(entry::dictionary_type::const_iterator fiter=filesystem.begin(); fiter!=filesystem.end(); fiter++) {
if(fiter->first=="savepath") this->savepath=fiter->second.string();
}
}
}
if(this->uplimit>-1 && this->uplimit<12) this->downlimit=this->uplimit*5;
}
catch(...) {
return false;
}
return true;
}
bool Configuration::Save() {
entry::dictionary_type config;
{
entry::dictionary_type network;
network.push_back(pair<string,entry>("uplimit", this->uplimit));
network.push_back(pair<string,entry>("downlimit", this->downlimit));
network.push_back(pair<string,entry>("firstport", this->firstport));
network.push_back(pair<string,entry>("lastport", this->lastport));
config.push_back(pair<string,entry>("network", network));
}
{
entry::dictionary_type filesystem;
filesystem.push_back(pair<string,entry>("savepath", this->savepath.native_directory_string()));
config.push_back(pair<string,entry>("filesystem", filesystem));
}
return bencode(getmodulepath()/"libtorrent.conf", config);
}
};
static libtorrent::session *session=NULL;
static vector<Torrent> torrents;
static bool allpaused=false;
Configuration conf;
static string paused;
static string queued;
static string checking;
static string connecting;
static string downloading;
static string seeding;
static string unknown;
static string bytes;
static string kibibytes;
static string mebibytes;
static string gibibytes;
static char *strsize(double s) {
double downloaded;
const char *units;
if(s>=1073741824) {
downloaded=s/1073741824.0;
units=gibibytes.c_str();
}
else if(s>=1048576) {
downloaded=s/1048576.0;
units=mebibytes.c_str();
}
else if(s>=1024) {
downloaded=s/1024.0;
units=kibibytes.c_str();
}
else {
downloaded=s;
units=bytes.c_str();
}
static char buf[64];
StringCchPrintf(buf, 64, "%.1f %s", downloaded, units);
return buf;
}
IBittorrent* CreateIBittorrent()
{
return new CBittorrent();
}
CBittorrent::CBittorrent(void)
{
}
CBittorrent::~CBittorrent(void)
{
}
static void AddTorrent(path file) {
try {
const path rfile=getmodulepath()/"resume"/file;
libtorrent::entry metadata=bdecode(file);
libtorrent::entry resumedata;
if(boost::filesystem::exists(rfile)) {
try {
resumedata=bdecode(rfile.leaf());
}
catch(...) {
char text[256], title[128];
LoadString(GetModuleHandle(NULL), IDS_RESUMEERR, title, 128);
LoadString(GetModuleHandle(NULL), IDS_RESUMEERRTEXT, text, 256);
boost::filesystem::remove(rfile);
}
}
if(!boost::filesystem::exists(getmodulepath()/"torrents"))
boost::filesystem::create_directory(getmodulepath()/"torrents");
if(!boost::filesystem::exists(getmodulepath()/"torrents"/file.leaf()))
boost::filesystem::copy_file(file, getmodulepath()/"torrents"/file.leaf());
if(!boost::filesystem::exists(conf.savepath))
boost::filesystem::create_directory(conf.savepath);
vector<libtorrent::torrent_handle>::size_type i=torrents.size();
Torrent t;
t.file=file.leaf();
t.handle=session->add_torrent(metadata, conf.savepath, resumedata);
t.handle.set_max_uploads(conf.maxup);
t.handle.set_max_connections(conf.maxcon);
const libtorrent::torrent_info &info=t.handle.get_torrent_info();
t.cols[0]=info.name();
t.cols[1]=strsize((double)info.total_size());
torrents.push_back(t);
sort(torrents.begin(), torrents.end());
if(allpaused) t.handle.pause();
}
catch(exception &ex) {
string text=ex.what();
string caption=loadstring(IDS_EXCEPTION);
}
}
bool CBittorrent::InitModule( IBittorrentNotify* notify )
{
notify_ =notify;
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
if(!conf.Load()) {
conf.Save();
}
try {
session=new libtorrent::session(libtorrent::fingerprint("AR", 1, 0, 0, 1), pair<int,int>(conf.firstport, conf.lastport));
session->disable_extensions();
session->enable_extension(libtorrent::peer_connection::extended_metadata_message);
session->enable_extension(libtorrent::peer_connection::extended_peer_exchange_message);
session->enable_extension(libtorrent::peer_connection::extended_listen_port_message);
session->set_upload_rate_limit((conf.uplimit!=-1)?conf.uplimit*1024:-1);
session->set_download_rate_limit((conf.downlimit!=-1)?conf.downlimit*1024:-1);
session->set_max_connections(conf.maxcon);
#ifdef _DEBUG
session->set_severity_level(libtorrent::alert::debug);
#else
session->set_severity_level(libtorrent::alert::info);
#endif
}
catch(exception &ex) {
return false;
}
paused=loadstring(IDS_PAUSED);
queued=loadstring(IDS_QUEUED);
checking=loadstring(IDS_CHECKING);
connecting=loadstring(IDS_CONNECTING);
downloading=loadstring(IDS_DOWNLOADING);
seeding=loadstring(IDS_SEEDING);
unknown=loadstring(IDS_UNKNOWN);
bytes=loadstring(IDS_BYTES);
kibibytes=loadstring(IDS_KIBIBYTES);
mebibytes=loadstring(IDS_MEBIBYTES);
gibibytes=loadstring(IDS_GIBIBYTES);
path p=getmodulepath()/"torrents";
//WIN32_FIND_DATAA finddata={0};
//HANDLE find=FindFirstFileA((p/"*.torrent").native_file_string().c_str(), &finddata);
//if(find!=INVALID_HANDLE_VALUE) {
// do AddTorrent(p/finddata.cFileName);
// while(FindNextFileA(find, &finddata));
// FindClose(find);
//}
return true;
}
void CBittorrent::ReleaseModule()
{
path p=getmodulepath()/"resume";
CreateDirectoryA(p.native_directory_string().c_str(), NULL);
for(vector<Torrent>::size_type i=0; i<torrents.size(); i++) {
torrents[i].handle.pause();
libtorrent::entry e=torrents[i].handle.write_resume_data();
bencode(p/torrents[i].file, e);
}
delete session;
conf.Save();
delete this;
}
DWORD CBittorrent::OpenSource( const char* szUrl, bool bSource )
{
path file =szUrl;
AddTorrent(file);
return 0;
}
void CBittorrent::CloseSource( DWORD dwChannelID )
{
}
void CBittorrent::RequestSegment( DWORD dwChannelID, DWORD dwStartPos, DWORD dwLength )
{
}
bool CBittorrent::ReadSegment( DWORD dwChannelID, DWORD dwStartPos, char* pBuffer, DWORD& dwLength )
{
return false;
}
LONGLONG CBittorrent::GetChannelSize( DWORD dwChannelID )
{
return 0;
}
bool CBittorrent::GetChannelMonitorInfo( DWORD dwChannelID, stMonitorInfo& monInfo)
{
return false;
}
bool CBittorrent::GetChannelMonitorInfo( const char* szChannelHash, stMonitorInfo& monInfo)
{
return false;
}
bool CBittorrent::GetAllChannelID( list<DWORD>& listChannels)
{
return false;
}
void CBittorrent::tick_it()
{
static DWORD count = 0;
static DWORD ts = GetTickCount();
if ( ts + 1000 > GetTickCount())
return;
ts = GetTickCount();
count++;
char buf[32];
libtorrent::session_status s=session->status();
for(vector<Torrent>::size_type i=0; i<torrents.size(); i++) {
try {
libtorrent::torrent_status status=torrents[i].handle.status();
torrents[i].cols[2]=strsize((double)status.total_done);
torrents[i].cols[3]=strsize((double)status.total_upload);
if(status.paused) torrents[i].cols[4]=paused;
else switch(status.state) {
case libtorrent::torrent_status::queued_for_checking:
torrents[i].cols[4]=queued;
break;
case libtorrent::torrent_status::checking_files:
torrents[i].cols[4]=checking;
break;
case libtorrent::torrent_status::connecting_to_tracker:
torrents[i].cols[4]=connecting;
break;
case libtorrent::torrent_status::downloading:
case libtorrent::torrent_status::downloading_metadata:
torrents[i].cols[4]=downloading;
break;
case libtorrent::torrent_status::seeding:
torrents[i].cols[4]=seeding;
break;
default:
torrents[i].cols[4]=unknown;
break;
}
StringCchPrintf(buf, 32, "%.1f%%", (double)status.progress*100.0);
torrents[i].cols[5]=buf;
StringCchPrintf(buf, 32, "%s/s", strsize(status.download_rate));
torrents[i].cols[6]=buf;
StringCchPrintf(buf, 32, "%s/s", strsize(status.upload_rate));
torrents[i].cols[7]=buf;
StringCchPrintf(buf, 32, "%d%%", (int)(status.distributed_copies*100.0f));
torrents[i].cols[8]=buf;
torrents[i].cols[9]=_itoa(status.num_seeds, buf, 10);
torrents[i].cols[10]=_itoa(status.num_peers, buf, 10);
////////////////////////////////////////////////////////////
/// Process alerts
bool bprintf =false;
for(auto_ptr<libtorrent::alert> a=session->pop_alert(); a.get(); a=session->pop_alert()) {
string timestamp=to_simple_string(a->timestamp().time_of_day());
string message=a->msg();
printf("%s : %s\n", timestamp.c_str(), message.c_str());
bprintf = true;
}
if ( count % 5 == 0)
{
for( int j = 0; j < columncount; j++)
{
char buf[1024];
int len=LoadString(GetModuleHandle(NULL), columns[j], buf, 1024);
printf( "%s:%s\n", buf, torrents[i].cols[j].c_str());
}
StringCchPrintf(buf, 32, "D:%s/s", strsize(s.download_rate));
printf("%s,", buf);
StringCchPrintf(buf, 32, "U:%s/s", strsize(s.upload_rate));
printf("%s", buf);
printf("\n\n");
}
//after one minute force get announce url
if ( count % 60 == 0)
torrents[i].handle.force_reannounce();
}
catch(exception &ex) {
string text=ex.what();
printf("%s : %s", text.c_str(), "Exception");
continue;
}
}
} | [
"fuwenke@b5bb1052-fe17-11dd-bc25-5f29055a2a2d"
]
| [
[
[
1,
429
]
]
]
|
6b08698b2743cfa50af807f8d42ea7c349b207a8 | cbb40e1d71bc4585ad3a58d32024090901487b76 | /trunk/tokamaksrc/src/perflinux.cpp | 74228f43ca3a0cebfbcd754cc8f5cf2484acf42c | []
| no_license | huangleon/tokamak | c0dee7b8182ced6b514b37cf9c526934839c6c2e | 0218e4d17dcf93b7ab476e3e8bd4026f390f82ca | refs/heads/master | 2021-01-10T10:11:42.617076 | 2011-08-22T02:32:16 | 2011-08-22T02:32:16 | 50,816,154 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,807 | cpp | /*************************************************************************
* *
* Tokamak Physics Engine, Copyright (C) 2002-2007 David Lam. *
* All rights reserved. Email: [email protected] *
* Web: www.tokamakphysics.com *
* *
* This library 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 files *
* LICENSE.TXT for more details. *
* *
*************************************************************************/
#include "math/ne_type.h"
#include "math/ne_debug.h"
#include "tokamak.h"
#include "containers.h"
#include "scenery.h"
#include "collision.h"
#include "constraint.h"
#include "rigidbody.h"
#include "scenery.h"
#include "stack.h"
#include "simulator.h"
#include "perflinux.h"
#include <sys/time.h>
namespace Tokamak {
nePerformanceData * nePerformanceData::Create()
{
return new nePerformanceData;
}
s64 perfFreq;
timeval counter;
/****************************************************************************
*
* nePerformanceData::Start
*
****************************************************************************/
void DunselFunction() { return; }
void nePerformanceData::Init()
{
Reset();
void (*pFunc)() = DunselFunction;
gettimeofday(&counter, NULL);
}
void nePerformanceData::Start()
{
Reset();
gettimeofday(&counter, NULL);
}
f32 nePerformanceData::GetCount()
{
timeval tStart, tStop;
f32 start, end;
tStart = counter;
gettimeofday(&tStop, NULL);
start = (tStart.tv_sec * 1000000.0) + tStart.tv_usec;
end = (tStop.tv_sec * 1000000.0) + tStop.tv_usec;
return (end - start) * 0.000001;
}
void nePerformanceData::UpdateDynamic()
{
dynamic += GetCount();
}
void nePerformanceData::UpdatePosition()
{
position += GetCount();
}
void nePerformanceData::UpdateConstrain1()
{
constrain_1 += GetCount();
}
void nePerformanceData::UpdateConstrain2()
{
constrain_2 += GetCount();
}
void nePerformanceData::UpdateCD()
{
cd += GetCount();
}
void nePerformanceData::UpdateCDCulling()
{
cdCulling += GetCount();
}
void nePerformanceData::UpdateTerrain()
{
terrain += GetCount();
}
void nePerformanceData::UpdateControllerCallback()
{
controllerCallback += GetCount();
}
void nePerformanceData::UpdateTerrainCulling()
{
terrainCulling += GetCount();
}
}
| [
"[email protected]"
]
| [
[
[
1,
116
]
]
]
|
6e231d84d4ca80916a4d4b35e9ffb178d343df7d | 989aa92c9dab9a90373c8f28aa996c7714a758eb | /HydraIRC/FavoritesDlg.h | 25b56e81028cb4d61efff4a218443103ea789564 | []
| no_license | john-peterson/hydrairc | 5139ce002e2537d4bd8fbdcebfec6853168f23bc | f04b7f4abf0de0d2536aef93bd32bea5c4764445 | refs/heads/master | 2021-01-16T20:14:03.793977 | 2010-04-03T02:10:39 | 2010-04-03T02:10:39 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,728 | h | /*
HydraIRC
Copyright (C) 2002-2006 Dominic Clifton aka Hydra
HydraIRC limited-use source license
1) You can:
1.1) Use the source to create improvements and bug-fixes to send to the
author to be incorporated in the main program.
1.2) Use it for review/educational purposes.
2) You can NOT:
2.1) Use the source to create derivative works. (That is, you can't release
your own version of HydraIRC with your changes in it)
2.2) Compile your own version and sell it.
2.3) Distribute unmodified, modified source or compiled versions of HydraIRC
without first obtaining permission from the author. (I want one place
for people to come to get HydraIRC from)
2.4) Use any of the code or other part of HydraIRC in anything other than
HydraIRC.
3) All code submitted to the project:
3.1) Must not be covered by any license that conflicts with this license
(e.g. GPL code)
3.2) Will become the property of the author.
*/
// FavoritesDlg.h : interface of the CFavoritesDlg class
//
/////////////////////////////////////////////////////////////////////////////
#pragma once
template <class T>
class CTVEditT :
public CWindowImpl<CTVEditT<T> ,CEdit>
{
public:
BEGIN_MSG_MAP(CTVEditT< T >)
MESSAGE_HANDLER(WM_GETDLGCODE , OnWMGETDLGCODE )
END_MSG_MAP()
LRESULT OnWMGETDLGCODE( UINT uMsg,
WPARAM wParam,
LPARAM lParam,
BOOL& bHandled)
{
return (DLGC_WANTALLKEYS);
}
};
typedef CTVEditT<CWindow> CTVEdit;
class CFavoritesDlg :
public CDialogImpl<CFavoritesDlg>,
public CDialogResize<CFavoritesDlg>
{
private:
// Controls
CTreeViewCtrl m_TreeCtrl;
CTVEdit m_TVEdit;
CStatic m_NoteCtrl;
//CButton m_AddCtrl;
//CButton m_DeleteCtrl;
//CButton m_NewFolderCtrl;
CSimpleArray<TreeItemInfo *> m_TIIList;
// for dragging and dropping...
CImageList m_DragImage;
BOOL m_bLDragging;
HTREEITEM m_hitemDrag,m_hitemDrop,m_hRootItem;
HCURSOR m_dropCursor,m_noDropCursor;
xmlNodePtr m_pDragSourceNode;
public:
enum { IDD = IDD_FAVORITES };
CFavoritesDlg( void );
~CFavoritesDlg( void );
void DeleteSelectedItem( void );
BEGIN_MSG_MAP(CFavoritesDlg)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_ID_HANDLER(IDOK, OnOKCmd)
COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove)
MESSAGE_HANDLER(WM_LBUTTONUP, OnMouseButtonUp)
NOTIFY_HANDLER(IDC_FAVORITES_TREE, TVN_ENDLABELEDIT, OnTvnEndlabeleditFavoritesTree)
NOTIFY_HANDLER(IDC_FAVORITES_TREE, TVN_SELCHANGED, OnTvnSelchangedFavoritesTree)
NOTIFY_HANDLER(IDC_FAVORITES_TREE, TVN_BEGINLABELEDIT, OnTvnBeginlabeleditFavoritesTree)
COMMAND_HANDLER(IDC_FAVORITES_NEWFOLDER, BN_CLICKED, OnBnClickedFavoritesNewfolder)
COMMAND_HANDLER(IDC_FAVORITES_DELETE, BN_CLICKED, OnBnClickedFavoritesDelete)
NOTIFY_HANDLER(IDC_FAVORITES_TREE, TVN_BEGINDRAG, OnTvnBegindragFavoritesTree)
NOTIFY_HANDLER(IDC_FAVORITES_TREE, TVN_KEYDOWN, OnTvnKeydownFavoritesTree)
CHAIN_MSG_MAP(CDialogResize<CFavoritesDlg>)
END_MSG_MAP()
BEGIN_DLGRESIZE_MAP(CFavoritesDlg)
DLGRESIZE_CONTROL(IDC_FAVORITES_TREE ,DLSZ_SIZE_X | DLSZ_SIZE_Y)
DLGRESIZE_CONTROL(IDOK ,DLSZ_MOVE_X | DLSZ_MOVE_Y)
DLGRESIZE_CONTROL(IDC_FAVORITES_NOTE ,DLSZ_MOVE_Y | DLSZ_SIZE_X)
DLGRESIZE_CONTROL(IDC_FAVORITES_NEWFOLDER ,DLSZ_MOVE_Y )
DLGRESIZE_CONTROL(IDC_FAVORITES_DELETE ,DLSZ_MOVE_Y )
END_DLGRESIZE_MAP()
// Handler prototypes (uncomment arguments if needed):
// LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
// LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
// LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/)
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnOKCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnTvnEndlabeleditFavoritesTree(int /*idCtrl*/, LPNMHDR pNMHDR, BOOL& /*bHandled*/);
LRESULT OnTvnSelchangedFavoritesTree(int /*idCtrl*/, LPNMHDR pNMHDR, BOOL& /*bHandled*/);
LRESULT OnTvnBeginlabeleditFavoritesTree(int /*idCtrl*/, LPNMHDR pNMHDR, BOOL& /*bHandled*/);
LRESULT OnBnClickedFavoritesNewfolder(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnBnClickedFavoritesDelete(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnTvnKeydownFavoritesTree(int /*idCtrl*/, LPNMHDR pNMHDR, BOOL& /*bHandled*/);
// drag and drop...
LRESULT OnMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnMouseButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnTvnBegindragFavoritesTree(int /*idCtrl*/, LPNMHDR pNMHDR, BOOL& /*bHandled*/);
};
class CFavoritesAddDlg :
public CDialogImpl<CFavoritesAddDlg>,
public CDialogResize<CFavoritesAddDlg>
{
private:
// Controls
CTreeViewCtrl m_TreeCtrl;
CTVEdit m_TVEdit;
CEdit m_NameCtrl;
//CComboBox m_TypeCtrl;
CSimpleArray<TreeItemInfo *> m_TIIList;
HTREEITEM m_hRootItem;
xmlNodePtr m_pDestNode,m_pNewNode;
public:
enum { IDD = IDD_FAVORITESADD };
CFavoritesAddDlg( xmlNodePtr pNewNode );
~CFavoritesAddDlg( void );
BEGIN_MSG_MAP(CFavoritesAddDlg)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_ID_HANDLER(IDOK, OnOKCmd)
COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
NOTIFY_HANDLER(IDC_FAVORITESADD_TREE, TVN_SELCHANGED, OnTvnSelchangedFavoritesTree)
COMMAND_HANDLER(IDC_FAVORITESADD_NEWFOLDER, BN_CLICKED, OnBnClickedFavoritesaddNewfolder)
NOTIFY_HANDLER(IDC_FAVORITESADD_TREE, TVN_BEGINLABELEDIT, OnTvnBeginlabeleditFavoritesaddTree)
NOTIFY_HANDLER(IDC_FAVORITESADD_TREE, TVN_ENDLABELEDIT, OnTvnEndlabeleditFavoritesaddTree)
CHAIN_MSG_MAP(CDialogResize<CFavoritesAddDlg>)
END_MSG_MAP()
BEGIN_DLGRESIZE_MAP(CFavoritesAddDlg)
DLGRESIZE_CONTROL(IDC_FAVORITESADD_TREE ,DLSZ_SIZE_X | DLSZ_SIZE_Y)
DLGRESIZE_CONTROL(IDOK ,DLSZ_MOVE_X)
DLGRESIZE_CONTROL(IDCANCEL ,DLSZ_MOVE_X)
DLGRESIZE_CONTROL(IDC_FAVORITESADD_NAME ,DLSZ_SIZE_X)
DLGRESIZE_CONTROL(IDC_FAVORITESADD_NEWFOLDER ,DLSZ_MOVE_X)
END_DLGRESIZE_MAP()
// Handler prototypes (uncomment arguments if needed):
// LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
// LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
// LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/)
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
LRESULT OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnOKCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnTvnSelchangedFavoritesTree(int /*idCtrl*/, LPNMHDR pNMHDR, BOOL& /*bHandled*/);
LRESULT OnBnClickedFavoritesaddNewfolder(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
LRESULT OnTvnBeginlabeleditFavoritesaddTree(int /*idCtrl*/, LPNMHDR pNMHDR, BOOL& /*bHandled*/);
LRESULT OnTvnEndlabeleditFavoritesaddTree(int /*idCtrl*/, LPNMHDR pNMHDR, BOOL& /*bHandled*/);
};
| [
"hydra@b2473a34-e2c4-0310-847b-bd686bddb4b0"
]
| [
[
[
1,
191
]
]
]
|
34fde1063507e6f2d7695f5827dd6872b65a8041 | ce0622a0f49dd0ca172db04efdd9484064f20973 | /tools/GameList/Tools.h | 9c79216969049fb2fac91068fc15123843ffdc8c | []
| no_license | maninha22crazy/xboxplayer | a78b0699d4002058e12c8f2b8c83b1cbc3316500 | e9ff96899ad8e8c93deb3b2fe9168239f6a61fe1 | refs/heads/master | 2020-12-24T18:42:28.174670 | 2010-03-14T13:57:37 | 2010-03-14T13:57:37 | 56,190,024 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 11,242 | h | #pragma once
#include <xtl.h>
#include <xui.h>
#include <xuiapp.h>
#include <fstream>
#include <string>
#include <vector>
#include <hash_map>
#include <map>
using namespace std;
using namespace stdext;
#define TOOLS_API
#ifndef SAFE_DELETE
#define SAFE_DELETE(x) { if (x) { delete x; x = NULL; } }
#endif
#ifndef SAFE_DELETE_A
#define SAFE_DELETE_A(x) { if (x) { delete[] x; x = NULL; } }
#endif
#ifndef SAFE_RELEASE
#define SAFE_RELEASE(x) { if (x) { x->Release(); x = NULL; } }
#endif
struct TOOLS_API DI_Item {
wstring FileName;
long FileSize;
wstring Path;
int attribs;
};
// get time in ms since app started
TOOLS_API int GetTime();
// scale an interger by sf. rounds to nearest int
inline int Scale(int num, float sf)
{
return (int)((float)num * sf);
}
inline int ScaleFloor(int num, float sf)
{
return (int)(floor((float)num * sf));
}
inline int ScaleCeil(int num, float sf)
{
return (int)(ceil((float)num * sf));
}
////////////////////
// string tools
////////////////////
#ifdef _UNICODE
#define Tokenize TokenizeW
#define make_lowercase make_lowercaseW
#define make_uppercase make_uppercaseW
#else
#define Tokenize TokenizeA
#define make_lowercase make_lowercaseA
#define make_uppercase make_uppercaseA
#endif
// break a string down by a delimeter
TOOLS_API void TokenizeA(const string& str,
vector<string>& tokens,
const string& delimiters = " ");
TOOLS_API void TokenizeW(const wstring& str,
vector<wstring>& tokens,
const wstring& delimiters = L" ");
// lowercase string
TOOLS_API string make_lowercaseA(string s);
TOOLS_API wstring make_lowercaseW(wstring s);
// uppercase string
TOOLS_API string make_uppercaseA(string s);
TOOLS_API wstring make_uppercaseW(wstring s);
// Title Case String
TOOLS_API wstring make_titlecase(wstring s);
// Turn string into text numebr input
TOOLS_API wstring make_numeric(wstring s);
#ifdef _UNICODE
#define TrimLeft TrimLeftW
#define TrimRight TrimRightW
#define Trim TrimW
#else
#define TrimLeft TrimLeftA
#define TrimRight TrimRightA
#define Trim TrimA
#endif
// trim various chars from a string
TOOLS_API string TrimLeftA(string str);
TOOLS_API string TrimRightA(string str);
TOOLS_API string TrimA(string s);
// trim various chars from a string
TOOLS_API wstring TrimLeftW(wstring str);
TOOLS_API wstring TrimRightW(wstring str);
TOOLS_API wstring TrimW(wstring s);
// routines for making keypad filter display
TOOLS_API wstring make_filter_label(wstring filter, wstring text);
TOOLS_API wstring make_filter_label_2(wstring filter);
TOOLS_API wstring replace_numtochar(wstring in);
TOOLS_API wstring replace_noncharnum(wstring in);
// NO IDEA
TOOLS_API wstring TrimRightStr(wstring str,wstring crop);
// format time, from either ms or s (milliseconds or seconds)
TOOLS_API wstring mstohms(int time);
TOOLS_API wstring stohms(int time);
// format a filesize from size in Kb
TOOLS_API wstring format_size(wstring in);
TOOLS_API wstring format_size(int in);
// URL Encoding and Decoding
//TOOLS_API wstring UriDecode(const wstring & sSrc);
//TOOLS_API wstring UriEncode(const wstring & sSrc);
TOOLS_API wstring escape(wstring in); // break out html chars
TOOLS_API wstring unescape(wstring in);
// generic printf to make a string
#ifdef _UNICODE
#define sprintfa sprintfaW
#else
#define sprintfa sprintfaA
#endif
TOOLS_API string sprintfaA(const char *format, ...);
TOOLS_API wstring sprintfaW(const WCHAR *format, ...);
// Sort functions
TOOLS_API bool SortAlphabetical(const wstring left, const wstring right) ;
// convert to and from wide strings
TOOLS_API string wstrtostr(wstring wstr);
TOOLS_API wstring strtowstr(string str);
// Quick text to float routines
TOOLS_API WCHAR* fast_atof_move(WCHAR* c, float& out);
TOOLS_API const WCHAR* fast_atof_move_const(const WCHAR* c, float& out);
TOOLS_API float fast_atof(const WCHAR* c);
/////////////////////////
// Filesystem stuff
//////////////////////////
TOOLS_API void FindDataToStats(WIN32_FIND_DATA* findFileData, int & size, int & modified);
TOOLS_API int GetFileCreated(wstring filename);
TOOLS_API bool IsFolder(string filename);
TOOLS_API wstring ImageFromFolder(wstring path);
TOOLS_API wstring ImageFromFolderQuick(wstring path);
TOOLS_API int FilesInDir(wstring path);
TOOLS_API bool DirectoryInfo(wstring directory, vector<DI_Item>& files, vector<DI_Item>& folders, bool clear = true);
#ifdef _UNICODE
#define LastFolder LastFolderW
#define FileExt FileExtW
#define FileNoExt FileNoExtW
#define FileExists FileExistsW
#define str_replace str_replaceW
#define str_replaceall str_replaceallW
#else
#define LastFolder LastFolderA
#define FileExt FileExtA
#define FileNoExt FileNoExtA
#define FileExists FileExistsA
#define str_replace str_replaceA
#define str_replaceall str_replaceallA
#endif
TOOLS_API string LastFolderA(string folder);
TOOLS_API string FileExtA(string filename);
TOOLS_API string FileNoExtA(string filename);
TOOLS_API int FileExistsA(string filename);
TOOLS_API string str_replaceA(string source, string find, string replace);
TOOLS_API string str_replaceallA(string source, string find, string replace);
TOOLS_API wstring LastFolderW(wstring folder);
TOOLS_API wstring FileExtW(wstring filename);
TOOLS_API wstring FileNoExtW(wstring filename);
TOOLS_API int FileExistsW(wstring filename);
TOOLS_API wstring str_replaceW(wstring source, wstring find, wstring replace);
TOOLS_API wstring str_replaceallW(wstring source, wstring find, wstring replace);
//////////////////////////////////////////////
// output html list of commandparts into result
TOOLS_API void outputcmd(vector<wstring> commandparts, vector<wstring>& result);
// client window control stuff
TOOLS_API void RestoreClient();
TOOLS_API void MinimizeClient();
TOOLS_API HWND FindClient();
#ifdef _UNICODE
#define StringToFile StringToFileW
#define FileToString FileToStringW
#else
#define StringToFile StringToFileA
#define FileToString FileToStringA
#endif
// save and load a string to/from a file
TOOLS_API void StringToFileA(string &data, string filename);
TOOLS_API void FileToStringA(string & result, string filename);
TOOLS_API inline void StringToFileA(string &data, wstring filename)
{
return StringToFileA(data,wstrtostr(filename));
}
TOOLS_API inline void FileToStringA(string & result, wstring filename)
{
return FileToStringA(result,wstrtostr(filename));
}
TOOLS_API void StringToFileW(wstring &data, wstring filename);
TOOLS_API void FileToStringW(wstring & result, wstring filename);
// check if a string in is a list of extensions
TOOLS_API bool ExtInList(wstring ext, vector<string>* filetypes);
struct DriveInfo
{
wstring letter;
wstring desc;
int type;
int ready;
int SizeMb;
int FreeMb;
};
TOOLS_API void GetDriveList(vector <DriveInfo> & results);
TOOLS_API void GetDriveInfo(const WCHAR * unit, DriveInfo & di);
// uid stuff
TOOLS_API unsigned int MakeUID();
TOOLS_API wstring MakeBigUID();
// The following class defines a hash function for strings
class stringhasher : public stdext::hash_compare <std::wstring>
{
public:
size_t operator() (const wstring& s) const
{
size_t hash = 5381;
for(size_t i = 0; i < s.length(); i++)
{
hash = ((hash << 5) + hash) + (s[i] | 0x20);
}
return hash;
}
bool operator() (const std::wstring& s1, const std::wstring& s2) const
{
return s1 < s2;
}
};
//string MyAppPath;
TOOLS_API void CleanDir(wstring source);
enum CacheStyle {
CS_IMAGE,
CS_IMDBCOVER,
CS_SMALL,
};
TOOLS_API DWORD ParseHTMLColor(wstring color);
TOOLS_API int PickValue(map<wstring, int>& values, wstring value, int defaultval);
TOOLS_API bool HTMLYesNo(wstring text);
TOOLS_API bool FirstInFolder(wstring path, wstring filename, vector <wstring> * filetypes = NULL);
TOOLS_API wstring GetSpecialFolderPath(int PathID);
TOOLS_API inline wstring DOWToDay(int DOW)
{
switch (DOW)
{
case 0:
return L"Sunday";
case 1:
return L"Monday";
case 2:
return L"Tuesday";
case 3:
return L"Wednesday";
case 4:
return L"Thursday";
case 5:
return L"Friday";
case 6:
return L"Saturday";
}
return L"";
}
TOOLS_API inline wstring DOWToDayS(int DOW)
{
switch (DOW)
{
case 0:
return L"Sun";
case 1:
return L"Mon";
case 2:
return L"Tue";
case 3:
return L"Wed";
case 4:
return L"Thu";
case 5:
return L"Fri";
case 6:
return L"Sat";
}
return L"";
}
TOOLS_API inline wstring MonthToStr(int Month)
{
switch (Month)
{
case 1:
return L"Janurary";
case 2:
return L"Feburary";
case 3:
return L"March";
case 4:
return L"April";
case 5:
return L"May";
case 6:
return L"June";
case 7:
return L"July";
case 8:
return L"August";
case 9:
return L"September";
case 10:
return L"October";
case 11:
return L"November";
case 12:
return L"December";
}
return L"";
}
TOOLS_API inline wstring DayToDayth(int Dayno)
{
int last = Dayno % 10;
wstring day = sprintfa(L"%d",Dayno);
switch (last)
{
case 1:
return day + L"st";
case 2:
return day + L"nd";
case 3:
return day + L"rd";
case 0:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
return day + L"th";
}
return day;
}
TOOLS_API wstring SortVideoTSName(wstring path, wstring filename);
TOOLS_API inline void UnixTimeToFileTime(time_t t, LPFILETIME pft)
{
// Note that LONGLONG is a 64-bit value
LONGLONG ll;
ll = Int32x32To64(t, 10000000) + 116444736000000000;
pft->dwLowDateTime = (DWORD)ll;
pft->dwHighDateTime = (DWORD)(ll >> 32);
}
TOOLS_API inline void UnixTimeToSystemTime(time_t t, LPSYSTEMTIME pst)
{
FILETIME ft;
UnixTimeToFileTime(t, &ft);
FileTimeToSystemTime(&ft, pst);
}
TOOLS_API inline time_t FILETIMEtoUnix(FILETIME * ft)
{
LONGLONG ll;
ll = (LONGLONG)ft->dwLowDateTime + ((LONGLONG)ft->dwHighDateTime << 32);
ll -= 116444736000000000;
ll /= 10000000;
return (time_t)ll;
}
#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64
#else
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL
#endif
struct timezone
{
int tz_minuteswest; /* minutes W of Greenwich */
int tz_dsttime; /* type of dst correction */
};
TOOLS_API int gettimeofday(struct timeval *tv, struct timezone *tz);
TOOLS_API BOOL DeleteDirectory(const WCHAR* sPath);
TOOLS_API inline void GenSRand()
{
struct timeval tv;
gettimeofday(&tv, NULL);
srand((unsigned int)(((tv.tv_usec << 12) | (tv.tv_sec & 0xFFF)) ^ 5467203459UL));
}
TOOLS_API string UTF16toUTF8(const wstring & in);
#ifdef _UNICODE
#define DecodeHtml DecodeHtmlW
#else
#define DecodeHtml DecodeHtmlA
#endif
TOOLS_API string DecodeHtmlA(string in);
TOOLS_API wstring DecodeHtmlW(wstring in);
TOOLS_API wstring DecodeHtmlW(string in);
void aGetFileSize(string filename, DWORD & modified, DWORD & high); | [
"eme915@343f5ee6-a13e-11de-ba2c-3b65426ee844"
]
| [
[
[
1,
464
]
]
]
|
9f784509277b242f6916ee093ff6c7a47fcabb6e | 59abf9cf4595cc3d2663fcb38bacd328ab6618af | /3Party/squirrel/sqstdlib/sqstdstring.cpp | d366aa90a65287e08c507244c137715a0410791d | []
| no_license | DrDrake/mcore3d | 2ce53148ae3b9c07a3d48b15b3f1a0eab7846de6 | 0bab2c59650a815d6a5b581a2c2551d0659c51c3 | refs/heads/master | 2021-01-10T17:08:00.014942 | 2011-03-18T09:16:28 | 2011-03-18T09:16:28 | 54,134,775 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,278 | cpp | /* see copyright notice in squirrel.h */
#include "../squirrel.h"
#include "../sqstdstring.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <assert.h>
#ifdef SQUNICODE
#define scstrchr wcschr
#define scsnprintf wsnprintf
#define scatoi _wtoi
#define scstrtok wcstok
#else
#define scstrchr strchr
#define scsnprintf snprintf
#define scatoi atoi
#define scstrtok strtok
#endif
#define MAX_FORMAT_LEN 20
#define MAX_WFORMAT_LEN 3
#define ADDITIONAL_FORMAT_SPACE (100*sizeof(SQChar))
static SQInteger validate_format(HSQUIRRELVM v, SQChar *fmt, const SQChar *src, SQInteger n,SQInteger &width)
{
SQChar swidth[MAX_WFORMAT_LEN];
SQInteger wc = 0;
SQInteger start = n;
fmt[0] = '%';
while (scstrchr(_SC("-+ #0"), src[n])) n++;
while (scisdigit(src[n])) {
swidth[wc] = src[n];
n++;
wc++;
if(wc>=MAX_WFORMAT_LEN)
return sq_throwerror(v,_SC("width format too long"));
}
swidth[wc] = '\0';
if(wc > 0) {
width = scatoi(swidth);
}
else
width = 0;
if (src[n] == '.') {
n++;
wc = 0;
while (scisdigit(src[n])) {
swidth[wc] = src[n];
n++;
wc++;
if(wc>=MAX_WFORMAT_LEN)
return sq_throwerror(v,_SC("precision format too long"));
}
swidth[wc] = '\0';
if(wc > 0) {
width += scatoi(swidth);
}
}
if (n-start > MAX_FORMAT_LEN )
return sq_throwerror(v,_SC("format too long"));
memcpy(&fmt[1],&src[start],((n-start)+1)*sizeof(SQChar));
fmt[(n-start)+2] = '\0';
return n;
}
SQRESULT sqstd_format(HSQUIRRELVM v,SQInteger nformatstringidx,SQInteger *outlen,SQChar **output)
{
const SQChar *format;
SQChar *dest;
SQChar fmt[MAX_FORMAT_LEN];
sq_getstring(v,nformatstringidx,&format);
SQInteger allocated = (sq_getsize(v,nformatstringidx)+2)*sizeof(SQChar);
dest = sq_getscratchpad(v,allocated);
SQInteger n = 0,i = 0, nparam = nformatstringidx+1, w = 0;
while(format[n] != '\0') {
if(format[n] != '%') {
assert(i < allocated);
dest[i++] = format[n];
n++;
}
else if(format[n+1] == '%') { //handles %%
dest[i++] = '%';
n += 2;
}
else {
n++;
if( nparam > sq_gettop(v) )
return sq_throwerror(v,_SC("not enough paramters for the given format string"));
n = validate_format(v,fmt,format,n,w);
if(n < 0) return -1;
SQInteger addlen = 0;
SQInteger valtype = 0;
const SQChar *ts;
SQInteger ti;
SQFloat tf;
switch(format[n]) {
case 's':
if(SQ_FAILED(sq_getstring(v,nparam,&ts)))
return sq_throwerror(v,_SC("string expected for the specified format"));
addlen = (sq_getsize(v,nparam)*sizeof(SQChar))+((w+1)*sizeof(SQChar));
valtype = 's';
break;
case 'i': case 'd': case 'c':case 'o': case 'u': case 'x': case 'X':
if(SQ_FAILED(sq_getinteger(v,nparam,&ti)))
return sq_throwerror(v,_SC("integer expected for the specified format"));
addlen = (ADDITIONAL_FORMAT_SPACE)+((w+1)*sizeof(SQChar));
valtype = 'i';
break;
case 'f': case 'g': case 'G': case 'e': case 'E':
if(SQ_FAILED(sq_getfloat(v,nparam,&tf)))
return sq_throwerror(v,_SC("float expected for the specified format"));
addlen = (ADDITIONAL_FORMAT_SPACE)+((w+1)*sizeof(SQChar));
valtype = 'f';
break;
default:
return sq_throwerror(v,_SC("invalid format"));
}
n++;
allocated += addlen + sizeof(SQChar);
dest = sq_getscratchpad(v,allocated);
switch(valtype) {
case 's': i += scsprintf(&dest[i],fmt,ts); break;
case 'i': i += scsprintf(&dest[i],fmt,ti); break;
case 'f': i += scsprintf(&dest[i],fmt,tf); break;
};
nparam ++;
}
}
*outlen = i;
dest[i] = '\0';
*output = dest;
return SQ_OK;
}
static SQInteger _string_format(HSQUIRRELVM v)
{
SQChar *dest = NULL;
SQInteger length = 0;
if(SQ_FAILED(sqstd_format(v,2,&length,&dest)))
return -1;
sq_pushstring(v,dest,length);
return 1;
}
static void __strip_l(const SQChar *str,const SQChar **start)
{
const SQChar *t = str;
while(((*t) != '\0') && scisspace(*t)){ t++; }
*start = t;
}
static void __strip_r(const SQChar *str,SQInteger len,const SQChar **end)
{
if(len == 0) {
*end = str;
return;
}
const SQChar *t = &str[len-1];
while(t != str && scisspace(*t)) { t--; }
*end = t+1;
}
static SQInteger _string_strip(HSQUIRRELVM v)
{
const SQChar *str,*start,*end;
sq_getstring(v,2,&str);
SQInteger len = sq_getsize(v,2);
__strip_l(str,&start);
__strip_r(str,len,&end);
sq_pushstring(v,start,end - start);
return 1;
}
static SQInteger _string_lstrip(HSQUIRRELVM v)
{
const SQChar *str,*start;
sq_getstring(v,2,&str);
__strip_l(str,&start);
sq_pushstring(v,start,-1);
return 1;
}
static SQInteger _string_rstrip(HSQUIRRELVM v)
{
const SQChar *str,*end;
sq_getstring(v,2,&str);
SQInteger len = sq_getsize(v,2);
__strip_r(str,len,&end);
sq_pushstring(v,str,end - str);
return 1;
}
static SQInteger _string_split(HSQUIRRELVM v)
{
const SQChar *str,*seps;
SQChar *stemp,*tok;
sq_getstring(v,2,&str);
sq_getstring(v,3,&seps);
if(sq_getsize(v,3) == 0) return sq_throwerror(v,_SC("empty separators string"));
SQInteger memsize = (sq_getsize(v,2)+1)*sizeof(SQChar);
stemp = sq_getscratchpad(v,memsize);
memcpy(stemp,str,memsize);
tok = scstrtok(stemp,seps);
sq_newarray(v,0);
while( tok != NULL ) {
sq_pushstring(v,tok,-1);
sq_arrayappend(v,-2);
tok = scstrtok( NULL, seps );
}
return 1;
}
#define SETUP_REX(v) \
SQRex *self = NULL; \
sq_getinstanceup(v,1,(SQUserPointer *)&self,0);
static SQInteger _rexobj_releasehook(SQUserPointer p, SQInteger size)
{
SQRex *self = ((SQRex *)p);
sqstd_rex_free(self);
return 1;
}
static SQInteger _regexp_match(HSQUIRRELVM v)
{
SETUP_REX(v);
const SQChar *str;
sq_getstring(v,2,&str);
if(sqstd_rex_match(self,str) == SQTrue)
{
sq_pushbool(v,SQTrue);
return 1;
}
sq_pushbool(v,SQFalse);
return 1;
}
static void _addrexmatch(HSQUIRRELVM v,const SQChar *str,const SQChar *begin,const SQChar *end)
{
sq_newtable(v);
sq_pushstring(v,_SC("begin"),-1);
sq_pushinteger(v,begin - str);
sq_rawset(v,-3);
sq_pushstring(v,_SC("end"),-1);
sq_pushinteger(v,end - str);
sq_rawset(v,-3);
}
static SQInteger _regexp_search(HSQUIRRELVM v)
{
SETUP_REX(v);
const SQChar *str,*begin,*end;
SQInteger start = 0;
sq_getstring(v,2,&str);
if(sq_gettop(v) > 2) sq_getinteger(v,3,&start);
if(sqstd_rex_search(self,str+start,&begin,&end) == SQTrue) {
_addrexmatch(v,str,begin,end);
return 1;
}
return 0;
}
static SQInteger _regexp_capture(HSQUIRRELVM v)
{
SETUP_REX(v);
const SQChar *str,*begin,*end;
SQInteger start = 0;
sq_getstring(v,2,&str);
if(sq_gettop(v) > 2) sq_getinteger(v,3,&start);
if(sqstd_rex_search(self,str+start,&begin,&end) == SQTrue) {
SQInteger n = sqstd_rex_getsubexpcount(self);
SQRexMatch match;
sq_newarray(v,0);
for(SQInteger i = 0;i < n; i++) {
sqstd_rex_getsubexp(self,i,&match);
if(match.len > 0)
_addrexmatch(v,str,match.begin,match.begin+match.len);
else
_addrexmatch(v,str,str,str); //empty match
sq_arrayappend(v,-2);
}
return 1;
}
return 0;
}
static SQInteger _regexp_subexpcount(HSQUIRRELVM v)
{
SETUP_REX(v);
sq_pushinteger(v,sqstd_rex_getsubexpcount(self));
return 1;
}
static SQInteger _regexp_constructor(HSQUIRRELVM v)
{
const SQChar *error,*pattern;
sq_getstring(v,2,&pattern);
SQRex *rex = sqstd_rex_compile(pattern,&error);
if(!rex) return sq_throwerror(v,error);
sq_setinstanceup(v,1,rex);
sq_setreleasehook(v,1,_rexobj_releasehook);
return 0;
}
static SQInteger _regexp__typeof(HSQUIRRELVM v)
{
sq_pushstring(v,_SC("regexp"),-1);
return 1;
}
#define _DECL_REX_FUNC(name,nparams,pmask) {_SC(#name),_regexp_##name,nparams,pmask}
static SQRegFunction rexobj_funcs[]={
_DECL_REX_FUNC(constructor,2,_SC(".s")),
_DECL_REX_FUNC(search,-2,_SC("xsn")),
_DECL_REX_FUNC(match,2,_SC("xs")),
_DECL_REX_FUNC(capture,-2,_SC("xsn")),
_DECL_REX_FUNC(subexpcount,1,_SC("x")),
_DECL_REX_FUNC(_typeof,1,_SC("x")),
{0,0}
};
#define _DECL_FUNC(name,nparams,pmask) {_SC(#name),_string_##name,nparams,pmask}
static SQRegFunction stringlib_funcs[]={
_DECL_FUNC(format,-2,_SC(".s")),
_DECL_FUNC(strip,2,_SC(".s")),
_DECL_FUNC(lstrip,2,_SC(".s")),
_DECL_FUNC(rstrip,2,_SC(".s")),
_DECL_FUNC(split,3,_SC(".ss")),
{0,0}
};
SQInteger sqstd_register_stringlib(HSQUIRRELVM v)
{
sq_pushstring(v,_SC("regexp"),-1);
sq_newclass(v,SQFalse);
SQInteger i = 0;
while(rexobj_funcs[i].name != 0) {
SQRegFunction &f = rexobj_funcs[i];
sq_pushstring(v,f.name,-1);
sq_newclosure(v,f.f,0);
sq_setparamscheck(v,f.nparamscheck,f.typemask);
sq_setnativeclosurename(v,-1,f.name);
sq_createslot(v,-3);
i++;
}
sq_createslot(v,-3);
i = 0;
while(stringlib_funcs[i].name!=0)
{
sq_pushstring(v,stringlib_funcs[i].name,-1);
sq_newclosure(v,stringlib_funcs[i].f,0);
sq_setparamscheck(v,stringlib_funcs[i].nparamscheck,stringlib_funcs[i].typemask);
sq_setnativeclosurename(v,-1,stringlib_funcs[i].name);
sq_createslot(v,-3);
i++;
}
return 1;
}
| [
"mtlung@080b3119-2d51-0410-af92-4d39592ae298"
]
| [
[
[
1,
363
]
]
]
|
c7fc5e1be634dcf87cb53bc5f5181d1ab2057f3f | f08e489d72121ebad042e5b408371eaa212d3da9 | /TP1_v1/src/Estructuras/key_node.cpp | 71f914b5884a67c805b468cc9de14dd32d9a5884 | []
| 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 | 5,607 | cpp | #include "key_node.h"
/*CONSTRUCTORES */
Key_Node::Key_Node()
{
ref=Refs();
}
Key_Node::Key_Node(const Key_Node& toCopy)
{
this->Fields=toCopy.Fields;
this->ref= toCopy.ref;
}
Key_Node& Key_Node::operator = (const Key_Node &asignando){
this->Fields=asignando.Fields;
this->ref= asignando.ref;
return (*this);
}
void Key_Node::AddField(Field F)
{
this->Fields.push_back(F);
}
vector<Field>::iterator Key_Node::GetIterator(){
return Fields.begin();
}
Key_Node::~Key_Node(){
}
int Key_Node::GetFieldCount(){
return this->ref.vRefs.size();
}
/* OPERADOR <*/
const bool Key_Node::operator < ( Key_Node &comparador){
bool result;
vector<Field>::iterator it1=this->Fields.begin();
vector<Field>::iterator it2= comparador.GetIterator();
while( it1 != Fields.end() ) {
if((*it1)!=(*it2))
{
result = (*it1)<(*it2);
it1=this->Fields.end();
}
else
{
result=false;
it1++;
it2++;
}
}
return result;
}
///* OPERADOR >*/
const bool Key_Node::operator > ( Key_Node &comparador){
bool result;
vector<Field>::iterator it1=this->Fields.begin();
vector<Field>::iterator it2= comparador.GetIterator();
while( it1 != Fields.end() ) {
if(*it1!=*it2)
{
result = (*it1)>(*it2);
it1=this->Fields.end();
}
else
{
result=false;
it1++;
it2++;
}
}
return result;
}
//
///* OPERADOR ==*/
//
const bool Key_Node::operator == ( Key_Node &comparador){
bool result=false;
vector<Field>::iterator it1=this->Fields.begin();
vector<Field>::iterator it2= comparador.GetIterator();
while( it1 != Fields.end() ) {
if(*it1!=*it2)
{
result = false;
it1=this->Fields.end();
}
else
{
result=true;
it1++;
it2++;
}
}
return result;
}
///* OPERADOR !=*/
//
const bool Key_Node::operator != ( Key_Node &comparador){
bool result;
vector<Field>::iterator it1=this->Fields.begin();
vector<Field>::iterator it2= comparador.GetIterator();
while( it1 != Fields.end() ) {
if(*it1!=*it2)
{
result = true;
it1=this->Fields.end();
}
else
{
result=false;
it1++;
it2++;
}
}
return result;
}
//
///* OPERADOR <=*/
//
const bool Key_Node::operator <= ( Key_Node &comparador){
bool result;
vector<Field>::iterator it1=this->Fields.begin();
vector<Field>::iterator it2= comparador.GetIterator();
while( it1 != Fields.end() ) {
if(*it1!=*it2)
{
result = (*it1)<=(*it2);
it1=this->Fields.end();
}
else
{
result=true;
it1++;
it2++;
}
}
return result;
}
//
///* OPERADOR >=*/
//
const bool Key_Node::operator >= ( Key_Node &comparador){
bool result;
vector<Field>::iterator it1=this->Fields.begin();
vector<Field>::iterator it2= comparador.GetIterator();
while( it1 != Fields.end() ) {
if(*it1!=*it2)
{
result = (*it1)>=(*it2);
it1=this->Fields.end();
}
else
{
result=true;
it1++;
it2++;
}
}
return result;
}
int Key_Node::compareTo(Key_Node &comparador)
{
int result;
int si=Fields.size();
vector<Field>::iterator it1=this->Fields.begin();
vector<Field>::iterator it2= comparador.GetIterator();
while( it1 != Fields.end() ) {
if(*it1!=*it2)
{
result = -1;
it1=this->Fields.end();
}
else
{
result=0;
it1++;
it2++;
}
}
return result;
}
const int Key_Node::toInt()
{
int toReturn = 0;
for (unsigned int i = 0; i < Fields.size(); i++)
toReturn += (Fields.at(i)).toInt();
return toReturn;
}
void Key_Node::Serialize (std::ofstream *f)
{
*f<<"Begin_Key_Node"<<endl;
for(int i=0;i<Fields.size();i++)
{
*f<<Fields[i].Serialize()<<endl;
}
*f<<"End_Key_Node"<<endl;
}
void Key_Node::Print ()
{
cout<< "Begin_Key_Node - Clave: ";
cout << this->toInt() << endl;
for(int i = 0; i < Fields.size(); i++)
{
//cout << Fields[i].Serialize() << endl;
cout << Fields[i].getStr() << endl;
}
cout<<"End_Key_Node"<<endl;
}
void Key_Node::DesSerialize (std::ifstream *f)
{
Fields.clear();
//ref.posBloq=-1;
//ref.posReg=-1;
string aux;
getline(*f,aux);
while((aux!="End_Key_Node")&&(!(*f).eof()))
{
if(aux!="Begin_Key_Node"){
Field Faux=Field();
Faux.DesSerialize(aux);
Fields.push_back(Faux);
}
getline(*f,aux);
}
}
| [
"[email protected]"
]
| [
[
[
1,
277
]
]
]
|
cf879d7a17284e889c6a8fd6459177ed80f17a92 | 27d5670a7739a866c3ad97a71c0fc9334f6875f2 | /CPP/Targets/WayFinder/symbian-r6/TurnPictures.cpp | 12d9084ea18fe41b11d2b81a23b1b2886c042f88 | [
"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 | 29,771 | 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.
*/
#include "TurnPictures.h"
using namespace isab;
using namespace RouteEnums;
using namespace RouteInfoParts;
#include "wficons.mbg"
#if defined NAV2_CLIENT_SERIES60_V5 || defined NAV2_CLIENT_SERIES60_V32
#define EMbmWfturns4way_left EMbmWficonsFour_way_turn_left
#define EMbmWfturns4way_right EMbmWficonsFour_way_turn_right
#define EMbmWfturns4way_straight EMbmWficonsFour_way_drive_straight
#define EMbmWfturnsEnter_highway EMbmWficonsEnter_highway_right
#define EMbmWfturnsEnter_highway_left EMbmWficonsEnter_highway_left
#define EMbmWfturnsEnter_main_road EMbmWficonsEnter_main_road_right
#define EMbmWfturnsEnter_main_road_left EMbmWficonsEnter_main_road_left
#define EMbmWfturnsExit_highway EMbmWficonsExit_highway_right
#define EMbmWfturnsExit_highway_left EMbmWficonsExit_highway_left
#define EMbmWfturnsExit_main_road EMbmWficonsExit_main_road_right
#define EMbmWfturnsExit_main_road_left EMbmWficonsExit_main_road_left
#define EMbmWfturnsExit1 EMbmWficonsExit_1
#define EMbmWfturnsExit2 EMbmWficonsExit_2
#define EMbmWfturnsExit3 EMbmWficonsExit_3
#define EMbmWfturnsExit4 EMbmWficonsExit_4
#define EMbmWfturnsExit5 EMbmWficonsExit_5
#define EMbmWfturnsExit6 EMbmWficonsExit_6
#define EMbmWfturnsExit7 EMbmWficonsExit_7
#define EMbmWfturnsExit8 EMbmWficonsExit_8
#define EMbmWfturnsExit9 EMbmWficonsExit_9
#define EMbmWfturnsExit10 EMbmWficonsExit_10
#define EMbmWfturnsExit11 EMbmWficonsExit_11
#define EMbmWfturnsExit12 EMbmWficonsExit_12
#define EMbmWfturnsFerry EMbmWficonsFerry
#define EMbmWfturnsFinish_arrow EMbmWficonsReached_destination2
#define EMbmWfturnsFinish_flag EMbmWficonsReached_destination1
#define EMbmWfturnsHighway_straight EMbmWficonsHighway_straight_ahead_right
#define EMbmWfturnsHighway_straight_left EMbmWficonsHighway_straight_ahead_left
#define EMbmWfturnsKeep_left EMbmWficonsKeep_left
#define EMbmWfturnsKeep_right EMbmWficonsKeep_right
#define EMbmWfturnsLeft_arrow EMbmWficonsTurn_left
#define EMbmWfturnsMedium_back_arrow EMbmWficonsSm_wrong_direction
#define EMbmWfturnsMedium_blank EMbmWficonsSm_turn_blank
#define EMbmWfturnsMedium_detour EMbmWficonsDetour_square.svg
#define EMbmWfturnsMedium_ferry EMbmWficonsSm_ferry
#define EMbmWfturnsMedium_flag EMbmWficonsSm_reached_destination
#define EMbmWfturnsMedium_keep_left EMbmWficonsSm_keep_left
#define EMbmWfturnsMedium_keep_right EMbmWficonsSm_keep_right
#define EMbmWfturnsMedium_left_arrow EMbmWficonsSm_turn_left
#define EMbmWfturnsMedium_mask EMbmWficonsSm_turn_blank_mask
#define EMbmWfturnsMedium_multiway_rdbt EMbmWficonsSm_multiway_roundabout_right
#define EMbmWfturnsMedium_multiway_rdbt_left EMbmWficonsSm_multiway_roundabout_left
#define EMbmWfturnsMedium_offtrack EMbmWficonsSm_off_track
#define EMbmWfturnsMedium_park_car EMbmWficonsSm_parking_area
#define EMbmWfturnsMedium_right_arrow EMbmWficonsSm_turn_right
#define EMbmWfturnsMedium_speedcam EMbmWficonsSpeedcamera_square
#define EMbmWfturnsMedium_start EMbmWficonsSm_start
#define EMbmWfturnsMedium_straight_arrow EMbmWficonsSm_drive_straight_ahead1
#define EMbmWfturnsMedium_u_turn EMbmWficonsSm_uturn_right
#define EMbmWfturnsMedium_u_turn_left EMbmWficonsSm_uturn_left
#define EMbmWfturnsMultiway_rdbt EMbmWficonsMultiway_roundabout_right
#define EMbmWfturnsMultiway_rdbt_left EMbmWficonsMultiway_roundabout_left
#define EMbmWfturnsOfftrack EMbmWficonsOff_track
#define EMbmWfturnsOpposite_arrow EMbmWficonsWrong_direction
#define EMbmWfturnsPark_car EMbmWficonsParking_area
#define EMbmWfturnsRdbt_left EMbmWficonsTurn_left_roundabout_right
#define EMbmWfturnsRdbt_left_left EMbmWficonsTurn_left_roundabout_left
#define EMbmWfturnsRdbt_right EMbmWficonsTurn_right_roundabout_right
#define EMbmWfturnsRdbt_right_left EMbmWficonsTurn_right_roundabout_left
#define EMbmWfturnsRdbt_straight EMbmWficonsDrive_straight_roundabout_right
#define EMbmWfturnsRdbt_straight_left EMbmWficonsDrive_straight_roundabout_left
#define EMbmWfturnsRdbt_uturn EMbmWficonsUturn_roundabout_right
#define EMbmWfturnsRdbt_uturn_left EMbmWficonsUturn_roundabout_left
#define EMbmWfturnsRight_arrow EMbmWficonsTurn_right
#define EMbmWfturnsSmall_back_arrow EMbmWficonsSm_wrong_direction
#define EMbmWfturnsSmall_back_arrow_m EMbmWficonsSm_wrong_direction_mask
#define EMbmWfturnsSmall_blank EMbmWficonsSm_turn_blank
#define EMbmWfturnsSmall_blank_m EMbmWficonsSm_turn_blank_mask
#define EMbmWfturnsSmall_detour EMbmWficonsDetour_square
#define EMbmWfturnsSmall_detour_m EMbmWficonsDetour_square_mask
#define EMbmWfturnsSmall_ferry EMbmWficonsSm_ferry
#define EMbmWfturnsSmall_ferry_m EMbmWficonsSm_ferry_mask
#define EMbmWfturnsSmall_flag EMbmWficonsSm_reached_destination
#define EMbmWfturnsSmall_flag_m EMbmWficonsSm_reached_destination_mask
#define EMbmWfturnsSmall_keep_left EMbmWficonsSm_keep_left
#define EMbmWfturnsSmall_keep_left_m EMbmWficonsSm_keep_left_mask
#define EMbmWfturnsSmall_keep_right EMbmWficonsSm_keep_right
#define EMbmWfturnsSmall_keep_right_m EMbmWficonsSm_keep_right_mask
#define EMbmWfturnsSmall_left_arrow EMbmWficonsSm_turn_left
#define EMbmWfturnsSmall_left_arrow_m EMbmWficonsSm_turn_left_mask
#define EMbmWfturnsSmall_mask EMbmWficonsSm_turn_blan_mask
#define EMbmWfturnsSmall_multiway_rdbt EMbmWficonsSm_multiway_roundabout_right
#define EMbmWfturnsSmall_multiway_rdbt_m EMbmWficonsSm_multiway_roundabout_right_mask
#define EMbmWfturnsSmall_multiway_rdbt_left EMbmWficonsSm_multiway_roundabout_left
#define EMbmWfturnsSmall_multiway_rdbt_left_m EMbmWficonsSm_multiway_roundabout_left_mask
#define EMbmWfturnsSmall_offtrack EMbmWficonsSm_off_track
#define EMbmWfturnsSmall_offtrack_m EMbmWficonsSm_off_track_mask
#define EMbmWfturnsSmall_park_car EMbmWficonsSm_parking_area
#define EMbmWfturnsSmall_park_car_m EMbmWficonsSm_parking_area_mask
#define EMbmWfturnsSmall_right_arrow EMbmWficonsSm_turn_right
#define EMbmWfturnsSmall_right_arrow_m EMbmWficonsSm_turn_right_mask
#define EMbmWfturnsSmall_speedcam EMbmWficonsSpeedcamera_square
#define EMbmWfturnsSmall_speedcam_m EMbmWficonsSpeedcamera_square_mask
#define EMbmWfturnsSmall_start EMbmWficonsSm_start
#define EMbmWfturnsSmall_start_m EMbmWficonsSm_start_mask
#define EMbmWfturnsSmall_straight_arrow EMbmWficonsSm_drive_straight_ahead1
#define EMbmWfturnsSmall_straight_arrow_m EMbmWficonsSm_drive_straight_ahead1_mask
#define EMbmWfturnsSmall_u_turn EMbmWficonsSm_uturn_right
#define EMbmWfturnsSmall_u_turn_m EMbmWficonsSm_uturn_right_mask
#define EMbmWfturnsSmall_u_turn_left EMbmWficonsSm_uturn_left
#define EMbmWfturnsSmall_u_turn_left_m EMbmWficonsSm_uturn_left_mask
#define EMbmWfturnsStraight_ahead EMbmWficonsDrive_straight_ahead2
#define EMbmWfturnsStraight_arrow EMbmWficonsDrive_straight_ahead1
#define EMbmWfturnsU_turn EMbmWficonsUturn_right
#define EMbmWfturnsU_turn_left EMbmWficonsUturn_left
#define EMbmWfturn_mask EMbmWficonsUturn_right_mask
#elif defined NAV2_CLIENT_SERIES60_V3
#define EMbmWfturns4way_left EMbmWficonsFour_way_turn_left
#define EMbmWfturns4way_right EMbmWficonsFour_way_turn_right
#define EMbmWfturns4way_straight EMbmWficonsFour_way_drive_straight
#define EMbmWfturnsEnter_highway EMbmWficonsEnter_highway_right
#define EMbmWfturnsEnter_highway_left EMbmWficonsEnter_highway_left
#define EMbmWfturnsEnter_main_road EMbmWficonsEnter_main_road_right
#define EMbmWfturnsEnter_main_road_left EMbmWficonsEnter_main_road_left
#define EMbmWfturnsExit_highway EMbmWficonsExit_highway_right
#define EMbmWfturnsExit_highway_left EMbmWficonsExit_highway_left
#define EMbmWfturnsExit_main_road EMbmWficonsExit_main_road_right
#define EMbmWfturnsExit_main_road_left EMbmWficonsExit_main_road_left
#define EMbmWfturnsExit1 EMbmWficonsExit_1
#define EMbmWfturnsExit2 EMbmWficonsExit_2
#define EMbmWfturnsExit3 EMbmWficonsExit_3
#define EMbmWfturnsExit4 EMbmWficonsExit_4
#define EMbmWfturnsExit5 EMbmWficonsExit_5
#define EMbmWfturnsExit6 EMbmWficonsExit_6
#define EMbmWfturnsExit7 EMbmWficonsExit_7
#define EMbmWfturnsExit8 EMbmWficonsExit_8
#define EMbmWfturnsExit9 EMbmWficonsExit_9
#define EMbmWfturnsExit10 EMbmWficonsExit_10
#define EMbmWfturnsExit11 EMbmWficonsExit_11
#define EMbmWfturnsExit12 EMbmWficonsExit_12
#define EMbmWfturnsFerry EMbmWficonsFerry
#define EMbmWfturnsFinish_arrow EMbmWficonsReached_destination2
#define EMbmWfturnsFinish_flag EMbmWficonsReached_destination1
#define EMbmWfturnsHighway_straight EMbmWficonsHighway_straight_ahead_right
#define EMbmWfturnsHighway_straight_left EMbmWficonsHighway_straight_ahead_left
#define EMbmWfturnsKeep_left EMbmWficonsKeep_left
#define EMbmWfturnsKeep_right EMbmWficonsKeep_right
#define EMbmWfturnsLeft_arrow EMbmWficonsTurn_left
#define EMbmWfturnsMedium_back_arrow EMbmWficonsSm_wrong_direction
#define EMbmWfturnsMedium_blank EMbmWficonsSm_turn_blank
#define EMbmWfturnsMedium_detour EMbmWficonsDetour_square.svg
#define EMbmWfturnsMedium_ferry EMbmWficonsSm_ferry
#define EMbmWfturnsMedium_flag EMbmWficonsSm_reached_destination
#define EMbmWfturnsMedium_keep_left EMbmWficonsSm_keep_left
#define EMbmWfturnsMedium_keep_right EMbmWficonsSm_keep_right
#define EMbmWfturnsMedium_left_arrow EMbmWficonsSm_turn_left
#define EMbmWfturnsMedium_mask EMbmWficonsSm_turn_blank_mask
#define EMbmWfturnsMedium_multiway_rdbt EMbmWficonsSm_multiway_roundabout_right
#define EMbmWfturnsMedium_multiway_rdbt_left EMbmWficonsSm_multiway_roundabout_left
#define EMbmWfturnsMedium_offtrack EMbmWficonsSm_off_track
#define EMbmWfturnsMedium_park_car EMbmWficonsSm_parking_area
#define EMbmWfturnsMedium_right_arrow EMbmWficonsSm_turn_right
#define EMbmWfturnsMedium_speedcam EMbmWficonsSpeedcamera_square
#define EMbmWfturnsMedium_start EMbmWficonsSm_start
#define EMbmWfturnsMedium_straight_arrow EMbmWficonsSm_drive_straight_ahead1
#define EMbmWfturnsMedium_u_turn EMbmWficonsSm_uturn_right
#define EMbmWfturnsMedium_u_turn_left EMbmWficonsSm_uturn_left
#define EMbmWfturnsMultiway_rdbt EMbmWficonsMultiway_roundabout_right
#define EMbmWfturnsMultiway_rdbt_left EMbmWficonsMultiway_roundabout_left
#define EMbmWfturnsOfftrack EMbmWficonsOff_track
#define EMbmWfturnsOpposite_arrow EMbmWficonsWrong_direction
#define EMbmWfturnsPark_car EMbmWficonsParking_area
#define EMbmWfturnsRdbt_left EMbmWficonsTurn_left_roundabout_right
#define EMbmWfturnsRdbt_left_left EMbmWficonsTurn_left_roundabout_left
#define EMbmWfturnsRdbt_right EMbmWficonsTurn_right_roundabout_right
#define EMbmWfturnsRdbt_right_left EMbmWficonsTurn_right_roundabout_left
#define EMbmWfturnsRdbt_straight EMbmWficonsDrive_straight_roundabout_right
#define EMbmWfturnsRdbt_straight_left EMbmWficonsDrive_straight_roundabout_left
#define EMbmWfturnsRdbt_uturn EMbmWficonsUturn_roundabout_right
#define EMbmWfturnsRdbt_uturn_left EMbmWficonsUturn_roundabout_left
#define EMbmWfturnsRight_arrow EMbmWficonsTurn_right
#define EMbmWfturnsSmall_back_arrow EMbmWficonsSmt_wrong_direction
#define EMbmWfturnsSmall_back_arrow_m EMbmWficonsSmt_wrong_direction_mask
#define EMbmWfturnsSmall_blank EMbmWficonsSmt_turn_blank
#define EMbmWfturnsSmall_blank_m EMbmWficonsSmt_turn_blank_mask
#define EMbmWfturnsSmall_detour EMbmWficonsDetour_square
#define EMbmWfturnsSmall_detour_m EMbmWficonsDetour_square_mask
#define EMbmWfturnsSmall_ferry EMbmWficonsSmt_ferry
#define EMbmWfturnsSmall_ferry_m EMbmWficonsSmt_ferry_mask
#define EMbmWfturnsSmall_flag EMbmWficonsSmt_reached_destination
#define EMbmWfturnsSmall_flag_m EMbmWficonsSmt_reached_destination_mask
#define EMbmWfturnsSmall_keep_left EMbmWficonsSmt_keep_left
#define EMbmWfturnsSmall_keep_left_m EMbmWficonsSmt_keep_left_mask
#define EMbmWfturnsSmall_keep_right EMbmWficonsSmt_keep_right
#define EMbmWfturnsSmall_keep_right_m EMbmWficonsSmt_keep_right_mask
#define EMbmWfturnsSmall_left_arrow EMbmWficonsSmt_turn_left
#define EMbmWfturnsSmall_left_arrow_m EMbmWficonsSmt_turn_left_mask
#define EMbmWfturnsSmall_mask EMbmWficonsSmt_turn_blan_mask
#define EMbmWfturnsSmall_multiway_rdbt EMbmWficonsSmt_multiway_roundabout_right
#define EMbmWfturnsSmall_multiway_rdbt_m EMbmWficonsSmt_multiway_roundabout_right_mask
#define EMbmWfturnsSmall_multiway_rdbt_left EMbmWficonsSmt_multiway_roundabout_left
#define EMbmWfturnsSmall_multiway_rdbt_left_m EMbmWficonsSmt_multiway_roundabout_left_mask
#define EMbmWfturnsSmall_offtrack EMbmWficonsSmt_off_track
#define EMbmWfturnsSmall_offtrack_m EMbmWficonsSmt_off_track_mask
#define EMbmWfturnsSmall_park_car EMbmWficonsSmt_parking_area
#define EMbmWfturnsSmall_park_car_m EMbmWficonsSmt_parking_area_mask
#define EMbmWfturnsSmall_right_arrow EMbmWficonsSmt_turn_right
#define EMbmWfturnsSmall_right_arrow_m EMbmWficonsSmt_turn_right_mask
#define EMbmWfturnsSmall_speedcam EMbmWficonsSpeedcamera_square
#define EMbmWfturnsSmall_speedcam_m EMbmWficonsSpeedcamera_square_mask
#define EMbmWfturnsSmall_start EMbmWficonsSmt_start
#define EMbmWfturnsSmall_start_m EMbmWficonsSmt_start_mask
#define EMbmWfturnsSmall_straight_arrow EMbmWficonsSmt_drive_straight_ahead1
#define EMbmWfturnsSmall_straight_arrow_m EMbmWficonsSmt_drive_straight_ahead1_mask
#define EMbmWfturnsSmall_u_turn EMbmWficonsSmt_uturn_right
#define EMbmWfturnsSmall_u_turn_m EMbmWficonsSmt_uturn_right_mask
#define EMbmWfturnsSmall_u_turn_left EMbmWficonsSmt_uturn_left
#define EMbmWfturnsSmall_u_turn_left_m EMbmWficonsSmt_uturn_left_mask
#define EMbmWfturnsStraight_ahead EMbmWficonsDrive_straight_ahead2
#define EMbmWfturnsStraight_arrow EMbmWficonsDrive_straight_ahead1
#define EMbmWfturnsU_turn EMbmWficonsUturn_right
#define EMbmWfturnsU_turn_left EMbmWficonsUturn_left
#define EMbmWfturn_mask EMbmWficonsUturn_right_mask
#endif
using namespace isab;
using namespace RouteEnums;
using namespace RouteInfoParts;
TPictures TTurnPictures::GetPicture( const enum isab::RouteAction aAction,
const enum isab::RouteCrossing aCrossing,
const TUint aDistance,
const TBool aHighway )
{
TPictures picture = ENoPicture;
switch( aAction )
{
case End:
picture = ENoPicture;
break;
case Finally:
if( aDistance > 30 ){
picture = EFinishArrow;
}
else{
picture = EFinishFlag;
}
break;
case Start:
if( aCrossing == NoCrossing ){
picture = EStraight;
}
else{
picture = EStraightArrow;
}
break;
case StartWithUTurn:
picture = EUTurn;
break;
case Ahead:
if( aHighway == EFalse ){
if( aCrossing == Crossing4Ways ){
picture = E4WayStraight;
}
else if( aCrossing == NoCrossing ){
picture = EStraight;
}
else{
picture = EStraightArrow;
}
}
else{
picture = EHighWayStraight;
}
break;
case AheadRdbt:
picture = ERdbStraight;
break;
case EndOfRoadLeft:
picture = E3WayTeeLeft;
break;
case Left:
if( aCrossing == Crossing4Ways )
picture = E4WayLeft;
else
picture = ELeftArrow;
break;
case LeftRdbt:
picture = ERdbLeft;
break;
case KeepLeft:
picture = EKeepLeft;
break;
case EndOfRoadRight:
picture = E3WayTeeRight;
break;
case Right:
if( aCrossing == Crossing4Ways ){
picture = E4WayRight;
}
else{
picture = ERightArrow;
}
break;
case RightRdbt:
picture = ERdbRight;
break;
case KeepRight:
picture = EKeepRight;
break;
case EnterRdbt:
picture = EMultiWayRdb;
break;
case ExitRdbt:
picture = EMultiWayRdb;
break;
case UTurn:
picture = EUTurn;
break;
case UTurnRdbt:
picture = ERdbUTurn;
break;
case ExitAt:
if(aHighway == EFalse){
picture = EExitMainRoad;
}
else{
picture = EExitHighWay;
}
break;
case On:
if( aHighway == EFalse ){
picture = EEnterMainRoad;
}
else{
picture = EEnterHighWay;
}
break;
case StartAt:
if( aHighway == EFalse ){
picture = EStraight;
}
else{
picture = EHighWayStraight;
}
break;
case ParkCar:
picture = EPark;
break;
case FollowRoad:
if( aHighway == EFalse ){
picture = EStraight;
}
else{
picture = EHighWayStraight;
}
break;
case EnterFerry:
case ExitFerry:
case ChangeFerry:
picture = EFerry;
break;
case InvalidAction:
picture = EOffTrack;
break;
case OffRampRight:
if( aHighway == EFalse ){
picture = EExitMainRoadRight;
}
else{
picture = EExitHighWayRight;
}
break;
case OffRampLeft:
if( aHighway == EFalse ){
picture = EExitMainRoadLeft;
}
else{
picture = EExitHighWayLeft;
}
break;
case Delta:
case RouteEnums::RouteActionMax:
break;
}
return picture;
}
TInt TTurnPictures::GetTurnPicture( const TPictures aTurn,
const TBool aLeftSide )
{
TInt mbmIndex = -1;
switch( aTurn )
{
case E4WayLeft:
mbmIndex = EMbmWfturns4way_left;
break;
case E4WayRight:
mbmIndex = EMbmWfturns4way_right;
break;
case E4WayStraight:
mbmIndex = EMbmWfturns4way_straight;
break;
case EEnterHighWay:
if( !aLeftSide ){
mbmIndex = EMbmWfturnsEnter_highway;
}
else{
mbmIndex = EMbmWfturnsEnter_highway_left;
}
break;
case EEnterMainRoad:
if( !aLeftSide ){
mbmIndex = EMbmWfturnsEnter_main_road;
}
else{
mbmIndex = EMbmWfturnsEnter_main_road_left;
}
break;
case EExitHighWay:
if( !aLeftSide ){
mbmIndex = EMbmWfturnsExit_highway;
}
else {
mbmIndex = EMbmWfturnsExit_highway_left;
}
break;
case EExitHighWayRight:
mbmIndex = EMbmWfturnsExit_highway;
break;
case EExitHighWayLeft:
mbmIndex = EMbmWfturnsExit_highway_left;
break;
case EExitMainRoad:
if( !aLeftSide ){
mbmIndex = EMbmWfturnsExit_main_road;
}
else{
mbmIndex = EMbmWfturnsExit_main_road_left;
}
break;
case EExitMainRoadRight:
mbmIndex = EMbmWfturnsExit_main_road;
break;
case EExitMainRoadLeft:
mbmIndex = EMbmWfturnsExit_main_road_left;
break;
case EFerry:
mbmIndex = EMbmWfturnsFerry;
break;
case EFinishArrow:
mbmIndex = EMbmWfturnsFinish_arrow;
break;
case EFinishFlag:
mbmIndex = EMbmWfturnsFinish_flag;
break;
case EHighWayStraight:
if( !aLeftSide ){
mbmIndex = EMbmWfturnsHighway_straight;
}
else{
mbmIndex = EMbmWfturnsHighway_straight_left;
}
break;
case EKeepLeft:
mbmIndex = EMbmWfturnsKeep_left;
break;
case EKeepRight:
mbmIndex = EMbmWfturnsKeep_right;
break;
case ELeftArrow:
mbmIndex = EMbmWfturnsLeft_arrow;
break;
case EMultiWayRdb:
if( !aLeftSide ){
mbmIndex = EMbmWfturnsMultiway_rdbt;
}
else{
mbmIndex = EMbmWfturnsMultiway_rdbt_left;
}
break;
case EOffTrack:
mbmIndex = EMbmWfturnsOfftrack;
break;
case EWrongDirection:
mbmIndex = EMbmWfturnsOpposite_arrow;
break;
case EPark:
mbmIndex = EMbmWfturnsPark_car;
break;
case ERdbLeft:
if( !aLeftSide ){
mbmIndex = EMbmWfturnsRdbt_left;
}
else{
mbmIndex = EMbmWfturnsRdbt_left_left;
}
break;
case ERdbRight:
if( !aLeftSide ){
mbmIndex = EMbmWfturnsRdbt_right;
}
else{
mbmIndex = EMbmWfturnsRdbt_right_left;
}
break;
case ERdbStraight:
if( !aLeftSide ){
mbmIndex = EMbmWfturnsRdbt_straight;
} else {
mbmIndex = EMbmWfturnsRdbt_straight_left;
}
break;
case ERdbUTurn:
if( !aLeftSide ){
mbmIndex = EMbmWfturnsRdbt_uturn;
} else {
mbmIndex = EMbmWfturnsRdbt_uturn_left;
}
break;
case ERightArrow:
mbmIndex = EMbmWfturnsRight_arrow;
break;
case EStraight:
mbmIndex = EMbmWfturnsStraight_ahead;
break;
case EStraightArrow:
mbmIndex = EMbmWfturnsStraight_arrow;
break;
case EUTurn:
if( !aLeftSide ){
mbmIndex = EMbmWfturnsU_turn;
} else {
mbmIndex = EMbmWfturnsU_turn_left;
}
break;
case ENoPicture:
default:
break;
}
return mbmIndex;
}
TInt TTurnPictures::GetMediumTurnPicture( const TPictures aTurn,
const TBool aLeftSide )
{
TInt mbmIndex = -1;
switch( aTurn )
{
case E4WayLeft:
case ELeftArrow:
case ERdbLeft:
mbmIndex = EMbmWfturnsMedium_left_arrow;
break;
case E4WayRight:
case ERdbRight:
case ERightArrow:
mbmIndex = EMbmWfturnsMedium_right_arrow;
break;
case E4WayStraight:
case EHighWayStraight:
case EStraight:
case EStraightArrow:
case ERdbStraight:
mbmIndex = EMbmWfturnsMedium_straight_arrow;
break;
case EEnterHighWay:
case EEnterMainRoad:
mbmIndex = EMbmWfturnsMedium_keep_left;
break;
case EExitHighWayLeft:
case EExitMainRoadLeft:
case EKeepLeft:
mbmIndex = EMbmWfturnsMedium_keep_left;
break;
case EExitHighWay:
case EExitMainRoad:
if( !aLeftSide ){
mbmIndex = EMbmWfturnsMedium_keep_right;
}
else{
mbmIndex = EMbmWfturnsMedium_keep_left;
}
break;
case EExitHighWayRight:
case EExitMainRoadRight:
case EKeepRight:
mbmIndex = EMbmWfturnsMedium_keep_right;
break;
case EFerry:
mbmIndex = EMbmWfturnsMedium_ferry;
break;
case EFinishArrow:
case EFinishFlag:
mbmIndex = EMbmWfturnsMedium_flag;
break;
case EMultiWayRdb:
if( !aLeftSide ){
mbmIndex = EMbmWfturnsMedium_multiway_rdbt;
} else {
mbmIndex = EMbmWfturnsMedium_multiway_rdbt_left;
}
break;
case EOffTrack:
mbmIndex = EMbmWfturnsMedium_offtrack;
break;
case EWrongDirection:
mbmIndex = EMbmWfturnsMedium_back_arrow;
break;
case EPark:
mbmIndex = EMbmWfturnsMedium_park_car;
break;
case ERdbUTurn:
case EUTurn:
if( !aLeftSide ){
mbmIndex = EMbmWfturnsMedium_u_turn;
} else {
mbmIndex = EMbmWfturnsMedium_u_turn_left;
}
break;
default:
break;
}
return mbmIndex;
}
void TTurnPictures::GetSmallTurnPicture( const TPictures aTurn,
const TBool aLeftSide,
TInt &mbmIndex,
TInt &mbmMaskIndex )
{
mbmIndex = -1;
mbmMaskIndex = -1;
switch( aTurn )
{
case E4WayLeft:
case ELeftArrow:
case ERdbLeft:
mbmIndex = EMbmWfturnsSmall_left_arrow;
mbmMaskIndex = EMbmWfturnsSmall_left_arrow_m;
break;
case E4WayRight:
case ERdbRight:
case ERightArrow:
mbmIndex = EMbmWfturnsSmall_right_arrow;
mbmMaskIndex = EMbmWfturnsSmall_right_arrow_m;
break;
case E4WayStraight:
case EHighWayStraight:
case EStraight:
case EStraightArrow:
case ERdbStraight:
mbmIndex = EMbmWfturnsSmall_straight_arrow;
mbmMaskIndex = EMbmWfturnsSmall_straight_arrow_m;
break;
case EEnterHighWay:
case EEnterMainRoad:
mbmIndex = EMbmWfturnsSmall_keep_left;
mbmMaskIndex = EMbmWfturnsSmall_keep_left_m;
break;
case EExitHighWayLeft:
case EExitMainRoadLeft:
case EKeepLeft:
mbmIndex = EMbmWfturnsSmall_keep_left;
mbmMaskIndex = EMbmWfturnsSmall_keep_left_m;
break;
case EExitHighWay:
case EExitMainRoad:
if( !aLeftSide ){
mbmIndex = EMbmWfturnsSmall_keep_right;
mbmMaskIndex = EMbmWfturnsSmall_keep_right_m;
}
else{
mbmIndex = EMbmWfturnsSmall_keep_left;
mbmMaskIndex = EMbmWfturnsSmall_keep_left_m;
}
break;
case EExitHighWayRight:
case EExitMainRoadRight:
case EKeepRight:
mbmIndex = EMbmWfturnsSmall_keep_right;
mbmMaskIndex = EMbmWfturnsSmall_keep_right_m;
break;
case EFerry:
mbmIndex = EMbmWfturnsSmall_ferry;
mbmMaskIndex = EMbmWfturnsSmall_ferry_m;
break;
case EFinishArrow:
case EFinishFlag:
mbmIndex = EMbmWfturnsSmall_flag;
mbmMaskIndex = EMbmWfturnsSmall_flag_m;
break;
case EMultiWayRdb:
if( !aLeftSide ){
mbmIndex = EMbmWfturnsSmall_multiway_rdbt;
mbmMaskIndex = EMbmWfturnsSmall_multiway_rdbt_m;
} else {
mbmIndex = EMbmWfturnsSmall_multiway_rdbt_left;
mbmMaskIndex = EMbmWfturnsSmall_multiway_rdbt_left_m;
}
break;
case EOffTrack:
mbmIndex = EMbmWfturnsSmall_offtrack;
mbmMaskIndex = EMbmWfturnsSmall_offtrack_m;
break;
case EWrongDirection:
mbmIndex = EMbmWfturnsSmall_back_arrow;
mbmMaskIndex = EMbmWfturnsSmall_back_arrow_m;
break;
case EPark:
mbmIndex = EMbmWfturnsSmall_park_car;
mbmMaskIndex = EMbmWfturnsSmall_park_car_m;
break;
case ERdbUTurn:
case EUTurn:
if( !aLeftSide ){
mbmIndex = EMbmWfturnsSmall_u_turn;
mbmMaskIndex = EMbmWfturnsSmall_u_turn_m;
} else {
mbmIndex = EMbmWfturnsSmall_u_turn_left;
mbmMaskIndex = EMbmWfturnsSmall_u_turn_left_m;
}
break;
default:
break;
}
//return mbmIndex;
}
TInt TTurnPictures::GetExit( const TInt exit )
{
TInt mbmIndex = -1;
switch( exit )
{
case 1:
mbmIndex = EMbmWfturnsExit1;
break;
case 2:
mbmIndex = EMbmWfturnsExit2;
break;
case 3:
mbmIndex = EMbmWfturnsExit3;
break;
case 4:
mbmIndex = EMbmWfturnsExit4;
break;
case 5:
mbmIndex = EMbmWfturnsExit5;
break;
case 6:
mbmIndex = EMbmWfturnsExit6;
break;
case 7:
mbmIndex = EMbmWfturnsExit7;
break;
case 8:
mbmIndex = EMbmWfturnsExit8;
break;
case 9:
mbmIndex = EMbmWfturnsExit9;
break;
case 10:
mbmIndex = EMbmWfturnsExit10;
break;
case 11:
mbmIndex = EMbmWfturnsExit11;
break;
case 12:
mbmIndex = EMbmWfturnsExit12;
break;
default:
break;
}
return mbmIndex;
}
TInt TTurnPictures::GetExitMask( const TInt exit )
{
TInt mbmIndex = -1;
#ifdef NAV2_CLIENT_SERIES60_V3
switch( exit )
{
case 1:
mbmIndex = EMbmWficonsExit_1_mask;
break;
case 2:
mbmIndex = EMbmWficonsExit_2_mask;
break;
case 3:
mbmIndex = EMbmWficonsExit_3_mask;
break;
case 4:
mbmIndex = EMbmWficonsExit_4_mask;
break;
case 5:
mbmIndex = EMbmWficonsExit_5_mask;
break;
case 6:
mbmIndex = EMbmWficonsExit_6_mask;
break;
case 7:
mbmIndex = EMbmWficonsExit_7_mask;
break;
case 8:
mbmIndex = EMbmWficonsExit_8_mask;
break;
case 9:
mbmIndex = EMbmWficonsExit_9_mask;
break;
case 10:
mbmIndex = EMbmWficonsExit_10_mask;
break;
case 11:
mbmIndex = EMbmWficonsExit_11_mask;
break;
case 12:
mbmIndex = EMbmWficonsExit_12_mask;
break;
default:
break;
}
#endif
return mbmIndex;
}
| [
"[email protected]"
]
| [
[
[
1,
847
]
]
]
|
15cbf2f109431ccfb26dcffeaf65235dcdd2f3a4 | 6bdb3508ed5a220c0d11193df174d8c215eb1fce | /Codes/Halak/UITouchEventArgs.cpp | bd92c31d92489b472e0c227b329bfe5c23c81bb8 | []
| 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 | 231 | cpp | #include <Halak/PCH.h>
#include <Halak/UITouchEventArgs.h>
namespace Halak
{
UITouchEventArgs::UITouchEventArgs()
: UIEventArgs(nullptr)
{
}
UITouchEventArgs::~UITouchEventArgs()
{
}
} | [
"[email protected]"
]
| [
[
[
1,
14
]
]
]
|
c2d96d0390543bc176e4c83a98c45ecb681f923e | 036223734cc17154c03ea556f227f4fc3a15b0d3 | /CT-Viewer-Native/CoreWrapper/Stdafx.cpp | 8d6f64403777522d3fdfba8651d1ff01909e8277 | []
| no_license | jschwanke/ctpv | d0e93d3930621b30dc41b1965c7aedbe3cbf3e58 | 948b87c2b0472fa0f23d60b63e68d9b3e4f323dc | refs/heads/master | 2021-01-10T20:13:55.887211 | 2009-03-25T18:31:23 | 2009-03-25T18:31:23 | 32,389,364 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 207 | cpp | // stdafx.cpp : source file that includes just the standard includes
// CoreWrapper.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
| [
"jens.schwanke@229a4498-4a46-0410-8831-316b8a3adfa8"
]
| [
[
[
1,
5
]
]
]
|
23386fa566996a738a0357715e317beb53d7bee0 | 6477cf9ac119fe17d2c410ff3d8da60656179e3b | /Projects/openredalert/src/game/WarheadDataList.h | 2c4dc6b0c2e99bacf1ef5973d003a2a05cf146ab | []
| no_license | crutchwalkfactory/motocakerteam | 1cce9f850d2c84faebfc87d0adbfdd23472d9f08 | 0747624a575fb41db53506379692973e5998f8fe | refs/heads/master | 2021-01-10T12:41:59.321840 | 2010-12-13T18:19:27 | 2010-12-13T18:19:27 | 46,494,539 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,151 | h | // WarheadDataList.h
// 1.0
// This file is part of OpenRedAlert.
//
// OpenRedAlert 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, version 2 of the License.
//
// OpenRedAlert 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 OpenRedAlert. If not, see <http://www.gnu.org/licenses/>.
#ifndef WARHEADDATALIST_H
#define WARHEADDATALIST_H
#include "misc/INIFile.h"
class WarheadData;
class WarheadDataList
{
public:
void loadWarheadData(INIFile* file, string name);
WarheadData* getData(string name);
int size();
void print();
private:
map < string, WarheadData * > data;
/** @link association */
/*# WarheadData * lnkWarheadData; */
};
#endif //WARHEADDATALIST_H
| [
"[email protected]"
]
| [
[
[
1,
41
]
]
]
|
dabb25b5f3f083540458664c232687adc6fa026b | a2ba072a87ab830f5343022ed11b4ac365f58ef0 | / urt-bumpy-q3map2 --username [email protected]/libs/gtkutil/image.cpp | fb1da5674816a58f999e0d1f713229e5a229347c | []
| no_license | Garey27/urt-bumpy-q3map2 | 7d0849fc8eb333d9007213b641138e8517aa092a | fcc567a04facada74f60306c01e68f410cb5a111 | refs/heads/master | 2021-01-10T17:24:51.991794 | 2010-06-22T13:19:24 | 2010-06-22T13:19:24 | 43,057,943 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,456 | cpp |
#include "image.h"
#include <gtk/gtkimage.h>
#include <gtk/gtkstock.h>
#include "string/string.h"
#include "stream/stringstream.h"
#include "stream/textstream.h"
namespace
{
CopiedString g_bitmapsPath;
}
void BitmapsPath_set(const char* path)
{
g_bitmapsPath = path;
}
GdkPixbuf* pixbuf_new_from_file_with_mask(const char* filename)
{
GdkPixbuf* rgb = gdk_pixbuf_new_from_file(filename, 0);
if(rgb == 0)
{
return 0;
}
else
{
GdkPixbuf* rgba = gdk_pixbuf_add_alpha(rgb, TRUE, 255, 0, 255);
gdk_pixbuf_unref(rgb);
return rgba;
}
}
GtkImage* image_new_from_file_with_mask(const char* filename)
{
GdkPixbuf* rgba = pixbuf_new_from_file_with_mask(filename);
if(rgba == 0)
{
return 0;
}
else
{
GtkImage* image = GTK_IMAGE(gtk_image_new_from_pixbuf(rgba));
gdk_pixbuf_unref(rgba);
return image;
}
}
GtkImage* image_new_missing()
{
return GTK_IMAGE(gtk_image_new_from_stock(GTK_STOCK_MISSING_IMAGE, GTK_ICON_SIZE_SMALL_TOOLBAR));
}
GtkImage* new_image(const char* filename)
{
{
GtkImage* image = image_new_from_file_with_mask(filename);
if(image != 0)
{
return image;
}
}
return image_new_missing();
}
GtkImage* new_local_image(const char* filename)
{
StringOutputStream fullPath(256);
fullPath << g_bitmapsPath.c_str() << filename;
return new_image(fullPath.c_str());
}
| [
"[email protected]"
]
| [
[
[
1,
76
]
]
]
|
0b95a9cf9f0085236a4d1dc43214f978ca033a4e | 802817310cdf7c69dbeab815b4abfc9fca393bcc | /src/shader.cpp | 6bcf37bed92219762351a1248b4def070dd7ad1e | []
| no_license | spjoe/echtzeitlu | a77b4c6765c8d4d88e52fda715fb96485f28d0eb | 6df1ad920e45c0624405b3620059a2fdf67d5fad | refs/heads/master | 2021-01-18T14:22:07.337680 | 2011-01-25T13:53:39 | 2011-01-25T13:53:39 | 32,144,342 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,221 | cpp | #include <fstream>
#include "shader.hpp"
Shader::Shader(const string &path) :
_success(false)
{
// Load the shader files
string vertex_shader_source;
if (file_exists(path+".vert")) {
vertex_shader_source = read_file(path+".vert");
} else {
cerr << "Vertex shader file "
<< path <<".vert does not exist." << endl;
return;
}
string fragment_shader_source;
if (file_exists(path+".frag")) {
fragment_shader_source = read_file(path+".frag");
} else {
cerr << "Fragment shader file "
<< path <<".frag does not exist." << endl;
return;
}
// Compile the shaders
_vertex_shader = compile(GL_VERTEX_SHADER, vertex_shader_source);
if (_vertex_shader == 0)
return;
get_errors();
_fragment_shader = compile(GL_FRAGMENT_SHADER, fragment_shader_source);
if (_fragment_shader == 0)
return;
get_errors();
// Link the shaders into a program
link();
if (_program == 0)
return;
_success = true;
get_errors();
}
Shader::Shader(const string vert, const string frag)
{
_vertex_shader = compile(GL_VERTEX_SHADER, vert);
if (_vertex_shader == 0)
return;
get_errors();
_fragment_shader = compile(GL_FRAGMENT_SHADER, frag);
if (_fragment_shader == 0)
return;
get_errors();
// Link the shaders into a program
link();
if (_program == 0)
return;
_success = true;
get_errors();
}
Shader::~Shader()
{
glDeleteProgram(_program);
glDeleteShader(_vertex_shader);
glDeleteShader(_fragment_shader);
}
GLuint Shader::compile (GLenum type, const string &source)
{
// Create shader object
GLuint shader = glCreateShader(type);
if (shader == 0) {
cerr << "Could not create shader object." << endl;
return 0;
}
// Define shader source and compile
const char* src = source.data();
int len = source.size();
glShaderSource(shader, 1, &src, &len);
glCompileShader(shader);
// Check for errors
int status;
glGetShaderiv(shader, GL_COMPILE_STATUS, &status);
if (status != GL_TRUE) {
cout << "Shader compilation failed." << endl;
shader_log(shader);
}
get_errors();
return shader;
}
void Shader::link(void)
{
// Create program handle
_program = glCreateProgram();
// Attach shaders and link
glAttachShader(_program, _vertex_shader);
glAttachShader(_program, _fragment_shader);
glLinkProgram(_program);
// Check for problems
int status;
glGetProgramiv(_program, GL_LINK_STATUS, &status);
if (status != GL_TRUE) {
cout << "Shader linking failed." << endl;
program_log(_program);
glDeleteProgram(_program);
_program = 0;
}
get_errors();
}
#define LOG_BUFFER_SIZE 8096
void Shader::program_log(GLuint program)
{
char logBuffer[LOG_BUFFER_SIZE];
GLsizei length;
logBuffer[0] = '\0';
glGetProgramInfoLog(program, LOG_BUFFER_SIZE, &length,logBuffer);
if (length > 0) {
cout << logBuffer << endl;
}
};
void Shader::shader_log(GLuint shader)
{
char logBuffer[LOG_BUFFER_SIZE];
GLsizei length;
logBuffer[0] = '\0';
glGetShaderInfoLog(shader, LOG_BUFFER_SIZE, &length,logBuffer);
if (length > 0) {
cout << logBuffer << endl;
}
};
| [
"cdellmour@2895edc6-717a-dc9c-75a2-8897665f464c"
]
| [
[
[
1,
173
]
]
]
|
1c7a4ba7c3c17740361bf3d47a7dab5583bc1b80 | 841e58a0ee1393ddd5053245793319c0069655ef | /Karma/Source/MenuState.cpp | 043224d113e9bc1fecfc647d931ab02ff995ca5b | []
| no_license | dremerbuik/projectkarma | 425169d06dc00f867187839618c2d45865da8aaa | faf42e22b855fc76ed15347501dd817c57ec3630 | refs/heads/master | 2016-08-11T10:02:06.537467 | 2010-06-09T07:06:59 | 2010-06-09T07:06:59 | 35,989,873 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,801 | cpp | /*---------------------------------------------------------------------------------*/
/* File: MenuState.cpp */
/* Author: Per Karlsson, [email protected] */
/* */
/* Description: http://www.ogre3d.org/wiki/index.php/Advanced_Ogre_Framework */
/* Based on the example in the Advanced Ogre Framework by spacegaier. */
/*---------------------------------------------------------------------------------*/
#include "MenuState.h"
/*---------------------------------------------------------------------------------*/
void MenuState::enter()
{
GameFramework::getSingletonPtr()->mpLog->logMessage("Entering MenuState...");
//Initiate the Scene Manager.
mtpSceneMgr = GameFramework::getSingletonPtr()->mpRoot->createSceneManager(Ogre::ST_GENERIC, "MenuSceneMgr");
//Create camera
mtpCamera = mtpSceneMgr->createCamera("MenuCam");
mtpCamera->setAspectRatio(Ogre::Real(GameFramework::getSingletonPtr()->mpViewport->getActualWidth()) /
Ogre::Real(GameFramework::getSingletonPtr()->mpViewport->getActualHeight()));
GameFramework::getSingletonPtr()->mpViewport->setCamera(mtpCamera);
//Set input
GameFramework::getSingletonPtr()->mpKeyboard->setEventCallback(this);
GameFramework::getSingletonPtr()->mpMouse->setEventCallback(this);
mvQuit = false;
//If the resource group "Menu" doesn't exist, load and create it.
if(!Ogre::ResourceGroupManager::getSingletonPtr()->resourceGroupExists("Menu"))
GameFramework::getSingletonPtr()->loadMenuResources();
GameFramework::getSingletonPtr()->mpRoot->renderOneFrame();
//If the resource group "Game" exist, we come from the game. If not, we have just started the application.
bool fromGame;
if(Ogre::ResourceGroupManager::getSingletonPtr()->resourceGroupExists("Game"))
fromGame = true;
else
fromGame = false;
//Create GUI with mouse over support
Ogre::String s = "GuiMenu/Menu";
mvGuiMouseOver = new GuiMouseOver<MenuState>(this, s);
//Add Resume button.
Ogre::String resume = "GuiMenu/Menu/Resume";
//Bind the function resumeToGameState() to the button.
void (MenuState::*resumeFunction)() = &MenuState::resumeToGameState;
//the bool fromGame determines if the button is locked or not.
int resumeButtoN = mvGuiMouseOver->addMouseOver(resume,resumeFunction,true,!fromGame);
//Add Quit button.
Ogre::String quit = "GuiMenu/Menu/Quit";
//Bind the function quit() to the button.
void (MenuState::*quitFunction)() = &MenuState::quit;
int quitButtoN = mvGuiMouseOver->addMouseOver(quit,quitFunction);
//Add Disconnect button.
Ogre::String disc = "GuiMenu/Menu/Disconnect";
//Bind the function quit() to the disconnect.
void (MenuState::*discFunction)() = &MenuState::disconnect;
//the bool fromGame determines if the button is locked or not.
int disconnectButtoN = mvGuiMouseOver->addMouseOver(disc,discFunction,true,!fromGame);
//Add New Game button.
Ogre::String newgame = "GuiMenu/Menu/NewGame";
//Bind the function createNewGameState() to the disconnect.
void (MenuState::*newGameFunction)() = &MenuState::createNewGameState;
//the bool fromGame determines if the button is locked or not.
int newGameButtoN = mvGuiMouseOver->addMouseOver(newgame,newGameFunction,true,fromGame);
//When the disconnect button is pressed, disconnect and resume button will be locked.
std::vector<int> disconnectLockedButtons;
disconnectLockedButtons.push_back(disconnectButtoN);
disconnectLockedButtons.push_back(resumeButtoN);
mvGuiMouseOver->addLockedRelation(disconnectButtoN,disconnectLockedButtons);
//When the disconnect button is pressed, New Game button will be unlocked.
std::vector<int> disconnectUnlockedButtons;
disconnectUnlockedButtons.push_back(newGameButtoN);
mvGuiMouseOver->addUnlockedRelation(disconnectButtoN,disconnectUnlockedButtons);
createScene();
}
/*---------------------------------------------------------------------------------*/
bool MenuState::pause()
{
//Didn't bother to set anything here since MenuState will never be paused.
return true;
}
/*---------------------------------------------------------------------------------*/
void MenuState::resume()
{
//Didn't bother to set anything here since MenuState will never be resumed.
}
/*---------------------------------------------------------------------------------*/
void MenuState::createScene()
{
}
/*---------------------------------------------------------------------------------*/
void MenuState::exit()
{
GameFramework::getSingletonPtr()->mpLog->logMessage("Leaving MenuState...");
//Show the loading texture
Ogre::OverlayManager::getSingletonPtr()->getByName("Loading")->show();
//Hide the Menu Overlay
Ogre::OverlayManager::getSingleton().getByName("GuiMenu/Menu")->hide();
//Render one frame to update and show the loading texture.
GameFramework::getSingletonPtr()->mpRoot->renderOneFrame();
//Destroy GuiMouseOver
delete mvGuiMouseOver;
//Destroy camera and scene manager.
mtpSceneMgr->destroyCamera(mtpCamera);
if(mtpSceneMgr)
GameFramework::getSingletonPtr()->mpRoot->destroySceneManager(mtpSceneMgr);
}
/*---------------------------------------------------------------------------------*/
void MenuState::createNewGameState()
{
//Creates a new GameState.
this->changeAppState(findByName("GameState"));
}
/*---------------------------------------------------------------------------------*/
void MenuState::resumeToGameState()
{
//The game state will always be in the background waiting.
this->popAppState();
}
/*---------------------------------------------------------------------------------*/
void MenuState::disconnect()
{
//Pops the Game state in the states list.
this->popGameState();
}
/*---------------------------------------------------------------------------------*/
void MenuState::quit()
{
//Pops all states and quits the application.
this->popAllAppStates();
}
/*---------------------------------------------------------------------------------*/
bool MenuState::keyPressed(const OIS::KeyEvent &keyEventRef)
{
//Escape = Quit.
if(GameFramework::getSingletonPtr()->mpKeyboard->isKeyDown(OIS::KC_ESCAPE))
mvQuit = true;
GameFramework::getSingletonPtr()->keyPressed(keyEventRef);
return true;
}
/*---------------------------------------------------------------------------------*/
bool MenuState::keyReleased(const OIS::KeyEvent &keyEventRef)
{
GameFramework::getSingletonPtr()->keyReleased(keyEventRef);
return true;
}
/*---------------------------------------------------------------------------------*/
bool MenuState::mouseMoved(const OIS::MouseEvent &evt)
{
//Update GUI cursor.
GameFramework::getSingletonPtr()->mpGui->updateCursorPos(evt.state.X.abs,evt.state.Y.abs );
//Check for mouse over elements.
mvGuiMouseOver->checkMouseOver(evt.state.X.abs, evt.state.Y.abs);
return true;
}
/*---------------------------------------------------------------------------------*/
bool MenuState::mousePressed(const OIS::MouseEvent &evt, OIS::MouseButtonID id)
{
//Fires an event if there is any active Mouse Over Element.
if(mvGuiMouseOver->mousePressed())
mvGuiMouseOver->resetMouseOver();
return true;
}
/*---------------------------------------------------------------------------------*/
bool MenuState::mouseReleased(const OIS::MouseEvent &evt, OIS::MouseButtonID id)
{
return true;
}
/*---------------------------------------------------------------------------------*/
void MenuState::update(double timeSinceLastFrame)
{
//Active as long as mvQuit is false
if(mvQuit == true)
quit();
}
/*---------------------------------------------------------------------------------*/ | [
"perkarlsson89@0a7da93c-2c89-6d21-fed9-0a9a637d9411"
]
| [
[
[
1,
196
]
]
]
|
e801ccee44533b95740435f82979a1a2e914c4a2 | 9a48be80edc7692df4918c0222a1640545384dbb | /Libraries/Boost1.40/libs/python/test/a_map_indexing_suite.cpp | d884b3de24aa63cac2b1acdea507d6945ecaba77 | [
"BSL-1.0"
]
| permissive | fcrick/RepSnapper | 05e4fb1157f634acad575fffa2029f7f655b7940 | a5809843f37b7162f19765e852b968648b33b694 | refs/heads/master | 2021-01-17T21:42:29.537504 | 2010-06-07T05:38:05 | 2010-06-07T05:38:05 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,868 | cpp | // Copyright Joel de Guzman 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)
#include <boost/python/suite/indexing/map_indexing_suite.hpp>
#include <boost/python/module.hpp>
#include <boost/python/def.hpp>
#include <boost/python/implicit.hpp>
using namespace boost::python;
struct A
{
int value;
A() : value(0){};
A(int v) : value(v) {};
};
bool operator==(const A& v1, const A& v2)
{
return (v1.value == v2.value);
}
struct B
{
A a;
};
// Converter from A to python int
struct AToPython
{
static PyObject* convert(const A& s)
{
return boost::python::incref(boost::python::object((int)s.value).ptr());
}
};
// Conversion from python int to A
struct AFromPython
{
AFromPython()
{
boost::python::converter::registry::push_back(
&convertible,
&construct,
boost::python::type_id< A >());
}
static void* convertible(PyObject* obj_ptr)
{
if (!PyInt_Check(obj_ptr)) return 0;
return obj_ptr;
}
static void construct(
PyObject* obj_ptr,
boost::python::converter::rvalue_from_python_stage1_data* data)
{
void* storage = (
(boost::python::converter::rvalue_from_python_storage< A >*)
data)-> storage.bytes;
new (storage) A((int)PyInt_AsLong(obj_ptr));
data->convertible = storage;
}
};
void a_map_indexing_suite()
{
to_python_converter< A , AToPython >();
AFromPython();
class_< std::map<int, A> >("AMap")
.def(map_indexing_suite<std::map<int, A>, true >())
;
class_< B >("B")
.add_property("a", make_getter(&B::a, return_value_policy<return_by_value>()),
make_setter(&B::a, return_value_policy<return_by_value>()))
;
}
| [
"metrix@Blended.(none)"
]
| [
[
[
1,
84
]
]
]
|
b4290db966ff877b8839827c34a5df0f19a3c64c | cd69369374074a7b4c4f42e970ee95847558e9f0 | /AEDA_parta2/Medico.h | 4828365e36603a603772de183d333a738f0610b5 | []
| no_license | miaosun/aeda-trab1 | 4e6b8ce3de8bb7e85e13670595012a5977258a2a | 1ec5e2edec383572c452545ed52e45fb26df6097 | refs/heads/master | 2021-01-25T03:40:21.146657 | 2010-12-25T03:35:28 | 2010-12-25T03:35:28 | 33,734,306 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,876 | h | ///////////////////////////////////////////////////////////
// Medico.h
// Implementation of the Class Medico
// Created on: 24-Out-2010 20:04:14
///////////////////////////////////////////////////////////
/**Classe Medico, uma das 3 subclasses da classe Pessoa, tem proprio 4 atribuitos, especialidade:string, horario:string, vencimento:double e funcionario:Pessoa*. */
#if !defined(EA_FC464729_C72D_4115_B003_E0DAD8DDC9B3__INCLUDED_)
#define EA_FC464729_C72D_4115_B003_E0DAD8DDC9B3__INCLUDED_
#include "Pessoa.h"
#include "Funcionario.h"
#include "Doente.h"
class Medico : public Pessoa
{
public:
Medico();
virtual ~Medico();
Funcionario *f_Funcionario;
Doente *m_Doente;
// Medico(int id, string nome, string dataNascimento, string tipo, string especialidade, string horario, double vencimento);
Medico(string nome, string dataNascimento, string tipo, string especialidade, string horario, double vencimento);
string getEspecialidade();
void setEspecialidade(string especialidade);
string getHorario();
void setHorario(string horario);
double getVencimento();
void setVencimento(double vencimento);
Pessoa * getFuncionario();
void setFuncionario(Pessoa * func);
vector<string> imprime();
vector<string> editPessoa();
string toString();
//funcoes abstradas para objecto da superclasse consegue acessar os metodos das classes derivadas
void setMorada(string morada);
void setCargo(string cargo);
string getCargo();
void showMedicos();
void addMedico(Pessoa * medico);
void addMedico(Pessoa * medico, string especialidade);
vector<Pessoa *> * getMedicos(string especialidade);
void addEspec(string d_esp);
private:
string especialidade;
string horario;
double vencimento;
Pessoa * funcionario;
};
#endif // !defined(EA_FC464729_C72D_4115_B003_E0DAD8DDC9B3__INCLUDED_)
| [
"miaosun88@9ca0f86a-2074-76d8-43a5-19cf18205b40"
]
| [
[
[
1,
59
]
]
]
|
c69bc31e6bbf9dd0db3cf5ea9e6a915b66d03c88 | 3d9e738c19a8796aad3195fd229cdacf00c80f90 | /src/geometries/power_crust_3/layers/Delaunay_layer_3.h | 38b7b0c9d6c221ac4e3947b51558917782f74f8f | []
| no_license | mrG7/mesecina | 0cd16eb5340c72b3e8db5feda362b6353b5cefda | d34135836d686a60b6f59fa0849015fb99164ab4 | refs/heads/master | 2021-01-17T10:02:04.124541 | 2011-03-05T17:29:40 | 2011-03-05T17:29:40 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,536 | h | /* This source file is part of Mesecina, a software for visualization and studying of
* the medial axis and related computational geometry structures.
* More info: http://www.agg.ethz.ch/~miklosb/mesecina
* Copyright Balint Miklos, Applied Geometry Group, ETH Zurich
*
* $Id: Delaunay_faces_layer_3.h 98 2007-05-01 23:11:20Z miklosb $
*/
#ifndef MESECINA_DELAUNAY_LAYER_3_H
#define MESECINA_DELAUNAY_LAYER_3_H
#include <geometries/power_crust_3/Power_crust_3.h>
#include <gui/gl_widget_3/GL_draw_layer_3.h>
template <class Power_crust_3>
class Delaunay_layer_3 : public GL_draw_layer_3 {
public:
typedef typename Power_crust_3::Triangulation_3 Triangulation_3;
typedef typename Triangulation_3::Finite_facets_iterator Finite_facets_iterator;
typedef typename Triangulation_3::Finite_cells_iterator Finite_cells_iterator;
typedef typename Triangulation_3::Finite_vertices_iterator Finite_vertices_iterator;
typedef typename Triangulation_3::Cell_handle Cell_handle;
typedef typename Power_crust_3::Triangle_3 Triangle_3;
typedef typename Power_crust_3::Segment_3 Segment_3;
Delaunay_layer_3(const QString& name, Power_crust_3* m, const QString& tt, bool vertex, bool edge, bool face, bool dual) : GL_draw_layer_3(name,tt), parent(m) {
do_vertex = vertex;
do_edge = edge;
do_face = face;
do_dual = dual;
}
virtual void draw_commands() {
Triangulation_3* t = parent->get_input_triangulation();
if (do_dual) *this << NO_BOUNDING;
if (do_vertex) {
*this << POINTS_START;
if (do_dual) {
Finite_cells_iterator c_it, c_end = t->finite_cells_end();
for (c_it = t->finite_cells_begin (); c_it!=c_end; c_it++) {
*this << t->dual(c_it);
}
} else {
Finite_vertices_iterator v_it, v_end = t->finite_vertices_end();
for (v_it = t->finite_vertices_begin(); v_it!=v_end; v_it++) {
*this << CGAL::to_double(v_it->point().x());
*this << v_it->point();
}
}
*this << POINTS_END;
} else if (do_edge) {
if (do_dual) {
Finite_facets_iterator f_it, f_end = t->finite_facets_end();
*this << SEGMENTS_START;
for (f_it = t->finite_facets_begin(); f_it!=f_end; f_it++) {
Cell_handle c = f_it->first;
int id = f_it->second;
Cell_handle c_n = c->neighbor(id);
if (!t->is_infinite(c) && !t->is_infinite(c_n))
*this << Segment_3( t->dual(c), t->dual(c_n));
}
*this << SEGMENTS_END;
} else *this << *t;
} else if (do_face) {
std::cout << PROGRESS_STATUS << "Extracting Delaunay faces" << std::endl;
Finite_facets_iterator f_it, f_end = t->finite_facets_end(); int i = 0;
*this << TRIANGLES_START;
for (f_it = t->finite_facets_begin(); f_it!=f_end; f_it++, i++) {
Cell_handle c = f_it->first;
int id = f_it->second;
*this << Triangle_3(
c->vertex((id+1)%4)->point(),
c->vertex((id+2)%4)->point(),
c->vertex((id+3)%4)->point());
}
*this << TRIANGLES_END;
std::cout << PROGRESS_DONE << std::endl;
}
if (do_dual) *this << NO_BOUNDING;
}
virtual bool has_property(Layer_property prop) {
switch (prop) {
case COLOR_EDITABLE:
return true;
break;
case POINT_SIZE_EDITABLE:
return do_vertex;
break;
case LINE_WIDTH_EDITABLE:
return do_edge;
break;
default:
return false;
break;
}
}
private:
Power_crust_3 *parent;
bool do_vertex, do_edge, do_face, do_dual;
};
#endif //MESECINA_DELAUNAY_LAYER_3_H | [
"balint.miklos@localhost"
]
| [
[
[
1,
106
]
]
]
|
2811a6876fe0042daeca462e5eb9a7a740692749 | 2aff7486e6c7afdbda48b7a5f424b257d47199df | /src/WorkingThread.h | 39fec5bfcfe00b590643215a7b79646671bda347 | []
| no_license | offlinehacker/LDI_test | 46111c60985d735c00ea768bdd3553de48ba2ced | 7b77d3261ee657819bae3262e3ad78793b636622 | refs/heads/master | 2021-01-10T20:44:55.324019 | 2011-08-17T16:41:43 | 2011-08-17T16:41:43 | 2,220,496 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,559 | h | #ifndef _WORKER_H
#define _WORKER_H
#include "highgui.h"
#include "cv.h"
#include "cvaux.h"
#include "cxcore.h"
#include "wx/wxprec.h"
#include "wx/thread.h"
//For displaying video
#include "Gui/camview.h"
#include "Camera/CameraSourceManager.h"
#include "VideoProcessor.h"
#include "VideoIOConfiguration.h"
#include "Output.h"
#include "VideoRecorder.h"
//Our working thread for camera reading, processing and output
class WorkingThread : public wxThread
{
private:
//Class for processing video
VideoProcessorManager *cVideoProcessorManager;
//Class for camera io
CameraSourceManager *cCameraSourceManager;
//class for video io
VideoIOConfiguration *cVideoIOConfiguration;
//Class for data output
OutputManager *cOutputManager;
//Class for video recording(managed by working thread)
VideoRecorder *cVideoRecorder;
bool VideoSourceOpened;
bool VideoIsProcessing;
bool VideoIsRecording;
bool working;
public:
WorkingThread( VideoProcessorManager *lVideoProcessorManager, CameraSourceManager *lCameraSourceManager, VideoIOConfiguration *lVideoIOConfiguration, OutputManager *lOutputManager );
~WorkingThread();
bool OpenVideoSource();
bool StartVideoProcessing(){ VideoIsProcessing= true; return true; }
bool CloseVideoSource();
void StopVideoProcessing(){ VideoIsProcessing= false; }
bool StartVideoRecording( char * filename );
void StopVideoRecording();
void StopThread(){ working= false; }
//Thread entry point
virtual void *Entry();
virtual void OnExit();
};
#endif | [
"[email protected]"
]
| [
[
[
1,
57
]
]
]
|
75fdcc9d1cf1382d6b24c886ec543f9cbdf24f04 | f55665c5faa3d79d0d6fe91fcfeb8daa5adf84d0 | /Depend/MyGUI/Tools/LayoutEditor/BackgroundControl.cpp | f57578efcae396cc0d7cfffb9960e288a02e5983 | []
| no_license | lxinhcn/starworld | 79ed06ca49d4064307ae73156574932d6185dbab | 86eb0fb8bd268994454b0cfe6419ffef3fc0fc80 | refs/heads/master | 2021-01-10T07:43:51.858394 | 2010-09-15T02:38:48 | 2010-09-15T02:38:48 | 47,859,019 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 337 | cpp | /*!
@file
@author Albert Semenov
@date 08/2008
*/
#include "precompiled.h"
#include "BackgroundControl.h"
#include "DialogManager.h"
namespace tools
{
BackgroundControl::BackgroundControl() :
wraps::BaseLayout("Background.layout")
{
}
BackgroundControl::~BackgroundControl()
{
}
} // namespace tools
| [
"albertclass@a94d7126-06ea-11de-b17c-0f1ef23b492c"
]
| [
[
[
1,
21
]
]
]
|
b29745547e744de16ede28bc1c35b65ad93e4b67 | 5ac13fa1746046451f1989b5b8734f40d6445322 | /minimangalore/Nebula2/code/mangalore/msg/ui/dragboxready.cc | 556c4992c300e3112404f1d2189caa27650f439f | []
| no_license | moltenguy1/minimangalore | 9f2edf7901e7392490cc22486a7cf13c1790008d | 4d849672a6f25d8e441245d374b6bde4b59cbd48 | refs/heads/master | 2020-04-23T08:57:16.492734 | 2009-08-01T09:13:33 | 2009-08-01T09:13:33 | 35,933,330 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 430 | cc | //------------------------------------------------------------------------------
// msg/ui/dragboxready.cc
// (C) 2006 Radon Labs GmbH
//------------------------------------------------------------------------------
#include "msg/ui/dragboxready.h"
namespace Message
{
ImplementRtti(Message::DragBoxReady, Message::Msg);
ImplementFactory(Message::DragBoxReady);
ImplementMsgId(DragBoxReady);
} // namespace Message
| [
"BawooiT@d1c0eb94-fc07-11dd-a7be-4b3ef3b0700c"
]
| [
[
[
1,
12
]
]
]
|
7acf017199d5050377345db10bd43a75666da2f9 | a36fcac2b8224325125203475fedea5e8ee8af7d | /KnihaJazd/CestaDlg.cpp | 7472069f7aac80cabdd1921a3b81688c21578982 | []
| no_license | mareqq/knihajazd | e000a04dbed8417e32f8a1ba3dce59e35892e3bb | e99958dd9bed7cfda6b7e8c50c86ea798c4e754e | refs/heads/master | 2021-01-19T08:25:50.761893 | 2008-05-26T09:11:56 | 2008-05-26T09:11:56 | 32,898,594 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,004 | cpp | #include "stdafx.h"
#include "KnihaJazd.h"
#include "CestaDlg.h"
#include "CestaRecordset.h"
IMPLEMENT_DYNAMIC(CCestaDlg, CDialog)
CCestaDlg::CCestaDlg(CWnd* pParent)
: CDialog(CCestaDlg::IDD, pParent)
, m_rsCesta(theApp.GetDB())
, m_Datum(0,0,0,0,0,0)
, m_Ciel("")
, m_Ucel("")
, m_PocetKm(0)
, m_PocStav(0)
, m_KonStav(0)
, m_Tankovane(0)
, m_Stravne(0)
, m_Ostatne(0)
{
m_IdAuta = 0;
m_Spolu = 0;
m_KmSadzba = 0;
}
CCestaDlg::~CCestaDlg()
{
m_rsCesta.Close();
}
void CCestaDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKER, m_Datum);
DDX_Text(pDX, IDC_EDIT_CIEL, m_Ciel);
DDX_Text(pDX, IDC_EDIT_UCEL, m_Ucel);
DDX_Text(pDX, IDC_EDIT_POCETKM, m_PocetKm);
DDX_Text(pDX, IDC_EDIT_POCSTAV, m_PocStav);
DDX_Text(pDX, IDC_EDIT_KONSTAV, m_KonStav);
DDX_Text(pDX, IDC_EDIT_TANKOVANE, m_Tankovane);
DDX_Text(pDX, IDC_EDIT_STRAVNE, m_Stravne);
DDX_Text(pDX, IDC_EDIT_OSTATNE, m_Ostatne);
DDX_Control(pDX, IDC_EDIT_SPOLU, m_SpoluCtrl);
DDV_MinMaxDouble(pDX, m_PocetKm, 1, 999999);
}
BEGIN_MESSAGE_MAP(CCestaDlg, CDialog)
END_MESSAGE_MAP()
BOOL CCestaDlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_rsCesta.SetSQLNacitanieKonkretnejCesty(m_IdAuta, m_Datum);
m_rsCesta.Open();
if (m_Datum != 0)
{
// Ak editujeme firmu
m_Datum = m_rsCesta.m_CDatum;
m_Ciel = m_rsCesta.m_CCiel;
m_Ucel = m_rsCesta.m_CUcel;
m_PocetKm = m_rsCesta.m_CPocetKm;
m_PocStav = m_rsCesta.m_CPocStav;
m_Tankovane = m_rsCesta.m_CTankovane;
m_Stravne = m_rsCesta.m_CStravne;
m_Ostatne = m_rsCesta.m_COstatne;
m_Spolu = m_Stravne + m_Ostatne + m_PocetKm*m_KmSadzba;
}
UpdateData(FALSE);
return TRUE;
}
void CCestaDlg::SetParamsA(long idAuta)
{
m_IdAuta = idAuta;
}
void CCestaDlg::SetParamsD(COleDateTime Datum)
{
m_Datum = Datum;
}
void CCestaDlg::SetParamsKS(float KmSadzba)
{
m_KmSadzba = KmSadzba;
}
void CCestaDlg::OnOK()
{
COleDateTime pomDatum;
pomDatum.SetDate(2000,1,1);
UpdateData(TRUE);
if (m_Datum == 0)
{
// Zistime maximalny datum u a nastavime o jeden viac
CCestaRecordset rs(theApp.GetDB());
rs.SetSQLNacitanieMaximalnehoDatumu(m_IdAuta);
rs.Open();
COleDateTimeSpan m_Datum = m_Datum + pomDatum;
rs.Close();
// Pridavame cestu
m_rsCesta.AddNew();
m_rsCesta.m_AId = m_IdAuta;
}
else
{
// Menime povodnu firmu
m_rsCesta.Edit();
}
m_rsCesta.m_CDatum = m_Datum;
m_rsCesta.m_CCiel = m_Ciel;
m_rsCesta.m_CUcel = m_Ucel;
m_rsCesta.m_CPocetKm = m_PocetKm;
m_PocStav = m_rsCesta.m_CPocStav;
m_rsCesta.m_CTankovane = m_Tankovane;
m_rsCesta.m_CStravne = m_Stravne;
m_rsCesta.m_COstatne = m_Ostatne;
m_rsCesta.Update();
CDialog::OnOK();
}
| [
"[email protected]@d4c424c1-354d-0410-9d05-3f146b4bb521"
]
| [
[
[
1,
129
]
]
]
|
b6d6319957602e7b39ad35c68d0fbde1c5c7c3ff | 5f28f9e0948b026058bafe651ba0ce03971eeafa | /LindsayAR Client Final/ARToolkitPlus/src/core/arGetInitRot2.cpp | 86b6fbfd7a89733c6a0ae8e5b9025e0089afc3e3 | []
| no_license | TheProjecter/surfacetoar | cbe460d9f41a2f2d7a677a697114e4eea7516218 | 4ccba52e55b026b63473811319ceccf6ae3fbc1f | refs/heads/master | 2020-05-17T15:41:31.087874 | 2010-11-08T00:09:25 | 2010-11-08T00:09:25 | 42,946,053 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,603 | cpp | /*
Copyright (C) 2010 ARToolkitPlus Authors
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/>.
Authors:
Daniel Wagner
Pavel Rojtberg
*/
#include "arGetInitRot2Sub.h"
#include "Tracker.h"
namespace ARToolKitPlus {
int
Tracker::arGetInitRot2(ARMarkerInfo *marker_info, ARFloat rot[3][3], ARFloat center[2], ARFloat width)
{
rpp_float err = 1e+20;
rpp_mat R, R_init;
rpp_vec t;
int dir = marker_info->dir;
rpp_vec ppos2d[4];
rpp_vec ppos3d[4];
const unsigned int n_pts = 4;
const rpp_float model_z = 0;
const rpp_float iprts_z = 1;
ppos2d[0][0] = marker_info->vertex[(4-dir)%4][0];
ppos2d[0][1] = marker_info->vertex[(4-dir)%4][1];
ppos2d[0][2] = iprts_z;
ppos2d[1][0] = marker_info->vertex[(5-dir)%4][0];
ppos2d[1][1] = marker_info->vertex[(5-dir)%4][1];
ppos2d[1][2] = iprts_z;
ppos2d[2][0] = marker_info->vertex[(6-dir)%4][0];
ppos2d[2][1] = marker_info->vertex[(6-dir)%4][1];
ppos2d[2][2] = iprts_z;
ppos2d[3][0] = marker_info->vertex[(7-dir)%4][0];
ppos2d[3][1] = marker_info->vertex[(7-dir)%4][1];
ppos2d[3][2] = iprts_z;
ppos3d[0][0] = center[0] - width*(ARFloat)0.5;
ppos3d[0][1] = center[1] + width*(ARFloat)0.5;
ppos3d[0][2] = model_z;
ppos3d[1][0] = center[0] + width*(ARFloat)0.5;
ppos3d[1][1] = center[1] + width*(ARFloat)0.5;
ppos3d[1][2] = model_z;
ppos3d[2][0] = center[0] + width*(ARFloat)0.5;
ppos3d[2][1] = center[1] - width*(ARFloat)0.5;
ppos3d[2][2] = model_z;
ppos3d[3][0] = center[0] - width*(ARFloat)0.5;
ppos3d[3][1] = center[1] - width*(ARFloat)0.5;
ppos3d[3][2] = model_z;
const rpp_float cc[2] = {arCamera->mat[0][2],arCamera->mat[1][2]};
const rpp_float fc[2] = {arCamera->mat[0][0],arCamera->mat[1][1]};
rpp::arGetInitRot2_sub(err,R,t,cc,fc,ppos3d,ppos2d,n_pts,R_init, true,0,0,0);
for(int i=0; i<3; i++)
for(int j=0; j<3; j++)
rot[i][j] = (ARFloat)R[i][j];
return 0;
}
} // namespace ARToolKitPlus
| [
"[email protected]"
]
| [
[
[
1,
85
]
]
]
|
742005d377634c69683eb26357698593eff92d88 | 3414945a21f778f467500c2ba0ae743fd6653565 | /src/gdx-cpp/scenes/scene2d/actors/FastImage.cpp | 2c658f279e052dc173f74be224e46d09f251f491 | [
"Apache-2.0"
]
| permissive | fredmen/libgdx-cpp | 945fdd6ec9837230a19d65cc560f210627747600 | 3447a8fa2a4f5435a6f9fe8a6405327877c263b2 | refs/heads/master | 2021-01-16T00:17:10.413392 | 2011-09-30T12:44:25 | 2011-09-30T12:44:25 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,303 | cpp |
/*
Copyright 2011 Aevum Software aevum @ aevumlab.com
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.
@author Victor Vicente de Carvalho [email protected]
@author Ozires Bortolon de Faria [email protected]
*/
#include "FastImage.hpp"
using namespace gdx_cpp::scenes::scene2d::actors;
void FastImage::draw (const gdx_cpp::graphics::g2d::SpriteBatch& batch,float parentAlpha) {
updateSprite();
if (region.getTexture() != null) {
sprite.draw(batch, parentAlpha);
}
}
void FastImage::updateSprite () {
if (sX != x || sY != y) {
sprite.setPosition(x, y);
sX = x;
sY = y;
}
if (sOriginX != originX || sOriginY != originY) {
sprite.setOrigin(originX, originY);
sOriginX = originX;
sOriginY = originY;
}
if (sRotation != rotation) {
sprite.setRotation(rotation);
sRotation = rotation;
}
if (sScaleX != scaleX || sScaleY != scaleY) {
sprite.setScale(scaleX, scaleY);
sScaleX = scaleX;
sScaleY = scaleY;
}
if (sWidth != width || sHeight != height) {
sprite.setSize(width, height);
sWidth = width;
sHeight = height;
}
sprite.setColor(color);
sprite.setRegion(region);
}
bool FastImage::touchDown (float x,float y,int pointer) {
return x > 0 && y > 0 && x < width && y < height;
}
bool FastImage::touchUp (float x,float y,int pointer) {
return false;
}
bool FastImage::touchDragged (float x,float y,int pointer) {
return false;
}
gdx_cpp::scenes::scene2d::Actor& FastImage::hit (float x,float y) {
if (x > 0 && x < width) if (y > 0 && y < height) return this;
return null;
}
| [
"[email protected]"
]
| [
[
[
1,
84
]
]
]
|
ef9d8be3abc0dc07a7d221c3fc7ddddf760339db | f1e1d4a52a7c840334ed8cc00b45e66aeb81f721 | /src/model.h | 3a31ccdd6826f2f49a7ee9107eced0754846d5bf | []
| no_license | attrezzo/repsnapper | 54f17c4de848378007500c5b173fc8de9e26af0f | 8e431670f5b4c69222be3060d7d2106901ceab4e | refs/heads/master | 2020-12-29T03:18:38.732606 | 2011-08-30T14:37:13 | 2011-08-30T14:37:13 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,937 | h | /*
This file is a part of the RepSnapper project.
Copyright (C) 2010 Kulitorum
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.
*/
#ifndef MODEL_H
#define MODEL_H
#include <math.h>
#include <giomm/file.h>
#include "stl.h"
#include "rfo.h"
#include "types.h"
#include "gcode.h"
#include "settings.h"
#ifdef WIN32
# pragma warning( disable : 4244 4267)
#endif
// For libreprap callbacks
#ifdef WIN32
# define RR_CALL __cdecl
#else
# define RR_CALL
#endif
typedef struct rr_dev_t *rr_dev;
class Progress {
public:
// Progress reporting
sigc::signal< void, const char *, double > m_signal_progress_start;
sigc::signal< void, double > m_signal_progress_update;
sigc::signal< void, const char * > m_signal_progress_stop;
// helpers
void start (const char *label, double max)
{
m_signal_progress_start.emit (label, max);
}
void stop (const char *label)
{
m_signal_progress_stop.emit (label);
}
void update (double value)
{
m_signal_progress_update.emit (value);
}
};
class Model
{
friend class PrintInhibitor;
bool m_printing;
unsigned long m_unconfirmed_lines;
sigc::signal< void > m_signal_rfo_changed;
bool m_inhibit_print;
sigc::signal< void > m_signal_inhibit_changed;
double m_temps[TEMP_LAST];
SerialState m_serial_state;
public:
SerialState get_serial_state () { return m_serial_state; }
void serial_try_connect (bool connect);
sigc::signal< void, SerialState > m_signal_serial_state_changed;
double get_temp (TempType t) { return m_temps[(int)t]; }
sigc::signal< void > m_signal_temp_changed;
sigc::signal< void, Gtk::MessageType, const char *, const char * > m_signal_alert;
void alert (const char *message);
void error (const char *message, const char *secondary);
Progress m_progress;
// Something in the rfo changed
sigc::signal< void > signal_rfo_changed() { return m_signal_rfo_changed; }
sigc::signal< void > signal_inhibit_changed() { return m_signal_inhibit_changed; }
bool get_inhibit_print() { return m_inhibit_print; }
Model();
~Model();
void progess_bar_start (const char *label, double max);
bool IsPrinting() { return m_printing; }
void SimpleAdvancedToggle();
void SaveConfig(Glib::RefPtr<Gio::File> file);
void LoadConfig() { LoadConfig(Gio::File::create_for_path("repsnapper.conf")); }
void LoadConfig(Glib::RefPtr<Gio::File> file);
// RFO Functions
void ReadRFO(std::string filename);
// STL Functions
void ReadStl(Glib::RefPtr<Gio::File> file);
RFO_File *AddStl(RFO_Object *parent, STL stl, string filename);
sigc::signal< void, Gtk::TreePath & > m_signal_stl_added;
void OptimizeRotation(RFO_File *file, RFO_Object *object);
void ScaleObject(RFO_File *file, RFO_Object *object, double scale);
void RotateObject(RFO_File *file, RFO_Object *object, Vector4f rotate);
bool updateStatusBar(GdkEventCrossing *event, Glib::ustring = "");
// GCode Functions
void init();
void ReadGCode(Glib::RefPtr<Gio::File> file);
void ConvertToGCode();
void MakeRaft(GCodeState &state, float &z);
void WriteGCode(Glib::RefPtr<Gio::File> file);
// Communication
bool IsConnected();
void SimplePrint();
void Print();
void Pause();
void Continue();
void Kick();
void Restart();
void RunExtruder(double extruder_speed, double extruder_length, bool reverse);
void SendNow(string str);
void setPort(string s);
void setSerialSpeed(int s );
void SetValidateConnection(bool validate);
void EnableTempReading(bool on);
void SetLogFileClear(bool on);
void SwitchPower(bool on);
void Home(string axis);
void Move(string axis, float distance);
void Goto(string axis, float position);
void STOP();
Matrix4f &SelectedNodeMatrix(uint objectNr = 1);
void SelectedNodeMatrices(vector<Matrix4f *> &result );
void newObject();
rr_dev m_device;
sigc::connection m_devconn;
/*- Custom button interface -*/
void SendCustomButton(int nr);
void SaveCustomButton();
void TestCustomButton();
void GetCustomButtonText(int nr);
void RefreshCustomButtonLabels();
void PrintButton();
void ContinuePauseButton();
void ClearLogs();
Settings settings;
// Model derived: Bounding box info
Vector3f Center;
Vector3f Min;
Vector3f Max;
vmml::Vector3f printOffset; // margin + raft
void CalcBoundingBoxAndCenter();
sigc::signal< void > m_model_changed;
void ModelChanged();
// Truly the model
RFO rfo;
GCode gcode;
Glib::RefPtr<Gtk::TextBuffer> commlog, errlog, echolog;
private:
bool handle_dev_fd (Glib::IOCondition cond);
// libreprap integration
static void RR_CALL rr_reply_fn (rr_dev dev, int type, float value,
void *expansion, void *closure);
static void RR_CALL rr_more_fn (rr_dev dev, void *closure);
static void RR_CALL rr_error_fn (rr_dev dev, int error_code,
const char *msg, size_t len, void *closure);
static void RR_CALL rr_wait_wr_fn (rr_dev dev, int wait, void *closure);
static void RR_CALL rr_log_fn (rr_dev dev, int type, const char *buffer,
size_t len, void *closure);
GCodeIter *m_iter;
};
#endif // MODEL_H
| [
"[email protected]",
"[email protected]",
"[email protected]"
]
| [
[
[
1,
20
],
[
28,
28
],
[
36,
65
],
[
67,
67
],
[
70,
72
],
[
76,
82
],
[
84,
96
],
[
100,
101
],
[
103,
105
],
[
107,
108
],
[
113,
113
],
[
116,
116
],
[
118,
124
],
[
126,
126
],
[
130,
130
],
[
133,
138
],
[
140,
140
],
[
143,
157
],
[
162,
163
],
[
165,
175
],
[
182,
183
],
[
186,
188
],
[
192,
210
]
],
[
[
21,
27
],
[
29,
35
],
[
66,
66
],
[
68,
69
],
[
73,
75
],
[
83,
83
],
[
97,
99
],
[
102,
102
],
[
106,
106
],
[
109,
112
],
[
114,
115
],
[
125,
125
],
[
127,
129
],
[
131,
132
],
[
139,
139
],
[
141,
142
],
[
158,
161
],
[
164,
164
],
[
176,
181
],
[
184,
185
],
[
189,
191
]
],
[
[
117,
117
]
]
]
|
dd2e6b15313363d6563126939fd6b6e6a9dd1c1e | 8f9358761aca3ef7c1069175ec1d18f009b81a61 | /CPP/xCalc_old/properties/QSerial.h | 83410cadb7b4b5cdabd19e2f3f2027f1b833e123 | []
| no_license | porfirioribeiro/resplacecode | 681d04151558445ed51c3c11f0ec9b7c626eba25 | c4c68ee40c0182bd7ce07a4c059300a0dfd62df4 | refs/heads/master | 2021-01-19T10:02:34.527605 | 2009-10-23T10:14:15 | 2009-10-23T10:14:15 | 32,256,450 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 860 | h | /*
* QSerial.h
*
* Created on: 30/Nov/2008
* Author: Porfirio
*/
#ifndef QSERIAL_H_
#define QSERIAL_H_
class QSerial {
public:
QSerial();
virtual ~QSerial();
static QSerial* Instance();
void doIt();
QMap<QString, BaudRateType> baudRateMap;
QMap<QString, ParityType> parityMap;
QMap<QString, DataBitsType> dataBitsMap;
QMap<QString, StopBitsType> stopBitsMap;
BaudRateType baudRateFromString(QString baudRate) {
return baudRateMap.value(baudRate);
}
ParityType parityFromString(QString parity) {
return parityMap.value(parity);
}
DataBitsType dataBitsFromString(QString dataBits) {
return dataBitsMap.value(dataBits);
}
StopBitsType stopBitsFromString(QString stopBits) {
return stopBitsMap.value(stopBits);
}
private:
static QSerial* CurrentInstance;
};
#endif /* QSERIAL_H_ */
| [
"porfirioribeiro@fe5bbf2e-9c30-0410-a8ad-a51b5c886b2f"
]
| [
[
[
1,
40
]
]
]
|
aac5b464690621eaa4e77103849dce02dcf674cb | 12ea67a9bd20cbeed3ed839e036187e3d5437504 | /winxgui/Test/MfcGuiApp/stdafx.cpp | 415d2a27bdbc53d988b13bd0f397089f39eecfb8 | []
| no_license | cnsuhao/winxgui | e0025edec44b9c93e13a6c2884692da3773f9103 | 348bb48994f56bf55e96e040d561ec25642d0e46 | refs/heads/master | 2021-05-28T21:33:54.407837 | 2008-09-13T19:43:38 | 2008-09-13T19:43:38 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 209 | cpp | // stdafx.cpp : source file that includes just the standard includes
// MfcGuiApp.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
| [
"xushiweizh@86f14454-5125-0410-a45d-e989635d7e98"
]
| [
[
[
1,
7
]
]
]
|
71f06879fe33ed2662c6ee04798bd6a95d7d9549 | fd4f996b64c1994c5e6d8c8ff78a2549255aacb7 | / nicolinorochetaller --username adrianachelotti/trunk/server_client/server/Parser.h | bf7befd7238f92fa020a12f6136c45ece6ce4876 | []
| no_license | adrianachelotti/nicolinorochetaller | 026f32476e41cdc5ac5c621c483d70af7b397fb0 | d3215dfdfa70b6226b3616c78121f36606135a5f | refs/heads/master | 2021-01-10T19:45:15.378823 | 2009-08-05T14:54:42 | 2009-08-05T14:54:42 | 32,193,619 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,463 | h | // Parser.h: interface for the Parser class.
//
//////////////////////////////////////////////////////////////////////
#if !defined PARSER_H
#define PARSER_H
#include <string>
#include <iostream>
#include <list>
#include <vector>
#include <fstream>
#include "Escenario.h"
#include "Cuadrado.h"
#include "Rectangulo.h"
#include "Circulo.h"
#include "Segmento.h"
#include "Triangulo.h"
#include "Textura.h"
using namespace std;
#define ERR1 "ERROR: - Error grave en un Tag principal -"
#define ERR2 "ERROR: - No se encontro el inicio del escenario -"
#define ERR3 "ERROR: - No se encontro el id de la textura -"
#define ERR3M "ERROR: - No se encontro formato valido de textura -"
#define ERR4 "ERROR: - Mo se encontro el path de la textura -"
#define ERR5 "ERROR: - Error grave al iniciar un Elemento -"
#define ERR6 "ERROR: - No se encontro el id del Cuadrado -"
#define ERR7 "ERROR: - No se encontro un lado valido en el Cuadrado -"
#define ERR8 "ERROR: - No se encontro Posicion de Elemento -"
#define ERR9 "ERROR: - No se encontro una coordenada X valida -"
#define ERR10 "ERROR: - No se encontro una coordenada Y valida -"
#define ERR11 "ERROR: - No se encontro el id del Circulo -"
#define ERR12 "ERROR: - No se encontro un radio valido de Circulo -"
#define ERR13 "ERROR: - No se encontro el id del Rectangulo -"
#define ERR14 "ERROR: - No se encontro una base valida en el Rectangulo -"
#define ERR15 "ERROR: - No se encontro una altura valida en el Rectangulo -"
#define ERR16 "ERROR: - No se encontro la id del Triangulo -"
#define ERR17 "ERROR: - No se encontro Vertice 1 de Triangulo -"
#define ERR18 "ERROR: - No se encontro Vertice 2 de Triangulo -"
#define ERR19 "ERROR: - No se encontro Vertice 3 de Triangulo -"
#define ERR20 "ERROR: - No se encontro la coordenada X valida del Vertice 1 del Triangulo -"
#define ERR21 "ERROR: - No se encontro la coordenada Y valida del Vertice 1 del Triangulo -"
#define ERR22 "ERROR: - No se encontro la coordenada X valida del Vertice 2 del Triangulo -"
#define ERR23 "ERROR: - No se encontro la coordenada Y valida del Vertice 2 del Triangulo -"
#define ERR24 "ERROR: - No se encontro la coordenada X valida del Vertice 3 del Triangulo -"
#define ERR25 "ERROR: - No se encontro la coordenada Y valida del Vertice 3 del Triangulo -"
#define ERR26 "ERROR: - No se encontro el id del Segmento -"
#define ERR27 "ERROR: - No se encontro el Inicio de Segmento -"
#define ERR28 "ERROR: - No se encontro la coordenada X valida del Inicio del Segmento -"
#define ERR29 "ERROR: - No se encontro la coordenada Y valida del Inicio del Segmento -"
#define ERR30 "ERROR: - No se encontro el Fin de Segmento -"
#define ERR31 "ERROR: - No se encontro la coordenada X del Fin del Segmento -"
#define ERR32 "ERROR: - No se encontro la coordenada y del Fin del Segmento -"
#define ERR33 "ERROR: - Los vertices del triangulo se encuentran sobre una misma recta -"
#define ERR34 "ERROR: - La linea no contiene un formato correcto de tag -"
#define ERR35 "ERROR: - Ya existe una figura con el identificador dado. La misma no se dibujara -"
#define ERR36 "ERROR: - Ya existe una textura con el identificador dado. La misma no se cargara -"
#define WAR1 "ADVERTENCIA: - No se encontro el cierre del escenario -"
#define WAR2 "ADVERTENCIA: - No se encontro la resolucion valida del escenario. Se colocara por defecto -"
#define WAR3 "ADVERTENCIA: - No se encontro Color para fondo de Figura. Se colocara por defecto -"
#define WAR4 "ADVERTENCIA: - No se encontro Color de Linea. Se colocara por defecto -"
#define WAR5 "ADVERTENCIA: - No se encontro Color de fondo de Escenario. Se colocara por defecto -"
#define WAR6 "ADVERTENCIA: - No se encontro Textura para la Figura. No se colocara Ninguna -"
#define WAR7 "ADVERTENCIA: - No se encontro Textura para el escenario. No se colocara Ninguna -"
#define WAR8 "ADVERTENCIA: - No se encontro el cierre del tag general -"
#define WAR9 "ADVERTENCIA: - No se encontro el cierre del tag ListadoDeElementos -"
#define WAR10 "ADVERTENCIA: - No se encontro el cierre del tag ListadoDeTexturas -"
#define WAR11 "ADVERTENCIA: - No se encontro el cierre de la textura -"
#define WAR12 "ADVERTENCIA: - El elemento no tiene textura asignada -"
#define WAR13 "ADVERTENCIA: - El elemento no tiene un color valido de Fondo -"
#define WAR13N "ADVERTENCIA: - No se encontro el color de Fondo del elemento -"
#define WAR14 "ADVERTENCIA: - El elemento no tiene un color valido de Linea -"
#define WAR14N "ADVERTENCIA: - No se encontro el color de Linea del elemento -"
#define WAR15 "ADVERTENCIA: - No se encontro el cierre del Cuadrado -"
#define WAR16 "ADVERTENCIA: - No se encontro el cierre del Rectangulo -"
#define WAR17 "ADVERTENCIA: - No se encontro el cierre del Triangulo -"
#define WAR18 "ADVERTENCIA: - No se encontro el cierre del Segmento -"
#define WAR19 "ADVERTENCIA: - No se encontro el cierre del Circulo -"
#define WAR20 "ADVERTENCIA: - Una componente del Color de fondo de la figura no es valido. -"
#define WAR21 "ADVERTENCIA: - Una componente del Color de linea de la figura no es valido. -"
#define WAR22 "ADVERTENCIA: - Una componente del Color de Fondo del Escenario no es valido. -"
#define WAR23 "ADVERTENCIA: - Se repite la etiqueta id -"
#define WAR24 "ADVERTENCIA: - Se repite la etiqueta lado -"
#define WAR25 "ADVERTENCIA: - Se repite la etiqueta colorFigura -"
#define WAR26 "ADVERTENCIA: - Se repite la etiqueta idTextura -"
#define WAR27 "ADVERTENCIA: - Se repite la etiqueta colorLinea -"
#define WAR28 "ADVERTENCIA: - Se repite la etiqueta radio -"
#define WAR29 "ADVERTENCIA: - Se repite la etiqueta base -"
#define WAR30 "ADVERTENCIA: - Se repite la etiqueta altura -"
#define WAR31 "ADVERTENCIA: - Se encontro texto invalido dentro de la etiqueta -"
#define WAR32 "ADVERTENCIA: - Se repite la etiqueta resolucion -"
#define WAR33 "ADVERTENCIA: - Se repite la etiqueta colorFondoFig -"
#define WAR34 "ADVERTENCIA: - Se repite la etiqueta texturaFig -"
#define WAR35 "ADVERTENCIA: - Se repite la etiqueta colorFondoEsc -"
#define WAR36 "ADVERTENCIA: - Se repite la etiqueta texturaEsc -"
#define WAR37 "ADVERTENCIA: - No se encontro la etiqueta General. Se creara una por defecto. -"
#define WAR38 "ADVERTENCIA: - Se encontro texto invalido dentro de la etiqueta -"
#define WAR39 "ADVERTENCIA: - Se repite la etiqueta circulo -"
#define WAR40 "ADVERTENCIA: - Se repite la etiqueta cuadrado -"
#define WAR41 "ADVERTENCIA: - Se repite la etiqueta rectangulo -"
#define WAR42 "ADVERTENCIA: - Se repite la etiqueta triangulo -"
#define WAR43 "ADVERTENCIA: - Se repite la etiqueta segmento -"
#define WAR44 "ADVERTENCIA: - Se repite la etiqueta General -"
#define WAR45 "ADVERTENCIA: - Se repite la etiqueta posicion -"
#define WAR46 "ADVERTENCIA: - Se repite la etiqueta x -"
#define WAR47 "ADVERTENCIA: - Se repite la etiqueta y -"
#define WAR48 "ADVERTENCIA: - Se repite la etiqueta textura -"
#define WAR49 "ADVERTENCIA: - Se repite la etiqueta path -"
#define WAR50 "ADVERTENCIA: - Se repite la etiqueta inicio -"
#define WAR51 "ADVERTENCIA: - Se repite la etiqueta fin -"
#define WAR52 "ADVERTENCIA: - Se repite la etiqueta ver -"
#define WAR53 "ADVERTENCIA: - La velocidad no es valida. Se colocara una por defecto -"
#define WAR54 "ADVERTENCIA: - No se encontro la etiqueta velocidad -"
#define COLOR_VACIO 0xFF000000
#define VALID_FORMAT 0
#define POSITION_MISS -1
#define SIDE_MISS -2
#define ID_MISS -3
#define INVALID_FORMAT -4
#define NO_CLOSE -5
#define RESO_DEF 800
#define LONGITUD_INICIAL 128
#define INCREMENTO 10
#define VELO_DEF 600
struct color {
int R;
int G;
int B;
};
class Parser
{
private:
int nroLinea;
bool hayGeneral;
list<string> tags;
int esConocido(string line);
void invalidTextFound(char* line, FILE* er);
public:
Parser();
virtual ~Parser();
void setNroLinea(int l);
int getNroLinea();
void setHayGeneral(bool hay);
bool getHayGeneral();
void plusLinea();
void minusLinea();
void imprimirError(char* linea,FILE* archivoErrores,char* err);
Uint32 getColor(int r, int g, int b);
Uint32 validaColor(char* linea, string aux,FILE* archivoError,char t);
Uint32 colorXdef();
int validar(FILE* archivo, FILE* archivoErrores);
int validaTagPadre(char* linea, FILE* archivo, FILE* archivoErrores);
int validaTextura(char* tag,FILE* archivo, FILE* archivoErrores);
int validaElementos(char* tag,FILE* archivo,FILE* archivoErrores);
int validaTrianguloCierre(FILE* archivo,FILE* archivoErrores);
int validaSegmentoCierre(FILE* archivo,FILE* archivoErrores);
int validaRectanguloCierre(FILE* archivo,FILE* archivoErrores);
int validaCuadradoCierre(FILE* archivo,FILE* archivoErrores);
int validaCirculoCierre(FILE* archivo,FILE* archivoErrores);
int validarGeneralCierre(FILE* archivo,FILE* archivoErrores);
int validaGeneral(char* tag,FILE* archivoErrores);
int colorValido(char* linea, int c,FILE* archivoError,char t);
int validaReso(int r,char* tag,FILE* arhivoError);
int validaSegmento(char* tag, FILE* archivoErrores,Segmento* nSegmento);
int validaTriangulo(char* tag, FILE* archivoErrores,Triangulo* nTriangulo);
int validaRectangulo(char* tag,FILE* archivoErrores,Rectangulo* nRectangulo);
int validaCirculo(char* tag,FILE* archivoErrores,Circulo* nCirculo);
int validaCuadrado(char* tag,FILE* archivoErrores,Cuadrado* nCuadrado);
int validaPos(FILE* archivo,FILE* archivoErrores,punto&p);
int validaInicioFin(FILE* archivo,FILE* archivoErrores,punto&i,punto&f);
int validaVertices(FILE* archivo,FILE* archivoErrores,punto&v1,punto&v2,punto&v3);
int validaPuntosTriangulo(punto vertices[3]);
char* readTag(FILE* arch,FILE* archivoError);
long validaVelo(long velo,char* tag,FILE* archivoErrores);
void isRepeatedVertice(char* line, FILE* aError,int num);
void isRepeatedInicio(char* line, FILE* aError);
void isRepeatedFin(char* line, FILE* aError);
void isRepeatedTextura(char* line, FILE* aError);
void isRepeatedPosition(char* line, FILE* aError);
void isRepeatedCuadrado(char* line, FILE* aError);
void isRepeatedGeneral(char* line, FILE* aError);
void isRepeatedCirculo(char* line, FILE* aError);
void isRepeatedRectangulo(char* line, FILE* aError);
void isRepeatedTriangulo(char* line, FILE* aError);
void isRepeatedSegmento(char* line, FILE* aError);
};
#endif
| [
"[email protected]@0b808588-0f27-11de-aab3-ff745001d230"
]
| [
[
[
1,
199
]
]
]
|
7bcee0e48985235d13a90135986b5b8fb903b09b | 61352a7371397524fe7dcfab838de40d502c3c9a | /client/Headers/Utils/MessageObserver.h | 1ce66de2c55ab22cdea93fcadd8cf597694dcad3 | []
| no_license | ustronieteam/emmanuelle | fec6b6ccfa1a9a6029d8c3bb5ee2b9134fccd004 | 68d639091a781795d2e8ce95c3806ce6ae9f36f6 | refs/heads/master | 2021-01-21T13:04:29.965061 | 2009-01-28T04:07:01 | 2009-01-28T04:07:01 | 32,144,524 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 800 | h | #ifndef MESSAGEOBSERVER_H
#define MESSAGEOBSERVER_H
#include <log4cxx/logger.h>
#include <log4cxx/level.h>
#include "IObserverView.h"
#include "IRemoteObserver.h"
///
/// MessageObserver
/// @brief Obserwator czekajacy na wiadomosci.
/// @author Wojciech Grzeskowiak
/// @date 2009.01.11
///
class MessageObserver : public IRemoteObserver
{
private:
///
/// Obiekt logowania.
///
log4cxx::LoggerPtr _logger;
///
/// Interfejs modelu do wywolan.
///
IObserverView * _view;
public:
///
/// Konstruktor.
///
MessageObserver(IObserverView * view);
///
/// Destruktor.
///
virtual ~MessageObserver();
///
/// Metoda wywolujaca.
///
int Refresh(RemoteObserverData objectData);
};
#endif
| [
"coutoPL@c118a9a8-d993-11dd-9042-6d746b85d38b",
"w.grzeskowiak@c118a9a8-d993-11dd-9042-6d746b85d38b"
]
| [
[
[
1,
3
],
[
9,
10
],
[
17,
18
],
[
20,
20
],
[
25,
25
],
[
31,
32
],
[
37,
37
],
[
41,
42
],
[
46,
46
],
[
48,
49
]
],
[
[
4,
8
],
[
11,
16
],
[
19,
19
],
[
21,
24
],
[
26,
30
],
[
33,
36
],
[
38,
40
],
[
43,
45
],
[
47,
47
]
]
]
|
ac7410b58ca44bf663e1af48b80536d534542d81 | bf89d461ac1ca2c793997a80094d32d0e2a9a163 | /ARDUINO/interrupt_example.cpp | 66a6411969b5f2f0ffa8e6157f38580f602517f0 | []
| no_license | bricef/led-cube | c544305bbc399d34ad2fcab2f74be7ae1de14bbf | 7f4d291ac38375358ae136361bcbb773dc988702 | refs/heads/master | 2016-09-06T14:18:04.814856 | 2009-05-21T02:22:51 | 2009-05-21T02:22:51 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,277 | cpp | #include < avr / interrupt.h >
#include < avr / io.h >
#define INIT_TIMER_COUNT 6
#define RESET_TIMER2 TCNT2 = INIT_TIMER_COUNT
int ledPin = 13;
int int_counter = 0;
volatile int second = 0;
int oldSecond = 0;
long starttime = 0;
// Aruino runs at 16 Mhz, so we have 1000 Overflows per second...
// 1/ ((16000000 / 64) / 256) = 1 / 1000
ISR(TIMER2_OVF_vect) {
RESET_TIMER2;
int_counter += 1;
if (int_counter == 1000) {
second+=1;
int_counter = 0;
}
};
void setup() {
Serial.begin(9600);
Serial.println("Initializing timerinterrupt");
//Timer2 Settings: Timer Prescaler /64,
TCCR2 |= (1< <CS22);
TCCR2 &= ~((1<<CS21) | (1<<CS20));
// Use normal mode
TCCR2 &= ~((1<<WGM21) | (1<<WGM20));
// Use internal clock - external clock not used in Arduino
ASSR |= (0<<AS2);
//Timer2 Overflow Interrupt Enable
TIMSK |= (1<<TOIE2) | (0<<OCIE2);
RESET_TIMER2;
sei();
starttime = millis();
}
void loop() {
if (oldSecond != second) {
Serial.print(second);
Serial.print(". ->");
Serial.print(millis() - starttime);
Serial.println(".");
digitalWrite(ledPin, HIGH);
delay(100);
digitalWrite(ledPin, LOW);
oldSecond = second;
}
}
| [
"brice.fernandes@d0259a58-13ce-11de-b208-e5a9466b8568"
]
| [
[
[
1,
52
]
]
]
|
d3962d59aed8860c67c49c2cf2ed238bb4ce839c | a84b013cd995870071589cefe0ab060ff3105f35 | /webdriver/branches/jsapi/third_party/gecko-1.9.0.11/win32/include/nsITraceableChannel.h | ac82bb30da64be3b36f8f498c4953bfb54fa8745 | [
"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 | 3,109 | h | /*
* DO NOT EDIT. THIS FILE IS GENERATED FROM e:/xr19rel/WINNT_5.2_Depend/mozilla/netwerk/base/public/nsITraceableChannel.idl
*/
#ifndef __gen_nsITraceableChannel_h__
#define __gen_nsITraceableChannel_h__
#ifndef __gen_nsISupports_h__
#include "nsISupports.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
class nsIStreamListener; /* forward declaration */
/* starting interface: nsITraceableChannel */
#define NS_ITRACEABLECHANNEL_IID_STR "68167b0b-ef34-4d79-a09a-8045f7c5140e"
#define NS_ITRACEABLECHANNEL_IID \
{0x68167b0b, 0xef34, 0x4d79, \
{ 0xa0, 0x9a, 0x80, 0x45, 0xf7, 0xc5, 0x14, 0x0e }}
/**
* A channel implementing this interface allows one to intercept its data by
* inserting intermediate stream listeners.
*/
class NS_NO_VTABLE NS_SCRIPTABLE nsITraceableChannel : public nsISupports {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ITRACEABLECHANNEL_IID)
/* nsIStreamListener setNewListener (in nsIStreamListener aListener); */
NS_SCRIPTABLE NS_IMETHOD SetNewListener(nsIStreamListener *aListener, nsIStreamListener **_retval) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsITraceableChannel, NS_ITRACEABLECHANNEL_IID)
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSITRACEABLECHANNEL \
NS_SCRIPTABLE NS_IMETHOD SetNewListener(nsIStreamListener *aListener, nsIStreamListener **_retval);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSITRACEABLECHANNEL(_to) \
NS_SCRIPTABLE NS_IMETHOD SetNewListener(nsIStreamListener *aListener, nsIStreamListener **_retval) { return _to SetNewListener(aListener, _retval); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSITRACEABLECHANNEL(_to) \
NS_SCRIPTABLE NS_IMETHOD SetNewListener(nsIStreamListener *aListener, nsIStreamListener **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetNewListener(aListener, _retval); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsTraceableChannel : public nsITraceableChannel
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSITRACEABLECHANNEL
nsTraceableChannel();
private:
~nsTraceableChannel();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsTraceableChannel, nsITraceableChannel)
nsTraceableChannel::nsTraceableChannel()
{
/* member initializers and constructor code */
}
nsTraceableChannel::~nsTraceableChannel()
{
/* destructor code */
}
/* nsIStreamListener setNewListener (in nsIStreamListener aListener); */
NS_IMETHODIMP nsTraceableChannel::SetNewListener(nsIStreamListener *aListener, nsIStreamListener **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsITraceableChannel_h__ */
| [
"simon.m.stewart@07704840-8298-11de-bf8c-fd130f914ac9"
]
| [
[
[
1,
97
]
]
]
|
afac3f90d4bdd4ec94ce896ead929ed8af4397d1 | 478570cde911b8e8e39046de62d3b5966b850384 | /apicompatanamdw/bcdrivers/os/graphics/common/inc/DataWrapperActive.h | 42aa24e2c016e0c84039922f3ec757733366388c | []
| no_license | SymbianSource/oss.FCL.sftools.ana.compatanamdw | a6a8abf9ef7ad71021d43b7f2b2076b504d4445e | 1169475bbf82ebb763de36686d144336fcf9d93b | refs/heads/master | 2020-12-24T12:29:44.646072 | 2010-11-11T14:03:20 | 2010-11-11T14:03:20 | 72,994,432 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 999 | h | /*
* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "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:
*
*/
#if (!defined __DATA_WRAPPER_ACTIVE__)
#define __DATA_WRAPPER_ACTIVE__
// User includes
#include "DataWrapperBase.h"
class CDataWrapperActive : public CDataWrapperBase
{
protected:
CDataWrapperActive();
virtual ~CDataWrapperActive();
virtual CActive* GetActive() = NULL;
virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
private:
void DoCmdCancel();
void DoCmdiStatus(const TDesC& aSection);
};
#endif /* __DATA_WRAPPER_ACTIVE__ */
| [
"none@none"
]
| [
[
[
1,
40
]
]
]
|
b4f6ac88289e8032bfd0a7cf3b75546415b2070e | 8258620cb8eca7519a58dadde63e84f65d99cc80 | /sandbox/dani/visual_extern_simulator/sky.h | 7d1d9653e197d82d4fddb5fe2a08dec6c8cf4675 | []
| no_license | danieleferro/3morduc | bfdf4c296243dcd7c5ba5984bc899001bf74732b | a27901ae90065ded879f5dd119b2f44a2933c6da | refs/heads/master | 2016-09-06T06:02:39.202421 | 2011-03-23T08:51:56 | 2011-03-23T08:51:56 | 32,210,720 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 994 | h | //#include <windows.h> // Header File For Windows
//#include <stdio.h> // Header File For Standard Input / Output
//#include <stdarg.h> // Header File For Variable Argument Routines
#include <gl\gl.h> // Header File For The OpenGL32 Library
#include <gl\glu.h> // Header File For The GLu32 Library
//#include <time.h>
typedef struct // Create A Structure
{
GLubyte *imageData; // Image Data (Up To 32 Bits)
GLuint bpp; // Image Color Depth In Bits Per Pixel.
GLuint width; // Image Width
GLuint height; // Image Height
GLuint texID; // Texture ID Used To Select A Texture
} TextureImage; // Structure Name
class Sky
{
public:
TextureImage textures[1];
GLUquadricObj *quadratic; // Storage For Our Quadratic Objects ( NEW )
float movement;
Sky();
bool LoadTGA(TextureImage *texture, char *filename);
void Draw(void);
}; | [
"loris.fichera@9b93cbac-0697-c522-f574-8d8975c4cc90"
]
| [
[
[
1,
28
]
]
]
|
cb7963476f11c8be18170698da278cd0a0ca39a6 | 91b964984762870246a2a71cb32187eb9e85d74e | /SRC/OFFI SRC!/_Interface/WndOptionGame.h | 81c85a44aa74c2de6c4de2d9696feaa86dec566e | []
| no_license | willrebuild/flyffsf | e5911fb412221e00a20a6867fd00c55afca593c7 | d38cc11790480d617b38bb5fc50729d676aef80d | refs/heads/master | 2021-01-19T20:27:35.200154 | 2011-02-10T12:34:43 | 2011-02-10T12:34:43 | 32,710,780 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,177 | h | #ifndef __WNDOPTIONGAME__H
#define __WNDOPTIONGAME__H
class CWndOptionGame : public CWndNeuz
{
public:
CWndOptionGame();
~CWndOptionGame();
virtual BOOL Initialize( CWndBase* pWndParent = NULL, DWORD nType = MB_OK );
virtual BOOL OnChildNotify( UINT message, UINT nID, LRESULT* pLResult );
virtual void OnDraw( C2DRender* p2DRender );
virtual void OnInitialUpdate();
virtual BOOL OnCommand( UINT nID, DWORD dwMessage, CWndBase* pWndBase );
virtual void OnSize( UINT nType, int cx, int cy );
virtual void OnLButtonUp( UINT nFlags, CPoint point );
virtual void OnLButtonDown( UINT nFlags, CPoint point );
#if __VER >= 12 // __UPDATE_OPT
CTexture m_Texture;
CTexture m_TexturePt;
BOOL m_bLButtonClick;
BOOL m_bLButtonClick2;
int m_nStep[2];
virtual void OnMouseMove(UINT nFlags, CPoint point);
void GetRangeSlider( DWORD dwWndId, int& nStep, CPoint point );
int GetSliderStep( DWORD dwWndId, int &nStep, CPoint point );
CPoint GetStepPos( int nStep, int nWidth, int nDivision );
virtual HRESULT RestoreDeviceObjects();
virtual HRESULT InvalidateDeviceObjects();
#endif
};
#endif
| [
"[email protected]@e2c90bd7-ee55-cca0-76d2-bbf4e3699278"
]
| [
[
[
1,
35
]
]
]
|
260cf178ecb68950f38293b89c1493ce96d9ad78 | 2e5fd1fc05c0d3b28f64abc99f358145c3ddd658 | /deps/quickfix/src/pt.cpp | d49ba794b378415f2de37598d4c845212e770210 | [
"BSD-2-Clause"
]
| permissive | indraj/fixfeed | 9365c51e2b622eaff4ce5fac5b86bea86415c1e4 | 5ea71aab502c459da61862eaea2b78859b0c3ab3 | refs/heads/master | 2020-12-25T10:41:39.427032 | 2011-02-15T13:38:34 | 2011-02-15T20:50:08 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 22,990 | cpp | /* -*- C++ -*- */
/****************************************************************************
** Copyright (c) quickfixengine.org All rights reserved.
**
** This file is part of the QuickFIX FIX Engine
**
** This file may be distributed under the terms of the quickfixengine.org
** license as defined by quickfixengine.org and appearing in the file
** LICENSE included in the packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.quickfixengine.org/LICENSE for licensing information.
**
** Contact [email protected] if any conditions of this licensing are
** not clear to you.
**
****************************************************************************/
#ifdef _MSC_VER
#pragma warning( disable : 4503 4355 4786 )
#include "stdafx.h"
#else
#include "config.h"
#endif
#include "getopt-repl.h"
#include <iostream>
#include "Application.h"
#include "FieldConvertors.h"
#include "Values.h"
#include "FileStore.h"
#include "SessionID.h"
#include "Session.h"
#include "DataDictionary.h"
#include "Parser.h"
#include "Utility.h"
#include "SocketAcceptor.h"
#include "SocketInitiator.h"
#include "ThreadedSocketAcceptor.h"
#include "ThreadedSocketInitiator.h"
#include "fix42/Heartbeat.h"
#include "fix42/NewOrderSingle.h"
#include "fix42/QuoteRequest.h"
int testIntegerToString( int );
int testStringToInteger( int );
int testDoubleToString( int );
int testStringToDouble( int );
int testCreateHeartbeat( int );
int testIdentifyType( int );
int testSerializeToStringHeartbeat( int );
int testSerializeFromStringHeartbeat( int );
int testCreateNewOrderSingle( int );
int testSerializeToStringNewOrderSingle( int );
int testSerializeFromStringNewOrderSingle( int );
int testCreateQuoteRequest( int );
int testReadFromQuoteRequest( int );
int testSerializeToStringQuoteRequest( int );
int testSerializeFromStringQuoteRequest( int );
int testFileStoreNewOrderSingle( int );
int testValidateNewOrderSingle( int );
int testValidateDictNewOrderSingle( int );
int testValidateQuoteRequest( int );
int testValidateDictQuoteRequest( int );
int testSendOnSocket( int, short );
int testSendOnThreadedSocket( int, short );
void report( int, int );
#ifndef _MSC_VER
#include <sys/time.h>
long GetTickCount()
{
timeval tv;
gettimeofday( &tv, 0 );
long millsec = tv.tv_sec * 1000;
millsec += ( long ) tv.tv_usec / ( 1000 );
return ( long ) millsec;
}
#endif
int main( int argc, char** argv )
{
int count = 0;
short port = 0;
int opt;
while ( (opt = getopt( argc, argv, "+p:+c:" )) != -1 )
{
switch( opt )
{
case 'p':
port = (short)atol( optarg );
break;
case 'c':
count = atol( optarg );
break;
default:
std::cout << "usage: "
<< argv[ 0 ]
<< " -p port -c count" << std::endl;
return 1;
}
}
std::cout << "Converting integers to strings: ";
report( testIntegerToString( count ), count );
std::cout << "Converting strings to integers: ";
report( testStringToInteger( count ), count );
std::cout << "Converting doubles to strings: ";
report( testDoubleToString( count ), count );
std::cout << "Converting strings to doubles: ";
report( testStringToDouble( count ), count );
std::cout << "Creating Heartbeat messages: ";
report( testCreateHeartbeat( count ), count );
std::cout << "Identifying message types: ";
report( testIdentifyType( count ), count );
std::cout << "Serializing Heartbeat messages to strings: ";
report( testSerializeToStringHeartbeat( count ), count );
std::cout << "Serializing Heartbeat messages from strings: ";
report( testSerializeFromStringHeartbeat( count ), count );
std::cout << "Creating NewOrderSingle messages: ";
report( testCreateNewOrderSingle( count ), count );
std::cout << "Serializing NewOrderSingle messages to strings: ";
report( testSerializeToStringNewOrderSingle( count ), count );
std::cout << "Serializing NewOrderSingle messages from strings: ";
report( testSerializeFromStringNewOrderSingle( count ), count );
std::cout << "Creating QuoteRequest messages: ";
report( testCreateQuoteRequest( count ), count );
std::cout << "Serializing QuoteRequest messages to strings: ";
report( testSerializeToStringQuoteRequest( count ), count );
std::cout << "Serializing QuoteRequest messages from strings: ";
report( testSerializeFromStringQuoteRequest( count ), count );
std::cout << "Reading fields from QuoteRequest message: ";
report( testReadFromQuoteRequest( count ), count );
std::cout << "Storing NewOrderSingle messages: ";
report( testFileStoreNewOrderSingle( count ), count );
std::cout << "Validating NewOrderSingle messages with no data dictionary: ";
report( testValidateNewOrderSingle( count ), count );
std::cout << "Validating NewOrderSingle messages with data dictionary: ";
report( testValidateDictNewOrderSingle( count ), count );
std::cout << "Validating QuoteRequest messages with no data dictionary: ";
report( testValidateQuoteRequest( count ), count );
std::cout << "Validating QuoteRequest messages with data dictionary: ";
report( testValidateDictQuoteRequest( count ), count );
std::cout << "Sending/Receiving NewOrderSingle/ExecutionReports on Socket";
report( testSendOnSocket( count, port ), count );
std::cout << "Sending/Receiving NewOrderSingle/ExecutionReports on ThreadedSocket";
report( testSendOnThreadedSocket( count, port ), count );
return 0;
}
void report( int time, int count )
{
double seconds = ( double ) time / 1000;
double num_per_second = count / seconds;
std::cout << std::endl << " num: " << count
<< ", seconds: " << seconds
<< ", num_per_second: " << num_per_second << std::endl;
}
int testIntegerToString( int count )
{
count = count - 1;
int start = GetTickCount();
for ( int i = 0; i <= count; ++i )
{
FIX::IntConvertor::convert( 1234 );
}
return GetTickCount() - start;
}
int testStringToInteger( int count )
{
std::string value( "1234" );
count = count - 1;
int start = GetTickCount();
for ( int i = 0; i <= count; ++i )
{
FIX::IntConvertor::convert( value );
}
return GetTickCount() - start;
}
int testDoubleToString( int count )
{
count = count - 1;
int start = GetTickCount();
for ( int i = 0; i <= count; ++i )
{
FIX::DoubleConvertor::convert( 123.45 );
}
return GetTickCount() - start;
}
int testStringToDouble( int count )
{
std::string value( "123.45" );
count = count - 1;
int start = GetTickCount();
for ( int i = 0; i <= count; ++i )
{
FIX::DoubleConvertor::convert( value );
}
return GetTickCount() - start;
}
int testCreateHeartbeat( int count )
{
count = count - 1;
int start = GetTickCount();
for ( int i = 0; i <= count; ++i )
{
FIX42::Heartbeat();
}
return GetTickCount() - start;
}
int testIdentifyType( int count )
{
FIX42::Heartbeat message;
std::string messageString = message.toString();
count = count - 1;
int start = GetTickCount();
for ( int i = 0; i <= count; ++i )
{
FIX::identifyType( messageString );
}
return GetTickCount() - start;
}
int testSerializeToStringHeartbeat( int count )
{
FIX42::Heartbeat message;
count = count - 1;
int start = GetTickCount();
for ( int i = 0; i <= count; ++i )
{
message.toString();
}
return GetTickCount() - start;
}
int testSerializeFromStringHeartbeat( int count )
{
FIX42::Heartbeat message;
std::string string = message.toString();
count = count - 1;
int start = GetTickCount();
for ( int i = 0; i <= count; ++i )
{
message.setString( string );
}
return GetTickCount() - start;
}
int testCreateNewOrderSingle( int count )
{
int start = GetTickCount();
for ( int i = 0; i <= count; ++i )
{
FIX::ClOrdID clOrdID( "ORDERID" );
FIX::HandlInst handlInst( '1' );
FIX::Symbol symbol( "LNUX" );
FIX::Side side( FIX::Side_BUY );
FIX::TransactTime transactTime;
FIX::OrdType ordType( FIX::OrdType_MARKET );
FIX42::NewOrderSingle( clOrdID, handlInst, symbol, side, transactTime, ordType );
}
return GetTickCount() - start;
}
int testSerializeToStringNewOrderSingle( int count )
{
FIX::ClOrdID clOrdID( "ORDERID" );
FIX::HandlInst handlInst( '1' );
FIX::Symbol symbol( "LNUX" );
FIX::Side side( FIX::Side_BUY );
FIX::TransactTime transactTime;
FIX::OrdType ordType( FIX::OrdType_MARKET );
FIX42::NewOrderSingle message
( clOrdID, handlInst, symbol, side, transactTime, ordType );
count = count - 1;
int start = GetTickCount();
for ( int i = 0; i <= count; ++i )
{
message.toString();
}
return GetTickCount() - start;
}
int testSerializeFromStringNewOrderSingle( int count )
{
FIX::ClOrdID clOrdID( "ORDERID" );
FIX::HandlInst handlInst( '1' );
FIX::Symbol symbol( "LNUX" );
FIX::Side side( FIX::Side_BUY );
FIX::TransactTime transactTime;
FIX::OrdType ordType( FIX::OrdType_MARKET );
FIX42::NewOrderSingle message
( clOrdID, handlInst, symbol, side, transactTime, ordType );
std::string string = message.toString();
count = count - 1;
int start = GetTickCount();
for ( int i = 0; i <= count; ++i )
{
message.setString( string );
}
return GetTickCount() - start;
}
int testCreateQuoteRequest( int count )
{
count = count - 1;
int start = GetTickCount();
FIX::Symbol symbol;
FIX::MaturityMonthYear maturityMonthYear;
FIX::PutOrCall putOrCall;
FIX::StrikePrice strikePrice;
FIX::Side side;
FIX::OrderQty orderQty;
FIX::Currency currency;
FIX::OrdType ordType;
for ( int i = 0; i <= count; ++i )
{
FIX42::QuoteRequest massQuote( FIX::QuoteReqID("1") );
FIX42::QuoteRequest::NoRelatedSym noRelatedSym;
for( int j = 1; j <= 10; ++j )
{
symbol.setValue( "IBM" );
maturityMonthYear.setValue( "022003" );
putOrCall.setValue( FIX::PutOrCall_PUT );
strikePrice.setValue( 120 );
side.setValue( FIX::Side_BUY );
orderQty.setValue( 100 );
currency.setValue( "USD" );
ordType.setValue( FIX::OrdType_MARKET );
noRelatedSym.set( symbol );
noRelatedSym.set( maturityMonthYear );
noRelatedSym.set( putOrCall );
noRelatedSym.set( strikePrice );
noRelatedSym.set( side );
noRelatedSym.set( orderQty );
noRelatedSym.set( currency );
noRelatedSym.set( ordType );
massQuote.addGroup( noRelatedSym );
noRelatedSym.clear();
}
}
return GetTickCount() - start;
}
int testSerializeToStringQuoteRequest( int count )
{
FIX42::QuoteRequest message( FIX::QuoteReqID("1") );
FIX42::QuoteRequest::NoRelatedSym noRelatedSym;
for( int i = 1; i <= 10; ++i )
{
noRelatedSym.set( FIX::Symbol("IBM") );
noRelatedSym.set( FIX::MaturityMonthYear() );
noRelatedSym.set( FIX::PutOrCall(FIX::PutOrCall_PUT) );
noRelatedSym.set( FIX::StrikePrice(120) );
noRelatedSym.set( FIX::Side(FIX::Side_BUY) );
noRelatedSym.set( FIX::OrderQty(100) );
noRelatedSym.set( FIX::Currency("USD") );
noRelatedSym.set( FIX::OrdType(FIX::OrdType_MARKET) );
message.addGroup( noRelatedSym );
}
count = count - 1;
int start = GetTickCount();
for ( int j = 0; j <= count; ++j )
{
message.toString();
}
return GetTickCount() - start;
}
int testSerializeFromStringQuoteRequest( int count )
{
FIX42::QuoteRequest message( FIX::QuoteReqID("1") );
FIX42::QuoteRequest::NoRelatedSym noRelatedSym;
for( int i = 1; i <= 10; ++i )
{
noRelatedSym.set( FIX::Symbol("IBM") );
noRelatedSym.set( FIX::MaturityMonthYear() );
noRelatedSym.set( FIX::PutOrCall(FIX::PutOrCall_PUT) );
noRelatedSym.set( FIX::StrikePrice(120) );
noRelatedSym.set( FIX::Side(FIX::Side_BUY) );
noRelatedSym.set( FIX::OrderQty(100) );
noRelatedSym.set( FIX::Currency("USD") );
noRelatedSym.set( FIX::OrdType(FIX::OrdType_MARKET) );
message.addGroup( noRelatedSym );
}
std::string string = message.toString();
count = count - 1;
int start = GetTickCount();
for ( int j = 0; j <= count; ++j )
{
message.setString( string );
}
return GetTickCount() - start;
}
int testReadFromQuoteRequest( int count )
{
count = count - 1;
FIX42::QuoteRequest message( FIX::QuoteReqID("1") );
FIX42::QuoteRequest::NoRelatedSym group;
for( int i = 1; i <= 10; ++i )
{
group.set( FIX::Symbol("IBM") );
group.set( FIX::MaturityMonthYear() );
group.set( FIX::PutOrCall(FIX::PutOrCall_PUT) );
group.set( FIX::StrikePrice(120) );
group.set( FIX::Side(FIX::Side_BUY) );
group.set( FIX::OrderQty(100) );
group.set( FIX::Currency("USD") );
group.set( FIX::OrdType(FIX::OrdType_MARKET) );
message.addGroup( group );
}
group.clear();
int start = GetTickCount();
for ( int j = 0; j <= count; ++j )
{
FIX::QuoteReqID quoteReqID;
FIX::Symbol symbol;
FIX::MaturityMonthYear maturityMonthYear;
FIX::PutOrCall putOrCall;
FIX::StrikePrice strikePrice;
FIX::Side side;
FIX::OrderQty orderQty;
FIX::Currency currency;
FIX::OrdType ordType;
FIX::NoRelatedSym noRelatedSym;
message.get( noRelatedSym );
int end = noRelatedSym;
for( int k = 1; k <= end; ++k )
{
message.getGroup( k, group );
group.get( symbol );
group.get( maturityMonthYear );
group.get( putOrCall);
group.get( strikePrice );
group.get( side );
group.get( orderQty );
group.get( currency );
group.get( ordType );
maturityMonthYear.getValue();
putOrCall.getValue();
strikePrice.getValue();
side.getValue();
orderQty.getValue();
currency.getValue();
ordType.getValue();
}
}
return GetTickCount() - start;
}
int testFileStoreNewOrderSingle( int count )
{
FIX::BeginString beginString( FIX::BeginString_FIX42 );
FIX::SenderCompID senderCompID( "SENDER" );
FIX::TargetCompID targetCompID( "TARGET" );
FIX::SessionID id( beginString, senderCompID, targetCompID );
FIX::ClOrdID clOrdID( "ORDERID" );
FIX::HandlInst handlInst( '1' );
FIX::Symbol symbol( "LNUX" );
FIX::Side side( FIX::Side_BUY );
FIX::TransactTime transactTime;
FIX::OrdType ordType( FIX::OrdType_MARKET );
FIX42::NewOrderSingle message
( clOrdID, handlInst, symbol, side, transactTime, ordType );
message.getHeader().set( FIX::MsgSeqNum( 1 ) );
std::string messageString = message.toString();
FIX::FileStore store( "store", id );
store.reset();
count = count - 1;
int start = GetTickCount();
for ( int i = 0; i <= count; ++i )
{
store.set( ++i, messageString );
}
int end = GetTickCount();
store.reset();
return end - start;
}
int testValidateNewOrderSingle( int count )
{
FIX::ClOrdID clOrdID( "ORDERID" );
FIX::HandlInst handlInst( '1' );
FIX::Symbol symbol( "LNUX" );
FIX::Side side( FIX::Side_BUY );
FIX::TransactTime transactTime;
FIX::OrdType ordType( FIX::OrdType_MARKET );
FIX42::NewOrderSingle message
( clOrdID, handlInst, symbol, side, transactTime, ordType );
message.getHeader().set( FIX::SenderCompID( "SENDER" ) );
message.getHeader().set( FIX::TargetCompID( "TARGET" ) );
message.getHeader().set( FIX::MsgSeqNum( 1 ) );
FIX::DataDictionary dataDictionary;
count = count - 1;
int start = GetTickCount();
for ( int i = 0; i <= count; ++i )
{
dataDictionary.validate( message );
}
return GetTickCount() - start;
}
int testValidateDictNewOrderSingle( int count )
{
FIX::ClOrdID clOrdID( "ORDERID" );
FIX::HandlInst handlInst( '1' );
FIX::Symbol symbol( "LNUX" );
FIX::Side side( FIX::Side_BUY );
FIX::TransactTime transactTime;
FIX::OrdType ordType( FIX::OrdType_MARKET );
FIX42::NewOrderSingle message
( clOrdID, handlInst, symbol, side, transactTime, ordType );
message.getHeader().set( FIX::SenderCompID( "SENDER" ) );
message.getHeader().set( FIX::TargetCompID( "TARGET" ) );
message.getHeader().set( FIX::MsgSeqNum( 1 ) );
FIX::DataDictionary dataDictionary( "../spec/FIX42.xml" );
count = count - 1;
int start = GetTickCount();
for ( int i = 0; i <= count; ++i )
{
dataDictionary.validate( message );
}
return GetTickCount() - start;
}
int testValidateQuoteRequest( int count )
{
FIX42::QuoteRequest message( FIX::QuoteReqID("1") );
FIX42::QuoteRequest::NoRelatedSym noRelatedSym;
for( int i = 1; i <= 10; ++i )
{
noRelatedSym.set( FIX::Symbol("IBM") );
noRelatedSym.set( FIX::MaturityMonthYear() );
noRelatedSym.set( FIX::PutOrCall(FIX::PutOrCall_PUT) );
noRelatedSym.set( FIX::StrikePrice(120) );
noRelatedSym.set( FIX::Side(FIX::Side_BUY) );
noRelatedSym.set( FIX::OrderQty(100) );
noRelatedSym.set( FIX::Currency("USD") );
noRelatedSym.set( FIX::OrdType(FIX::OrdType_MARKET) );
message.addGroup( noRelatedSym );
}
FIX::DataDictionary dataDictionary;
count = count - 1;
int start = GetTickCount();
for ( int j = 0; j <= count; ++j )
{
dataDictionary.validate( message );
}
return GetTickCount() - start;
}
int testValidateDictQuoteRequest( int count )
{
FIX42::QuoteRequest message( FIX::QuoteReqID("1") );
FIX42::QuoteRequest::NoRelatedSym noRelatedSym;
for( int i = 1; i <= 10; ++i )
{
noRelatedSym.set( FIX::Symbol("IBM") );
noRelatedSym.set( FIX::MaturityMonthYear() );
noRelatedSym.set( FIX::PutOrCall(FIX::PutOrCall_PUT) );
noRelatedSym.set( FIX::StrikePrice(120) );
noRelatedSym.set( FIX::Side(FIX::Side_BUY) );
noRelatedSym.set( FIX::OrderQty(100) );
noRelatedSym.set( FIX::Currency("USD") );
noRelatedSym.set( FIX::OrdType(FIX::OrdType_MARKET) );
message.addGroup( noRelatedSym );
}
FIX::DataDictionary dataDictionary( "../spec/FIX42.xml" );
count = count - 1;
int start = GetTickCount();
for ( int j = 0; j <= count; ++j )
{
dataDictionary.validate( message );
}
return GetTickCount() - start;
}
class TestApplication : public FIX::NullApplication
{
public:
TestApplication() : m_count(0) {}
void fromApp( const FIX::Message& m, const FIX::SessionID& )
throw( FIX::FieldNotFound, FIX::IncorrectDataFormat, FIX::IncorrectTagValue, FIX::UnsupportedMessageType )
{
m_count++;
}
int getCount() { return m_count; }
private:
int m_count;
};
int testSendOnSocket( int count, short port )
{
std::stringstream stream;
stream
<< "[DEFAULT]" << std::endl
<< "SocketConnectHost=localhost" << std::endl
<< "SocketConnectPort=" << (unsigned short)port << std::endl
<< "SocketAcceptPort=" << (unsigned short)port << std::endl
<< "SocketReuseAddress=Y" << std::endl
<< "StartTime=00:00:00" << std::endl
<< "EndTime=00:00:00" << std::endl
<< "UseDataDictionary=N" << std::endl
<< "BeginString=FIX.4.2" << std::endl
<< "PersistMessages=N" << std::endl
<< "[SESSION]" << std::endl
<< "ConnectionType=acceptor" << std::endl
<< "SenderCompID=SERVER" << std::endl
<< "TargetCompID=CLIENT" << std::endl
<< "[SESSION]" << std::endl
<< "ConnectionType=initiator" << std::endl
<< "SenderCompID=CLIENT" << std::endl
<< "TargetCompID=SERVER" << std::endl
<< "HeartBtInt=30" << std::endl;
FIX::ClOrdID clOrdID( "ORDERID" );
FIX::HandlInst handlInst( '1' );
FIX::Symbol symbol( "LNUX" );
FIX::Side side( FIX::Side_BUY );
FIX::TransactTime transactTime;
FIX::OrdType ordType( FIX::OrdType_MARKET );
FIX42::NewOrderSingle message( clOrdID, handlInst, symbol, side, transactTime, ordType );
FIX::SessionID sessionID( "FIX.4.2", "CLIENT", "SERVER" );
TestApplication application;
FIX::MemoryStoreFactory factory;
FIX::SessionSettings settings( stream );
FIX::ScreenLogFactory logFactory( settings );
FIX::SocketAcceptor acceptor( application, factory, settings );
acceptor.start();
FIX::SocketInitiator initiator( application, factory, settings );
initiator.start();
FIX::process_sleep( 1 );
int start = GetTickCount();
for ( int i = 0; i <= count; ++i )
FIX::Session::sendToTarget( message, sessionID );
while( application.getCount() < count )
FIX::process_sleep( 0.1 );
int ticks = GetTickCount() - start;
initiator.stop();
acceptor.stop();
return ticks;
}
int testSendOnThreadedSocket( int count, short port )
{
std::stringstream stream;
stream
<< "[DEFAULT]" << std::endl
<< "SocketConnectHost=localhost" << std::endl
<< "SocketConnectPort=" << (unsigned short)port << std::endl
<< "SocketAcceptPort=" << (unsigned short)port << std::endl
<< "SocketReuseAddress=Y" << std::endl
<< "StartTime=00:00:00" << std::endl
<< "EndTime=00:00:00" << std::endl
<< "UseDataDictionary=N" << std::endl
<< "BeginString=FIX.4.2" << std::endl
<< "PersistMessages=N" << std::endl
<< "[SESSION]" << std::endl
<< "ConnectionType=acceptor" << std::endl
<< "SenderCompID=SERVER" << std::endl
<< "TargetCompID=CLIENT" << std::endl
<< "[SESSION]" << std::endl
<< "ConnectionType=initiator" << std::endl
<< "SenderCompID=CLIENT" << std::endl
<< "TargetCompID=SERVER" << std::endl
<< "HeartBtInt=30" << std::endl;
FIX::ClOrdID clOrdID( "ORDERID" );
FIX::HandlInst handlInst( '1' );
FIX::Symbol symbol( "LNUX" );
FIX::Side side( FIX::Side_BUY );
FIX::TransactTime transactTime;
FIX::OrdType ordType( FIX::OrdType_MARKET );
FIX42::NewOrderSingle message( clOrdID, handlInst, symbol, side, transactTime, ordType );
FIX::SessionID sessionID( "FIX.4.2", "CLIENT", "SERVER" );
TestApplication application;
FIX::MemoryStoreFactory factory;
FIX::SessionSettings settings( stream );
FIX::ThreadedSocketAcceptor acceptor( application, factory, settings );
acceptor.start();
FIX::ThreadedSocketInitiator initiator( application, factory, settings );
initiator.start();
FIX::process_sleep( 1 );
int start = GetTickCount();
for ( int i = 0; i <= count; ++i )
FIX::Session::sendToTarget( message, sessionID );
while( application.getCount() < count )
FIX::process_sleep( 0.1 );
int ticks = GetTickCount() - start;
initiator.stop();
acceptor.stop();
return ticks;
}
| [
"[email protected]"
]
| [
[
[
1,
795
]
]
]
|
a2a81fbfb5adf7115c07ff95c398a54e86a84b22 | f246dc2a816ccd5acd0776a48c2c24cdb1f4178f | /libsrc/Desktop/PigletDeskVMTemp.CPP | 44ac20da9b65c460d524d7982176ba0f29dd4902 | []
| no_license | profcturner/pigletlib | 3f2c4b1af000d73cf4a176a8463c16aaeefde99a | b2ccbb43270a5e8d3a0f8ae6bd3d3cb82a061fec | refs/heads/master | 2021-07-24T07:23:10.577261 | 2007-08-26T22:36:47 | 2007-08-26T22:36:47 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,865 | cpp | /*
** Piglet Productions
**
** FileName : PigletDeskVMTemp.CPP
**
** Implements : PigletVBarMenu (Template Loading)
** PigletVMenuTemplate
**
** Description
**
** Allows menu data to be read from files.
**
**
** Initial Coding : Colin Turner
**
** Date : 1998
**
*/
#include <PigletDesktop.h>
/*
** LoadTemplate
**
** This function should read template data in a formatted file straight into
** the menu data.
**
** Parameters
**
** tp (Open) file handle of the data file containing the template
** ident Unique case sensitive text identifier for template block
**
** Returns
**
** 1 on success, 0 on failure
**/
int PigletVBarMenu::LoadTemplate(FILE * tp, char * Ident)
{
int found = 0;
int error;
unsigned short loop;
PigletVMenuTemplate * MenuHdr = new PigletVMenuTemplate;
char * Data;
char * Status;
fseek(tp, 0, SEEK_SET);
while (!found && !feof(tp)) {
if (fread(MenuHdr, sizeof(PigletVMenuTemplate), 1, tp)==1) {
if (strcmp(Ident, MenuHdr->Ident)) // No match, read past entries
fseek(tp, (unsigned long) ((MenuHdr->DataLen + MenuHdr->StatusLen)*MenuHdr->Items), SEEK_CUR);
else {
X = MenuHdr->xOffset;
Y = MenuHdr->yOffset;
Data = new char[MenuHdr->DataLen];
Status = new char[MenuHdr->StatusLen];
for (loop=0; loop<MenuHdr->Items; loop++) {
error = 0;
if (fread(Data, MenuHdr->DataLen, 1, tp)!=1) error=1;
if (fread(Status, MenuHdr->StatusLen, 1, tp)!=1) error=1;
if (!error) Add(Data, Status);
}
delete Status;
delete Data;
found = 1;
}
}
}
delete(MenuHdr);
return(found);
}
// End of File
| [
"[email protected]"
]
| [
[
[
1,
75
]
]
]
|
dba169d50f9b1283820a2e79c912efdc2096de57 | 71b601e499aa3f2c18797cca5ec16ea312f5f61d | /BCB5_WinInetIntro/main.h | f6ed68b1a76ff963ad546be70354a47c89f8d5c7 | []
| no_license | jmnavarro/BCB_LosRinconesDelAPIWinInet | e9186b88bfe4266443a3fcf290cd10b214b0bd5c | b6b58658866370274ea0cbfb4facbcf03f682dec | refs/heads/master | 2016-08-07T20:41:23.277852 | 2011-07-01T08:43:59 | 2011-07-01T08:43:59 | 1,982,567 | 0 | 0 | null | null | null | null | ISO-8859-1 | C++ | false | false | 3,996 | h | //---------------------------------------------------------------------------------------------
//
// Archivo: main.h
//
// Propósito:
// Formulario principal y función inline LinkTo
//
// Autor: José Manuel Navarro ([email protected])
// Fecha: 01/04/2003
// Observaciones: Unidad creada en C++ Builder 6 para Síntesis nº 14 (http://www.grupoalbor.com)
// Copyright: Este código es de dominio público y se puede utilizar y/o mejorar siempre que
// SE HAGA REFERENCIA AL AUTOR ORIGINAL, ya sea a través de estos comentarios
// o de cualquier otro modo.
//
//---------------------------------------------------------------------------------------------
#ifndef mainH
#define mainH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include "Ejecutar.h"
#include <ActnList.hpp>
#include <CheckLst.hpp>
#include <ComCtrls.hpp>
#include <ExtCtrls.hpp>
//---------------------------------------------------------------------------
#include <wininet.h>
#include <Buttons.hpp>
class TMainForm : public TForm
{
__published: // IDE-managed Components
TShape *sh_funcion;
TImage *i_icono;
TLabel *l_jm;
TLabel *l_url;
TLabel *l_conexion;
TPanel *p_funciones;
TPageControl *pc_funciones;
TTabSheet *ts_modem;
TPageControl *pc_modem;
TTabSheet *ts_cookies;
TPageControl *pc_cookies;
TPanel *p_aux;
TActionList *ActionList1;
TTabSheet *ts_autodial;
TEjecutarFrame *AutodialFrame;
TTabSheet *ts_autodialHangup;
TTabSheet *ts_dial;
TTabSheet *ts_hangup;
TEjecutarFrame *DialFrame;
TEjecutarFrame *AutodialHangupFrame;
TEjecutarFrame *HangupFrame;
TAction *InetAutodial;
TAction *InetAutodialHangup;
TAction *InetDial;
TAction *InetHangup;
TAction *InetSetCookie;
TAction *InetGetCookie;
TTabSheet *ts_setcookie;
TTabSheet *ts_getcookie;
TEjecutarFrame *SetCookieFrame;
TEjecutarFrame *GetCookieFrame;
TCheckListBox *AutodialFlags;
TCheckListBox *DialFlags;
TEdit *e_idConn;
TEdit *e_idConn2;
TEdit *e_urlSetCookie;
TEdit *e_variable;
TEdit *e_valor;
TEdit *e_urlGetCookie;
TListBox *lb_variables;
TLabel *l_rincones;
TLabel *l_wininet;
TLabel *l_sintesis;
TBevel *bv;
void __fastcall FormCreate(TObject *Sender);
void __fastcall CambioFunciones(TObject *Sender);
void __fastcall InetAutodialExecute(TObject *Sender);
void __fastcall InetAutodialHangupExecute(TObject *Sender);
void __fastcall InetDialExecute(TObject *Sender);
void __fastcall InetHangupExecute(TObject *Sender);
void __fastcall InetSetCookieExecute(TObject *Sender);
void __fastcall InetGetCookieExecute(TObject *Sender);
void __fastcall l_jmClick(TObject *Sender);
void __fastcall l_wininetClick(TObject *Sender);
void __fastcall l_sintesisClick(TObject *Sender);
void __fastcall l_rinconesClick(TObject *Sender);
private:
TLabel *FLabelFunciones[2];
TLabel *FLabelActiva;
void __fastcall InitFunciones();
public:
__fastcall TMainForm(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TMainForm *MainForm;
//---------------------------------------------------------------------------
//
// Función auxiliar para lanzar el explorador por defecto
//
inline bool LinkTo(const char *url)
{
return ( HINSTANCE_ERROR <= (int) ::ShellExecute( ::GetForegroundWindow(),
NULL,
url,
NULL,
NULL,
SW_NORMAL) );
}
#endif
| [
"[email protected]"
]
| [
[
[
1,
126
]
]
]
|
bbea9366bcd7c4a2783e1db952052b88c7f8d1b4 | f89e32cc183d64db5fc4eb17c47644a15c99e104 | /pcsx2-rr/plugins/zerogs/opengl/GS.h | 8add8cb833024fa3b38963de654794198b97be5c | []
| no_license | mauzus/progenitor | f99b882a48eb47a1cdbfacd2f38505e4c87480b4 | 7b4f30eb1f022b08e6da7eaafa5d2e77634d7bae | refs/heads/master | 2021-01-10T07:24:00.383776 | 2011-04-28T11:03:43 | 2011-04-28T11:03:43 | 45,171,114 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 16,897 | h | /* ZeroGS KOSMOS
* Copyright (C) 2005-2006 [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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __GS_H__
#define __GS_H__
#ifdef _WIN32
#include <windows.h>
#include <windowsx.h>
extern HWND GShwnd;
#else // linux basic definitions
#include <GL/glew.h>
#include <GL/gl.h>
#include <GL/glx.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <X11/extensions/xf86vmode.h>
#include <gtk/gtk.h>
#include <sys/stat.h>
#include <sys/types.h>
#endif
#include <stdio.h>
#include <malloc.h>
#include <assert.h>
// need C definitions
extern "C" {
#define GSdefs
#include "PS2Edefs.h"
extern "C" u32 CALLBACK PS2EgetLibType(void);
extern "C" u32 CALLBACK PS2EgetLibVersion2(u32 type);
extern "C" char* CALLBACK PS2EgetLibName(void);
}
#include "zerogsmath.h"
#ifndef _WIN32
#include <assert.h>
#include <vector>
#include <string>
using namespace std;
extern std::string s_strIniPath;
extern u32 THR_KeyEvent; // value for passing out key events beetwen threads
extern bool THR_bShift;
#if !defined(_MSC_VER) && !defined(HAVE_ALIGNED_MALLOC)
// declare linux equivalents
static __forceinline void* pcsx2_aligned_malloc(size_t size, size_t align)
{
assert( align < 0x10000 );
char* p = (char*)malloc(size+align);
int off = 2+align - ((int)(uptr)(p+2) % align);
p += off;
*(u16*)(p-2) = off;
return p;
}
static __forceinline void pcsx2_aligned_free(void* pmem)
{
if( pmem != NULL ) {
char* p = (char*)pmem;
free(p - (int)*(u16*)(p-2));
}
}
#define _aligned_malloc pcsx2_aligned_malloc
#define _aligned_free pcsx2_aligned_free
#endif
#include <sys/timeb.h> // ftime(), struct timeb
inline unsigned long timeGetTime()
{
#ifdef _WIN32
_timeb t;
_ftime(&t);
#else
timeb t;
ftime(&t);
#endif
return (unsigned long)(t.time*1000+t.millitm);
}
#define max(a,b) (((a) > (b)) ? (a) : (b))
#define min(a,b) (((a) < (b)) ? (a) : (b))
struct RECT
{
int left, top;
int right, bottom;
};
#define GL_X11_WINDOW
class GLWindow
{
private:
#ifdef GL_X11_WINDOW
Display *glDisplay;
Window glWindow;
int glScreen;
GLXContext context;
XSetWindowAttributes attr;
XF86VidModeModeInfo deskMode;
#endif
bool fullScreen, doubleBuffered;
s32 x, y;
u32 width, height, depth;
public:
void SwapBuffers();
void SetTitle(char *strtitle);
bool CreateWindow(void *pDisplay);
bool DestroyWindow();
void CloseWindow();
void DisplayWindow(int _width, int _height);
void ResizeCheck();
};
extern GLWindow GLWin;
#endif // linux basic definitions
struct Vector_16F
{
u16 x, y, z, w;
};
/////////////////////
#ifdef ZEROGS_DEVBUILD
#define GS_LOG __Log
#else
#define GS_LOG 0&&
#endif
#define ERROR_LOG __LogToConsole
#define DEBUG_LOG printf
#ifndef ZEROGS_DEVBUILD
#define WARN_LOG 0&&
#define PRIM_LOG 0&&
#else
#define WARN_LOG printf
#define PRIM_LOG if (conf.log & 0x00000010) GS_LOG
#endif
#ifndef GREG_LOG
#define GREG_LOG 0&&
#endif
#ifndef PRIM_LOG
#define PRIM_LOG 0&&
#endif
#ifndef WARN_LOG
#define WARN_LOG 0&&
#endif
#define REG64(name) \
union name \
{ \
u64 i64; \
u32 ai32[2]; \
struct { \
#define REG128(name)\
union name \
{ \
u64 ai64[2]; \
u32 ai32[4]; \
struct { \
#define REG64_(prefix, name) REG64(prefix##name)
#define REG128_(prefix, name) REG128(prefix##name)
#define REG_END }; };
#define REG_END2 };
#define REG64_SET(name) \
union name \
{ \
u64 i64; \
u32 ai32[2]; \
#define REG128_SET(name)\
union name \
{ \
u64 ai64[2]; \
u32 ai32[4]; \
#define REG_SET_END };
REG64_(GSReg, BGCOLOR)
u32 R:8;
u32 G:8;
u32 B:8;
u32 _PAD1:8;
u32 _PAD2:32;
REG_END
REG64_(GSReg, BUSDIR)
u32 DIR:1;
u32 _PAD1:31;
u32 _PAD2:32;
REG_END
REG64_(GSReg, CSR)
u32 SIGNAL:1;
u32 FINISH:1;
u32 HSINT:1;
u32 VSINT:1;
u32 EDWINT:1;
u32 ZERO1:1;
u32 ZERO2:1;
u32 _PAD1:1;
u32 FLUSH:1;
u32 RESET:1;
u32 _PAD2:2;
u32 NFIELD:1;
u32 FIELD:1;
u32 FIFO:2;
u32 REV:8;
u32 ID:8;
u32 _PAD3:32;
REG_END
REG64_(GSReg, DISPFB) // (-1/2)
u32 FBP:9;
u32 FBW:6;
u32 PSM:5;
u32 _PAD:12;
u32 DBX:11;
u32 DBY:11;
u32 _PAD2:10;
REG_END
REG64_(GSReg, DISPLAY) // (-1/2)
u32 DX:12;
u32 DY:11;
u32 MAGH:4;
u32 MAGV:2;
u32 _PAD:3;
u32 DW:12;
u32 DH:11;
u32 _PAD2:9;
REG_END
REG64_(GSReg, EXTBUF)
u32 EXBP:14;
u32 EXBW:6;
u32 FBIN:2;
u32 WFFMD:1;
u32 EMODA:2;
u32 EMODC:2;
u32 _PAD1:5;
u32 WDX:11;
u32 WDY:11;
u32 _PAD2:10;
REG_END
REG64_(GSReg, EXTDATA)
u32 SX:12;
u32 SY:11;
u32 SMPH:4;
u32 SMPV:2;
u32 _PAD1:3;
u32 WW:12;
u32 WH:11;
u32 _PAD2:9;
REG_END
REG64_(GSReg, EXTWRITE)
u32 WRITE;
u32 _PAD2:32;
REG_END
REG64_(GSReg, IMR)
u32 _PAD1:8;
u32 SIGMSK:1;
u32 FINISHMSK:1;
u32 HSMSK:1;
u32 VSMSK:1;
u32 EDWMSK:1;
u32 _PAD2:19;
u32 _PAD3:32;
REG_END
REG64_(GSReg, PMODE)
u32 EN1:1;
u32 EN2:1;
u32 CRTMD:3;
u32 MMOD:1;
u32 AMOD:1;
u32 SLBG:1;
u32 ALP:8;
u32 _PAD:16;
u32 _PAD1:32;
REG_END
REG64_(GSReg, SIGLBLID)
u32 SIGID:32;
u32 LBLID:32;
REG_END
REG64_(GSReg, SMODE1)
u32 RC:3;
u32 LC:7;
u32 T1248:2;
u32 SLCK:1;
u32 CMOD:2;
u32 EX:1;
u32 PRST:1;
u32 SINT:1;
u32 XPCK:1;
u32 PCK2:2;
u32 SPML:4;
u32 GCONT:1;
u32 PHS:1;
u32 PVS:1;
u32 PEHS:1;
u32 PEVS:1;
u32 CLKSEL:2;
u32 NVCK:1;
u32 SLCK2:1;
u32 VCKSEL:2;
u32 VHP:1;
u32 _PAD1:27;
REG_END
REG64_(GSReg, SMODE2)
u32 INT:1;
u32 FFMD:1;
u32 DPMS:2;
u32 _PAD2:28;
u32 _PAD3:32;
REG_END
REG64_(GSReg, SIGBLID)
u32 SIGID;
u32 LBLID;
REG_END
extern int g_LastCRC;
extern u8* g_pBasePS2Mem;
#define PMODE ((GSRegPMODE*)(g_pBasePS2Mem+0x0000))
#define SMODE1 ((GSRegSMODE1*)(g_pBasePS2Mem+0x0010))
#define SMODE2 ((GSRegSMODE2*)(g_pBasePS2Mem+0x0020))
// SRFSH
#define SYNCH1 ((GSRegSYNCH1*)(g_pBasePS2Mem+0x0040))
#define SYNCH2 ((GSRegSYNCH2*)(g_pBasePS2Mem+0x0050))
#define SYNCV ((GSRegSYNCV*)(g_pBasePS2Mem+0x0060))
#define DISPFB1 ((GSRegDISPFB*)(g_pBasePS2Mem+0x0070))
#define DISPLAY1 ((GSRegDISPLAY*)(g_pBasePS2Mem+0x0080))
#define DISPFB2 ((GSRegDISPFB*)(g_pBasePS2Mem+0x0090))
#define DISPLAY2 ((GSRegDISPLAY*)(g_pBasePS2Mem+0x00a0))
#define EXTBUF ((GSRegEXTBUF*)(g_pBasePS2Mem+0x00b0))
#define EXTDATA ((GSRegEXTDATA*)(g_pBasePS2Mem+0x00c0))
#define EXTWRITE ((GSRegEXTWRITE*)(g_pBasePS2Mem+0x00d0))
#define BGCOLOR ((GSRegBGCOLOR*)(g_pBasePS2Mem+0x00e0))
#define CSR ((GSRegCSR*)(g_pBasePS2Mem+0x1000))
#define IMR ((GSRegIMR*)(g_pBasePS2Mem+0x1010))
#define BUSDIR ((GSRegBUSDIR*)(g_pBasePS2Mem+0x1040))
#define SIGLBLID ((GSRegSIGBLID*)(g_pBasePS2Mem+0x1080))
#define GET_GSFPS (((SMODE1->CMOD&1) ? 50 : 60) / (SMODE2->INT ? 1 : 2))
//
// sps2tags.h
//
#ifdef _M_AMD64
#define GET_GIF_REG(tag, reg) \
(((tag).ai64[1] >> ((reg) << 2)) & 0xf)
#else
#define GET_GIF_REG(tag, reg) \
(((tag).ai32[2 + ((reg) >> 3)] >> (((reg) & 7) << 2)) & 0xf)
#endif
//
// GIFTag
REG128(GIFTag)
u32 NLOOP:15;
u32 EOP:1;
u32 _PAD1:16;
u32 _PAD2:14;
u32 PRE:1;
u32 PRIM:11;
u32 FLG:2; // enum GIF_FLG
u32 NREG:4;
u64 REGS:64;
REG_END
typedef struct {
int x, y, w, h;
} Rect;
typedef struct {
int x, y;
} Point;
typedef struct {
int x0, y0;
int x1, y1;
} Rect2;
typedef struct {
int x, y, c;
} PointC;
#define GSOPTION_FULLSCREEN 0x2
#define GSOPTION_TGASNAP 0x4
#define GSOPTION_CAPTUREAVI 0x8
#define GSOPTION_WINDIMS 0x30
#define GSOPTION_WIN640 0x00
#define GSOPTION_WIN800 0x10
#define GSOPTION_WIN1024 0x20
#define GSOPTION_WIN1280 0x30
#define GSOPTION_WIREFRAME 0x100
#define GSOPTION_LOADED 0x8000
typedef struct {
u8 mrtdepth; // write color in render target
u8 interlace;
u8 aa; // antialiasing 0 - off, 1 - 2x, 2 - 4x
u8 bilinear; // set to enable bilinear support
u32 options;
u32 gamesettings; // default game settings
int width, height;
int winstyle; // window style before full screen
#ifdef GS_LOG
u32 log;
#endif
} GSconf;
struct VertexGPU
{
s16 x, y, f, resv0; // note: xy is 12d3
u32 rgba;
u32 z;
float s, t, q;
};
struct Vertex
{
u16 x, y, f, resv0; // note: xy is 12d3
u32 rgba;
u32 z;
float s, t, q;
u16 u, v;
};
extern int g_GameSettings;
extern GSconf conf;
extern int ppf;
// PSM values
// PSM types == Texture Storage Format
enum PSM_value{
PSMCT32 = 0, // 000000
PSMCT24 = 1, // 000001
PSMCT16 = 2, // 000010
PSMCT16S = 10, // 001010
PSMT8 = 19, // 010011
PSMT4 = 20, // 010100
PSMT8H = 27, // 011011
PSMT4HL = 36, // 100100
PSMT4HH = 44, // 101100
PSMT32Z = 48, // 110000
PSMT24Z = 49, // 110001
PSMT16Z = 50, // 110010
PSMT16SZ = 58, // 111010
};
static __forceinline bool PSMT_ISCLUT(u32 psm) { return ((psm & 0x7) > 2);}
static __forceinline bool PSMT_IS16BIT(u32 psm) { return ((psm & 0x7) == 2);}
typedef struct {
int nloop;
int eop;
int nreg;
} tagInfo;
typedef union {
s64 SD;
u64 UD;
s32 SL[2];
u32 UL[2];
s16 SS[4];
u16 US[4];
s8 SC[8];
u8 UC[8];
} reg64;
/* general purpose regs structs */
typedef struct {
int fbp;
int fbw;
int fbh;
int psm;
u32 fbm;
} frameInfo;
typedef struct {
u16 prim;
union {
struct {
u16 iip : 1;
u16 tme : 1;
u16 fge : 1;
u16 abe : 1;
u16 aa1 : 1;
u16 fst : 1;
u16 ctxt : 1;
u16 fix : 1;
u16 resv : 8;
};
u16 _val;
};
} primInfo;
extern primInfo *prim;
typedef union {
struct {
u32 ate : 1;
u32 atst : 3;
u32 aref : 8;
u32 afail : 2;
u32 date : 1;
u32 datm : 1;
u32 zte : 1;
u32 ztst : 2;
u32 resv : 13;
};
u32 _val;
} pixTest;
typedef struct {
int bp;
int bw;
int psm;
} bufInfo;
typedef struct {
int tbp0;
int tbw;
int cbp;
u16 tw, th;
u8 psm;
u8 tcc;
u8 tfx;
u8 cpsm;
u8 csm;
u8 csa;
u8 cld;
} tex0Info;
#define TEX_MODULATE 0
#define TEX_DECAL 1
#define TEX_HIGHLIGHT 2
#define TEX_HIGHLIGHT2 3
typedef struct {
int lcm;
int mxl;
int mmag;
int mmin;
int mtba;
int l;
int k;
} tex1Info;
typedef struct {
int wms;
int wmt;
int minu;
int maxu;
int minv;
int maxv;
} clampInfo;
typedef struct {
int cbw;
int cou;
int cov;
} clutInfo;
typedef struct {
int tbp[3];
int tbw[3];
} miptbpInfo;
typedef struct {
u16 aem;
u8 ta[2];
float fta[2];
} texaInfo;
typedef struct {
int sx;
int sy;
int dx;
int dy;
int dir;
} trxposInfo;
typedef struct {
union {
struct {
u8 a : 2;
u8 b : 2;
u8 c : 2;
u8 d : 2;
};
u8 abcd;
};
u8 fix : 8;
} alphaInfo;
typedef struct {
u16 zbp; // u16 address / 64
u8 psm;
u8 zmsk;
} zbufInfo;
typedef struct {
int fba;
} fbaInfo;
typedef struct {
int mode;
int regn;
u64 regs;
tagInfo tag;
} pathInfo;
typedef struct {
Vertex gsvertex[3];
u32 rgba;
float q;
Vertex vertexregs;
int primC; // number of verts current storing
int primIndex; // current prim index
int nTriFanVert;
int prac;
int dthe;
int colclamp;
int fogcol;
int smask;
int pabe;
u64 buff[2];
int buffsize;
int cbp[2]; // internal cbp registers
u32 CSRw;
primInfo _prim[2];
bufInfo srcbuf, srcbufnew;
bufInfo dstbuf, dstbufnew;
clutInfo clut;
texaInfo texa;
trxposInfo trxpos, trxposnew;
int imageWtemp, imageHtemp;
int imageTransfer;
int imageWnew, imageHnew, imageX, imageY, imageEndX, imageEndY;
pathInfo path1;
pathInfo path2;
pathInfo path3;
} GSinternal;
extern GSinternal gs;
extern FILE *gsLog;
void __Log(const char *fmt, ...);
void __LogToConsole(const char *fmt, ...);
void LoadConfig();
void SaveConfig();
extern void (*GSirq)();
void *SysLoadLibrary(char *lib); // Loads Library
void *SysLoadSym(void *lib, char *sym); // Loads Symbol from Library
char *SysLibError(); // Gets previous error loading sysbols
void SysCloseLibrary(void *lib); // Closes Library
void SysMessage(char *fmt, ...);
extern "C" void * memcpy_amd(void *dest, const void *src, size_t n);
extern "C" u8 memcmp_mmx(const void *dest, const void *src, int n);
template <typename T>
class CInterfacePtr
{
public:
inline CInterfacePtr() : ptr(NULL) {}
inline explicit CInterfacePtr(T* newptr) : ptr(newptr) { if ( ptr != NULL ) ptr->AddRef(); }
inline ~CInterfacePtr() { if( ptr != NULL ) ptr->Release(); }
inline T* operator* () { assert( ptr != NULL); return *ptr; }
inline T* operator->() { return ptr; }
inline T* get() { return ptr; }
inline void release() {
if( ptr != NULL ) { ptr->Release(); ptr = NULL; }
}
inline operator T*() { return ptr; }
inline bool operator==(T* rhs) { return ptr == rhs; }
inline bool operator!=(T* rhs) { return ptr != rhs; }
inline CInterfacePtr& operator= (T* newptr) {
if( ptr != NULL ) ptr->Release();
ptr = newptr;
if( ptr != NULL ) ptr->AddRef();
return *this;
}
private:
T* ptr;
};
#define RGBA32to16(c) \
(u16)((((c) & 0x000000f8) >> 3) | \
(((c) & 0x0000f800) >> 6) | \
(((c) & 0x00f80000) >> 9) | \
(((c) & 0x80000000) >> 16)) \
#define RGBA16to32(c) \
(((c) & 0x001f) << 3) | \
(((c) & 0x03e0) << 6) | \
(((c) & 0x7c00) << 9) | \
(((c) & 0x8000) ? 0xff000000 : 0) \
// converts float16 [0,1] to BYTE [0,255] (assumes value is in range, otherwise will take lower 8bits)
// f is a u16
static __forceinline u16 Float16ToBYTE(u16 f) {
//assert( !(f & 0x8000) );
if( f & 0x8000 ) return 0;
u16 d = ((((f&0x3ff)|0x400)*255)>>(10-((f>>10)&0x1f)+15));
return d > 255 ? 255 : d;
}
static __forceinline u16 Float16ToALPHA(u16 f) {
//assert( !(f & 0x8000) );
if( f & 0x8000 ) return 0;
// round up instead of down (crash and burn), too much and charlie breaks
u16 d = (((((f&0x3ff)|0x400))*255)>>(10-((f>>10)&0x1f)+15));
d = (d)>>1;
return d > 255 ? 255 : d;
}
#ifndef COLOR_ARGB
#define COLOR_ARGB(a,r,g,b) \
((u32)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff)))
#endif
// assumes that positive in [1,2] (then extracts fraction by just looking at the specified bits)
#define Float16ToBYTE_2(f) ((u8)(*(u16*)&f>>2))
#define Float16To5BIT(f) (Float16ToBYTE(f)>>3)
#define Float16Alpha(f) (((*(u16*)&f&0x7c00)>=0x3900)?0x8000:0) // alpha is >= 1
// converts an array of 4 u16s to a u32 color
// f is a pointer to a u16
#define Float16ToARGB(f) COLOR_ARGB(Float16ToALPHA(f.w), Float16ToBYTE(f.x), Float16ToBYTE(f.y), Float16ToBYTE(f.z));
#define Float16ToARGB16(f) (Float16Alpha(f.w)|(Float16To5BIT(f.x)<<10)|(Float16To5BIT(f.y)<<5)|Float16To5BIT(f.z))
// used for Z values
#define Float16ToARGB_Z(f) COLOR_ARGB((u32)Float16ToBYTE_2(f.w), Float16ToBYTE_2(f.x), Float16ToBYTE_2(f.y), Float16ToBYTE_2(f.z))
#define Float16ToARGB16_Z(f) ((Float16ToBYTE_2(f.y)<<8)|Float16ToBYTE_2(f.z))
inline float Clamp(float fx, float fmin, float fmax)
{
if( fx < fmin ) return fmin;
return fx > fmax ? fmax : fx;
}
// IMPORTANT: For every Register there must be an End
void DVProfRegister(char* pname); // first checks if this profiler exists in g_listProfilers
void DVProfEnd(u32 dwUserData);
void DVProfWrite(char* pfilename, u32 frames = 0);
void DVProfClear(); // clears all the profilers
#define DVPROFILE
#ifdef DVPROFILE
class DVProfileFunc
{
public:
u32 dwUserData;
DVProfileFunc(char* pname) { DVProfRegister(pname); dwUserData = 0; }
DVProfileFunc(char* pname, u32 dwUserData) : dwUserData(dwUserData) { DVProfRegister(pname); }
~DVProfileFunc() { DVProfEnd(dwUserData); }
};
#else
class DVProfileFunc
{
public:
u32 dwUserData;
static __forceinline DVProfileFunc(char* pname) {}
static __forceinline DVProfileFunc(char* pname, u32 dwUserData) { }
~DVProfileFunc() {}
};
#endif
#endif
| [
"koeiprogenitor@bfa1b011-20a7-a6e3-c617-88e5d26e11c5"
]
| [
[
[
1,
858
]
]
]
|
efaed97cb7e7de3da2c829a31e878ea4f3cb8733 | b56f6642b802cc5b45237e2e0b7758c042f81ebe | /flashgui/Dialog.h | 4b95d87e3cbd3c81876cba071ed94118abc86e7c | []
| no_license | gmiranda/flashphoto | d44146fc84872349b999a9c56e57b9b3335ce8b5 | b78380cecf72021c5a0bfa5ac692ebf91c6add6f | refs/heads/master | 2021-01-10T10:48:33.889755 | 2011-11-28T09:40:11 | 2011-11-28T09:40:11 | 46,440,178 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,637 | h | #ifndef _Dialog_h_
#define _Dialog_h_
#include <QDialog>
#include <QGroupBox>
#include <QPushButton>
#include <QRadioButton>
#include <QString>
#include <QLabel>
#include <string>
// Gotta hate forward declarations
/*class QGroupBox;
class QPushButton;*/
/**
* Main Application Dialog
*/
class FlashDialog : public QDialog{
Q_OBJECT
public:
FlashDialog();
virtual ~FlashDialog();
private:
// Attributes
//! Name of the executable file
const std::string executable;
//! Number of elements in the vertical groupbox
const static unsigned verticalOptions = 3;
//! Button enumeration
enum{ flashImage = 0, noFlashImage, resultImage };
//! Group of buttons to choose the image files (2 input/1 output)
QGroupBox* gridGroupBox;
//! Buttons pointer array
QPushButton *buttons[verticalOptions];
//! Image boxes
QLabel* imageBoxes[verticalOptions];
//! Option box
QGroupBox* optionBox;
//! Normal bilateral filter option
QRadioButton *plainBilateral,
//! Cross bilateral filter option
*crossBilateral;
//! Info label
QLabel* infoLabel;
//! Go button (starts the main program)
QPushButton * goButton,
//! Cancel button (quits the program: GUI and core)
* cancelButton;
//! Quit Action
QAction* quitAction;
//! Flash Image Path
QString flashImagePath,
//! No Flash Image Path
noFlashImagePath,
//! Result Path
resultImagePath;
private:
// Methods
void createImageLayout();
void createOptionLayout();
std::string parameters()const;
private slots:
// Slots
void openFlashImage();
void openNoFlashImage();
void saveResultImage();
void launchFlashExec();
};
#endif // _Dialog_h_
| [
"gmiranda@ce2dd6bc-64f8-f6e2-0175-3f3cbbe2768e"
]
| [
[
[
1,
80
]
]
]
|
7aaaefffadeb6d08f0b135e2fae06f9f0e865e9b | 80716d408715377e88de1fc736c9204b87a12376 | /TspLib3/UISrc/Spdll.cpp | 64fac8865d9807826791b38801e12d9a61efee51 | []
| no_license | junction/jn-tapi | b5cf4b1bb010d696473cabcc3d5950b756ef37e9 | a2ef6c91c9ffa60739ecee75d6d58928f4a5ffd4 | refs/heads/master | 2021-03-12T23:38:01.037779 | 2011-03-10T01:08:40 | 2011-03-10T01:08:40 | 199,317 | 2 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 9,247 | cpp | /******************************************************************************/
//
// SPDLL.CPP - UI Service Provider DLL shell.
//
// Copyright (C) 1994-1999 JulMar Entertainment Technology, Inc.
// All rights reserved
//
// This module intercepts the TSPI calls and invokes the SP object
// with the appropriate parameters.
//
// This source code is intended only as a supplement to the
// TSP++ Class Library product documentation. This source code cannot
// be used in part or whole in any form outside the TSP++ library.
//
/******************************************************************************/
#include "stdafx.h"
#include <ctype.h>
// Include all our inline code if necessary
#ifdef _NOINLINES_
#include "uiline.inl"
#include "uiaddr.inl"
#include "uidevice.inl"
#include "uiagent.inl"
#include "uiphone.inl"
#endif
// Entrypoint definition for each TSPUI_xxx function
#define TSPUI_ENTRY(t,o,f) (GetUISP()->_SetIntCallback(t,(DWORD)o,f))
#ifndef _UNICODE
///////////////////////////////////////////////////////////////////////////
// ConvertWideToAnsi
//
// Utility function included with non-UNICODE build to convert the
// UNICODE strings to normal ANSI single-byte strings.
//
CString ConvertWideToAnsi(LPCWSTR lpszInput)
{
CString strReturn;
if (lpszInput != NULL)
{
int iSize = WideCharToMultiByte (CP_ACP, 0, lpszInput, -1, NULL, 0, NULL, NULL);
if (iSize > 0)
{
LPSTR lpszBuff = strReturn.GetBuffer(iSize+1);
if (lpszBuff != NULL)
WideCharToMultiByte (CP_ACP, 0, lpszInput, -1, lpszBuff, iSize, NULL, NULL);
strReturn.ReleaseBuffer();
}
}
return strReturn;
}// ConvertWideToAnsi
#endif // _UNICODE
/////////////////////////////////////////////////////////////////////////////
// TUISPI_lineConfigDialog
//
// This function is called to display the line configuration dialog
// when the user requests it through either the TAPI api or the control
// panel applet.
//
extern "C"
LONG TSPIAPI TUISPI_lineConfigDialog (TUISPIDLLCALLBACK lpfnDLLCallback, DWORD dwDeviceID, HWND hwndOwner, LPCWSTR lpszDeviceClass)
{
TSPUI_ENTRY(TUISPIDLL_OBJECT_LINEID , dwDeviceID, lpfnDLLCallback);
#ifdef _UNICODE
CString strDevClass = lpszDeviceClass;
#else
CString strDevClass = ConvertWideToAnsi (lpszDeviceClass);
#endif
// If the parent window is the desktop, then set it to NULL
// so we don't inadvertantly disable the desktop window (which causes
// big trouble even under WinNT). NULL has the same basic effect.
if (hwndOwner == ::GetDesktopWindow())
hwndOwner = NULL;
strDevClass.MakeLower();
return GetUISP()->lineConfigDialog(dwDeviceID, CWnd::FromHandle(hwndOwner), strDevClass);
}// TUISPI_lineConfigDialog
///////////////////////////////////////////////////////////////////////////
// TUISPI_lineConfigDialogEdit
//
// This function causes the provider of the specified line device to
// display a modal dialog to allow the user to configure parameters
// related to the line device. The parameters editted are NOT the
// current device parameters, rather the set retrieved from the
// 'TSPI_lineGetDevConfig' function (lpDeviceConfigIn), and are returned
// in the lpDeviceConfigOut parameter.
//
extern "C"
LONG TSPIAPI TUISPI_lineConfigDialogEdit (TUISPIDLLCALLBACK lpfnDLLCallback,
DWORD dwDeviceID, HWND hwndOwner,
LPCWSTR lpszDeviceClass, LPVOID const lpDeviceConfigIn, DWORD dwSize,
LPVARSTRING lpDeviceConfigOut)
{
TSPUI_ENTRY(TUISPIDLL_OBJECT_LINEID , dwDeviceID, lpfnDLLCallback);
#ifdef _UNICODE
CString strDevClass = lpszDeviceClass;
#else
CString strDevClass = ConvertWideToAnsi (lpszDeviceClass);
#endif
// If the parent window is the desktop, then set it to NULL
// so we don't inadvertantly disable the desktop window (which causes
// big trouble even under WinNT). NULL has the same basic effect.
if (hwndOwner == ::GetDesktopWindow())
hwndOwner = NULL;
strDevClass.MakeLower();
return GetUISP()->lineConfigDialogEdit(dwDeviceID, CWnd::FromHandle(hwndOwner),
strDevClass, lpDeviceConfigIn, dwSize, lpDeviceConfigOut);
}// TUISPI_lineConfigDialogEdit
///////////////////////////////////////////////////////////////////////////
// TUISPI_phoneConfigDialog
//
// This function invokes the parameter configuration dialog for the
// phone device.
//
extern "C"
LONG TSPIAPI TUISPI_phoneConfigDialog (TUISPIDLLCALLBACK lpfnDLLCallback,
DWORD dwDeviceId, HWND hwndOwner, LPCWSTR lpszDeviceClass)
{
TSPUI_ENTRY(TUISPIDLL_OBJECT_PHONEID, dwDeviceId, lpfnDLLCallback);
#ifdef _UNICODE
CString strDevClass = lpszDeviceClass;
#else
CString strDevClass = ConvertWideToAnsi (lpszDeviceClass);
#endif
// If the parent window is the desktop, then set it to NULL
// so we don't inadvertantly disable the desktop window (which causes
// big trouble even under WinNT). NULL has the same basic effect.
if (hwndOwner == ::GetDesktopWindow())
hwndOwner = NULL;
return GetUISP()->phoneConfigDialog(dwDeviceId, CWnd::FromHandle(hwndOwner), strDevClass);
}// TUISPI_phoneConfigDialog
////////////////////////////////////////////////////////////////////////////
// TUISPI_providerConfig
//
// This function is invoked from the control panel and allows the user
// to configure our service provider.
//
extern "C"
LONG TSPIAPI TUISPI_providerConfig (TUISPIDLLCALLBACK lpfnDLLCallback,
HWND hwndOwner, DWORD dwPermanentProviderID)
{
TSPUI_ENTRY(TUISPIDLL_OBJECT_PROVIDERID, dwPermanentProviderID, lpfnDLLCallback);
// If the parent window is the desktop, then set it to NULL
// so we don't inadvertantly disable the desktop window (which causes
// big trouble even under WinNT). NULL has the same basic effect.
if (hwndOwner == ::GetDesktopWindow())
hwndOwner = NULL;
return GetUISP()->providerConfig(dwPermanentProviderID, CWnd::FromHandle(hwndOwner));
}// TUISPI_providerConfig
////////////////////////////////////////////////////////////////////////////
// TUISPI_providerGenericDialog
//
// This function is called when the service provider requests
// a spontaneous dialog not known by TAPI itself.
//
extern "C"
LONG TSPIAPI TUISPI_providerGenericDialog (TUISPIDLLCALLBACK lpfnDLLCallback,
HTAPIDIALOGINSTANCE htDlgInst, LPVOID lpParams, DWORD dwSize,
HANDLE hEvent)
{
TSPUI_ENTRY(TUISPIDLL_OBJECT_DIALOGINSTANCE, htDlgInst, lpfnDLLCallback);
return GetUISP()->providerGenericDialog (htDlgInst, lpParams, dwSize, hEvent);
}// TUISPI_providerGenericDialog
/////////////////////////////////////////////////////////////////////////////
// TSPI_providerGenericDialogData
//
// This function delivers to the UI DLL data that was
// sent from the service provider via the LINE_SENDDIALOGINSTANCEDATA
// message. The contents of the memory block pointed to be
// lpParams is defined by the service provider and UI DLL.
//
extern "C"
LONG TSPIAPI TUISPI_providerGenericDialogData (
HTAPIDIALOGINSTANCE htDlgInst, LPVOID lpParams, DWORD dwSize)
{
return GetUISP()->providerGenericDialogData (htDlgInst, lpParams, dwSize);
}// TSPI_providerGenericDialogData
////////////////////////////////////////////////////////////////////////////
// TUISPI_providerInstall
//
// This function is invoked to install the service provider onto
// the system.
//
extern "C"
LONG TSPIAPI TUISPI_providerInstall(TUISPIDLLCALLBACK lpfnDLLCallback,
HWND hwndOwner, DWORD dwPermanentProviderID)
{
TSPUI_ENTRY(TUISPIDLL_OBJECT_PROVIDERID, dwPermanentProviderID, lpfnDLLCallback);
// If the parent window is the desktop, then set it to NULL
// so we don't inadvertantly disable the desktop window (which causes
// big trouble even under WinNT). NULL has the same basic effect.
if (hwndOwner == ::GetDesktopWindow())
hwndOwner = NULL;
return GetUISP()->providerInstall(dwPermanentProviderID, CWnd::FromHandle(hwndOwner));
}// TUISPI_providerInstall
////////////////////////////////////////////////////////////////////////////
// TUISPI_providerRemove
//
// This function removes the service provider
//
extern "C"
LONG TSPIAPI TUISPI_providerRemove(TUISPIDLLCALLBACK lpfnDLLCallback,
HWND hwndOwner, DWORD dwPermanentProviderID)
{
TSPUI_ENTRY(TUISPIDLL_OBJECT_PROVIDERID, dwPermanentProviderID, lpfnDLLCallback);
// If the parent window is the desktop, then set it to NULL
// so we don't inadvertantly disable the desktop window (which causes
// big trouble even under WinNT). NULL has the same basic effect.
if (hwndOwner == ::GetDesktopWindow())
hwndOwner = NULL;
return GetUISP()->providerRemove(dwPermanentProviderID, CWnd::FromHandle(hwndOwner));
}// TUISPI_providerRemove
| [
"Owner@.(none)"
]
| [
[
[
1,
246
]
]
]
|
3fbb17ab639a5207b754801690797e00fd56d75c | 80716d408715377e88de1fc736c9204b87a12376 | /TspLib3/Include/uiphone.inl | c5a9c538ad2d5bb65ae15becab6f95c236f2ecfe | []
| no_license | junction/jn-tapi | b5cf4b1bb010d696473cabcc3d5950b756ef37e9 | a2ef6c91c9ffa60739ecee75d6d58928f4a5ffd4 | refs/heads/master | 2021-03-12T23:38:01.037779 | 2011-03-10T01:08:40 | 2011-03-10T01:08:40 | 199,317 | 2 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 9,736 | inl | /******************************************************************************/
//
// UIPHONE.INL - TAPI Service Provider C++ Library header
//
// Copyright (C) 1994-1999 JulMar Entertainment Technology, Inc.
// All rights reserved
//
// The SPLIB classes provide a basis for developing MS-TAPI complient
// Service Providers. They provide basic handling for all of the TSPI
// APIs and a C-based handler which routes all requests through a set of C++
// classes.
//
// This source code is intended only as a supplement to the
// TSP++ Class Library product documentation. This source code cannot
// be used in part or whole in any form outside the TSP++ library.
//
// INLINE FUNCTIONS
//
/******************************************************************************/
#ifndef _UIPHONE_INL_INC_
#define _UIPHONE_INL_INC_
#ifndef _NOINLINES_
#define TSP_INLINE inline
#else
#define TSP_INLINE
#endif
/******************************************************************************/
//
// CTSPUIDevice class functions
//
/******************************************************************************/
///////////////////////////////////////////////////////////////////////////
// CTSPUIDevice::GetPhoneCount
//
// Returns the number of phones stored in our internal array
//
TSP_INLINE unsigned int CTSPUIDevice::GetPhoneCount() const
{
return m_arrPhones.GetSize();
}// CTSPUIDevice::GetPhoneCount
///////////////////////////////////////////////////////////////////////////
// CTSPUIDevice::GetPhoneConnection
//
// Returns a specific phone object by index
//
TSP_INLINE CTSPUIPhoneConnection* CTSPUIDevice::GetPhoneConnectionInfo(unsigned int nIndex) const
{
return (nIndex < GetPhoneCount()) ?
m_arrPhones[nIndex] : NULL;
}// CTSPUIDevice::GetPhoneConnection
///////////////////////////////////////////////////////////////////////////
// CTSPUIDevice::AddPhone
//
// Add a Phone to the service provider
//
TSP_INLINE unsigned int CTSPUIDevice::AddPhone(CTSPUIPhoneConnection* pPhone)
{
pPhone->m_pDevice = this;
return m_arrPhones.Add(pPhone);
}// CTSPUIDevice::AddPhone
///////////////////////////////////////////////////////////////////////////
// CTSPUIDevice::RemovePhone
//
// Remove a Phone from the service provider
//
TSP_INLINE void CTSPUIDevice::RemovePhone(unsigned int iPhone)
{
if (iPhone < GetPhoneCount())
m_arrPhones.RemoveAt(iPhone);
}// CTSPUIDevice::RemovePhone
///////////////////////////////////////////////////////////////////////////
// CTSPUIDevice::RemovePhone
//
// Remove a Phone from the service provider
//
TSP_INLINE void CTSPUIDevice::RemovePhone(CTSPUIPhoneConnection* pPhone)
{
for (unsigned int i = 0; i < GetPhoneCount(); i++)
{
if (GetPhoneConnectionInfo(i) == pPhone)
{
RemovePhone(i);
break;
}
}
}// CTSPUIDevice::RemovePhone
///////////////////////////////////////////////////////////////////////////
// CTSPUIDevice::FindPhoneConnectionByPermanentID
//
// Returns a specific line object by line id
//
TSP_INLINE CTSPUIPhoneConnection* CTSPUIDevice::FindPhoneConnectionByPermanentID(DWORD dwPermID)
{
for (unsigned int i = 0; i < GetPhoneCount(); i++)
{
CTSPUIPhoneConnection* pPhone = GetPhoneConnectionInfo(i);
if (pPhone->GetPermanentDeviceID() == dwPermID)
return pPhone;
}
return NULL;
}// CTSPUIDevice::FindPhoneConnectionByPermanentID
/******************************************************************************/
//
// CTSPUIPhoneConnection class functions
//
/******************************************************************************/
///////////////////////////////////////////////////////////////////////////
// CTSPUIPhoneConnection::CTSPUIPhoneConnection
//
// Constructor for the CTSPUIPhoneConnection class
//
TSP_INLINE CTSPUIPhoneConnection::CTSPUIPhoneConnection() : m_pDevice(0),
m_dwDeviceID(0xffffffff), m_dwLineID(0xffffffff)
{
m_sizDisplay.cx = m_sizDisplay.cy = 0;
}// CTSPUIPhoneConnection::CTSPUIPhoneConnection
///////////////////////////////////////////////////////////////////////////
// CTSPUIPhoneConnection::CTSPUIPhoneConnection
//
// Constructor for the CTSPUIPhoneConnection class
//
TSP_INLINE CTSPUIPhoneConnection::CTSPUIPhoneConnection(DWORD dwDeviceID, LPCTSTR pszName) :
m_pDevice(0), m_dwDeviceID(dwDeviceID), m_strName(pszName), m_dwLineID(0xffffffff)
{
m_sizDisplay.cx = m_sizDisplay.cy = 0;
}// CTSPUIPhoneConnection::CTSPUIPhoneConnection
///////////////////////////////////////////////////////////////////////////
// CTSPUIPhoneConnection::GetDeviceInfo
//
// Return the device information object
//
TSP_INLINE CTSPUIDevice* CTSPUIPhoneConnection::GetDeviceInfo() const
{
return m_pDevice;
}// CTSPUIPhoneConnection::GetDeviceInfo
///////////////////////////////////////////////////////////////////////////
// CTSPUIPhoneConnection::SetAssociatedLine
//
// Sets the line associated to this phone object
//
TSP_INLINE void CTSPUIPhoneConnection::SetAssociatedLine(DWORD dwLineID)
{
if (m_dwLineID != dwLineID)
{
CTSPUILineConnection* pLine = GetAssociatedLine();
m_dwLineID = dwLineID;
if (pLine != NULL)
pLine->SetAssociatedPhone(0xffffffff);
pLine = GetAssociatedLine();
if (pLine != NULL)
pLine->SetAssociatedPhone(m_dwDeviceID);
else
m_dwLineID = 0xffffffff;
}
}// CTSPUIPhoneConnection::SetAssociatedLine
///////////////////////////////////////////////////////////////////////////
// CTSPUIPhoneConnection::GetAssociatedLine
//
// Gets the line associated to this phone object
//
TSP_INLINE CTSPUILineConnection* CTSPUIPhoneConnection::GetAssociatedLine() const
{
if (m_dwLineID != 0xffffffff && GetDeviceInfo() != NULL)
return GetDeviceInfo()->FindLineConnectionByPermanentID(m_dwLineID);
return NULL;
}// CTSPUIPhoneConnection::GetAssociatedLine
///////////////////////////////////////////////////////////////////////////
// CTSPUIPhoneConnection::GetPermanentDeviceID
//
// Returns the device id for this line
//
TSP_INLINE DWORD CTSPUIPhoneConnection::GetPermanentDeviceID() const
{
return m_dwDeviceID;
}// CTSPUIPhoneConnection::GetPermanentDeviceID
///////////////////////////////////////////////////////////////////////////
// CTSPUIPhoneConnection::GetName
//
// Returns the name for this line
//
TSP_INLINE LPCTSTR CTSPUIPhoneConnection::GetName() const
{
return m_strName;
}// CTSPUIPhoneConnection::GetName
///////////////////////////////////////////////////////////////////////////
// CTSPUIPhoneConnection::SetPermanentDeviceID
//
// Returns the device id for this line
//
TSP_INLINE void CTSPUIPhoneConnection::SetPermanentDeviceID(DWORD dwDeviceID)
{
m_dwDeviceID = dwDeviceID;
}// CTSPUIPhoneConnection::SetPermanentDeviceID
///////////////////////////////////////////////////////////////////////////
// CTSPUIPhoneConnection::SetName
//
// Returns the name for this line
//
TSP_INLINE void CTSPUIPhoneConnection::SetName(LPCTSTR pszName)
{
m_strName = pszName;
}// CTSPUIPhoneConnection::SetName
///////////////////////////////////////////////////////////////////////////
// CTSPUIPhoneConnection::AddUploadBuffer
//
// Adds a new upload buffer to the phone
//
TSP_INLINE int CTSPUIPhoneConnection::AddUploadBuffer (DWORD dwSizeOfBuffer)
{
return m_arrUploadBuffers.Add(dwSizeOfBuffer);
}// CTSPUIPhoneConnection::AddUploadBuffer
///////////////////////////////////////////////////////////////////////////
// CTSPUIPhoneConnection::AddDownloadBuffer
//
// Adds a new download buffer to the phone
//
TSP_INLINE int CTSPUIPhoneConnection::AddDownloadBuffer (DWORD dwSizeOfBuffer)
{
return m_arrDownloadBuffers.Add(dwSizeOfBuffer);
}// CTSPUIPhoneConnection::AddDownloadBuffer
///////////////////////////////////////////////////////////////////////////
// CTSPUIPhoneConnection::SetupDisplay
//
// Setup the display for the phone
//
TSP_INLINE void CTSPUIPhoneConnection::SetupDisplay (int iColumns, int iRows, char cChar)
{
m_sizDisplay.cx = iColumns;
m_sizDisplay.cy = iRows;
m_chDisplay = cChar;
}// CTSPUIPhoneConnection::SetupDisplay
///////////////////////////////////////////////////////////////////////////
// CTSPUIPhoneConnection::AddButton
//
// Add a button to the phone unit.
//
TSP_INLINE int CTSPUIPhoneConnection::AddButton (DWORD dwFunction, DWORD dwMode, DWORD dwAvailLampModes, LPCTSTR lpszText)
{
return m_arrButtons.Add(new tsplibui::CPhoneButtonInfo(dwFunction, dwMode, dwAvailLampModes, lpszText));
}// CTSPUIPhoneConnection::AddButton
///////////////////////////////////////////////////////////////////////////
// CTSPUIPhoneConnection::AddHookSwitchDevice
//
// Add a hook switch device to the unit
//
TSP_INLINE int CTSPUIPhoneConnection::AddHookSwitchDevice(DWORD dwHookSwitchDev, DWORD dwAvailModes, DWORD dwVolume, DWORD dwGain, DWORD dwSettableModes, DWORD dwMonitoredModes, bool fSupportsVolChange, bool fSupportsGainChange)
{
return m_arrHookswitch.Add(new tsplibui::CPhoneHSInfo(dwHookSwitchDev, dwAvailModes, dwVolume, dwGain, dwSettableModes, dwMonitoredModes, fSupportsVolChange, fSupportsGainChange));
}// CTSPUIPhoneConnection::AddHookSwitchDevice
#endif // _UIPHONE_INL_INC_
| [
"Owner@.(none)"
]
| [
[
[
1,
297
]
]
]
|
08243e9b47bef254de3d635cd11c1e4316c0bef3 | 59166d9d1eea9b034ac331d9c5590362ab942a8f | /osgSimpleGLSL/main.cpp | 15eda46cabe0e54c7b8390e4c8d210b91ecee73e | []
| 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 | UTF-8 | C++ | false | false | 273 | cpp | #include <osgViewer/Viewer>
#include "GL2Scene.h"
int main()
{
// construct the viewer.
osgViewer::Viewer viewer;
// create the scene
GL2ScenePtr gl2Scene = new GL2Scene;
viewer.setSceneData( gl2Scene->getRootNode().get() );
return viewer.run();
} | [
"asmzx79@3290fc28-3049-11de-8daa-cfecb5f7ff5b"
]
| [
[
[
1,
16
]
]
]
|
089e194a467be14dbc1e2ad3fc12b3471d0fb3ed | 5ff30d64df43c7438bbbcfda528b09bb8fec9e6b | /knet/message/net/NetControlMessage.h | 4c12b692a4664e117dbe33afcaecf2fe0b2b041e | []
| no_license | lvtx/gamekernel | c80cdb4655f6d4930a7d035a5448b469ac9ae924 | a84d9c268590a294a298a4c825d2dfe35e6eca21 | refs/heads/master | 2016-09-06T18:11:42.702216 | 2011-09-27T07:22:08 | 2011-09-27T07:22:08 | 38,255,025 | 3 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,040 | h | #pragma once
#include <knet/message/Message.h>
#include <knet/message/net/NetMessageTypes.h>
#include <knet/socket/Socket.h>
#include <knet/NetSecurity.h>
namespace gk {
/**
* @struct NetControlMessage
*
* Internal message to control network
*/
struct NetControlMessage : public Message
{
enum Control
{
NONE
, UDP_LISTEN
, UDP_OPEN
, UDP_CLOSE
, UDP_MAKE_LOSSY
, TCP_LISTEN
, TCP_CONNECT
, TCP_CLOSE
};
uint control; // control
uint connectionId; // connnection id when greater than 0
IpAddress remote; // Remote address
uint param; // parameter if any
SecurityLevel sl;
NetControlMessage()
: control( 0 )
, connectionId( 0 )
, remote()
, param( 0 )
, sl( SECURITY0 )
{
type = NET_CONTROL_MESSAGE;
}
bool Pack( BitStream& /* bs */ )
{
K_ASSERT( !_T("Internal message") );
return false;
}
bool Unpack( BitStream& /* bs */ )
{
K_ASSERT( !_T("Internal message") );
return false;
}
};
} // gk
| [
"darkface@localhost"
]
| [
[
[
1,
60
]
]
]
|
88791395088ec12bc1db7561e1e2662a25ce7931 | 967868cbef4914f2bade9ef8f6c300eb5d14bc57 | /Vector/IntVector.cpp | 1cc61780f77bd3d2f2b789ecd08517d21cc197ed | []
| no_license | saminigod/baseclasses-001 | 159c80d40f69954797f1c695682074b469027ac6 | 381c27f72583e0401e59eb19260c70ee68f9a64c | refs/heads/master | 2023-04-29T13:34:02.754963 | 2009-10-29T11:22:46 | 2009-10-29T11:22:46 | null | 0 | 0 | null | null | null | null | WINDOWS-1252 | C++ | false | false | 19,541 | cpp | /*
© Vestris Inc., Geneva Switzerland
http://www.vestris.com, 1998, All Rights Reserved
__________________________________________________
written by Daniel Doubrovkine - [email protected]
09.09.1999: fixed interation m_CArrayMemoryFill-iCollapseCounter in RemoveFromGroup
*/
#include <baseclasses.hpp>
#include "IntVector.hpp"
const int CIntVector::HByte = (1<<31);
const int CIntVector::XByte = ~HByte;
bool CIntVector::operator==(const CIntVector& Vector) const {
if (m_CArrayMemoryFill != Vector.m_CArrayMemoryFill) return false;
for (register int i=0;i<m_CArrayMemoryFill;i++)
if (m_CArray[i] != Vector.m_CArray[i]) return false;
return true;
}
bool CIntVector::operator>=(const CIntVector& Vector) const {
if (m_CArrayRealSize >= Vector.m_CArrayRealSize) return true;
else return false;
}
bool CIntVector::operator<=(const CIntVector& Vector) const {
if (m_CArrayRealSize <= Vector.m_CArrayRealSize) return true;
else return false;
}
bool CIntVector::operator>(const CIntVector& Vector) const {
if (m_CArrayRealSize > Vector.m_CArrayRealSize) return true;
else return false;
}
bool CIntVector::operator<(const CIntVector& Vector) const {
if (m_CArrayRealSize < Vector.m_CArrayRealSize) return true;
else return false;
}
bool CIntVector::operator!=(const CIntVector& Vector) const {
return !(operator==(Vector));
}
CIntVector::CIntVector(const CIntVector& Vector) {
m_CArray = NULL;
m_CArrayRealSize = 0;
m_CArrayMemorySize = 0;
m_CArrayMemoryFill = 0;
operator=(Vector);
}
CIntVector& CIntVector::operator=(const CIntVector& Vector) {
if ((&Vector) == this)
return (* this);
CCVResize(Vector.m_CArrayMemoryFill);
if (Vector.m_CArrayMemoryFill) {
memcpy(m_CArray, Vector.m_CArray, Vector.m_CArrayMemoryFill * sizeof(int));
m_CArrayMemoryFill = Vector.m_CArrayMemoryFill;
m_CArrayRealSize = Vector.m_CArrayRealSize;
} else {
m_CArrayMemoryFill = 0;
m_CArrayRealSize = 0;
}
return (* this);
}
CIntVector::~CIntVector(void) {
if (m_CArray)
Free(m_CArray);
}
CIntVector::CIntVector(void) {
m_CArrayMemorySize = 0;
m_CArrayMemoryFill = 0;
m_CArrayRealSize = 0;
m_CArray = NULL;
}
bool CIntVector::CCVPartOf(int Index, int Value) {
if (Index < m_CArrayMemoryFill) {
if ((m_CArray[Index]&HByte) && (Index < (m_CArrayMemoryFill - 1))) {
if ((m_CArray[Index+1] <= Value)&&((m_CArray[Index+1]+(m_CArray[Index]&XByte)) >= Value)) return true;
else return false;
} else return (m_CArray[Index] == Value);
} else return false;
}
void CIntVector::RemoveFromGroup(int i, int Value, int iEltMin, int iEltCount) {
// element is inside the group
// split the group
if ((Value == iEltMin)||(Value == (iEltMin + iEltCount - 1))) {
// leftmost/rightmost element
if (Value == iEltMin) m_CArray[i+1]++;
m_CArray[i]--;
//cout << "unique counter: [" << (m_CArray[i]&XByte) << "]" << endl;
if ((m_CArray[i]&XByte) == 1) {
// merge into a single element
for (register int j=i;j<(m_CArrayMemoryFill-1);j++)
m_CArray[j] = m_CArray[j+1];
m_CArrayMemoryFill--;
}
m_CArrayRealSize--;
} else {
// somewhere middle element
// idea: separte into two lists and then collapse lists if needed
// add a new empty list
CCVResize(m_CArrayMemoryFill + 2);
for (register int j=m_CArrayMemoryFill-1;j>=(i+2);j--)
m_CArray[j+2] = m_CArray[j];
m_CArrayMemoryFill+=2;
// set the right list
// cout << "Right list counter:[" << ((m_CArray[i] - (Index - iCounter + 1))&XByte) << "]" << endl;
// cout << "Left list counter:[" << (Index - iCounter) << "]" << endl;
int iCollapseCounter = 0;
m_CArray[i+2] = m_CArray[i] - (Value - iEltMin + 1); // counter (right)
m_CArray[i] = (Value - iEltMin)|HByte; // counter (left)
// cout << "left counter:[" << (m_CArray[i]&XByte) << "]" << endl;
// cout << "right counter:[" << (m_CArray[i+2]&XByte) << "]" << endl;
m_CArray[i+3] = m_CArray[i+1] + Value - iEltMin + 1;
if ((m_CArray[i]&XByte) == 1) {
m_CArray[i] = m_CArray[i+1];
m_CArray[i+1] = m_CArray[i+2];
m_CArray[i+2] = m_CArray[i+3];
iCollapseCounter++;
}
if ((m_CArray[i+2-iCollapseCounter]&XByte) == 1) {
m_CArray[i+2-iCollapseCounter] = m_CArray[i+3-iCollapseCounter];
iCollapseCounter++;
}
if (iCollapseCounter) {
/* 09.09.1999: fix, interation m_CArrayMemoryFill-iCollapseCounter */
for (register int j=i+2;j<m_CArrayMemoryFill-iCollapseCounter;j++)
m_CArray[j] = m_CArray[j+iCollapseCounter];
m_CArrayMemoryFill -= iCollapseCounter;
}
m_CArrayRealSize--;
}
}
int CIntVector::FindElt(int Value) const {
int iEltCount;
int iEltMin;
for (register int i=0;i<m_CArrayMemoryFill;i++) {
if (m_CArray[i]&HByte) {
iEltCount = (m_CArray[i]&XByte);
iEltMin = m_CArray[i+1];
if ((iEltMin <= Value)&&(iEltMin+iEltCount-1 >= Value)) {
// found in group
return (i+(Value-iEltMin));
}
if (iEltMin+iEltCount-1>Value) return -1;
i++;
} else {
if (m_CArray[i] == Value) {
// remove single element
return i;
} else if (m_CArray[i] > Value) return -1;
}
}
return -1;
}
bool CIntVector::DeleteElt(int Value) {
int iEltCount;
int iEltMin;
for (register int i=0;i<m_CArrayMemoryFill;i++) {
if (m_CArray[i]&HByte) {
iEltCount = (m_CArray[i]&XByte);
iEltMin = m_CArray[i+1];
if ((iEltMin <= Value)&&(iEltMin+iEltCount-1 >= Value)) {
// found in group
RemoveFromGroup(i, Value, iEltMin, iEltCount);
return true;
}
if (iEltMin+iEltCount-1>Value) return false;
i++;
} else {
if (m_CArray[i] == Value) {
// remove single element
RemoveSingle(i);
return true;
} else if (m_CArray[i] > Value) {
return false;
}
}
}
return false;
}
void CIntVector::RemoveSingle(int i) {
// collapse array on element i
for (register int j=i;j<(m_CArrayMemoryFill-1);j++)
m_CArray[j] = m_CArray[j+1];
// we never need to merge, since we removed an intermediate element
m_CArrayMemoryFill--;
m_CArrayRealSize--;
}
bool CIntVector::DeleteEltAt(int Index) {
int iCounter = 0, iEltCount, iEltMin;
for (register int i=0;i<m_CArrayMemoryFill;i++) {
if (m_CArray[i]&HByte) {
iEltCount = (m_CArray[i]&XByte);
iEltMin = (m_CArray[i+1]);
if ((int) (iCounter + iEltCount) > Index) {
//cout << "removing: [" << iEltMin + (Index - iCounter) << "]" << endl;
RemoveFromGroup(i, iEltMin + (Index - iCounter), m_CArray[i+1], iEltCount);
return true;
} else {
iCounter+=iEltCount;
i++;
}
} else if (iCounter == Index) {
RemoveSingle(i);
return true;
}
else iCounter++;
}
return false;
}
bool CIntVector::Contains(int Value) const {
int iEltCount;
int iEltMin;
for (register int i=0;i<m_CArrayMemoryFill;i++) {
if (m_CArray[i]&HByte) {
iEltCount = (m_CArray[i]&XByte);
iEltMin = m_CArray[i+1];
if ((iEltMin <= Value)&&(iEltMin+iEltCount-1 >= Value)) return 1;
if (iEltMin+iEltCount-1>Value) return false;
i++;
} else {
if (m_CArray[i] == Value) return true;
else if (m_CArray[i] > Value) return false;
}
}
return false;
}
void CIntVector::CCVResize(int DesiredSize) {
if (DesiredSize > m_CArrayMemorySize) {
int NewSize = DesiredSize;
if (NewSize < MBYTE) {
NewSize = (m_CArrayMemorySize?(m_CArrayMemorySize << 1):DesiredSize);
while ( NewSize < DesiredSize)
NewSize <<= 1;
}
int * NewArray = Allocate(NewSize);
if (m_CArray) {
memcpy(NewArray, m_CArray, sizeof(int) * m_CArrayMemoryFill);
Free(m_CArray);
}
m_CArray = NewArray;
m_CArrayMemorySize = NewSize;
}
}
bool CIntVector::InsertElt(int Value) {
// cout << "Inserting " << Value << " into " << (* this) << endl;
int iEltMin;
int iEltCount;
int MostLikelyPosition = 0;
for (register int i=0;i<m_CArrayMemoryFill;i++) {
if (m_CArray[i]&HByte) { // high bit at 1
// if (Value == PAGE_REQ) { cout << "(1)" << endl; base_sleep(1); }
iEltCount = (m_CArray[i]&XByte);
iEltMin = m_CArray[i+1];
// element in the existing interval ?
// cout << "min: " << iEltMin << " count: " << iEltCount << endl;
if ((iEltMin <= Value)&&(iEltMin+iEltCount-1 >= Value)) {
return false;
}
// element bounding the interval (left) ?
if ((iEltMin - 1) == Value) {
// if (Value == PAGE_REQ) { cout << "(2)" << endl; base_sleep(1); }
m_CArray[i] = (iEltCount+1) | (HByte);
m_CArray[i+1] = Value;
m_CArrayRealSize++;
return true;
} else if ((iEltMin + iEltCount) == Value) { // element bounding the interval (right) ?
// if (Value == PAGE_REQ) { cout << "(3)" << endl; base_sleep(1); }
m_CArray[i] = ((iEltCount+1) | (HByte));
// cout << "new count: " << (m_CArray[i]&XByte) << endl;
// check if we need to merge
if (CCVPartOf(i+2, Value+1)) {
// if (Value == PAGE_REQ) { cout << "(4)" << endl; base_sleep(1); }
// merge the two groups/elements
if (m_CArray[i+2]&HByte) {
m_CArray[i] += (m_CArray[i+2]&XByte);
for (register int j=i+2;j<(m_CArrayMemoryFill-2);j++)
m_CArray[j] = m_CArray[j+2];
m_CArrayMemoryFill-=2;
} else {
// if (Value == PAGE_REQ) { cout << "(5)" << endl; base_sleep(1); }
// merging element is simple: increment the counter again
m_CArray[i]++;
for (int j=i+2;j<(m_CArrayMemoryFill-1);j++)
m_CArray[j] = m_CArray[j+1];
m_CArrayMemoryFill--;
}
CCVResize(m_CArrayMemoryFill);
}
m_CArrayRealSize++;
return true;
}
i++;
if (iEltMin + iEltCount < Value) MostLikelyPosition = i+1;
} else {
// if (Value == PAGE_REQ) { cout << "(6)" << endl; base_sleep(1); }
// individual element
if (m_CArray[i] == Value) {
return false;
} else if (m_CArray[i] - 1 == Value) {
// if (Value == PAGE_REQ) { cout << "(7)" << endl; base_sleep(1); }
CCVResize(m_CArrayMemoryFill+1);
if (m_CArrayMemoryFill) {
for (register int j=m_CArrayMemoryFill-1;j>i;j--)
m_CArray[j+1] = m_CArray[j];
}
m_CArrayMemoryFill++;
m_CArray[i] = 2 | (HByte);
m_CArray[i+1] = Value;
m_CArrayRealSize++;
return true;
} else if (m_CArray[i] + 1 == Value) {
// if (Value == PAGE_REQ) { cout << "(8)" << endl; base_sleep(1); }
CCVResize(m_CArrayMemoryFill+1);
if (m_CArrayMemoryFill) {
for (register int j=m_CArrayMemoryFill-1;j>=i;j--)
m_CArray[j+1] = m_CArray[j];
}
m_CArrayMemoryFill++;
m_CArray[i] = 2 | (HByte);
// see if we need to merge
if (CCVPartOf(i+2, Value+1)) {
// if (Value == PAGE_REQ) { cout << "(9)" << endl; base_sleep(1); }
// merge the two groups/elements
if (m_CArray[i+2]&HByte) {
// if (Value == PAGE_REQ) { cout << "(10)" << endl; base_sleep(1); }
m_CArray[i] += (m_CArray[i+2]&XByte);
for (register int j=i+2;j<(m_CArrayMemoryFill-2);j++)
m_CArray[j] = m_CArray[j+2];
m_CArrayMemoryFill-=2;
} else {
// if (Value == PAGE_REQ) { cout << "(11)" << endl; base_sleep(1); }
// merging elements: increment the counter again
m_CArray[i]++;
for (register int j=i+2;j<(m_CArrayMemoryFill-1);j++)
m_CArray[j] = m_CArray[j+1];
m_CArrayMemoryFill--;
}
CCVResize(m_CArrayMemoryFill);
}
m_CArrayRealSize++;
return true;
}
if ((i < m_CArrayMemoryFill) && (m_CArray[i] < Value)) MostLikelyPosition = i+1;
}
}
// nothing appropriate found
// insert at MostlyLikelyPosition
CCVResize(m_CArrayMemoryFill + 1);
for (register int j=(m_CArrayMemoryFill-1);j>=MostLikelyPosition;j--)
m_CArray[j+1] = m_CArray[j];
m_CArray[MostLikelyPosition] = Value;
m_CArrayMemoryFill++;
m_CArrayRealSize++;
return true;
}
void CIntVector::AppendVector(const CIntVector& Vector) {
if ((&Vector == this) || (Vector.m_CArrayMemoryFill == 0))
return;
if (m_CArrayMemoryFill == 0) {
operator=(Vector);
} else {
CCVResize(m_CArrayMemoryFill + Vector.m_CArrayMemoryFill);
for (int i=0;i<Vector.m_CArrayMemoryFill;i++) {
if (Vector.m_CArray[i]&HByte) {
AddInterval(Vector.m_CArray[i+1], Vector.m_CArray[i+1] + (Vector.m_CArray[i]&XByte) - 1);
i++;
} else InsertElt(Vector.m_CArray[i]);
}
}
}
void CIntVector::AddInterval(int First, int Last) {
//cout << "INTERVAL:[" << First << "-" << Last << "]" << endl;
int l_Append = 1;
if (m_CArrayRealSize >= 1) {
int l_Last = m_CArray[m_CArrayMemoryFill-1];
if ((m_CArrayMemoryFill >= 2)&&(m_CArray[m_CArrayMemoryFill-2]&HByte)) {
l_Last += (m_CArray[m_CArrayMemoryFill-2]&XByte);
}
if (l_Last >= First) l_Append = 0;
}
if (l_Append) {
CCVResize(m_CArrayMemoryFill + 2);
m_CArray[m_CArrayMemoryFill] = (Last - First + 1) | (HByte);
m_CArray[m_CArrayMemoryFill+1] = First;
m_CArrayMemoryFill+=2;
m_CArrayRealSize += (Last - First + 1);
} else {
for (register int i=First;i<=Last;i++) {
InsertElt(i);
}
}
}
int * CIntVector::GetVector(void) const {
// cout << "getting real vector from " << m_CArrayRealSize << "/" << m_CArrayMemoryFill << endl;
if (m_CArrayRealSize) {
int iEltCount;
int * Result = new int[m_CArrayRealSize];
int iCounter = 0;
for (register int i=0;i<m_CArrayMemoryFill;i++) {
if (m_CArray[i]&HByte) {
iEltCount = (m_CArray[i]&XByte);
for (int j=0;j<iEltCount;j++)
Result[iCounter++] = m_CArray[i+1] + j;
i++;
} else Result[iCounter++] = m_CArray[i];
}
assert(iCounter == m_CArrayRealSize);
return Result;
} else return NULL;
}
int CIntVector::GetEltAt(int Index) const {
int iCounter = 0, iEltCount;
for (register int i=0;i<m_CArrayMemoryFill;i++) {
if (m_CArray[i]&HByte) {
iEltCount = (m_CArray[i]&XByte);
if (iCounter + iEltCount > Index) {
return (m_CArray[i+1] + Index - iCounter);
} else {
iCounter+=iEltCount;
i++;
}
} else if (iCounter == Index) return m_CArray[i];
else iCounter++;
}
return 0;
}
istream& CIntVector::operator>>(istream& Stream) {
assert(0);
return Stream;
}
ostream& CIntVector::operator<<(ostream& Stream) const {
int PrevValue = -1;
int iEltCount, iEltMin;
for (register int i=0;i<m_CArrayMemoryFill;i++) {
if (m_CArray[i]&HByte) { // high bit at 1
iEltCount = (m_CArray[i]&XByte);
iEltMin = m_CArray[i+1];
if (PrevValue != -1) Stream << ' ';
Stream << iEltMin << '-' << iEltMin+iEltCount-1;
PrevValue = iEltMin+iEltCount-1;
i++;
} else {
if (PrevValue != -1) Stream << ' ';
PrevValue = m_CArray[i];
Stream << m_CArray[i];
}
}
return Stream;
}
void CIntVector::_AppendElt(int Value) {
CCVResize(m_CArrayMemoryFill+1);
m_CArray[m_CArrayMemoryFill] = Value;
m_CArrayMemoryFill++;
m_CArrayRealSize++;
}
void CIntVector::_AppendInt(int First, int Last) {
CCVResize(m_CArrayMemoryFill+2);
m_CArray[m_CArrayMemoryFill] = (Last - First + 1) | (HByte);
m_CArray[m_CArrayMemoryFill+1] = First;
m_CArrayMemoryFill+=2;
m_CArrayRealSize+=(Last - First + 1);
}
void CIntVector::Write(FILE * Descr) const {
int PrevValue = -1;
int iEltCount, iEltMin;
for (register int i=0;i<m_CArrayMemoryFill;i++) {
if (m_CArray[i]&HByte) { // high bit at 1
iEltCount = (m_CArray[i]&XByte);
iEltMin = m_CArray[i+1];
if (PrevValue != -1) fprintf(Descr, " ");
fprintf(Descr, "%d-%d", iEltMin, iEltMin+iEltCount-1);
PrevValue = iEltMin+iEltCount-1;
i++;
} else {
if (PrevValue != -1) fprintf(Descr, " ");
PrevValue = m_CArray[i];
fprintf(Descr, "%d", m_CArray[i]);
}
}
}
CVector<int>& CIntVector::AppendTo(CVector<int>& Target) const {
int iEltCount;
Target.SetDim(Target.GetSize() + GetSize());
for (register int i=0;i<m_CArrayMemoryFill;i++) {
if (m_CArray[i]&HByte) {
iEltCount = m_CArray[i]&XByte;
for (int j=0;j<iEltCount;j++) Target += m_CArray[i+1] + j;
i++;
} else Target += m_CArray[i];
}
return Target;
}
| [
"[email protected]"
]
| [
[
[
1,
530
]
]
]
|
a57ce2691ad86da34aa6402e0eaf98cecaa2b910 | c6dca462f8e982b2a327285cf084d08fa7f27dd8 | /liblearning/util/Eigen_util.cpp | 4996115d65ff12ecab321792aec2fc34fe99dc07 | []
| no_license | nagyistoce/liblearning | 2a7e94344f15c5af105974207ece68822102524b | ac0a77dce09ad72f32b2cae067f4616e49d60697 | refs/heads/master | 2021-01-01T16:59:44.689918 | 2010-08-20T12:07:22 | 2010-08-20T12:07:22 | 32,806,608 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,230 | cpp | /*
* Eigen_util.cpp
*
* Created on: 2010-6-4
* Author: sun
*/
#include <liblearning/util/Eigen_util.h>
#include <liblearning/util/math_util.h>
#include <cstdlib>
#include <cassert>
#include <cmath>
#include <ctime>
#ifdef __GNUC__
#include <tr1/random.h>
#else
#include <random>
#endif
using namespace Eigen;
MatrixXd randn(int m, int n)
{
MatrixXd x(m,n);
#ifndef USE_MKL
std::tr1::mt19937 rng(static_cast<unsigned int>(std::time(0)));
std::tr1::normal_distribution<double> nd(0.0, 1.0);
std::tr1::variate_generator<std::tr1::mt19937&,
std::tr1::normal_distribution<double> > var_nor(rng, nd);
for (int i = 0;i<m;i++)
for (int j = 0;j<n;j++)
x(i,j) = var_nor();
#else
fill_randn(x.data(), m*n,0,1);
#endif
return x;
}
Eigen::VectorXd randn(int size)
{
VectorXd x(size);
std::tr1::mt19937 rng(static_cast<unsigned int>(std::time(0)));
std::tr1::normal_distribution<double> nd(0.0, 1.0);
std::tr1::variate_generator<std::tr1::mt19937&,
std::tr1::normal_distribution<double> > var_nor(rng, nd);
for (int i = 0;i<size;i++)
x(i) = var_nor();
return x;
}
MatrixXd rand(int r, int c)
{
MatrixXd x(r,c);
#ifndef USE_MKL
std::tr1::mt19937 rng(static_cast<unsigned int>(std::time(0)));
std::tr1::uniform_real<double> nd(0.0, 1.0);
std::tr1::variate_generator<std::tr1::mt19937&,
std::tr1::uniform_real<double> > var_nor(rng, nd);
for (int i = 0;i<r;i++)
for (int j = 0;j<c;j++)
x(i,j) = var_nor();
#else
fill_rand(x.data(), r*c,0,1);
#endif
return x;
}
Eigen::VectorXd rand(int size)
{
VectorXd x(size);
std::tr1::mt19937 rng(static_cast<unsigned int>(std::time(0)));
std::tr1::uniform_real<double> nd(0.0, 1.0);
std::tr1::variate_generator<std::tr1::mt19937&,
std::tr1::uniform_real<double> > var_nor(rng, nd);
for (int i = 0;i<size;i++)
x(i) = var_nor();
return x;
}
Eigen::MatrixXd operator > (const Eigen::MatrixXd & a, const Eigen::MatrixXd & b)
{
assert(a.rows() == b.rows() && a.cols() == b.cols());
Eigen::MatrixXd result(a.rows(),a.cols());
for (int i = 0;i<a.rows();i++)
for (int j = 0;j<a.cols();j++)
result(i,j) = a(i,j) > b(i,j);
return result;
}
#ifdef USE_MKL
#include <mkl_vml_functions.h>
#include <mkl_vsl.h>
#include <mkl_blas.h>
#endif
double error(const Eigen::MatrixXd & a, const Eigen::MatrixXd & b)
{
#ifndef USE_MKL
return (a-b).squaredNorm();
#else
extern double TEMP[];
vdSub(a.size(),a.data(),b.data(),TEMP);
int one_i = 1;
int size = a.size();
double norm = dnrm2(&size,TEMP,&one_i);
return norm*norm;
#endif
}
Eigen::MatrixXd sqdist(const Eigen::MatrixXd & a, const Eigen::MatrixXd & b)
{
VectorXd aa = (a.array()*a.array()).colwise().sum();
VectorXd bb = (b.array()*b.array()).colwise().sum();
MatrixXd dist = -2*a.transpose()*b;
for (int i = 0;i<dist.cols();i++)
{
dist.col(i) += aa;
}
for (int i = 0;i<dist.rows();i++)
{
dist.row(i) += bb.transpose();
}
return dist;
}
| [
"[email protected]"
]
| [
[
[
1,
165
]
]
]
|
ed5a7169fc544a22e47d41d246e5b7a4e3159ede | 9d6d89a97c85abbfce7e2533d133816480ba8e11 | /src/Engine/test/testText.cpp | a37ccc09c5c478c0bc608b047592feecc1446df1 | []
| no_license | polycraft/Bomberman-like-reseau | 1963b79b9cf5d99f1846a7b60507977ba544c680 | 27361a47bd1aa4ffea972c85b3407c3c97fe6b8e | refs/heads/master | 2020-05-16T22:36:22.182021 | 2011-06-09T07:37:01 | 2011-06-09T07:37:01 | 1,564,502 | 1 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 809 | cpp | #include "testText.h"
using namespace Engine;
int testText()
{
GraphicEngine engine("TestGraphicEngine",800, 600,1,1);
Camera *camera = new Camera(6, 0, 6, 0, 0, 0, 0, 0, 1);
engine.addCamera(camera);
ManagerFont* font=new ManagerFont("src/ressource/font/font.ttf",24);
string s("Blablbla");
Text text(s,50.0,100.0);
text.setColor(1,1,1,1);
font->addText(&text);
engine.getManagerText().addFont(font);
int continuer = 1;
SDL_Event event;
while (continuer)
{
SDL_Delay(30);
SDL_PollEvent(&event);
switch(event.type)
{
case SDL_QUIT:
continuer = 0;
break;
case SDL_KEYDOWN :
switch (event.key.keysym.sym)
{
case SDLK_UP:
break;
default:
break;
}
default:
break;
}
engine.draw(camera);
}
return 0;
}
| [
"[email protected]",
"[email protected]"
]
| [
[
[
1,
45
],
[
47,
47
]
],
[
[
46,
46
]
]
]
|
c1d81f36e430402b7344e3aaecc30727ca308cb7 | 119ba245bea18df8d27b84ee06e152b35c707da1 | /unreal/branches/robots/qrgui/interpreters/robots/details/blocks/waitForSonarDistanceBlock.h | c111c318ad1c29870c25e82fec97cd0b9fbb5f19 | []
| no_license | nfrey/qreal | 05cd4f9b9d3193531eb68ff238d8a447babcb3d2 | 71641e6c5f8dc87eef9ec3a01cabfb9dd7b0e164 | refs/heads/master | 2020-04-06T06:43:41.910531 | 2011-05-30T19:30:09 | 2011-05-30T19:30:09 | 1,634,768 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 741 | h | #pragma once
#include <QtCore/QObject>
#include <QtCore/QTimer>
#include "block.h"
#include "../robotParts/robotModel.h"
namespace qReal {
namespace interpreters {
namespace robots {
namespace details {
namespace blocks {
class WaitForSonarDistanceBlock : public Block
{
Q_OBJECT
public:
WaitForSonarDistanceBlock(RobotModel const * const robotModel);
virtual void run();
virtual QList<SensorPortPair> usedSensors() const;
private slots:
void responseSlot(int reading);
void failureSlot();
void timerTimeout();
private:
robotParts::SonarSensor *mSonarSensor; // Doesn't have ownership
RobotModel const * const mRobotModel;
QTimer mActiveWaitingTimer;
void stop();
};
}
}
}
}
}
| [
"[email protected]"
]
| [
[
[
1,
42
]
]
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.