当前位置: 首页>>代码示例>>C++>>正文


C++ TiXmlString::c_str方法代码示例

本文整理汇总了C++中TiXmlString::c_str方法的典型用法代码示例。如果您正苦于以下问题:C++ TiXmlString::c_str方法的具体用法?C++ TiXmlString::c_str怎么用?C++ TiXmlString::c_str使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TiXmlString的用法示例。


在下文中一共展示了TiXmlString::c_str方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Auth

bool IHomeSession:: Auth(Request *req,int sock)
{

    TiXmlString user;
    TiXmlString pass;
    char passwd[33];
    if(!TinyXPath::o_xpath_string(root,"/REQUEST/USER/text()",user) || !TinyXPath::o_xpath_string(root,"/REQUEST/PASS/text()",pass))
    {
        SendResponse(req,ERR_USER_PASS,sock);
             return false;
    }
   const char *ptr = config.GetKeyValue("password");
   int len = strlen(ptr);
   MD5Encode((void *)ptr,len,passwd);
   if(strcmp(user.c_str(),config.GetKeyValue("username")) == 0 && strcmp(pass.c_str(),passwd) == 0)
    {

            authOK = true;
            SendResponse(req,RESPONSE_OK,sock);
            log.Log("SES",DEBUG,"User %s login success %d",user.c_str(),sock);
            return true;
    //发送一个成功的应答
    }
    //发送一个认证失败
   SendResponse(req,1,sock);
    log.Log("SES",DEBUG,"User %s login failed",user.c_str());
    return true;
}
开发者ID:yohoj,项目名称:ITS,代码行数:28,代码来源:ihomesession.cpp

示例2: l_domoticz_applyXPath

int CLuaHandler::l_domoticz_applyXPath(lua_State* lua_state)
{
	int nargs = lua_gettop(lua_state);
	if (nargs >= 2)
	{
		if (lua_isstring(lua_state, 1) && lua_isstring(lua_state, 2))
		{
			std::string buffer = lua_tostring(lua_state, 1);
			std::string xpath = lua_tostring(lua_state, 2);

			TiXmlDocument doc;
			doc.Parse(buffer.c_str(), 0, TIXML_ENCODING_UTF8);

			TiXmlElement* root = doc.RootElement();
			if (!root)
			{
				_log.Log(LOG_ERROR, "CLuaHandler (applyXPath from LUA) : Invalid data received!");
				return 0;
			}
			TinyXPath::xpath_processor processor(root, xpath.c_str());
			TiXmlString xresult = processor.S_compute_xpath();
			lua_pushstring(lua_state, xresult.c_str());
			return 1;
		}
		else
		{
			_log.Log(LOG_ERROR, "CLuaHandler (applyXPath from LUA) : Incorrect parameters type");
		}
	}
	else
	{
		_log.Log(LOG_ERROR, "CLuaHandler (applyXPath from LUA) : Not enough parameters");
	}
	return 0;
}
开发者ID:defl,项目名称:domoticz,代码行数:35,代码来源:LuaHandler.cpp

示例3: initLogXml

bool LogXml::initLogXml(const char * pfilename)
{
    TiXmlString pfullname = TiXmlString(LOG_XML_PATH) + TiXmlString("//") + TiXmlString(pfilename);

    if(!init(pfullname.c_str(), LOG_XML_ROOT_NAME)) return false;
    return true;
}
开发者ID:murusu,项目名称:autobot,代码行数:7,代码来源:xml_log.cpp

示例4: parsePartition

void XCFParser::parsePartition(TiXmlElement* partition){
    TiXmlString partitionId (partition->Attribute(XCFMapping::PARTITION_ID));
    TiXmlNode* node = partition->FirstChild();

    while (node != NULL){
        if (node->Type() == TiXmlNode::TINYXML_ELEMENT) {
            TiXmlElement* element = (TiXmlElement*)node;
            TiXmlString name(node->Value());
            if (name == XCFMapping::INSTANCE) {
                TiXmlString instanceId (element->Attribute(XCFMapping::INSTANCE_ID));
                mapStr->insert(pair<string,string>(instanceId.c_str(), partitionId.c_str()));
            }else {
                cerr << "Invalid node "<< name.c_str() << endl;
                exit(1);
            }
        }

        node = node->NextSibling();
    }
}
开发者ID:orcc,项目名称:jade,代码行数:20,代码来源:XCFParser.cpp

