static PyObject* TextParser_changeNode(PyObject* self, PyObject* args) { PyObject* handle; const char* label; if(!PyArg_ParseTuple(args, "Os", &handle, &label)) { return NULL; } TextParser* tp = static_cast<TextParser*>(PyCObject_AsVoidPtr(handle)); int ret = tp->changeNode(label); return Py_BuildValue("i", ret); }
// ################################################################# // TextParserでのParse CDM::E_CDM_ERRORCODE //cdm_FieldFileNameFormat::Read(TextParser *tp) cdm_FieldFileNameFormat::Read(cdm_TextParser tpCntl) { //TP TextParser *tp = tpCntl.getTPPtr(); if( !tp ) { return CDM::E_CDM_ERROR_TEXTPARSER; } vector<string> top_label; ///< カレントの子ノードのラベル格納 tp->getNodes(top_label); //FieldFileNameFormatタグがある int cnt=0; for(int i=0; i< top_label.size(); i++) { if( (strcasecmp(top_label[i].c_str(),"FieldFileNameFormat") == 0 ) ) cnt ++; } if( cnt<1 ) return CDM::E_CDM_ERROR_UNDEFINED_FIELDFILENAMEFORMAT; vector<string> label; ///< FieldFileNameFormat子ノードのラベル格納 //FieldFileNameFormatタグへの移動 tp->changeNode("FieldFileNameFormat"); //FieldFileNameFormatの子ノードを取得 tp->getNodes(label,2); //FieldFileNameFormatの子ノード数のループ for(int i=0; i<label.size(); i++) { //FieldFileNameFormatElemのインスタンス cdm_FieldFileNameFormatElem elem(label[i]); //FieldFileNameFormatElemのパース if( elem.Read(tp) ) { //FieldFileNameFormatElemをmapに追加 AddFieldFileNameFormatElem(elem); } else { return CDM::E_CDM_ERROR; } } return CDM::E_CDM_SUCCESS; }