void CGUIIncludes::FlattenSkinVariableConditions() { for (auto& variable : m_skinvariables) { TiXmlElement* valueNode = variable.second.FirstChildElement("value"); while (valueNode) { const char *condition = valueNode->Attribute("condition"); if (condition) valueNode->SetAttribute("condition", ResolveExpressions(condition)); valueNode = valueNode->NextSiblingElement("value"); } } }
static int _FormatWrite(std::map<int, std::string> &mapAll, char *strFMTWrite) { TiXmlDocument *XmlDoc; TiXmlElement *RootElement; TiXmlElement *Segment; TiXmlElement *Colum; TiXmlDeclaration HeadDec; TiXmlPrinter Printer; // 增加XML的头部说明 XmlDoc = new TiXmlDocument(); HeadDec.Parse("<?xml version=\"1.0\" encoding=\"gb2312\" ?>", 0, TIXML_ENCODING_UNKNOWN); XmlDoc->LinkEndChild(&HeadDec); RootElement = new TiXmlElement("SEGMENTS"); RootElement->SetAttribute("PROGRAMID", "001"); Segment = new TiXmlElement("SEGMENT"); Segment->SetAttribute("ID", 2); std::map<int, std::string>::iterator iter = mapAll.begin(); for (; iter != mapAll.end(); ++iter) { Colum = new TiXmlElement("COLUMN"); Colum->SetAttribute("ID", iter->first); Colum->SetAttribute("VALUE", iter->second.c_str()); Segment->LinkEndChild(Colum); } RootElement->LinkEndChild(Segment); XmlDoc->LinkEndChild(RootElement); XmlDoc->Accept(&Printer); strcpy(strFMTWrite, Printer.CStr()); return 0; }
bool ConditionStd::SaveToXml(TiXmlElement *node) { TiXmlElement *cond_node = new TiXmlElement("calaos:condition"); cond_node->SetAttribute("type", "standard"); cond_node->SetAttribute("trigger", trigger?"true":"false"); node->LinkEndChild(cond_node); for (uint i = 0;i < inputs.size();i++) { Input *in = inputs[i]; TiXmlElement *cnode = new TiXmlElement("calaos:input"); cnode->SetAttribute("id", in->get_param("id")); cnode->SetAttribute("oper", ops[in->get_param("id")]); cnode->SetAttribute("val", params[in->get_param("id")]); if (params_var[in->get_param("id")] != "") cnode->SetAttribute("val_var", params_var[in->get_param("id")]); cond_node->LinkEndChild(cnode); } return true; }
TiXmlElement* SaveTraitsXML(TiXmlElement* pRoot, std::string TagName, const int numTraits, sTrait* traits[], int tempTraits[]) { TiXmlElement* pTraits = new TiXmlElement(TagName); pRoot->LinkEndChild(pTraits); for (int i = 0; i < numTraits; i++) // save the trait names { if (traits[i]) { TiXmlElement* pTrait = new TiXmlElement(XMLifyString(traits[i]->m_Name)); // Trait name pTraits->LinkEndChild(pTrait); if (tempTraits) pTrait->SetAttribute("Temp", tempTraits[i]); // Is temporary } } return pTraits; }
STDMETHODIMP CYashProfiler::ExceptionThrown(ObjectID thrownObjectID) { LogString("Exception %d Thrown\r\n\r\n", thrownObjectID); ThreadID threadId; m_pICorProfilerInfo->GetCurrentThreadID(&threadId); std::stringstream threadStr; threadStr << threadId; // add to XML TiXmlElement * methodEvent = new TiXmlElement( "exceptionEvent" ); char *exceptionId = new char(256); sprintf(exceptionId, "%d", thrownObjectID); methodEvent->SetAttribute("exceptionId", exceptionId); methodEvent->SetAttribute("threadId", threadStr.str().c_str()); methodEvent->SetAttribute("type", "ExceptionThrown"); LARGE_INTEGER time, freq; QueryPerformanceCounter(&time); QueryPerformanceFrequency(&freq); methodEvent->SetDoubleAttribute("timestamp", (float) time.QuadPart / (float) freq.QuadPart); m_events->LinkEndChild( methodEvent ); return S_OK; }
void SceneImporter::serialise() { BinaryDataStore<char> binaryDataStore; TiXmlDocument doc; TiXmlDeclaration* decl = new TiXmlDeclaration("1.0", "", ""); doc.LinkEndChild(decl); TiXmlElement* root = new TiXmlElement("root"); doc.LinkEndChild(root); TiXmlElement* header = new TiXmlElement("Header"); header->SetAttribute("type", "SkinnedCharacter"); root->LinkEndChild(header); TiXmlElement* prefab = new TiXmlElement("Model"); root->LinkEndChild(prefab); TiXmlElement* meshes = new TiXmlElement("Meshes"); prefab->LinkEndChild(meshes); meshes->SetAttribute("count", _meshes.size()); for (auto It = _meshes.begin(); It != _meshes.end(); It++) { auto_ptr<Mesh>& meshPtr = *(It); meshPtr->serialise(meshes, binaryDataStore); } Animator::get()->serialise(prefab, binaryDataStore); const char* fileName = "prefab.xml"; ofstream os; binaryDataStore.compact(); os.open(fileName, ios::binary); long numBinaryBytes = binaryDataStore.size(); os.write((const char*)&numBinaryBytes, sizeof(long)); const vector<char>& buffer = binaryDataStore.getBuffer(); os.write(&buffer[0], numBinaryBytes); os.close(); FILE* fp; fp = fopen(fileName, "a"); doc.Print(fp); fclose(fp); }
bool Internal::SaveToXml(TiXmlElement *node) { TiXmlElement *cnode = new TiXmlElement("calaos:internal"); node->LinkEndChild(cnode); for (int i = 0;i < get_params().size();i++) { string key, value; get_params().get_item(i, key, value); if (key == "value" && get_param("save") != "true") continue; cnode->SetAttribute(key, value); } return true; }
void xmlFrondsSave::FillTextures( const dataFronds &_data , TiXmlElement* root ) { //заполнить данными о текстурах //создать запись для текстур TiXmlElement *pTextures = NULL; pTextures = new TiXmlElement( m_FrondsNames.m_sTextures.c_str() ); //количество текстур pTextures->SetAttribute( m_FrondsNames.m_sNum.c_str() , _data.m_vTextures.size() ); for ( int i = 0 ; i < _data.m_vTextures.size() ; ++i ) { TiXmlElement *pTexture = NULL; pTexture = new TiXmlElement( m_FrondsNames.m_sTexture.c_str() ); //количество текстур pTexture->SetAttribute( m_FrondsNames.m_sVal.c_str() , _data.m_vTextures[ i ].c_str() ); pTextures->LinkEndChild( pTexture ); } root->LinkEndChild( pTextures ); }
bool ParsingXml::storeScore(std::string &playerName, int data) { TiXmlElement *players = this->_doc.FirstChildElement("players"); if (players) { unsigned int nb = 0; for(TiXmlElement *player = players->FirstChildElement("player"); player; player = player->NextSiblingElement("player")) { nb++; if (player->Attribute("name") == playerName) { player->SetAttribute("score", data); return _doc.SaveFile(); } } TiXmlElement *player = new TiXmlElement("player"); player->SetAttribute("id", nb); player->SetAttribute("name", playerName); player->SetAttribute("score", data); players->LinkEndChild(player); return _doc.SaveFile(); } return false; }
int em::EmXml::WriteRootAttr( const char* szAttrName, const char* szAttrValue ) { int iResult = 0; TiXmlElement *pElemRoot = m_pDoc->RootElement(); if(pElemRoot == NULL) { return EM_ERR_XML_LOST_ROOT; } pElemRoot->SetAttribute(szAttrName,szAttrValue); m_bUpdated = true; return iResult; }
BOOL SetPowerOpt(BOOL bAllowSuspendMode) { TiXmlDocument doc; if( CheckValidXML(&doc) == FALSE ) { return FALSE; } TiXmlElement* pElem = doc.FirstChild("BBS_WiFiConfig")->FirstChild("Setting")->FirstChild("Option")->FirstChildElement("PowerOption"); pElem->SetAttribute("AllowSuspend", bAllowSuspendMode); return doc.SaveFile(); }
bool ConferenceInfo::ToXml(const char* szPath) { TiXmlDocument xmlDocument; TiXmlDeclaration *pDeclaration = new TiXmlDeclaration(_T("1.0"),_T("utf-8"),_T("")); if (!pDeclaration) return false; xmlDocument.LinkEndChild(pDeclaration); TiXmlElement *rootElement = TinyXmlFunction::DocNewElement("root", &xmlDocument); if (!rootElement) return false; rootElement->SetAttribute("updatetime", updatetime); rootElement->SetAttribute("version", version); TiXmlElement *boxElement = TinyXmlFunction::NewElement("box", rootElement); if (!boxElement) return false; boxElement->SetAttribute("boxnos", boxnos); list<ConferenceRecord>::iterator it; for (it = record.begin(); it != record.end(); it++) { SetRecord(boxElement, it); } xmlDocument.SaveFile(szPath);//保存到文件 return true; }
TiXmlElement* Base64CreateElement(const string& name,const string& value) { TiXmlElement* e = NULL; if (value != "") { e = CreateElement(name,base64_encode((const unsigned char*)value.c_str(),value.size())); if (e != NULL) e->SetAttribute("encode","base64"); } else { e = CreateElement(name,value); } return e; }
void Template::SaveToFile(const std::string &path) { TiXmlDocument *doc = new TiXmlDocument(); TiXmlElement *baseEle = new TiXmlElement("Template"); TiXmlElement *descEle = new TiXmlElement("Description"); descEle->LinkEndChild(new TiXmlText(m_description.c_str())); TiXmlElement *ele = new TiXmlElement("Keyframes"); ele->SetDoubleAttribute("period", m_period); ele->SetAttribute("types", m_types); for(std::map<std::string, BoneAnimation>::iterator it = m_keyFrames.begin(); it != m_keyFrames.end(); it++) { TiXmlElement *boneEle = new TiXmlElement("Bone"); boneEle->SetAttribute("name", it->first.c_str()); for(std::map<KeyFrameType, std::vector<KeyFrame> >::iterator it2 = it->second.keyFrames.begin(); it2 != it->second.keyFrames.end(); it2++) { TiXmlElement *keyframetypeEle = new TiXmlElement("Type"); keyframetypeEle->SetDoubleAttribute("type", static_cast<int>(it2->first)); for(unsigned int a = 0; a < it2->second.size(); a++) { TiXmlElement *timefloatEle = new TiXmlElement("Keyframe"); timefloatEle->SetDoubleAttribute("time", it2->second.at(a).time); timefloatEle->SetDoubleAttribute("value", it2->second.at(a).value); timefloatEle->SetAttribute("valueStr", it2->second.at(a).valueStr.c_str()); timefloatEle->SetAttribute("interpolation", it2->second.at(a).interpolation.c_str()); keyframetypeEle->LinkEndChild(timefloatEle); } boneEle->LinkEndChild(keyframetypeEle); } ele->LinkEndChild(boneEle); } TiXmlElement *descriptionsEle = baseEle->LinkEndChild(new TiXmlElement("BonesDescriptions"))->ToElement(); for(unsigned int a = 0; a < m_boneDescriptions.size(); a++) { TiXmlElement *boneDescrEle = new TiXmlElement("BoneDescription"); boneDescrEle->SetAttribute("bone", m_boneDescriptions[a].first.c_str()); boneDescrEle->SetAttribute("description", m_boneDescriptions[a].second.c_str()); descriptionsEle->LinkEndChild(boneDescrEle); } baseEle->LinkEndChild(descEle); baseEle->LinkEndChild(ele); doc->LinkEndChild(baseEle); doc->SaveFile(path.c_str()); }
void XMLSaver::SaveSegment(Segment *s, TiXmlElement *m) { TiXmlElement *se = new TiXmlElement("Segment"); se->SetAttribute("name", s->name); se->SetDoubleAttribute("mass", s->mass); se->SetDoubleAttribute("rot_inertia", s->rot_inertia); for (list <Connector *>::iterator i = s->connectors.begin(); i != s->connectors.end(); i++) { Connector *c = *i; if (c != s->polus) SaveConnector(c, se); } m->LinkEndChild(se); }
TiXmlElement* PhysicsComponent::VGenerateXml(void) { TiXmlElement* pBaseElement = GCC_NEW TiXmlElement(VGetName()); // shape TiXmlElement* pShape = GCC_NEW TiXmlElement("Shape"); TiXmlText* pShapeText = GCC_NEW TiXmlText(m_shape.c_str()); pShape->LinkEndChild(pShapeText); pBaseElement->LinkEndChild(pShape); // density TiXmlElement* pDensity = GCC_NEW TiXmlElement("Density"); TiXmlText* pDensityText = GCC_NEW TiXmlText(m_density.c_str()); pDensity->LinkEndChild(pDensityText); pBaseElement->LinkEndChild(pDensity); // material TiXmlElement* pMaterial = GCC_NEW TiXmlElement("Material"); TiXmlText* pMaterialText = GCC_NEW TiXmlText(m_material.c_str()); pMaterial->LinkEndChild(pMaterialText); pBaseElement->LinkEndChild(pMaterial); // rigid body transform TiXmlElement* pInitialTransform = GCC_NEW TiXmlElement("RigidBodyTransform"); // initial transform -> position TiXmlElement* pPosition = GCC_NEW TiXmlElement("Position"); pPosition->SetAttribute("x", ToStr(m_RigidBodyLocation.x).c_str()); pPosition->SetAttribute("y", ToStr(m_RigidBodyLocation.y).c_str()); pPosition->SetAttribute("z", ToStr(m_RigidBodyLocation.z).c_str()); pInitialTransform->LinkEndChild(pPosition); // initial transform -> orientation TiXmlElement* pOrientation = GCC_NEW TiXmlElement("Orientation"); pOrientation->SetAttribute("yaw", ToStr(m_RigidBodyOrientation.x).c_str()); pOrientation->SetAttribute("pitch", ToStr(m_RigidBodyOrientation.y).c_str()); pOrientation->SetAttribute("roll", ToStr(m_RigidBodyOrientation.z).c_str()); pInitialTransform->LinkEndChild(pOrientation); // initial transform -> scale TiXmlElement* pScale = GCC_NEW TiXmlElement("Scale"); pScale->SetAttribute("x", ToStr(m_RigidBodyScale.x).c_str()); pScale->SetAttribute("y", ToStr(m_RigidBodyScale.y).c_str()); pScale->SetAttribute("z", ToStr(m_RigidBodyScale.z).c_str()); pInitialTransform->LinkEndChild(pScale); pBaseElement->LinkEndChild(pInitialTransform); return pBaseElement; }
/// Generic attribute setter with unicode value Attribute Handle_t::setAttr(const XmlChar* nam, const XmlChar* val) const { #ifdef DD4HEP_USE_TINYXML TiXmlElement* e = Xml(m_node).e; e->SetAttribute(nam,val); return Attribute(e->AttributeNode(nam)); #else xercesc::DOMElement* e = _E(m_node); xercesc::DOMAttr* a = e->getAttributeNode(nam); if (!a) { a = e->getOwnerDocument()->createAttribute(nam); e->setAttributeNode(a); } a->setValue(val); return Attribute(a); #endif }
TiXmlElement* GetModuleElement(Module* module) { TiXmlElement *moduleEl = new TiXmlElement("Module"); moduleEl->SetAttribute("Name", module->Name.c_str()); // ищем все обобщения, обобщенные или специализированные процедуры for(unsigned int i = 0; i < module->objects.objList.size(); ++i) { Type *type = dynamic_cast<Type*>(module->objects.objList[i]); if(type && (type->WhatIsIt() == ItIsTypeGeneric || type->WhatIsIt() == ItIsTypeGenRecord)) { TiXmlElement *genEl = GetGenericElement(type); if (genEl) moduleEl->InsertEndChild(*genEl); continue; } GenericProc *gProc = dynamic_cast<GenericProc*>(module->objects.objList[i]); if (gProc) { TiXmlElement *gProcEl = GetGenericProcElement(gProc); moduleEl->InsertEndChild(*gProcEl); } } // также ищем в подключаемом модуле if (module->AttachmentModule) { // ищем все обобщения, обобщенные или специализированные процедуры for(unsigned int i = 0; i < module->AttachmentModule->objects.objList.size(); ++i) { Type *type = dynamic_cast<Type*>(module->AttachmentModule->objects.objList[i]); if(type && (type->WhatIsIt() == ItIsTypeGeneric || type->WhatIsIt() == ItIsTypeGenRecord)) { TiXmlElement *genEl = GetGenericElement(type); if (genEl) moduleEl->InsertEndChild(*genEl); continue; } } } return moduleEl; }
/** * Creates the object of the layer's texture. **/ void IO::saveTexture(TiXmlElement *parent, Texture *t) { if (t == NULL) return; TiXmlElement *texture = new TiXmlElement("texture"); const char *filename = basename((char *)(t->getFilename())); if (filename) texture->SetAttribute("location", filename); texture->SetDoubleAttribute("x", t->x); texture->SetDoubleAttribute("y", t->y); texture->SetDoubleAttribute("scale", t->getScale()); parent->LinkEndChild(texture); }
int em::EmXml::WriteRootChildAttrMap( const char* szKeyName, const char* szKeyValue, EmMapStr &rMapStr ) { std::string strResult; bool bUpdated = false; int iResult = 0; TiXmlElement *pElemRoot = m_pDoc->RootElement(); if(pElemRoot == NULL) { return 0; } TiXmlElement *pElemChild = pElemRoot->FirstChildElement(); TiXmlAttribute *pAttrChild = NULL; while(true) { if(pElemChild == NULL) { break; } if(pElemChild->Type() != TiXmlNode::TINYXML_ELEMENT) { continue; } pAttrChild = pElemChild->FirstAttribute(); if(EmSz::Equal( pElemChild->Attribute( szKeyName), szKeyValue)) { EmMapStr::const_iterator iterMap; for(iterMap = rMapStr.begin(); iterMap != rMapStr.end(); iterMap++) { pElemChild->SetAttribute(iterMap->first , iterMap->second); } bUpdated = true; break; } pElemChild = pElemChild->NextSiblingElement(); } m_bUpdated = bUpdated; return iResult; }
/** * Saves scene in XML. * \param filename filename to save to * \param rootLayer pointer to the main vector of layers **/ void IO::save(const char *filename, Layer *rootLayer) { TiXmlDocument doc; TiXmlDeclaration *decl = new TiXmlDeclaration("1.0", "", ""); doc.LinkEndChild(decl); TiXmlElement *animata = new TiXmlElement("animata"); char versionstr[128]; snprintf(versionstr, 128, "%d.%03d", ANIMATA_MAJOR_VERSION, ANIMATA_MINOR_VERSION); animata->SetAttribute("version", versionstr); doc.LinkEndChild(animata); saveLayer(animata, rootLayer); doc.SaveFile(filename); }
void ActivityWidgetsView::SaveWidgets() { TiXmlDocument document; TiXmlDeclaration *decl = new TiXmlDeclaration("1.0", "UTF-8", ""); TiXmlElement *rootnode = new TiXmlElement("calaos:widgets"); rootnode->SetAttribute("xmlns:calaos", "http://www.calaos.fr"); document.LinkEndChild(decl); document.LinkEndChild(rootnode); for (int i = 0;i < (int)widgets.size();i++) { widgets[i]->Save(rootnode); } string file = Utils::getConfigFile(WIDGET_CONFIG); document.SaveFile(file); }
void CXmlConfig::AttribSet(const vector<const char*>& szParElemNames, const char* szChildElemName, const vector<string>& vecAttribValueName, const vector<string>& vecAttribValueValue) { TiXmlNode *pParentNode = this->GetNode(szParElemNames, false); if( pParentNode == NULL ) pParentNode = m_pRoot; TiXmlElement *pSetElement = new TiXmlElement(szChildElemName); pParentNode->LinkEndChild(pSetElement); size_t size = vecAttribValueName.size(); for (size_t i = 0; i < size; ++i ) { string name = vecAttribValueName[i]; string value = vecAttribValueValue[i]; pSetElement->SetAttribute(name.c_str(), value.c_str()); } }
TiXmlElement* MasterFile::SaveXML( TiXmlElement* pRoot ) { TiXmlElement* pLoadedFiles = new TiXmlElement("Loaded_Files"); pRoot->LinkEndChild( pLoadedFiles ); TiXmlElement* pGirlsFiles = new TiXmlElement("Girls_Files"); pLoadedFiles->LinkEndChild( pGirlsFiles ); FileFlags::const_iterator it; for( it = files.begin(); it != files.end(); ++it ) { TiXmlElement* pFile = new TiXmlElement("File"); pGirlsFiles->LinkEndChild( pFile ); pFile->SetAttribute( "Filename", it->first ); } return pLoadedFiles; }
void FEEditorCanvas::Serialize(TiXmlDocument* _poXmlDoc, TiXmlElement* _poParent) { ElementPairMapIterator it = m_Elements.begin(); while(it != m_Elements.end()) { ElementPair* ePair = (*it).second; TiXmlElement* poPairData = new TiXmlElement("PairData"); _poParent->LinkEndChild(poPairData); poPairData->SetAttribute("id", (*it).first); ePair->m_RefElement->Serialize(_poXmlDoc, poPairData); ePair->m_FormationElement->Serialize(_poXmlDoc, poPairData); ++it; } }
void ClauncherDlg::OnNMReleasedcaptureSlider1(NMHDR *pNMHDR, LRESULT *pResult) { // retrieve configuration element TiXmlElement* sound = getConfigElement( "sound" ); assert( sound ); float volume = float( m_MusicVolume.GetPos() ) / 100.0f; if( volume < 0 ) volume = 0; if( volume > 1 ) volume = 1; char str[512]; sprintf( str, "%3.2f", volume ); sound->SetAttribute( "musicVolume", str ); // save config m_config->SaveFile(); *pResult = 0; }
void WriteVectorTerm(ParameterScalar PS[3], TiXmlElement &elem, const char* attr, bool mode, bool sci, const char delimiter) { stringstream ss; if (sci) ss << scientific; for (int i=0;i<3;++i) { if (PS[i].GetMode() && mode) ss << string("term:")+PS[i].GetString(); else if (PS[i].GetValue()==NAN) ss << "NAN" << endl; else ss << PS[i].GetValue(); if (i<2) ss << delimiter; } elem.SetAttribute(attr,ss.str().c_str()); }
void LayoutCellPane::toXml(TiXmlElement *xml) { TiXmlElement * inner; LayoutCell * lc; unsigned int count = this->m_vpCells.size(); unsigned int weight; if (this->m_nType == LayoutCellPane::HORZ) xml->SetAttribute("cascade", "h"); else if (this->m_nType == LayoutCellPane::VERT) xml->SetAttribute("cascade", "v"); if (count > 0) { for (unsigned int i = 0; i < count; i++) { lc = this->m_vpCells[i].first; weight = this->m_vpCells[i].second; inner = lc->toXml(); if (weight != 0) inner->SetAttribute("weight", weight); xml->LinkEndChild(inner); } } }
bool SimulationData_CudaSystem::saveConfiguration(const char* filename) { TiXmlDocument doc; TiXmlDeclaration * decl = new TiXmlDeclaration( "1.0", "", "" ); doc.LinkEndChild( decl ); TiXmlElement * elmt = new TiXmlElement( "Cuda_System_Material" ); doc.LinkEndChild(elmt); elmt->SetAttribute("name","Cuda_System_Material"); elmt->SetDoubleAttribute("visualizationRadius",this->particleRadius); elmt->SetDoubleAttribute("particle_mass",this->particleMass); elmt->SetDoubleAttribute("interactionRadius",this->interactionRadius); elmt->SetDoubleAttribute("spring",this->spring); elmt->SetDoubleAttribute("damping",this->damping); elmt->SetDoubleAttribute("shear",this->shear); elmt->SetDoubleAttribute("attraction",this->attraction); doc.SaveFile(filename); return true; }
bool cSubMenuNode::SaveXml(TiXmlElement * root ) { bool ok = true; if (root!=NULL) { TiXmlElement *e = NULL; switch(_type) { case SYSTEM: e = new TiXmlElement(TAG_SYSTEM); e->SetAttribute("name", GetName()); break; case COMMAND: e = new TiXmlElement(TAG_COMMAND); e->SetAttribute("name", GetName()); e->SetAttribute("execute", GetCommand()); if (_commandConfirm) e->SetAttribute("confirm", TRUE_STR); break; case PLUGIN: e = new TiXmlElement(TAG_PLUGIN); e->SetAttribute("name", GetName()); break; case MENU: e = new TiXmlElement(TAG_MENU); e->SetAttribute("name", GetName()); break; case UNDEFINED: default: ok=false; break; } if (ok) { root->LinkEndChild(e); if (HasSubMenus()) { for (cSubMenuNode *node = _subMenus.First(); node; node = _subMenus.Next(node)) { node->SaveXml(e); } } } } else { return false; } return ok; }