本文整理汇总了C++中VarList类的典型用法代码示例。如果您正苦于以下问题:C++ VarList类的具体用法?C++ VarList怎么用?C++ VarList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VarList类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: doEnableQuitOnClose
void OptionsTabApplication::restoreOptions()
{
if ( !w )
return;
OptApplicationUI *d = (OptApplicationUI *)w;
d->ck_autoUpdate->setChecked(PsiOptions::instance()->getOption("options.auto-update.check-on-startup").toBool());
d->ck_quitOnClose->setChecked(PsiOptions::instance()->getOption("options.ui.contactlist.quit-on-close").toBool());
// docklet
d->ck_docklet->setChecked( PsiOptions::instance()->getOption("options.ui.systemtray.enable").toBool() );
d->ck_dockDCstyle->setChecked( PsiOptions::instance()->getOption("options.ui.systemtray.use-double-click").toBool() );
d->ck_dockHideMW->setChecked( PsiOptions::instance()->getOption("options.contactlist.hide-on-start").toBool() );
d->ck_dockToolMW->setChecked( PsiOptions::instance()->getOption("options.contactlist.use-toolwindow").toBool() );
doEnableQuitOnClose(d->ck_docklet->isChecked()?1:0);
// data transfer
d->le_dtPort->setText( QString::number(PsiOptions::instance()->getOption("options.p2p.bytestreams.listen-port").toInt()) );
d->le_dtExternal->setText( PsiOptions::instance()->getOption("options.p2p.bytestreams.external-address").toString() );
// Language
VarList vList = TranslationManager::instance()->availableTranslations();
QStringList lang = vList.varsToStringList();
d->cb_lang->addItem(tr("Default"));
foreach(QString item, lang) {
d->cb_lang->addItem(vList.get(item));
}
开发者ID:Vitozz,项目名称:psi,代码行数:28,代码来源:opt_application.cpp
示例2: Inst
InstFakeKill::InstFakeKill(Cfg *Func, const VarList &KilledRegs,
const Inst *Linked)
: Inst(Func, Inst::FakeKill, KilledRegs.size(), NULL), Linked(Linked) {
for (VarList::const_iterator I = KilledRegs.begin(), E = KilledRegs.end();
I != E; ++I) {
Variable *Var = *I;
addSource(Var);
}
}
开发者ID:stichnot,项目名称:subzero,代码行数:9,代码来源:IceInst.cpp
示例3: renderDofAmountTest
void renderDofAmountTest()
{
Options opts;
opts.xRes = 320;
opts.yRes = 240;
opts.gridSize = 8;
opts.clipNear = 0.1;
opts.superSamp = Imath::V2i(10,10);
opts.pixelFilter = makeGaussianFilter(Vec2(2.0,2.0));
opts.fstop = 100;
opts.focalLength = 20;
opts.focalDistance = 3;
Attributes attrs;
attrs.shadingRate = 1;
attrs.smoothShading = true;
Mat4 camToScreen =
perspectiveProjection(90, opts.clipNear, opts.clipFar) *
screenWindow(-2.33333, 0.33333, -1, 1);
// Output variables.
VarList outVars;
outVars.push_back(Stdvar::Cs);
Renderer r(opts, camToScreen, outVars);
Mat4 wToO = Mat4().setTranslation(Vec3(-0.5,-0.5,-1)) *
Mat4().setAxisAngle(Vec3(0,0,1), deg2rad(45)) *
Mat4().setTranslation(Vec3(-1.5, 0, 2));
const float P[12] = {0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0};
{
const float Cs[3] = {1, 0.7, 0.7};
r.add(createPatch(P, Cs, wToO), attrs);
}
{
const float Cs[3] = {0.7, 1, 0.7};
r.add(createPatch(P, Cs, Mat4().setTranslation(Vec3(0,0,1))*wToO), attrs);
}
{
const float Cs[3] = {0.7, 0.7, 1};
r.add(createPatch(P, Cs, Mat4().setTranslation(Vec3(0,0,2))*wToO), attrs);
}
{
const float Cs[3] = {1, 0.7, 0.7};
r.add(createPatch(P, Cs, Mat4().setTranslation(Vec3(0,0,5))*wToO), attrs);
}
{
const float Cs[3] = {0.7, 1, 0.7};
r.add(createPatch(P, Cs, Mat4().setTranslation(Vec3(0,0,25))*wToO), attrs);
}
r.render();
}
开发者ID:UIKit0,项目名称:aqsis,代码行数:55,代码来源:dofamounttest.cpp
示例4: fprintf
void DataRewriter::organizeNewBss(Region* reg, unsigned char magic) {
/**
*
*/
fprintf(stderr, "BSS region starts at %p\n", reg->getRegionAddr());
VarList globals = filterVariables(reg);
unsigned int dataSize = 0;
unsigned int dataBase = 0;
unsigned int dataOffset = 0;
unsigned int rawIndex = 0;
unsigned int rawValue = 0;
unsigned int newRawIndex = 0;
dataSize = reg->getRegionSize();
dataBase = newDataBase + newDataSize;
fprintf(stderr, "BSS base = %p\n", (void*) dataBase);
unsigned int newBssSize = sizeof(unsigned char) * dataSize;
oldRawBss = (unsigned char*) reg->getPtrToRawData();
newRawBss = (unsigned char*) malloc (newBssSize);
memcpy(newRawBss, oldRawBss, dataSize);
for (int i = 0; i < globals.size(); i++) {
dataOffset = globals[i]->getOffset();
rawIndex = dataOffset - dataBase;
// Update the relocated address mapping
newLocs[dataOffset] = dataBase + newRawIndex;
newRawIndex += globals[i]->getSize();
}
for (AddrMapping::const_iterator iter = newLocs.begin();
iter != newLocs.end();
++iter) {
fprintf(stderr, "%p -> %p\n", iter->first, iter->second);
}
// Causes a segfault in the mutated binary
//
//if (!reg->setPtrToRawData(newRawBss, newDataSize)) {
// fprintf(stderr, "Unable to assign new data section.\n");
// exit(EXIT_FAILURE);
//}
}
开发者ID:AmesianX,项目名称:memz,代码行数:53,代码来源:DataRewriter.cpp
示例5: var
const Var* var( const size_t index ) const
{
VarList::const_iterator var = m_vars.begin();
VarList::const_iterator last = m_vars.end();
size_t counter = 0;
while ( var != last )
{
if ( counter++ == index ) break;
var++;
}
return( *var );
}
开发者ID:zkbreeze,项目名称:OceanVis,代码行数:13,代码来源:main.cpp
示例6: filterVariables
void DataRewriter::organizeNewData(Region* reg, unsigned char magic) {
/**
*
*/
VarList globals = filterVariables(reg);
unsigned int dataSize = 0;
unsigned int dataBase = 0;
unsigned int dataOffset = 0;
unsigned int rawIndex = 0;
unsigned int rawValue = 0;
unsigned int newRawIndex = 0;
dataSize = reg->getRegionSize();
dataBase = reg->getRegionAddr();
newDataBase = dataBase;
newDataSize = sizeof(unsigned char) * dataSize * 2;
oldRaw = (unsigned char*) reg->getPtrToRawData();
newRaw = (unsigned char*) malloc (newDataSize);
// The dso_handle bullshit
memcpy(newRaw, oldRaw, 4);
memset(newRaw + 4, magic, 4);
newRawIndex += 8;
// Pad the new data section with an extra 4 bytes between all 4 byte values.
for (int i = 0; i < globals.size(); i++) {
dataOffset = globals[i]->getOffset();
rawIndex = dataOffset - dataBase;
memcpy(newRaw + newRawIndex, oldRaw + rawIndex, 4);
// Sanity checks, write magic values into padding
memset(newRaw + newRawIndex + 4, magic, 4);
// Update the relocated address mapping
newLocs[dataOffset] = dataBase + newRawIndex;
newRawIndex += 8;
}
fprintf(stderr, "NEW DATA: %p through %p\n", newDataBase, newDataBase + newDataSize);
if (!reg->setPtrToRawData(newRaw, newDataSize)) {
fprintf(stderr, "Unable to assign new data section.\n");
exit(EXIT_FAILURE);
}
}
开发者ID:AmesianX,项目名称:memz,代码行数:49,代码来源:DataRewriter.cpp
示例7:
void CameraParameters::AdditionalCalibrationInformation::addSettingsToList(
VarList& list) {
for (int i = 0; i < kNumControlPoints; ++i) {
list.addChild(control_point_set[i]);
}
list.addChild(initial_distortion);
list.addChild(camera_height);
list.addChild(line_search_corridor_width);
list.addChild(image_boundary);
list.addChild(max_feature_distance);
list.addChild(convergence_timeout);
list.addChild(cov_corner_x);
list.addChild(cov_corner_y);
list.addChild(cov_ls_x);
list.addChild(cov_ls_y);
list.addChild(pointSeparation);
}
开发者ID:AnthonyCAS,项目名称:ssl-vision,代码行数:18,代码来源:camera_calibration.cpp
示例8: test_varlist
void test_varlist()
{
VarList args;
args.add(1);
args.add("ddddd");
args.add(true);
printf("args count: %d\n", args.count());
printf("args 0: %d\n", args.get(0).toInt());
printf("args 1: %s\n", args.get(1).toString());
printf("args 2: %s\n", args.get(2).toBool() ? "true" : "false");
}
开发者ID:wgq168668,项目名称:misc,代码行数:11,代码来源:main.cpp
示例9: call
Variable FunctionCheckInit::call( Variable &input, VarList lParams ) {
VarList::const_iterator i = lParams.begin();
// Fetch values
Bu::String what = (*i).getString();
// Lets check stuff!
pContext->getView()->checkBegin(what);
return new Variable(Variable::typeNone);
}
开发者ID:IngwiePhoenix,项目名称:IceTea_old,代码行数:11,代码来源:functioncheckinit.cpp
示例10: call
Variable FunctionTargets::call( Variable &/*input*/, VarList lParams )
{
Variable vRet( Variable::typeList );
TargetList lTrg;
if( lParams.getSize() == 0 )
{
lTrg = pContext->getExplicitTargets();
}
else
{
lTrg = pContext->getTag( lParams.first().toString() );
}
for( TargetList::const_iterator i = lTrg.begin(); i; i++ )
{
for( StrList::const_iterator j = (*i)->getOutputList().begin(); j; j++ )
{
vRet.append( *j );
}
}
return vRet;
}
开发者ID:IngwiePhoenix,项目名称:IceTea_old,代码行数:21,代码来源:functiontargets.cpp
示例11: GetString
//------------------------------------------------------------------------
wstring StringParser::GetString( const string& key, const VarList& args, bool returnKeyIfFailed/*=true*/ )
{
StringParser::StringItem* item = m_StringItems.GetStringItemById( key );
if( item == 0 )
{
_LogError( string("StringParser::GetString Error : ") + key + " ²»´æÔÚ" );
if( returnKeyIfFailed )
return We::Type::ToWstring( key );
return L"";
}
if( item->m_Texts.size() != args.Size() + 1 )
{
_LogError( string("StringParser::GetString Error : ") + key + " ²ÎÊý¸öÊý²»Æ¥Åä" );
if( returnKeyIfFailed )
return We::Type::ToWstring( key );
return L"";
}
wstring ret = item->m_Texts[0];
for( int i=0; i<args.Size(); ++i )
ret += args.GetValue( item->m_Indexes[i]-1 ).ForceToWstring() + item->m_Texts[i+1];
return ret;
}
开发者ID:xpisceo,项目名称:hobbyDemo,代码行数:23,代码来源:WeStringParser.cpp
示例12: while
~File( void )
{
if ( m_file ) delete m_file;
DimList::iterator dim = m_dims.begin();
DimList::const_iterator last_dim = m_dims.end();
while ( dim != last_dim )
{
if ( *dim ) delete *dim;
dim++;
}
m_dims.clear();
VarList::iterator var = m_vars.begin();
VarList::const_iterator last_var = m_vars.end();
while ( var != last_var )
{
if ( *var ) delete *var;
var++;
}
m_vars.clear();
}
开发者ID:zkbreeze,项目名称:OceanVis,代码行数:22,代码来源:main.cpp
示例13: addSettingsToList
void CameraParameters::addSettingsToList(VarList& list) {
list.addChild(focal_length);
list.addChild(principal_point_x);
list.addChild(principal_point_y);
list.addChild(distortion);
list.addChild(q0);
list.addChild(q1);
list.addChild(q2);
list.addChild(q3);
list.addChild(tx);
list.addChild(ty);
list.addChild(tz);
}
开发者ID:AnthonyCAS,项目名称:ssl-vision,代码行数:13,代码来源:camera_calibration.cpp
示例14: setupUi
MainWindow::MainWindow(bool start_capture, bool enforce_affinity)
{
affinity=0;
if (enforce_affinity) affinity=new AffinityManager();
//opt=new GetOpt();
settings=0;
setupUi((QMainWindow *)this);
tree_view=new VarTreeView();
tmodel=new VarTreeModel();
splitter = new QSplitter(Qt::Horizontal,this);
splitter2 = new QSplitter(Qt::Vertical);
root=new VarList("Vision System");
opts=new RenderOptions();
right_tab=0;
QString stack_id="";
//opt->addArgument("stack",&stack_id);
//opt->parse();
//load RoboCup SSL stack by default:
multi_stack=new MultiStackRoboCupSSL(opts, 2);
VarExternal * stackvar;
root->addChild(stackvar= new VarExternal((multi_stack->getSettingsFileName() + ".xml").c_str(),multi_stack->getName()));
stackvar->addChild(multi_stack->getSettings());
//create tabs, GL visualizations and tool-panes for each capture thread in the multi-stack:
for (unsigned int i=0;i<multi_stack->threads.size();i++) {
VisionStack * s = multi_stack->threads[i]->getStack();
if (affinity!=0) multi_stack->threads[i]->setAffinityManager(affinity);
GLWidget * gl=new GLWidget(0,false);
gl->setRingBuffer(multi_stack->threads[i]->getFrameBuffer());
gl->setVisionStack(s);
QString label = "Camera " + QString::number(i);
VarList * threadvar = new VarList(label.toStdString());
threadvar->addChild(s->getSettings());
//iterate through plugin variables
QSplitter * stack_widget = new QSplitter(Qt::Horizontal);
stack_widgets.push_back(stack_widget);
QSplitter * stack_vis_splitter = new QSplitter(Qt::Vertical);
stack_widget->addWidget(stack_vis_splitter);
QTabWidget * stack_control_tab = new QTabWidget();
stack_control_tab->setTabPosition(QTabWidget::East);
stack_widget->addWidget(stack_control_tab);
VideoWidget * w=new VideoWidget(label,gl);
display_widgets.push_back(gl);
threadvar->addChild(multi_stack->threads[i]->getSettings());
stack_vis_splitter->addWidget(w);
//iterate through all plugins
unsigned int n=s->stack.size();
for (unsigned int j=0;j<n;j++) {
VisionPlugin * p=s->stack[j];
if (p->isSharedAmongStacks()) {
if (i==0) {
//this is a shared global plugin...
//add it to global pane
if (p->getSettings()!=0) stackvar->addChild(p->getSettings());
QWidget * tmp_control = p->getControlWidget();
if (tmp_control!=0) {
if (right_tab==0) {
right_tab=new QTabWidget();
right_tab->setTabPosition(QTabWidget::East);
}
right_tab->addTab(tmp_control,QString::fromStdString(p->getName()));
}
QWidget * tmp_vis = p->getVisualizationWidget();
if (tmp_vis!=0) splitter2->addWidget(tmp_vis);
}
} else {
if (p->getSettings()!=0) threadvar->addChild(p->getSettings());
//this is a local plugin relating only to a single thread
//add it to the context.
QWidget * tmp_control = p->getControlWidget();
if (tmp_control!=0) stack_control_tab->addTab(tmp_control,QString::fromStdString(p->getName()));
QWidget * tmp_vis = p->getVisualizationWidget();
if (tmp_vis!=0) stack_vis_splitter->addWidget(tmp_vis);
}
}
stackvar->addChild(threadvar);
splitter2->addWidget(stack_widget);
}
if (affinity!=0) affinity->demandCore(multi_stack->threads.size());
//.........这里部分代码省略.........
开发者ID:EjaadTech,项目名称:ssl-vision,代码行数:101,代码来源:mainwindow.cpp
示例15: memset
void NetSystem::CompleteRecv(epoll_event& event) {
LinkInfo * pLink = (LinkInfo *) event.data.ptr;
//如果是已经连接的用户,并且收到数据,那么进行读入。
char recvbuff[RECVBUF_SIZE];
memset(recvbuff, 0, RECVBUF_SIZE);
int nRecvLen = 0;
//在这里会不会出现因为tpc接受缓冲区一直有东西存在 所以就直卡死在这个read中 所以改成read一次
//但是有可能出现消息丢失
while (true) { //这里注意 要增加 频率检测
if ((nRecvLen = read(pLink->m_socket, recvbuff, RECVBUF_SIZE)) <= 0) {
if (EAGAIN == errno && -1 == nRecvLen) {
break;
}
if (0 == nRecvLen) {
LOG_ERROR("NetSystem::MainLoop client is EOF, LinkID : %d", pLink->m_socket);
m_pCallBackSystem->ExKernelEvent(m_pKernel,
pLink->m_remotetype, KERNEL_EVENT_CONNECTION_EOF, pLink->m_socket, VarList());
} else {
LOG_ERROR("NetSystem::MainLoop client is break off, LinkID : %d", pLink->m_socket);
m_pCallBackSystem->ExKernelEvent(m_pKernel,
pLink->m_remotetype, KERNEL_EVENT_CONNECTION_BREAK, pLink->m_socket, VarList());
}
CleanLink(pLink);
event.data.ptr = NULL;
break;
}
if (!pLink->m_recvstream.WriteBuff(recvbuff, nRecvLen)) {
LOG_TRACE("NetSystem::MainLoop WriteBuff error, LinkID : %d", pLink->m_socket);
m_pCallBackSystem->ExKernelEvent(m_pKernel,
pLink->m_remotetype, KERNEL_EVENT_CONNECTION_BREAK, pLink->m_socket, VarList());
CleanLink(pLink);
event.data.ptr = NULL;
break;
}
Archive msg;
VarList args;
while (pLink->m_recvstream.ReadArchive(msg)) {
if (msg.ToVarList(args)) {
if (args.Type(0) != TYPE_INT) {
LOG_ERROR("NetSystem::MainLoop Error msg");
m_pCallBackSystem->ExKernelEvent(m_pKernel,
pLink->m_remotetype, KERNEL_EVENT_CONNECTION_BREAK, pLink->m_socket, VarList());
CleanLink(pLink);
event.data.ptr = NULL;
break;
}
UI32 nMsgId = args.GetInt(0);
m_pCallBackSystem->ExMsgCall(m_pKernel, pLink->m_remotetype, nMsgId, pLink->m_socket, args);
const CIdentity player = m_pObjectManage->QueryPlayer(pLink->m_socket);
if (player != CIdentity_INIT()) {
m_pCallBackSystem->ExMsgCall(m_pKernel, pLink->m_remotetype, nMsgId, player, args);
}
}
}
}
if (pLink != NULL) {
//设置用于写操作的文件描述符
struct epoll_event ev;
ev.data.ptr = pLink;
ev.events = EPOLLIN | EPOLLOUT | EPOLLET;
epoll_ctl(m_epfd, EPOLL_CTL_MOD, pLink->m_socket, &ev);
}
return;
}
开发者ID:854825967,项目名称:kernel,代码行数:72,代码来源:NetSystem.cpp
示例16: LOG_ERROR
bool NetSystem::Initialize() {
if (NULL == (m_pKernel = Kernel::Employ()) ||
NULL == (m_pCallBackSystem = CallBackSystem::Employ()) ||
NULL == (m_pConfigManage = ConfigManage::Employ()) ||
NULL == (m_pObjectManage = ObjectManage::Employ()) ||
NULL == (m_pHeartBeatManage = HeartBeatManage::Employ()) ||
NULL == (m_pLogSystem = LogSystem::Employ())) {
LOG_ERROR("NetSystem initialize failed");
Assert(false);
return false;
}
m_alive = true;
const CIniConfig * globlaconfig = m_pConfigManage->GetConfig(KERNEL_CONFIG_GLOBLA_INI);
if (NULL == globlaconfig) {
LOG_ERROR("Get GloblaConfig Failed");
Assert(false);
return false;
}
const char * pStrServerTypes = globlaconfig->GetStringConfig("Global", "ServerTypes");
if ("" == string(pStrServerTypes)) {
LOG_ERROR("Get ServerTypes Failed");
Assert(false);
return false;
}
VarList types;
SafeSplitString(pStrServerTypes, ";", types);
UI32 nCount = types.Count();
if (0 >= nCount) {
LOG_ERROR("Count Of ServerTypes : 0");
Assert(0);
return false;
}
for (UI32 i = 0; i < nCount; i++) {
m_linkmanage.AddLinkType(types.GetString(i));
}
const CIniConfig * baseconfig = m_pConfigManage->GetConfig(KERNEL_CONFIG_BASE_INI);
if (NULL == baseconfig) {
LOG_ERROR("Get BaseConfig failed ");
Assert(false);
return false;
}
const char * pstartlisten = baseconfig->GetStringConfig("Base", "Listen");
if (pstartlisten != NULL && strlen(pstartlisten) != 0) {
VarList lslist;
SafeSplitString(pstartlisten, ";", lslist);
nCount = lslist.Count();
for (UI32 i = 0; i < nCount; i++) {
VarList listeninfo;
SafeSplitString(lslist.GetString(i), ",", listeninfo);
if (listeninfo.Count() != 3) {
LOG_ERROR("Check the format of you listen config : %s", lslist.GetString(i));
Assert(false);
return false;
}
Listen(listeninfo.GetString(0), listeninfo.GetString(1), StringAsInt(listeninfo.GetString(2)), LISTEN_GAME_SOCKET);
}
}
const char * pstartconnects = baseconfig->GetStringConfig("Base", "Connect");
if (pstartconnects != NULL && strlen(pstartconnects) != 0) {
VarList connects;
SafeSplitString(pstartconnects, ";", connects);
nCount = connects.Count();
for (UI32 i = 0; i < nCount; i++) {
VarList connectinfo;
SafeSplitString(connects.GetString(i), ",", connectinfo);
if (connectinfo.Count() != 3) {
LOG_ERROR("Check the format of you connect config : %s", connects.GetString(i));
Assert(false);
return false;
}
Connect(connectinfo.GetString(0), connectinfo.GetString(1), StringAsInt(connectinfo.GetString(2)));
}
}
const char * pConsolelisten = baseconfig->GetStringConfig("Base", "Console");
if (pConsolelisten != NULL && strlen(pConsolelisten) != 0) {
VarList csllist;
SafeSplitString(pConsolelisten, ";", csllist);
nCount = csllist.Count();
for (UI32 i = 0; i < nCount; i++) {
VarList listeninfo;
SafeSplitString(csllist.GetString(i), ",", listeninfo);
if (listeninfo.Count() != 3) {
LOG_ERROR("Check the format of you listen config : %s", csllist.GetString(i));
Assert(false);
return false;
}
Listen(listeninfo.GetString(0), listeninfo.GetString(1), StringAsInt(listeninfo.GetString(2)), LISTEN_CONSOLE_SOCKET);
}
}
//.........这里部分代码省略.........
开发者ID:854825967,项目名称:kernel,代码行数:101,代码来源:NetSystem.cpp
示例17: condition
/**
* Convenience function for conditioning one iterator on the current
* value of another. This equalivalent to the following code
* <pre>
* DomainIterator it1(...), it2(...);
* DomainIterator::VarList vars = it1.getVars();
* DomainIterator::IndList inds = it1.getSubInd();
* it2.condition(vars.begin(),vars.end(),inds.begin(), inds.end());
* </pre>
* @see DomainIterator::condition(const VarIt,const VarIt,const IndIt,const IndIt)
*/
void DomainIterator::condition(const DomainIterator& it)
{
VarList vars = it.getVars();
IndList inds = it.getSubInd();
condition(vars.begin(),vars.end(),inds.begin(), inds.end());
}
开发者ID:lteacy,项目名称:maxsum-cpp,代码行数:17,代码来源:DomainIterator.cpp
示例18: ParseBool
void ParseBool(char *buffer)
{
string VarName="";
// skip boool
int i=5;
while(buffer[i]!= '=')
VarName+=buffer[i++];
// add to the global list
GlobalVar v(VarName,GlobalIndex,line);
GlobalList.push_back(v);
CheckForDuplicateVarNames();
GlobalIndex++;
// now get the variable value up to the ; token
// skip = sign
i++;
VarName="";
while(buffer[i]!= ';')
VarName+=buffer[i++];
bool vf;
if(VarName == "true")
vf=true;
else if(VarName == "false")
vf=false;
else
{
cout <<"***************ERROR IN COMPILATION**********************"<<endl;
cout <<" Error in compilation line :"<<line<<endl;
cout <<" bool data type must be initialised as either true or false "<<endl;
cout << "****************** COMPILATION FAILED EXITING ***********"<<endl;
exit(0);
}
VarObj Vo(vf);
Globals.Add(Vo);
}
开发者ID:NCCA,项目名称:NGL6Demos,代码行数:34,代码来源:ParseVariables.cpp
示例19: ParseVector
void ParseVector(char *buffer)
{
string VarName="";
char val[BUFFSIZE];
//Vector vf;
// skip Vector
int i=7;
int s=0;
while(buffer[i]!= '=')
VarName+=buffer[i++];
//VarName[s]='\0';
// add to the global list
GlobalVar v(VarName,GlobalIndex,line);
GlobalList.push_back(v);
CheckForDuplicateVarNames();
GlobalIndex++;
// skip over [
i+=2;
float x,y,z,w;
s=0;
while(buffer[i]!= ',')
val[s++]=buffer[i++];
val[s]='\0';
x=atof(val);
i++; s=0;
while(buffer[i]!= ',')
val[s++]=buffer[i++];
val[s]='\0';
y=atof(val);
i++; s=0;
while(buffer[i]!= ',')
val[s++]=buffer[i++];
val[s]='\0';
z=atof(val);
i++; s=0;
while(buffer[i]!= ']')
val[s++]=buffer[i++];
val[s]='\0';
w=atof(val);
Vec4 vf(x,y,z,w);
VarObj Vo(vf);
Globals.Add(Vo);
//cout <<"Buffer "<<buffer <<" ";
//cout <<"X "<<x<<" Y "<<y <<" z "<<z<<endl;
}
开发者ID:NCCA,项目名称:NGL6Demos,代码行数:47,代码来源:ParseVariables.cpp
示例20: ParsePoint
void ParsePoint(char *buffer)
{
string VarName="";
char val[30];
Vec3 vf;
// skip Vector
int i=6;
int s=0;
while(buffer[i]!= '=')
VarName+=buffer[i++];
// add to the global list
GlobalVar v(VarName,GlobalIndex,line);
GlobalList.push_back(v);
CheckForDuplicateVarNames();
GlobalIndex++;
// skip over [
i+=2;
float x,y,z;
s=0;
while(buffer[i]!= ',')
val[s++]=buffer[i++];
val[s]='\0';
x=atof(val);
i++; s=0;
while(buffer[i]!= ',')
val[s++]=buffer[i++];
val[s]='\0';
y=atof(val);
i++; s=0;
while(buffer[i]!= ']')
val[s++]=buffer[i++];
val[s]='\0';
z=atof(val);
vf.set(x,y,z);
VarObj Vo(vf);
Globals.Add(Vo);
}
开发者ID:NCCA,项目名称:NGL6Demos,代码行数:39,代码来源:ParseVariables.cpp
注:本文中的VarList类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论