本文整理汇总了C++中TiXmlElement::Attribute方法的典型用法代码示例。如果您正苦于以下问题:C++ TiXmlElement::Attribute方法的具体用法?C++ TiXmlElement::Attribute怎么用?C++ TiXmlElement::Attribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TiXmlElement
的用法示例。
在下文中一共展示了TiXmlElement::Attribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VInit
bool BaseScriptComponent::VInit(TiXmlElement* pData)
{
LuaStateManager* pStateMgr = LuaStateManager::Get();
GCC_ASSERT(pStateMgr);
// load the <ScriptObject> tag and validate it
TiXmlElement* pScriptObjectElement = pData->FirstChildElement("ScriptObject");
if (!pScriptObjectElement)
{
GCC_ERROR("No <ScriptObject> tag in XML. This won't be a very useful script component.");
return true; // technically it succeeded even though it won't be accessible
}
// read all the attributes
const char* temp = NULL;
temp = pScriptObjectElement->Attribute("var");
if (temp)
m_scriptObjectName = temp;
temp = pScriptObjectElement->Attribute("constructor");
if (temp)
m_constructorName = temp;
temp = pScriptObjectElement->Attribute("destructor");
if (temp)
m_destructorName = temp;
// Having a var attribute will export the instance of this object to that name.
if (!m_scriptObjectName.empty())
{
m_scriptObject = pStateMgr->CreatePath(m_scriptObjectName.c_str());
if (!m_scriptObject.IsNil())
{
CreateScriptObject();
}
}
// The scriptConstructor attribute will also cause a Lua object to be created if one wasn't created in
// the previous step. The scriptConstructor string is treated as a function of the form f(scriptObject)
// and is called.
if (!m_constructorName.empty())
{
m_scriptConstructor = pStateMgr->GetGlobalVars().Lookup(m_constructorName.c_str());
if (m_scriptConstructor.IsFunction())
{
// m_scriptObject could be nil if there was no scriptObject attribute. If this is the case,
// the Lua object is created here.
if (m_scriptObject.IsNil())
{
m_scriptObject.AssignNewTable(pStateMgr->GetLuaState());
CreateScriptObject();
}
}
}
// The scriptDestructor attribute is treated as a function in the form of f(scriptObject) and is called
// when the C++ ScriptObject instance is destroyed.
if (!m_destructorName.empty())
{
m_scriptDestructor = pStateMgr->GetGlobalVars().Lookup(m_destructorName.c_str());
}
// read the <ScriptData> tag
TiXmlElement* pScriptDataElement = pData->FirstChildElement("ScriptData");
if (pScriptDataElement)
{
if (m_scriptObject.IsNil())
{
GCC_ERROR("m_scriptObject cannot be nil when ScriptData has been defined");
return false;
}
for (TiXmlAttribute* pAttribute = pScriptDataElement->FirstAttribute(); pAttribute != NULL; pAttribute = pAttribute->Next())
{
m_scriptObject.SetString(pAttribute->Name(), pAttribute->Value());
}
}
return true;
}
示例2: if
MutualFund::MutualFund(TiXmlNode* xmlNode)
: UnderlyingAsset(xmlNode)
{
#ifdef ConsolePrint
std::string initialtap_ = FileManager::instance().tap_;
FileManager::instance().tap_.append(" ");
#endif
//openEndedFundNode ----------------------------------------------------------------------------------------------------------------------
TiXmlElement* openEndedFundNode = xmlNode->FirstChildElement("openEndedFund");
if(openEndedFundNode){openEndedFundIsNull_ = false;}
else{openEndedFundIsNull_ = true;}
#ifdef ConsolePrint
FileManager::instance().outFile_ << FileManager::instance().tap_.c_str() << "- openEndedFundNode , address : " << openEndedFundNode << std::endl;
#endif
if(openEndedFundNode)
{
if(openEndedFundNode->Attribute("href") || openEndedFundNode->Attribute("id"))
{
if(openEndedFundNode->Attribute("id"))
{
openEndedFundIDRef_ = openEndedFundNode->Attribute("id");
openEndedFund_ = boost::shared_ptr<XsdTypeBoolean>(new XsdTypeBoolean(openEndedFundNode));
openEndedFund_->setID(openEndedFundIDRef_);
IDManager::instance().setID(openEndedFundIDRef_,openEndedFund_);
}
else if(openEndedFundNode->Attribute("href")) { openEndedFundIDRef_ = openEndedFundNode->Attribute("href");}
else { QL_FAIL("id or href error"); }
}
else { openEndedFund_ = boost::shared_ptr<XsdTypeBoolean>(new XsdTypeBoolean(openEndedFundNode));}
}
//fundManagerNode ----------------------------------------------------------------------------------------------------------------------
TiXmlElement* fundManagerNode = xmlNode->FirstChildElement("fundManager");
if(fundManagerNode){fundManagerIsNull_ = false;}
else{fundManagerIsNull_ = true;}
#ifdef ConsolePrint
FileManager::instance().outFile_ << FileManager::instance().tap_.c_str() << "- fundManagerNode , address : " << fundManagerNode << std::endl;
#endif
if(fundManagerNode)
{
if(fundManagerNode->Attribute("href") || fundManagerNode->Attribute("id"))
{
if(fundManagerNode->Attribute("id"))
{
fundManagerIDRef_ = fundManagerNode->Attribute("id");
fundManager_ = boost::shared_ptr<XsdTypeString>(new XsdTypeString(fundManagerNode));
fundManager_->setID(fundManagerIDRef_);
IDManager::instance().setID(fundManagerIDRef_,fundManager_);
}
else if(fundManagerNode->Attribute("href")) { fundManagerIDRef_ = fundManagerNode->Attribute("href");}
else { QL_FAIL("id or href error"); }
}
else { fundManager_ = boost::shared_ptr<XsdTypeString>(new XsdTypeString(fundManagerNode));}
}
#ifdef ConsolePrint
FileManager::instance().tap_ = initialtap_;
#endif
}
示例3: ParseIEDs
int CXGseScd::ParseIEDs(TiXmlNode *pRootNode)
{
TiXmlNode *pIEDNode = pRootNode->FirstChild("IED");
std::string ied_name;
TiXmlElement *pIEDElement = NULL;
while (pIEDNode != NULL)//IED
{
ied_name = pIEDNode->ToElement()->Attribute("name");
TiXmlNode *pAPNode = pIEDNode->FirstChildElement("AccessPoint");
while (pAPNode != NULL)//G1
{
TiXmlNode *pLDNode = NULL;
if (GES_MEMCMP(pAPNode->ToElement()->Attribute("name"), GSE_TYPE_TAG))
{
pLDNode = pAPNode->FirstChild("Server")->FirstChild("LDevice");
std::string ld_inst;
TiXmlNode *pLN0Node = NULL;
while (pLDNode != NULL)//LDevice
{
ld_inst = pLDNode->ToElement()->Attribute("inst");
pLN0Node = pLDNode->FirstChild("LN0");
//TiXmlNode *pDataSetNode = NULL;
TiXmlNode *pGSECtrlNode = NULL;
if (pLN0Node != NULL)
{
std::string gocb_name;
std::string datset_name;
pGSECtrlNode = pLN0Node->FirstChild("GSEControl");
while (pGSECtrlNode != NULL)
{
TiXmlElement *pGSECtrlElement = pGSECtrlNode->ToElement();
gocb_name = pGSECtrlElement->Attribute("name");
datset_name = pGSECtrlElement->Attribute("datSet");
printf("%s\n", datset_name.c_str());
//生成一条记录
u_int32_t appid = 0;
//查找对应的APPID
if (FindAppid(ied_name, ld_inst, gocb_name, appid) != J_OK)
{
//没有对应的APPID
printf("CXGseScd::ParseIEDs %s Is not a GOOSE IED\n", ied_name.c_str());
pGSECtrlNode = pGSECtrlNode->NextSibling();
continue;
}
if (appid == 1328)
{
printf("%d\n", appid);
}
GSE_DataSetInfo *pDataSetInfo = new GSE_DataSetInfo;
if (MakeDataSetInfo(pLN0Node, datset_name, pDataSetInfo) != J_OK)
{
//数据解析有错误
assert(false);
}
m_gocbMap[appid] = pDataSetInfo;
pGSECtrlNode = pGSECtrlNode->NextSibling("GSEControl");
}
}
pLDNode = pLDNode->NextSibling();
}
}
pAPNode = pAPNode->NextSibling();
}
pIEDNode = pIEDNode->NextSibling("IED");
}
return J_OK;
}
示例4: GetSettingsFromMappingsFile
void CPeripherals::GetSettingsFromMappingsFile(TiXmlElement *xmlNode, std::map<std::string, PeripheralDeviceSetting> &settings)
{
TiXmlElement *currentNode = xmlNode->FirstChildElement("setting");
int iMaxOrder = 0;
while (currentNode)
{
CSetting *setting = nullptr;
std::string strKey = XMLUtils::GetAttribute(currentNode, "key");
if (strKey.empty())
continue;
std::string strSettingsType = XMLUtils::GetAttribute(currentNode, "type");
int iLabelId = currentNode->Attribute("label") ? atoi(currentNode->Attribute("label")) : -1;
const std::string config = XMLUtils::GetAttribute(currentNode, "configurable");
bool bConfigurable = (config.empty() || (config != "no" && config != "false" && config != "0"));
if (strSettingsType == "bool")
{
const std::string value = XMLUtils::GetAttribute(currentNode, "value");
bool bValue = (value != "no" && value != "false" && value != "0");
setting = new CSettingBool(strKey, iLabelId, bValue);
}
else if (strSettingsType == "int")
{
int iValue = currentNode->Attribute("value") ? atoi(currentNode->Attribute("value")) : 0;
int iMin = currentNode->Attribute("min") ? atoi(currentNode->Attribute("min")) : 0;
int iStep = currentNode->Attribute("step") ? atoi(currentNode->Attribute("step")) : 1;
int iMax = currentNode->Attribute("max") ? atoi(currentNode->Attribute("max")) : 255;
setting = new CSettingInt(strKey, iLabelId, iValue, iMin, iStep, iMax);
}
else if (strSettingsType == "float")
{
float fValue = currentNode->Attribute("value") ? (float) atof(currentNode->Attribute("value")) : 0;
float fMin = currentNode->Attribute("min") ? (float) atof(currentNode->Attribute("min")) : 0;
float fStep = currentNode->Attribute("step") ? (float) atof(currentNode->Attribute("step")) : 0;
float fMax = currentNode->Attribute("max") ? (float) atof(currentNode->Attribute("max")) : 0;
setting = new CSettingNumber(strKey, iLabelId, fValue, fMin, fStep, fMax);
}
else if (StringUtils::EqualsNoCase(strSettingsType, "enum"))
{
std::string strEnums = XMLUtils::GetAttribute(currentNode, "lvalues");
if (!strEnums.empty())
{
std::vector< std::pair<int,int> > enums;
std::vector<std::string> valuesVec;
StringUtils::Tokenize(strEnums, valuesVec, "|");
for (unsigned int i = 0; i < valuesVec.size(); i++)
enums.push_back(std::make_pair(atoi(valuesVec[i].c_str()), atoi(valuesVec[i].c_str())));
int iValue = currentNode->Attribute("value") ? atoi(currentNode->Attribute("value")) : 0;
setting = new CSettingInt(strKey, iLabelId, iValue, enums);
}
}
else
{
std::string strValue = XMLUtils::GetAttribute(currentNode, "value");
setting = new CSettingString(strKey, iLabelId, strValue);
}
if (setting)
{
//! @todo add more types if needed
/* set the visibility */
setting->SetVisible(bConfigurable);
/* set the order */
int iOrder = 0;
currentNode->Attribute("order", &iOrder);
/* if the order attribute is invalid or 0, then the setting will be added at the end */
if (iOrder < 0)
iOrder = 0;
if (iOrder > iMaxOrder)
iMaxOrder = iOrder;
/* and add this new setting */
PeripheralDeviceSetting deviceSetting = { setting, iOrder };
settings[strKey] = deviceSetting;
}
currentNode = currentNode->NextSiblingElement("setting");
}
/* add the settings without an order attribute or an invalid order attribute set at the end */
for (auto& it : settings)
{
if (it.second.m_order == 0)
it.second.m_order = ++iMaxOrder;
}
}
示例5: AnalyseConfigFile
bool CConfigManager::AnalyseConfigFile()
{
TiXmlDocument doc;
doc.LoadFile(m_strConfigFile.c_str());
TiXmlElement* pRoot = doc.RootElement();
const char* szRoot = pRoot->Value();
if(strcmp("system", szRoot) != 0)
return false;
for (TiXmlElement* pChiled = pRoot->FirstChildElement(); pChiled != NULL; pChiled = pChiled->NextSiblingElement())
{
const char* szValue = pChiled->Value();
if(strcmp(Software, szValue) == 0)
{
m_strAppVer = pChiled->Attribute(Ver);
m_strSotfUrl = pChiled->Attribute(URL);
}
else if(strcmp(Configur, szValue) == 0)
{
m_strConfigVer = pChiled->Attribute(Ver);
}
else if(strcmp(Globle, szValue) == 0)
{
m_strHeight = pChiled->Attribute(Height);
m_strWidth = pChiled->Attribute(Width);
string strAdverCount = pChiled->Attribute(AdverCount);
m_nAdverCount = atoi(strAdverCount.c_str());
}
else if(strcmp(Sever, szValue) == 0)
{
m_strIp = pChiled->Attribute(IP);
m_strPort = pChiled->Attribute(Port);
}
else if(strcmp(Notice, szValue) == 0)
{
m_strNoticeDir = pChiled->Attribute(Dir);
}
else if(strcmp(Template, szValue) == 0)
{
m_strTempVer = pChiled->Attribute(Ver);
m_strTemplatePath = pChiled->Attribute(Dir);
}
else if(strcmp(Adver, szValue) == 0)
{
m_Adver.AnalyseAdver(pChiled);
}
else if(strcmp(BusStop, szValue) == 0)
{
m_Busstop.AnalyseBusStop(pChiled);
}
else if(strcmp(Picture, szValue) == 0)
{
m_strPictrueDir = pChiled->Attribute(Dir);
}
else if(strcmp(Default, szValue) == 0)
{
m_strDefaultPath = pChiled->Attribute(Dir);
}
else if(strcmp(Volume, szValue) == 0)
{
m_strVolumeDir = pChiled->Attribute(Dir);
}
}
return true;
}
示例6: parseAppearences
bool XMLScene::parseAppearences() {
printf("Processing appearences...\n\n");
bool valid_nr_appear = false;
char tmp_str[MAX_STRING_LEN], app_id[MAX_STRING_LEN], app_text_ref[MAX_STRING_LEN];
double app_emiss_r = 0, app_emiss_g = 0, app_emiss_b = 0, app_emiss_a = 0, app_amb_r = 0, app_amb_g = 0, app_amb_b =
0, app_amb_a = 0, app_dif_r = 0, app_dif_g = 0, app_dif_b = 0, app_dif_a = 0, app_spec_r = 0,
app_spec_g = 0, app_spec_b = 0, app_spec_a = 0, app_shin = 0, app_text_len_s = 0, app_text_len_t = 0;
TiXmlElement * app = NULL;
if ((app = appearencesElement->FirstChildElement("appearance")) != NULL) {
valid_nr_appear = true;
do {
if (strdup(app_id, app->Attribute("id")) == NULL) {
printf("Error in \"id\" attribute!\n");
throw InvalidXMLException();
}
if (strdup(tmp_str, app->Attribute("emissive")) == NULL) {
printf("Error in \"emissive\" attribute of %s appearence!\n", app_id);
throw InvalidXMLException();
}
if (sscanf(tmp_str, "%lf %lf %lf %lf", &app_emiss_r, &app_emiss_g, &app_emiss_b, &app_emiss_a) != 4) {
printf("Error parsing \"emissive\" attribute of %s appearence!\n", app_id);
throw InvalidXMLException();
}
if (strdup(tmp_str, app->Attribute("ambient")) == NULL) {
printf("Error in \"ambient\" attribute of %s appearence!\n", app_id);
throw InvalidXMLException();
}
if (sscanf(tmp_str, "%lf %lf %lf %lf", &app_amb_r, &app_amb_g, &app_amb_b, &app_amb_a) != 4) {
printf("Error parsing \"ambient\" attribute of %s appearence!\n", app_id);
throw InvalidXMLException();
}
if (strdup(tmp_str, app->Attribute("diffuse")) == NULL) {
printf("Error in \"diffuse\" attribute of %s appearence!\n", app_id);
throw InvalidXMLException();
}
if (sscanf(tmp_str, "%lf %lf %lf %lf", &app_dif_r, &app_dif_g, &app_dif_b, &app_dif_a) != 4) {
printf("Error parsing \"diffuse\" attribute of %s appearence!\n", app_id);
throw InvalidXMLException();
}
if (strdup(tmp_str, app->Attribute("specular")) == NULL) {
printf("Error in \"specular\" attribute of %s appearence!\n", app_id);
throw InvalidXMLException();
}
if (sscanf(tmp_str, "%lf %lf %lf %lf", &app_spec_r, &app_spec_g, &app_spec_b, &app_spec_a) != 4) {
printf("Error parsing \"specular\" attribute of %s appearence!\n", app_id);
throw InvalidXMLException();
}
if (app->Attribute("shininess", &app_shin) == NULL) {
printf("Error parsing \"shininess\" attribute of %s appearence!\n", app_id);
throw InvalidXMLException();
}
Appearance *new_app = new Appearance(app_id);
new_app->setEmissivity(app_emiss_r, app_emiss_g, app_emiss_b, app_emiss_a);
new_app->setAmbient(app_amb_r, app_amb_g, app_amb_b, app_amb_a);
new_app->setDiffuse(app_dif_r, app_dif_g, app_dif_b, app_dif_a);
new_app->setSpecular(app_spec_r, app_spec_g, app_spec_b, app_spec_a);
if (strdup(app_text_ref, app->Attribute("textureref")) != NULL) {
if (strcmp(app_text_ref, "") != 0) {
if (app->Attribute("texlength_s", &app_text_len_s) == NULL) {
printf("Error parsing \"texlength_s\" attribute of %s appearence!\n", app_id);
throw InvalidXMLException();
}
if (app->Attribute("texlength_t", &app_text_len_t) == NULL) {
printf("Error parsing \"texlength_t\" attribute of %s appearence!\n", app_id);
throw InvalidXMLException();
}
new_app->setTextProp(app_text_ref, app_text_len_s, app_text_len_t);
} else {
strdup(app_text_ref, "none");
app_text_len_s = 0.0;
app_text_len_t = 0.0;
}
} else {
strdup(app_text_ref, "none");
app_text_len_s = 0.0;
app_text_len_t = 0.0;
}
Scene::getInstance()->addAppearance(app_id, new_app);
printf(
"id: %s\nemissive: (%f,%f,%f,%f)\nambient: (%f,%f,%f,%f)\ndiffuse: (%f,%f,%f,%f)\nspecular: (%f,%f,%f,%f)\nshininess: %f\ntextureref: %s\ntexlength_s: %f\ntextlength_t: %f\n\n",
app_id, app_emiss_r, app_emiss_g, app_emiss_b, app_emiss_a, app_amb_r, app_amb_g, app_amb_b,
app_amb_a, app_dif_r, app_dif_g, app_dif_b, app_dif_a, app_spec_r, app_spec_g, app_spec_b,
app_spec_a, app_shin, app_text_ref, app_text_len_s, app_text_len_t);
//.........这里部分代码省略.........
示例7: parseNode
bool XMLScene::parseNode(TiXmlElement *curr_node, bool is_inside_dl) {
char node_id[MAX_STRING_LEN];
if (strdup(node_id, curr_node->Attribute("id")) == NULL) {
printf("Error reading \"id\" attribute!\n");
throw InvalidXMLException();
}
printf("id: %s\n", node_id);
bool is_dl = false;
string dl_node_id;
if (curr_node->QueryBoolAttribute("displaylist", &is_dl) != TIXML_SUCCESS) {
printf("No \"displaylist\" attribute\n");
}
if (is_dl) {
printf("Node \"%s\" defined as a display list.\n", node_id);
dl_node_id = Scene::getInstance()->findNextNameAvail(node_id);
printf("dl_node_id: %s\n", dl_node_id.c_str());
}
Node *n;
if (is_dl) {
n = new DisplayList(dl_node_id);
} else {
n = new Node(node_id);
}
nodes_being_processed.push_back(node_id);
printf("Processing transformations...\n");
TiXmlElement *transf_block = NULL;
if ((transf_block = curr_node->FirstChildElement("transforms")) == NULL) {
printf("Could not find \"transforms\" block on %s node!\n", node_id);
throw InvalidXMLException();
}
TiXmlElement *transf = NULL;
while ((transf = (TiXmlElement*) transf_block->IterateChildren(transf))) {
char t_type[MAX_STRING_LEN];
if (strdup(t_type, transf->Value()) == NULL) {
printf("Invalid transformation on node %s\n", node_id);
throw InvalidXMLException();
}
if (strcmp(t_type, "translate") == 0) {
char tmp_str[MAX_STRING_LEN];
double t_x = 0, t_y = 0, t_z = 0;
if (strdup(tmp_str, transf->Attribute("to")) == NULL) {
printf("Error on translate transformation on node %s!\n", node_id);
throw InvalidXMLException();
}
if (sscanf(tmp_str, "%lf %lf %lf", &t_x, &t_y, &t_z) != 3) {
printf("Error parsing translate transformation on node %s!\n", node_id);
throw InvalidXMLException();
}
n->addTranslate(t_x, t_y, t_z);
printf("Translate\nto: (%f %f %f)\n", t_x, t_y, t_z);
} else if (strcmp(t_type, "rotate") == 0) {
char tmp_str[2];
char r_axis = '\0';
double r_angle;
if (strdup(tmp_str, transf->Attribute("axis")) == NULL) {
printf("Error on rotate transformation on node %s!\n", node_id);
throw InvalidXMLException();
}
r_axis = tmp_str[0];
if (transf->QueryDoubleAttribute("angle", &r_angle)) {
printf("Error parsing rotate transformation on node %s!\n", node_id);
throw InvalidXMLException();
}
n->addRotation(r_angle, r_axis);
printf("Rotate\naxis: %c\nangle: %f\n", r_axis, r_angle);
} else if (strcmp(t_type, "scale") == 0) {
char tmp_str[MAX_STRING_LEN];
double f_x = 0, f_y = 0, f_z = 0;
if (strdup(tmp_str, transf->Attribute("factor")) == NULL) {
printf("Error on scale transformation on node %s!\n", node_id);
throw InvalidXMLException();
}
if (sscanf(tmp_str, "%lf %lf %lf", &f_x, &f_y, &f_z) != 3) {
printf("Error parsing scale transformation on node %s!\n", node_id);
throw InvalidXMLException();
}
n->addScale(f_x, f_y, f_z);
//.........这里部分代码省略.........
示例8: handler
vector<EncodedAttributeInfo*> LoadSavedDataSources::loadCodedAttributes(string dsName,int rowCount,bool limit){
TiXmlDocument doc_1(this->_fileName.c_str());
doc_1.LoadFile();
TiXmlHandle handler(&doc_1);
TiXmlElement *dsElement = handler.FirstChild("DataSources").ToElement();
dsElement = dsElement->FirstChildElement("DataSource");
vector<EncodedAttributeInfo*> codedAtts;
try
{
while (dsElement)
{
if (strcmp(dsElement->Attribute("Name"),dsName.c_str()) == 0)
{
dsElement = dsElement->FirstChildElement("CodedAttributes")->FirstChildElement("Attribute");
while (dsElement)
{
int attID = dsElement->FirstAttribute()->IntValue();
int attType = atoi(dsElement->Attribute("Type"));
string attName = dsElement->Attribute("Name");
int noVStreams = dsElement->LastAttribute()->IntValue();
EncodedAttributeInfo* attr;
switch(attType){
case 0:
{
EncodedIntAttribute *intAtt = new EncodedIntAttribute();
intAtt->setAttID(attID);
intAtt->setAttName(attName);
intAtt->setNoOfVBitStreams(noVStreams,rowCount);
intAtt->setAttType(getAttType(attType));
BitStreamInfo** bitStreams = new BitStreamInfo*[noVStreams];
TiXmlElement *vbs = dsElement->FirstChildElement("VBitStreams")->FirstChildElement("vbitstream");
for (int k = 0 ; k < noVStreams ; k++)
{
BitStreamInfo* bitStr = new VBitStream();
bitStr->setBitCount(rowCount);
bitStr->setBitStreamAllocAttID(attID);
bitStr->setBitStreamAllocAttName(attName);
string bitStream;
if (limit)
{
bitStream = vbs->GetText();
long offset = rowCount - this->_rowLimit;
bitStream = bitStream.substr(offset,this->_rowLimit);
}
else bitStream = vbs->GetText();
dynamic_bitset<> temp(bitStream);
bitStr->convert(temp);
bitStreams[k] = bitStr;
vbs = vbs->NextSiblingElement("vbitstream");
}
vector<BitStreamInfo*> tempVB(bitStreams , bitStreams + noVStreams);
intAtt->setVBitStreams(tempVB);
attr = intAtt;
codedAtts.push_back(attr);
break;
}
case 1:
{
EncodedDoubleAttribute *doubleAtt = new EncodedDoubleAttribute();
doubleAtt->setAttID(attID);
doubleAtt->setAttName(attName);
doubleAtt->setNoOfVBitStreams(noVStreams,rowCount);
doubleAtt->setAttType(getAttType(attType));
BitStreamInfo** bitStreams = new BitStreamInfo*[noVStreams];
TiXmlElement *vbs = dsElement->FirstChildElement("VBitStreams")->FirstChildElement("vbitstream");
for (int k = 0 ; k < noVStreams ; k++)
{
BitStreamInfo* bitStr = new VBitStream();
bitStr->setBitCount(rowCount);
bitStr->setBitStreamAllocAttID(attID);
bitStr->setBitStreamAllocAttName(attName);
string bitStream;
if (limit)
{
bitStream = vbs->GetText();
long offset = rowCount - this->_rowLimit;
bitStream = bitStream.substr(offset,this->_rowLimit);
}
else bitStream = vbs->GetText();
dynamic_bitset<> temp(bitStream);
bitStr->convert(temp);
bitStreams[k] = bitStr;
vbs = vbs->NextSiblingElement("vbitstream");
}
vector<BitStreamInfo*> tempVB(bitStreams , bitStreams + noVStreams);
doubleAtt->setVBitStreams(tempVB);
attr = doubleAtt;
codedAtts.push_back(attr);
break;
}
case 3:
{
EncodedMultiCatAttribute *catAtt = new EncodedMultiCatAttribute();
catAtt->setAttID(attID);
catAtt->setAttName(attName);
catAtt->setAttType(getAttType(attType));
catAtt->setNoOfVBitStreams(noVStreams,rowCount);
//.........这里部分代码省略.........
示例9: if
PrevailingTime::PrevailingTime(TiXmlNode* xmlNode)
: ISerialized(xmlNode)
{
#ifdef ConsolePrint
std::string initialtap_ = FileManager::instance().tap_;
FileManager::instance().tap_.append(" ");
#endif
//hourMinuteTimeNode ----------------------------------------------------------------------------------------------------------------------
TiXmlElement* hourMinuteTimeNode = xmlNode->FirstChildElement("hourMinuteTime");
if(hourMinuteTimeNode){hourMinuteTimeIsNull_ = false;}
else{hourMinuteTimeIsNull_ = true;}
#ifdef ConsolePrint
FileManager::instance().outFile_ << FileManager::instance().tap_.c_str() << "- hourMinuteTimeNode , address : " << hourMinuteTimeNode << std::endl;
#endif
if(hourMinuteTimeNode)
{
if(hourMinuteTimeNode->Attribute("href") || hourMinuteTimeNode->Attribute("id"))
{
if(hourMinuteTimeNode->Attribute("id"))
{
hourMinuteTimeIDRef_ = hourMinuteTimeNode->Attribute("id");
hourMinuteTime_ = boost::shared_ptr<HourMinuteTime>(new HourMinuteTime(hourMinuteTimeNode));
hourMinuteTime_->setID(hourMinuteTimeIDRef_);
IDManager::instance().setID(hourMinuteTimeIDRef_,hourMinuteTime_);
}
else if(hourMinuteTimeNode->Attribute("href")) { hourMinuteTimeIDRef_ = hourMinuteTimeNode->Attribute("href");}
else { QL_FAIL("id or href error"); }
}
else { hourMinuteTime_ = boost::shared_ptr<HourMinuteTime>(new HourMinuteTime(hourMinuteTimeNode));}
}
//locationNode ----------------------------------------------------------------------------------------------------------------------
TiXmlElement* locationNode = xmlNode->FirstChildElement("location");
if(locationNode){locationIsNull_ = false;}
else{locationIsNull_ = true;}
#ifdef ConsolePrint
FileManager::instance().outFile_ << FileManager::instance().tap_.c_str() << "- locationNode , address : " << locationNode << std::endl;
#endif
if(locationNode)
{
if(locationNode->Attribute("href") || locationNode->Attribute("id"))
{
if(locationNode->Attribute("id"))
{
locationIDRef_ = locationNode->Attribute("id");
location_ = boost::shared_ptr<TimezoneLocation>(new TimezoneLocation(locationNode));
location_->setID(locationIDRef_);
IDManager::instance().setID(locationIDRef_,location_);
}
else if(locationNode->Attribute("href")) { locationIDRef_ = locationNode->Attribute("href");}
else { QL_FAIL("id or href error"); }
}
else { location_ = boost::shared_ptr<TimezoneLocation>(new TimezoneLocation(locationNode));}
}
#ifdef ConsolePrint
FileManager::instance().tap_ = initialtap_;
#endif
}
示例10: if
PortfolioReference::PortfolioReference(TiXmlNode* xmlNode)
: PortfolioReferenceBase(xmlNode)
{
#ifdef ConsolePrint
std::string initialtap_ = FileManager::instance().tap_;
FileManager::instance().tap_.append(" ");
#endif
//sequenceNumberNode ----------------------------------------------------------------------------------------------------------------------
TiXmlElement* sequenceNumberNode = xmlNode->FirstChildElement("sequenceNumber");
if(sequenceNumberNode){sequenceNumberIsNull_ = false;}
else{sequenceNumberIsNull_ = true;}
#ifdef ConsolePrint
FileManager::instance().outFile_ << FileManager::instance().tap_.c_str() << "- sequenceNumberNode , address : " << sequenceNumberNode << std::endl;
#endif
if(sequenceNumberNode)
{
if(sequenceNumberNode->Attribute("href") || sequenceNumberNode->Attribute("id"))
{
if(sequenceNumberNode->Attribute("id"))
{
sequenceNumberIDRef_ = sequenceNumberNode->Attribute("id");
sequenceNumber_ = boost::shared_ptr<XsdTypePositiveInteger>(new XsdTypePositiveInteger(sequenceNumberNode));
sequenceNumber_->setID(sequenceNumberIDRef_);
IDManager::instance().setID(sequenceNumberIDRef_,sequenceNumber_);
}
else if(sequenceNumberNode->Attribute("href")) { sequenceNumberIDRef_ = sequenceNumberNode->Attribute("href");}
else { QL_FAIL("id or href error"); }
}
else { sequenceNumber_ = boost::shared_ptr<XsdTypePositiveInteger>(new XsdTypePositiveInteger(sequenceNumberNode));}
}
//submissionsCompleteNode ----------------------------------------------------------------------------------------------------------------------
TiXmlElement* submissionsCompleteNode = xmlNode->FirstChildElement("submissionsComplete");
if(submissionsCompleteNode){submissionsCompleteIsNull_ = false;}
else{submissionsCompleteIsNull_ = true;}
#ifdef ConsolePrint
FileManager::instance().outFile_ << FileManager::instance().tap_.c_str() << "- submissionsCompleteNode , address : " << submissionsCompleteNode << std::endl;
#endif
if(submissionsCompleteNode)
{
if(submissionsCompleteNode->Attribute("href") || submissionsCompleteNode->Attribute("id"))
{
if(submissionsCompleteNode->Attribute("id"))
{
submissionsCompleteIDRef_ = submissionsCompleteNode->Attribute("id");
submissionsComplete_ = boost::shared_ptr<XsdTypeBoolean>(new XsdTypeBoolean(submissionsCompleteNode));
submissionsComplete_->setID(submissionsCompleteIDRef_);
IDManager::instance().setID(submissionsCompleteIDRef_,submissionsComplete_);
}
else if(submissionsCompleteNode->Attribute("href")) { submissionsCompleteIDRef_ = submissionsCompleteNode->Attribute("href");}
else { QL_FAIL("id or href error"); }
}
else { submissionsComplete_ = boost::shared_ptr<XsdTypeBoolean>(new XsdTypeBoolean(submissionsCompleteNode));}
}
#ifdef ConsolePrint
FileManager::instance().tap_ = initialtap_;
#endif
}
示例11: ParseSettingsFile
void CAdvancedSettings::ParseSettingsFile(const CStdString &file)
{
CXBMCTinyXML advancedXML;
if (!CFile::Exists(file))
{
CLog::Log(LOGNOTICE, "No settings file to load (%s)", file.c_str());
return;
}
if (!advancedXML.LoadFile(file))
{
CLog::Log(LOGERROR, "Error loading %s, Line %d\n%s", file.c_str(), advancedXML.ErrorRow(), advancedXML.ErrorDesc());
return;
}
TiXmlElement *pRootElement = advancedXML.RootElement();
if (!pRootElement || strcmpi(pRootElement->Value(),"advancedsettings") != 0)
{
CLog::Log(LOGERROR, "Error loading %s, no <advancedsettings> node", file.c_str());
return;
}
// succeeded - tell the user it worked
CLog::Log(LOGNOTICE, "Loaded settings file from %s", file.c_str());
// Dump contents of AS.xml to debug log
TiXmlPrinter printer;
printer.SetLineBreak("\n");
printer.SetIndent(" ");
advancedXML.Accept(&printer);
CLog::Log(LOGNOTICE, "Contents of %s are...\n%s", file.c_str(), printer.CStr());
TiXmlElement *pElement = pRootElement->FirstChildElement("audio");
if (pElement)
{
XMLUtils::GetFloat(pElement, "ac3downmixgain", m_ac3Gain, -96.0f, 96.0f);
XMLUtils::GetInt(pElement, "headroom", m_audioHeadRoom, 0, 12);
XMLUtils::GetString(pElement, "defaultplayer", m_audioDefaultPlayer);
// 101 on purpose - can be used to never automark as watched
XMLUtils::GetFloat(pElement, "playcountminimumpercent", m_audioPlayCountMinimumPercent, 0.0f, 101.0f);
XMLUtils::GetBoolean(pElement, "usetimeseeking", m_musicUseTimeSeeking);
XMLUtils::GetInt(pElement, "timeseekforward", m_musicTimeSeekForward, 0, 6000);
XMLUtils::GetInt(pElement, "timeseekbackward", m_musicTimeSeekBackward, -6000, 0);
XMLUtils::GetInt(pElement, "timeseekforwardbig", m_musicTimeSeekForwardBig, 0, 6000);
XMLUtils::GetInt(pElement, "timeseekbackwardbig", m_musicTimeSeekBackwardBig, -6000, 0);
XMLUtils::GetInt(pElement, "percentseekforward", m_musicPercentSeekForward, 0, 100);
XMLUtils::GetInt(pElement, "percentseekbackward", m_musicPercentSeekBackward, -100, 0);
XMLUtils::GetInt(pElement, "percentseekforwardbig", m_musicPercentSeekForwardBig, 0, 100);
XMLUtils::GetInt(pElement, "percentseekbackwardbig", m_musicPercentSeekBackwardBig, -100, 0);
XMLUtils::GetInt(pElement, "resample", m_audioResample, 0, 192000);
XMLUtils::GetBoolean(pElement, "allowtranscode44100", m_allowTranscode44100);
XMLUtils::GetBoolean(pElement, "forceDirectSound", m_audioForceDirectSound);
XMLUtils::GetBoolean(pElement, "audiophile", m_audioAudiophile);
XMLUtils::GetBoolean(pElement, "allchannelstereo", m_allChannelStereo);
XMLUtils::GetString(pElement, "transcodeto", m_audioTranscodeTo);
XMLUtils::GetInt(pElement, "audiosinkbufferdurationmsec", m_audioSinkBufferDurationMsec);
TiXmlElement* pAudioExcludes = pElement->FirstChildElement("excludefromlisting");
if (pAudioExcludes)
GetCustomRegexps(pAudioExcludes, m_audioExcludeFromListingRegExps);
pAudioExcludes = pElement->FirstChildElement("excludefromscan");
if (pAudioExcludes)
GetCustomRegexps(pAudioExcludes, m_audioExcludeFromScanRegExps);
XMLUtils::GetString(pElement, "audiohost", m_audioHost);
XMLUtils::GetBoolean(pElement, "applydrc", m_audioApplyDrc);
XMLUtils::GetBoolean(pElement, "dvdplayerignoredtsinwav", m_dvdplayerIgnoreDTSinWAV);
XMLUtils::GetFloat(pElement, "limiterhold", m_limiterHold, 0.0f, 100.0f);
XMLUtils::GetFloat(pElement, "limiterrelease", m_limiterRelease, 0.001f, 100.0f);
}
pElement = pRootElement->FirstChildElement("karaoke");
if (pElement)
{
XMLUtils::GetFloat(pElement, "syncdelaycdg", m_karaokeSyncDelayCDG, -3.0f, 3.0f); // keep the old name for comp
XMLUtils::GetFloat(pElement, "syncdelaylrc", m_karaokeSyncDelayLRC, -3.0f, 3.0f);
XMLUtils::GetBoolean(pElement, "alwaysreplacegenre", m_karaokeChangeGenreForKaraokeSongs );
XMLUtils::GetBoolean(pElement, "storedelay", m_karaokeKeepDelay );
XMLUtils::GetInt(pElement, "autoassignstartfrom", m_karaokeStartIndex, 1, 2000000000);
XMLUtils::GetBoolean(pElement, "nocdgbackground", m_karaokeAlwaysEmptyOnCdgs );
XMLUtils::GetBoolean(pElement, "lookupsongbackground", m_karaokeUseSongSpecificBackground );
TiXmlElement* pKaraokeBackground = pElement->FirstChildElement("defaultbackground");
if (pKaraokeBackground)
{
const char* attr = pKaraokeBackground->Attribute("type");
if ( attr )
m_karaokeDefaultBackgroundType = attr;
attr = pKaraokeBackground->Attribute("path");
if ( attr )
m_karaokeDefaultBackgroundFilePath = attr;
}
}
//.........这里部分代码省略.........
示例12: LoadMap
//This function loads a map from the specified .tmx file
void Game::LoadMap(string filename)
{
//Create our Root Document handle and open it up
TiXmlDocument Root(filename.c_str());
if (!Root.LoadFile()) throw std::runtime_error(string("Failed to open level file: ") + filename);
//Get a handle to our first set of 'layer' data in the map. This could be anything from a tile/object layer to tileset info,
//so we need to check what it is before we do anything with it.
TiXmlElement *Layer = Root.FirstChildElement("map")->FirstChildElement();
//Clear out any existing object data
GameStorage->ClearAll();
//Loop through all layers we can find in the map data
while (Layer)
{
//Check for an object layer that has child elements. Currently this is the only kind we're interested in.
if (string(Layer->Value()) == "objectgroup" && !Layer->NoChildren())
{
//Get our first object in this layer
TiXmlElement *Object = Layer->FirstChildElement();
//Get the name of our layer
string name(Layer->Attribute("name"));
ColourType colour;
//Convert name to lower-case
for (int i = 0; i < name.length(); i++)
{
name[i] = tolower(name[i]);
}
//Loop through all objects
while (Object)
{
string type((Object->Attribute("type") != NULL) ? Object->Attribute("type") : "");
//Depending on the type of this layer, spawn a certain type of object
if (name == "red")
{
colour = COLOUR_RED;
}
else if (name == "blue")
{
colour = COLOUR_BLUE;
}
else if (name == "yellow")
{
colour = COLOUR_YELLOW;
}
else if (name == "white")
{
colour = COLOUR_WHITE;
}
else if (name == "player")
{
player.ReadPosition(Object);
}
else if (name == "exit")
{
exit.ReadPosition(Object);
}
if (name != "player" && name != "exit")
{
if (type == "" || type == "normal")
{
GameStorage->AddObject(GameObjectPointer(new ColourBox(Object, colour)));
}
else if (type == "moveable")
{
}
else if (type == "moving")
{
GameStorage->AddObject(GameObjectPointer(new MovingColourBlock(Object, colour)));
}
}
Object = Object->NextSiblingElement();
}
}
Layer = Layer->NextSiblingElement();
}
ColouredObject::SetCurrentColour(COLOUR_RED);
}
示例13: Load
bool CGUIWindow::Load(TiXmlElement *pRootElement)
{
if (!pRootElement)
return false;
// set the scaling resolution so that any control creation or initialisation can
// be done with respect to the correct aspect ratio
CServiceBroker::GetWinSystem()->GetGfxContext().SetScalingResolution(m_coordsRes, m_needsScaling);
// now load in the skin file
SetDefaults();
CGUIControlFactory::GetInfoColor(pRootElement, "backgroundcolor", m_clearBackground, GetID());
CGUIControlFactory::GetActions(pRootElement, "onload", m_loadActions);
CGUIControlFactory::GetActions(pRootElement, "onunload", m_unloadActions);
CRect parentRect(0, 0, static_cast<float>(m_coordsRes.iWidth), static_cast<float>(m_coordsRes.iHeight));
CGUIControlFactory::GetHitRect(pRootElement, m_hitRect, parentRect);
TiXmlElement *pChild = pRootElement->FirstChildElement();
while (pChild)
{
std::string strValue = pChild->Value();
if (strValue == "previouswindow" && pChild->FirstChild())
{
m_previousWindow = CWindowTranslator::TranslateWindow(pChild->FirstChild()->Value());
}
else if (strValue == "defaultcontrol" && pChild->FirstChild())
{
const char *always = pChild->Attribute("always");
if (always && StringUtils::EqualsNoCase(always, "true"))
m_defaultAlways = true;
m_defaultControl = atoi(pChild->FirstChild()->Value());
}
else if(strValue == "menucontrol" && pChild->FirstChild())
{
m_menuControlID = atoi(pChild->FirstChild()->Value());
}
else if (strValue == "visible" && pChild->FirstChild())
{
std::string condition;
CGUIControlFactory::GetConditionalVisibility(pRootElement, condition);
m_visibleCondition = CServiceBroker::GetGUI()->GetInfoManager().Register(condition, GetID());
}
else if (strValue == "animation" && pChild->FirstChild())
{
CRect rect(0, 0, static_cast<float>(m_coordsRes.iWidth), static_cast<float>(m_coordsRes.iHeight));
CAnimation anim;
anim.Create(pChild, rect, GetID());
m_animations.push_back(anim);
}
else if (strValue == "zorder" && pChild->FirstChild())
{
m_renderOrder = atoi(pChild->FirstChild()->Value());
}
else if (strValue == "coordinates")
{
XMLUtils::GetFloat(pChild, "posx", m_posX);
XMLUtils::GetFloat(pChild, "posy", m_posY);
XMLUtils::GetFloat(pChild, "left", m_posX);
XMLUtils::GetFloat(pChild, "top", m_posY);
TiXmlElement *originElement = pChild->FirstChildElement("origin");
while (originElement)
{
COrigin origin;
origin.x = CGUIControlFactory::ParsePosition(originElement->Attribute("x"), static_cast<float>(m_coordsRes.iWidth));
origin.y = CGUIControlFactory::ParsePosition(originElement->Attribute("y"), static_cast<float>(m_coordsRes.iHeight));
if (originElement->FirstChild())
origin.condition = CServiceBroker::GetGUI()->GetInfoManager().Register(originElement->FirstChild()->Value(), GetID());
m_origins.push_back(origin);
originElement = originElement->NextSiblingElement("origin");
}
}
else if (strValue == "camera")
{ // z is fixed
m_camera.x = CGUIControlFactory::ParsePosition(pChild->Attribute("x"), static_cast<float>(m_coordsRes.iWidth));
m_camera.y = CGUIControlFactory::ParsePosition(pChild->Attribute("y"), static_cast<float>(m_coordsRes.iHeight));
m_hasCamera = true;
}
else if (strValue == "depth" && pChild->FirstChild())
{
float stereo = static_cast<float>(atof(pChild->FirstChild()->Value()));
m_stereo = std::max(-1.f, std::min(1.f, stereo));
}
else if (strValue == "controls")
{
TiXmlElement *pControl = pChild->FirstChildElement();
while (pControl)
{
if (StringUtils::EqualsNoCase(pControl->Value(), "control"))
{
LoadControl(pControl, nullptr, CRect(0, 0, static_cast<float>(m_coordsRes.iWidth), static_cast<float>(m_coordsRes.iHeight)));
}
pControl = pControl->NextSiblingElement();
}
}
pChild = pChild->NextSiblingElement();
}
//.........这里部分代码省略.........
示例14: _tmain
int _tmain(int argc, _TCHAR* argv[])
{
std::string input = "svn_log.xml";
std::string output = "Changelog.txt";
int limit = 0;
if (argc < 2)
{
// output help information
printf("usage:\n");
printf("\n");
printf(" Changelog input <output> <limit>\n");
printf("\n");
printf(" input : input .xml file generated from SVN (using svn log --xml)\n");
printf(" DOWNLOAD to download direct from XBMC SVN\n");
printf(" <output> : output .txt file for the changelog (defaults to Changelog.txt)\n");
printf(" <limit> : the number of log entries for svn to fetch. (defaults to no limit)");
printf("\n");
return 0;
}
input = argv[1];
if (argc > 2)
output = argv[2];
FILE *file = fopen(output.c_str(), "wb");
if (!file)
return 1;
fprintf(file, header);
if (input.compare("download") == 0)
{
if(argc > 3)
limit = atoi(argv[3]);
// download our input file
std::string command = "svn log -r 'HEAD':8638 ";
if (limit > 0)
{
command += "--limit ";
command += argv[3]; // the limit as a string
command += " ";
}
#ifndef _LINUX
command += "--xml https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk/XBMC > svn_log.xml";
#else
command += "--xml https://xbmc.svn.sourceforge.net/svnroot/xbmc/branches/linuxport/XBMC > svn_log.xml";
#endif
printf("Downloading changelog from SVN - this will take some time (around 1MB to download with no limit)\n");
system(command.c_str());
input = "svn_log.xml";
printf("Downloading done - processing\n");
}
TiXmlDocument doc;
if (!doc.LoadFile(input.c_str()))
{
return 1;
}
TiXmlElement *root = doc.RootElement();
if (!root) return 1;
TiXmlElement *logitem = root->FirstChildElement("logentry");
while (logitem)
{
int revision;
logitem->Attribute("revision", &revision);
TiXmlNode *date = logitem->FirstChild("date");
std::string dateString;
if (date && date->FirstChild())
dateString = date->FirstChild()->Value();
TiXmlNode *msg = logitem->FirstChild("msg");
if (msg && msg->FirstChild())
{
// filter the message a bit
std::string message = FilterMessage(msg->FirstChild()->Value());
if (message.size())
fprintf(file, "%s %4i %s\r\n", dateString.substr(0,10).c_str(), revision, message.c_str());
else
int breakhere = 1;
}
logitem = logitem->NextSiblingElement("logentry");
}
fclose(file);
printf("Changelog saved as: %s\n", output.c_str());
return 0;
}
示例15: LoadSetup
//! 读取配置
BOOL NetSetup::LoadSetup(const char *pXmlFilename)
{
if(NULL == pXmlFilename)
return FALSE;
TiXmlNode *pNode = NULL;
TiXmlDocument* m_Tdoc = new TiXmlDocument(pXmlFilename);
if(!m_Tdoc->LoadFile())
return FALSE;
pNode = m_Tdoc->FirstChild("NetSetup");
if (pNode == NULL)
{
SAFE_DELETE(m_Tdoc);
return FALSE;
}
TiXmlElement* pNetSetup = pNode->ToElement();//获取node 的指针
if (pNetSetup == NULL)
{
SAFE_DELETE(m_Tdoc);
return FALSE;
}
////////////////////////////////////////////
m_bIsReady = FALSE;
m_mapServerSetup.clear();
m_MemSetup.dwDataBlockNum = atoi(pNetSetup->Attribute("DataBlockNum"));
m_MemSetup.dwDataBlockSize = atoi(pNetSetup->Attribute("DataBlockSize"));
m_MemSetup.dwFreeMsgNum = atoi(pNetSetup->Attribute("FreeMsgNum"));
TiXmlElement* pServerSetup = pNetSetup->FirstChildElement("ServerSetup");
for (; pServerSetup != NULL; pServerSetup = pServerSetup->NextSiblingElement("ServerSetup"))
{
tagServerSetup ServerSetup;
LONG lID = atoi(pServerSetup->Attribute("ID"));
ServerSetup.dwListenOrConnectPort = atoi(pServerSetup->Attribute("ListenOrConnectPort")); // 侦听或者连接端口
ServerSetup.dwFreeSockOperNum = atoi(pServerSetup->Attribute("FreeSockOperNum")); // 网络命令操作预分配数量
ServerSetup.dwFreeIOOperNum = atoi(pServerSetup->Attribute("FreeIOOperNum")); // 完成端口上IO操作预分配数量
ServerSetup.dwIOOperDataBufNum = atoi(pServerSetup->Attribute("IOOperDataBufNum")); // 默认IO操作的DataBuf数量
ServerSetup.dwCheckNet = atoi(pServerSetup->Attribute("CheckNet")); // 是否对网络进行检测
ServerSetup.dwBanIPTime = atoi(pServerSetup->Attribute("BanIPTime")); // 禁止IP的时间
ServerSetup.dwMaxMsgLen = atoi(pServerSetup->Attribute("MaxMsgLen")); // 允许传输的最大消息长度
ServerSetup.dwMaxConnectNum = atoi(pServerSetup->Attribute("MaxConnectNum")); // 客户端的最大连接数量
ServerSetup.dwMaxClientsNum = atoi(pServerSetup->Attribute("MaxClientsNum")); // 最大的客户端发送缓冲区大小
ServerSetup.dwPendingWrBufNum = atoi(pServerSetup->Attribute("PendingWrBufNum")); // 最大的发送IO操作Buf总大小
ServerSetup.dwPendingRdBufNum = atoi(pServerSetup->Attribute("PendingRdBufNum")); // 最大的接受IO操作Buf总大小
ServerSetup.dwMaxSendSizePerSecond = atoi(pServerSetup->Attribute("MaxSendSizePerSecond")); // 向客户端每秒发送的最大字节数
ServerSetup.dwMaxRecvSizePerSecond = atoi(pServerSetup->Attribute("MaxRecvSizePerSecond")); // 从客户端接受的每秒最大字节数
ServerSetup.dwMaxBlockedSendMsgNum = atoi(pServerSetup->Attribute("MaxBlockedSendMsgNum")); // 最大阻塞的发送消息数量
ServerSetup.dwConPendingWrBufNum = atoi(pServerSetup->Attribute("ConPendingWrBufNum")); // 客户端最大的发送IO操作Buf总大小
ServerSetup.dwConPendingRdBufNum = atoi(pServerSetup->Attribute("ConPendingRdBufNum")); // 客户端最大的接受IO操作Buf总大小
ServerSetup.dwConMaxSendSizePerSecond = atoi(pServerSetup->Attribute("ConMaxSendSizePerSecond")); // 向服务器发送的每秒最大字节数
ServerSetup.dwConMaxRecvSizePerSecond = atoi(pServerSetup->Attribute("ConMaxRecvSizePerSecond")); // 从服务器接受的每秒最大字节数
ServerSetup.dwConMaxBlockedSendMsgNum = atoi(pServerSetup->Attribute("ConMaxBlockedSendMsgNum")); // 最大阻塞的发送消息数量
m_mapServerSetup[lID] = ServerSetup;
}
////////////////////////////////////////////
m_bIsReady = TRUE;
SAFE_DELETE(m_Tdoc);
return TRUE;
}