示例5: length

	// = operator. Safe when assign own content
	void TiXmlString ::operator = (const TiXmlString & copy)
	{
		unsigned newlen;
		WCHAR * newstring;

		if (! copy . length ())
		{
			empty_it ();
			return;
		}
		newlen = copy . length () + 1;
		newstring = new WCHAR [newlen];
		// strcpy (newstring, copy.c_str ());
		CopyMemory(newstring, copy.c_str (), sizeof(WCHAR)*newlen);
		empty_it ();
		allocated = newlen;
		cstring = newstring;
		current_length = newlen - 1;
	}
开发者ID:JJMoon,项目名称:CGSF,代码行数:20,代码来源:tinystr.cpp

示例6: main


//.........这里部分代码省略.........
		item.InsertEndChild( meeting1 );
		item.InsertEndChild( meeting2 );

		// And add the node to the existing list after the first child.
		node = todoElement->FirstChild( "Item" );
		assert( node );
		itemElement = node->ToElement();
		assert( itemElement );

		todoElement->InsertAfterChild( itemElement, item );

		printf( "\n** Demo doc processed: ** \n\n" );
		doc.Print( stdout );


	#ifdef TIXML_USE_STL
		printf( "** Demo doc processed to stream: ** \n\n" );
		cout << doc << endl << endl;
	#endif

		// --------------------------------------------------------
		// Different tests...do we have what we expect?
		// --------------------------------------------------------

		int count = 0;
		TiXmlElement*	element;

		//////////////////////////////////////////////////////

	#ifdef TIXML_USE_STL
		cout << "** Basic structure. **\n";
		ostringstream outputStream( ostringstream::out );
		outputStream << doc;
		XmlTest( "Output stream correct.",	string( demoEnd ).c_str(),
											outputStream.str().c_str(), true );
	#endif

		node = doc.RootElement();
		assert( node );
		XmlTest( "Root element exists.", true, ( node != 0 && node->ToElement() ) );
		XmlTest ( "Root element value is 'ToDo'.", "ToDo",  node->Value());

		node = node->FirstChild();
		XmlTest( "First child exists & is a comment.", true, ( node != 0 && node->ToComment() ) );
		node = node->NextSibling();
		XmlTest( "Sibling element exists & is an element.", true, ( node != 0 && node->ToElement() ) );
		XmlTest ( "Value is 'Item'.", "Item", node->Value() );

		node = node->FirstChild();
		XmlTest ( "First child exists.", true, ( node != 0 && node->ToText() ) );
		XmlTest ( "Value is 'Go to the'.", "Go to the", node->Value() );


		//////////////////////////////////////////////////////
		printf ("\n** Iterators. **\n");

		// Walk all the top level nodes of the document.
		count = 0;
		for( node = doc.FirstChild();
			 node;
			 node = node->NextSibling() )
		{
			count++;
		}
		XmlTest( "Top level nodes, using First / Next.", 3, count );
开发者ID:huntriver,项目名称:TankVSBugs-CSE380-,代码行数:66,代码来源:xmltest.cpp

示例7: strcmp

inline bool operator == (const TiXmlString & a, const char* b) { return strcmp(a.c_str(), b) == 0; }
开发者ID:CodeAsm,项目名称:open-sauce,代码行数:1,代码来源:tinystr.hpp

示例8: main


//.........这里部分代码省略.........
	item.InsertEndChild( meeting1 );
	item.InsertEndChild( meeting2 );

	// And add the node to the existing list after the first child.
	node = todoElement->FirstChild( "Item" );
	assert( node );
	itemElement = node->ToElement();
	assert( itemElement );

	todoElement->InsertAfterChild( itemElement, item );

	printf( "\n** Demo doc processed: ** \n\n" );
	doc.Print( stdout );


#ifdef TIXML_USE_STL
	printf( "** Demo doc processed to stream: ** \n\n" );
	cout << doc << endl << endl;
#endif

	// --------------------------------------------------------
	// Different tests...do we have what we expect?
	// --------------------------------------------------------

	int count = 0;
	TiXmlElement*	element;

	//////////////////////////////////////////////////////

#ifdef TIXML_USE_STL
	cout << "** Basic structure. **\n";
	ostringstream outputStream( ostringstream::out );
	outputStream << doc;
	XmlTest( "Output stream correct.",	string( demoEnd ).c_str(),
										outputStream.str().c_str(), true );
#endif

	node = doc.RootElement();
	XmlTest( "Root element exists.", true, ( node != 0 && node->ToElement() ) );
	XmlTest ( "Root element value is 'ToDo'.", "ToDo",  node->Value());

	node = node->FirstChild();
	XmlTest( "First child exists & is a comment.", true, ( node != 0 && node->ToComment() ) );
	node = node->NextSibling();
	XmlTest( "Sibling element exists & is an element.", true, ( node != 0 && node->ToElement() ) );
	XmlTest ( "Value is 'Item'.", "Item", node->Value() );

	node = node->FirstChild();
	XmlTest ( "First child exists.", true, ( node != 0 && node->ToText() ) );
	XmlTest ( "Value is 'Go to the'.", "Go to the", node->Value() );


	//////////////////////////////////////////////////////
	printf ("\n** Iterators. **\n");

	// Walk all the top level nodes of the document.
	count = 0;
	for( node = doc.FirstChild();
		 node;
		 node = node->NextSibling() )
	{
		count++;
	}
	XmlTest( "Top level nodes, using First / Next.", 3, count );

	count = 0;
开发者ID:bsmr-worldforge,项目名称:libwfut,代码行数:67,代码来源:xmltest.cpp

示例9: main


//.........这里部分代码省略.........
          item.InsertEndChild( text );
          item.InsertEndChild( meeting1 );
          item.InsertEndChild( meeting2 );
          
          // And add the node to the existing list after the first child.
          node = todoElement->FirstChild( "Item" );
          assert( node );
          itemElement = node->ToElement();
          assert( itemElement );
          
          todoElement->InsertAfterChild( itemElement, item );
          
          printf( "\n** Demo doc processed: ** \n\n" );
          doc.Print( stdout );
          
          
#ifdef TIXML_USE_STL
          printf( "** Demo doc processed to stream: ** \n\n" );
          cout << doc << endl << endl;
#endif

	// --------------------------------------------------------
	// Different tests...do we have what we expect?
	// --------------------------------------------------------

	int count = 0;
	TiXmlElement*	element;

	//////////////////////////////////////////////////////

#ifdef TIXML_USE_STL
	cout << "** Basic structure. **\n";
	outputStream << doc;
	XmlTest( "Output stream correct.",	string( demoEnd ).c_str(),
                 outputStream.str().c_str(), true );
#endif
        
	node = doc.RootElement();
	XmlTest( "Root element exists.", true, ( node != 0 && node->ToElement() ) );
	XmlTest ( "Root element value is 'ToDo'.", "ToDo",  node->Value());

	node = node->FirstChild();
	XmlTest( "First child exists & is a comment.", true, ( node != 0 && node->ToComment() ) );
	node = node->NextSibling();
	XmlTest( "Sibling element exists & is an element.", true, ( node != 0 && node->ToElement() ) );
	XmlTest ( "Value is 'Item'.", "Item", node->Value() );

	node = node->FirstChild();
	XmlTest ( "First child exists.", true, ( node != 0 && node->ToText() ) );
	XmlTest ( "Value is 'Go to the'.", "Go to the", node->Value() );


	//////////////////////////////////////////////////////
	printf ("\n** Iterators. **\n");

	// Walk all the top level nodes of the document.
	count = 0;
	for( node = doc.FirstChild();
		 node;
		 node = node->NextSibling() )
	{
		count++;
	}
	XmlTest( "Top level nodes, using First / Next.", 3, count );

	count = 0;
开发者ID:E-LLP,项目名称:europa,代码行数:67,代码来源:xmltest.cpp


注:本文中的TiXmlString::c_str方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。