void OGRDXFDataSource::ReadHeaderSection() { char szLineBuf[257]; int nCode; while( (nCode = ReadValue( szLineBuf, sizeof(szLineBuf) )) > -1 && !EQUAL(szLineBuf,"ENDSEC") ) { if( nCode != 9 ) continue; CPLString osName = szLineBuf; ReadValue( szLineBuf, sizeof(szLineBuf) ); CPLString osValue = szLineBuf; oHeaderVariables[osName] = osValue; } CPLDebug( "DXF", "Read %d header variables.", (int) oHeaderVariables.size() ); }
int NameAttributeText::Compare(WidgetAttributeText &attr, BPoseView *view) { NameAttributeText *compareTo = dynamic_cast<NameAttributeText *>(&attr); ASSERT(compareTo); if (fValueDirty) ReadValue(&fFullValueText); if (NameAttributeText::sSortFolderNamesFirst) return fModel->CompareFolderNamesFirst(attr.TargetModel()); return NaturalCompare(fFullValueText.String(), compareTo->ValueAsText(view)); }
bool GenericAttributeText::CheckAttributeChanged() { GenericValueStruct tmpValue = fValue; BString tmpString(fFullValueText); ReadValue(&fFullValueText); // fDirty could already be true, in that case we mustn't set it to // false, even if the attribute text hasn't changed bool changed = (fValue.int64t != tmpValue.int64t) || (tmpString != fFullValueText); if (changed) fDirty = true; return fDirty; }
int RealNameAttributeText::Compare(WidgetAttributeText& attr, BPoseView* view) { RealNameAttributeText* compareTo = dynamic_cast<RealNameAttributeText*>(&attr); ThrowOnAssert(compareTo != NULL); if (fValueDirty) ReadValue(&fFullValueText); if (RealNameAttributeText::sSortFolderNamesFirst) return fModel->CompareFolderNamesFirst(attr.TargetModel()); return NaturalCompare(fFullValueText.String(), compareTo->ValueAsText(view)); }
/***************************************************************************** * FUNCTION * mmi_brw_recent_pages_read_sorting_method * DESCRIPTION * Function to read settings from NVRAM * PARAMETERS * void * RETURNS * void *****************************************************************************/ void mmi_brw_recent_pages_read_sorting_method(void) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ S16 NvramError; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ ReadValue(NVRAM_BRW_RECENT_PAGES_SORTING_METHOD, &(g_brw_cntx.sorting_method), DS_BYTE, &NvramError); if (g_brw_cntx.sorting_method == 0xFF) { g_brw_cntx.sorting_method = WAP_CUSTOM_CFG_DEFAULT_SORTING_METHOD; WriteValue(NVRAM_BRW_RECENT_PAGES_SORTING_METHOD, &(g_brw_cntx.sorting_method), DS_BYTE, &NvramError); } }
bool RegKey::ReadValueDW(const wchar_t* name, DWORD* value) { DCHECK(value); DWORD type = REG_DWORD; DWORD size = sizeof(DWORD); DWORD result = 0; if(ReadValue(name, &result, &size, &type) && (type==REG_DWORD || type==REG_BINARY) && size==sizeof(DWORD)) { *value = result; return true; } return false; }
void CVisProp::ReadValue(CVisSDIStream& refsdistream, bool fOnlyValue, const void *pvReferenceOffset) { if (fOnlyValue) { // We assume that the type and name have already been read and that // storage for the object has been allocated. assert(IsValid()); if (IsArray()) { void *pvObjFirst = PRefCntArray()->PvObjFirst(); if ((pvReferenceOffset != 0) && (IsObjReference())) { pvObjFirst = (void *) (((BYTE *) pvObjFirst) + ((int) pvReferenceOffset)); } m_pproptypeinfo->ReadObjArray(refsdistream, Dim(), pvObjFirst); } else { void *pvObj = PvObj(); if ((pvReferenceOffset != 0) && (IsObjReference())) { pvObj = (void *) (((BYTE *) pvObj) + ((int) pvReferenceOffset)); } m_pproptypeinfo->ReadObj(refsdistream, pvObj); } } else { #ifndef VIS_NO_SD_STREAM // Need to read type and name and then create storate for object. std::string strType; std::string strName; bool fShared; CVisDim dim; refsdistream.ReadTypeNameAndDim(strType, strName, dim, &fShared); SetTypeNameAndDim(strType.c_str(), strName.c_str(), dim, fShared); ReadValue(refsdistream, true, pvReferenceOffset); refsdistream.EndObj(); #endif // VIS_NO_SD_STREAM } }
virtual void OnClick(Point pt, int widget, int click_count) { const NWidgetBase *wid = this->GetWidget<NWidgetBase>(CW_PANEL); uint btn = (pt.y - wid->pos_y - WD_FRAMERECT_TOP - this->header_height) / (FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL); uint x = pt.x - wid->pos_x; bool rtl = _current_text_dir == TD_RTL; if (rtl) x = wid->current_x - x; if (btn >= lengthof(_cheats_ui)) return; const CheatEntry *ce = &_cheats_ui[btn]; int value = (int32)ReadValue(ce->variable, ce->type); int oldvalue = value; if (btn == CHT_CHANGE_DATE && x >= 40) { /* Click at the date text directly. */ SetDParam(0, value); ShowQueryString(STR_JUST_INT, STR_CHEAT_CHANGE_DATE_QUERY_CAPT, 8, this, CS_NUMERAL, QSF_ACCEPT_UNCHANGED); return; } /* Not clicking a button? */ if (!IsInsideMM(x, 20, 40)) return; *ce->been_used = true; switch (ce->type) { case SLE_BOOL: value ^= 1; if (ce->proc != NULL) ce->proc(value, 0); break; default: /* Take whatever the function returns */ value = ce->proc(value + ((x >= 30) ? 1 : -1), (x >= 30) ? 1 : -1); /* The first cheat (money), doesn't return a different value. */ if (value != oldvalue || btn == CHT_MONEY) this->clicked = btn * 2 + 1 + ((x >= 30) != rtl ? 1 : 0); break; } if (value != oldvalue) WriteValue(ce->variable, ce->type, (int64)value); this->flags4 |= WF_TIMEOUT_BEGIN; this->SetDirty(); }
typename std::enable_if<is_map_container<T>::value>::type ReadObject(T&& t, Value& v) { using U = typename std::decay<T>::type; size_t sz = v.Size(); for (size_t i = 0; i < sz; i++) { Value& element = v[i]; typename U::key_type key; typename U::value_type::second_type value; ReadValue(key, element["0"], i); //key ReadObject(value, element["1"]); //value t.emplace(key, value); } }
bool NDataReader::ReadValue(LPCTSTR name, DWORD& value) { nui::Base::NString data; if(!ReadValue(name, data)) return false; if(data.GetLength() == 0) return false; bool result = false; if(data[0] == _T('#')) { if(data.GetLength() == 7) { result = _sntscanf(data.GetData() + 1, 6, _T("%x"), &value) == 1; value = Ui::MakeArgb(0xFF, (BYTE)((value & 0xFF0000) >> 16), (BYTE)((value & 0xFF00) >> 8), (BYTE)(value & 0xFF)); } else if(data.GetLength() == 9)
static void RefreshAddresses(WATCHDATA *ptr, VARINFO *var, int address, THREAD *thread, int noscope) { ptr->structNesting[ptr->nestingCount++] = var; while (var) { char buf[1048]; int unscope = noscope; var->scope = ptr->structNesting[0]->scope; if (noscope) var->outofscope = TRUE; else { int val; var->outofscope = FALSE; if (thread) var->thread = thread; if (var->offset == -1) { DEBUG_INFO *dbg; int i; char name[2048]; name[0] = 0; for (i=0; i < ptr->nestingCount-1; i++) sprintf(name + strlen(name), "%s", ptr->structNesting[i]->structtag); sprintf(name + strlen(name), "@%s", var->membername); dbg = findDebug(ptr->structNesting[0]->scope->address); val = var->address = GetSymbolAddress(dbg, name); // static member data } else { val = var->address = address + var->offset; } if (var->constant) val = var->address; else if (var->pointer) { unscope = ((val = var->derefaddress) == -1 && !ReadValue(var->address, &val, 4, var)) || !val; } RefreshAddresses(ptr, var->subtype, val, thread, unscope); } var = var->link; } ptr->nestingCount--; }
void OpenWithRelationAttributeText::FitValue(BString* outString, const BPoseView* view) { if (fValueDirty) ReadValue(); ASSERT(view == fPoseView); const OpenWithPoseView* launchWithView = dynamic_cast<const OpenWithPoseView*>(view); if (launchWithView != NULL) launchWithView->OpenWithRelationDescription(fModel, &fRelationText); fOldWidth = fColumn->Width(); fTruncatedWidth = TruncString(outString, fRelationText.String(), fRelationText.Length(), view, fOldWidth, B_TRUNCATE_END); fDirty = false; }
void CheckboxAttributeText::FitValue(BString* outString, const BPoseView* view) { if (fValueDirty) ReadValue(&fFullValueText); fOldWidth = fColumn->Width(); fDirty = false; if (!fValueIsDefined) { *outString = fOffChar; fTruncatedWidth = TruncString(outString, fFullValueText.String(), fFullValueText.Length(), view, fOldWidth); return; } bool checked = false; switch (fColumn->AttrType()) { case B_BOOL_TYPE: checked = fValue.boolt; break; case B_INT8_TYPE: case B_UINT8_TYPE: checked = fValue.int8t != 0; break; case B_INT16_TYPE: case B_UINT16_TYPE: checked = fValue.int16t != 0; break; case B_INT32_TYPE: case B_UINT32_TYPE: checked = fValue.int32t != 0; break; } fFullValueText = checked ? fOnChar : fOffChar; fTruncatedWidth = TruncString(outString, fFullValueText.String(), fFullValueText.Length(), view, fOldWidth); }
// ELEMENT を読み込む ELEMENT *ReadElement(BUF *b) { UINT i; char name[MAX_ELEMENT_NAME_LEN + 1]; UINT type, num_value; VALUE **values; ELEMENT *e; // 引数チェック if (b == NULL) { return NULL; } // 名前 if (ReadBufStr(b, name, sizeof(name)) == false) { return NULL; } // 項目の種類 type = ReadBufInt(b); // 項目数 num_value = ReadBufInt(b); if (num_value > MAX_VALUE_NUM) { // 個数オーバー return NULL; } // VALUE values = (VALUE **)Malloc(sizeof(VALUE *) * num_value); for (i = 0;i < num_value;i++) { values[i] = ReadValue(b, type); } // ELEMENT を作成 e = NewElement(name, type, num_value, values); Free(values); return e; }
void OGRDXFDataSource::ReadLayerDefinition() { char szLineBuf[257]; int nCode; std::map<CPLString,CPLString> oLayerProperties; CPLString osLayerName = ""; while( (nCode = ReadValue( szLineBuf, sizeof(szLineBuf) )) > 0 ) { switch( nCode ) { case 2: osLayerName = szLineBuf; oLayerProperties["Exists"] = "1"; break; case 6: oLayerProperties["Linetype"] = szLineBuf; break; case 62: oLayerProperties["Color"] = szLineBuf; break; case 70: oLayerProperties["Flags"] = szLineBuf; break; case 370: case 39: oLayerProperties["LineWeight"] = szLineBuf; break; default: break; } } if( oLayerProperties.size() > 0 ) oLayerTable[osLayerName] = oLayerProperties; UnreadValue(); }
void OGRDXFDataSource::ReadLineTypeDefinition() { char szLineBuf[257]; int nCode; CPLString osLineTypeName; CPLString osLineTypeDef; while( (nCode = ReadValue( szLineBuf, sizeof(szLineBuf) )) > 0 ) { switch( nCode ) { case 2: osLineTypeName = ACTextUnescape(szLineBuf,GetEncoding()); break; case 49: { if( osLineTypeDef != "" ) osLineTypeDef += " "; if( szLineBuf[0] == '-' ) osLineTypeDef += szLineBuf+1; else osLineTypeDef += szLineBuf; osLineTypeDef += "g"; } break; default: break; } } if( osLineTypeDef != "" ) oLineTypeTable[osLineTypeName] = osLineTypeDef; if( nCode == 0 ) UnreadValue(); }
// Returns the key value as a bool type. Returns false if the key is // not found. bool IniFile::ReadBool(const string& mKey, const string& szSection, bool def_value) { bool bValue = def_value; string mValue = ReadValue(mKey, szSection); if(mWasFound) { if ( mValue.find("1") == 0 || compareNoCase(mValue, "true") == 0 || compareNoCase(mValue, "yes") == 0 ) { bValue = true; } else { bValue = false; } } return bValue; }
//------------------------------------------------------------------------------ BOOL isWine() { HKEY CleTmp=0; if (RegOpenKey(HKEY_LOCAL_MACHINE,"Software\\Wine",&CleTmp)==ERROR_SUCCESS) { RegCloseKey(CleTmp); return TRUE; } //deuxième cas char tmp[MAX_PATH]=""; if(ReadValue(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug","Debugger",tmp, MAX_PATH)) { if (Contient(tmp,"winedbg")) { return TRUE; } } return FALSE; }
void LoadConfigDisplayAttr(int no) { std::wstring strxmlval; BOOL se; TF_DISPLAYATTRIBUTE da; for(int i = 0; i < _countof(displayAttr[no]) && displayAttr[no][i].key != nullptr; i++) { ReadValue(pathconfigxml, SectionDisplayAttr, displayAttr[no][i].key, strxmlval); if(!strxmlval.empty()) { if(swscanf_s(strxmlval.c_str(), displayAttrFormat, &se, &da.crText.type, &da.crText.cr, &da.crBk.type, &da.crBk.cr, &da.lsStyle, &da.fBoldLine, &da.crLine.type, &da.crLine.cr, &da.bAttr) == 10) { displayAttr[no][i].se = se; displayAttr[no][i].da = da; } } } }
bool JsonString::ReadObject(Token &tokenstart) { Token tokenname; while(ReadToken(tokenname)) { if(tokenname.type_ == tokenObjectEnd) { return true; } if(tokenname.type_ != tokenString) { break; } Token colon; if(!ReadToken(colon) || colon.type_ != tokenMemberSeparator) { return false; } bool ok = ReadValue(); if(!ok) { return false; } Token comma; if(!ReadToken(comma) ||(comma.type_ != tokenObjectEnd && comma.type_ != tokenArraySeparator)) { return false; } if(comma.type_ == tokenObjectEnd) { return true; } } return false; }
void RefreshAddresses(VARINFO *var, int address, THREAD *thread, int noscope) { while (var) { int unscope = noscope; int val; if (noscope) var->outofscope = TRUE; else { var->outofscope = FALSE; if (thread) var->thread = thread; val = var->address = address + var->offset; if (var->pointer) { unscope = (val = var->derefaddress) == -1 && !ReadValue(var->address, &val, 4, var) || !val; } } RefreshAddresses(var->subtype, val, thread, unscope); var = var->link; } }
static void ExpandPointer(VARINFO *v, int code, WATCHDATA *ptr) { if (v->pointer) { if (code == TVE_EXPAND) { int val; int outofscope; outofscope = ((val = v->derefaddress) == -1 && !ReadValue(v->address, &val, 4, v)) || !val; if (!v->subtype && ptr->watchinfo_list[v->watchindex].dbg_info) { TreeView_DeleteItem(ptr->hwndWatchTree, v->hTreeHolder); ExpandPointerInfo(ptr->watchinfo_list[v->watchindex].dbg_info, v); if (v->subtype->structure) { InsertSubTree(v->hTreeItem, 0, v->subtype->subtype, v->watchindex, ptr); } else InsertSubTree(v->hTreeItem, 0, v->subtype, v->watchindex, ptr); } ptr->structNesting[ptr->nestingCount++] = v; RefreshAddresses(ptr, v->subtype, val, NULL, outofscope); ptr->nestingCount--; RefreshData(ptr->watchinfo_list[v->watchindex].dbg_info, v, TRUE); } else if (code == TVE_COLLAPSE) { if (v->subtype && !v->derefaddress) { FreeTree(v->subtype, ptr); FreeVarInfo(v->subtype); v->subtype = 0; v->hTreeHolder = InsertItem(v->hTreeItem, TVI_LAST, v, ptr); } } } }
/***************************************************************************** * FUNCTION * mmi_ssc_handle_venus_debug_panel * DESCRIPTION * SSC handler for Venus UI Debug Panel * PARAMETERS * void * RETURNS * void *****************************************************************************/ void mmi_ssc_venus_debug_panel(void) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ PU8 items[2]; U8* gui_buffer; S16 error; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ if (!mmi_frm_scrn_enter(GRP_ID_ROOT, SCR_ENTER_SSC, NULL, mmi_ssc_venus_debug_panel, MMI_FRM_FULL_SCRN)) { return; } ReadValue(NVRAM_VENUS_DEBUG_PANEL_ENABLE, &debug_panel_enabled, DS_BYTE, &error); items[0] = (PU8)GetString(STR_GLOBAL_ON); items[1] = (PU8)GetString(STR_GLOBAL_OFF); gui_buffer = mmi_frm_scrn_get_active_gui_buf(); RegisterHighlightHandler(mmi_ssc_venus_debug_panel_hilite_hdlr); ShowCategory36Screen( STR_ID_EM_PROFILING_VENUS_DEBUG_PANEL, 0, STR_GLOBAL_OK, IMG_GLOBAL_OK, STR_GLOBAL_BACK, IMG_GLOBAL_BACK, 2, (PU8*)items, debug_panel_enabled ? 0 : 1, gui_buffer); EnableCenterSoftkey(0, IMG_GLOBAL_COMMON_CSK); SetLeftSoftkeyFunction(mmi_ssc_venus_debug_panel_done, KEY_EVENT_UP); SetRightSoftkeyFunction(mmi_frm_scrn_close_active_id, KEY_EVENT_UP); }
static int resolvenametoaddr(char *name, int doErrors, DWORD *size, DWORD *addr) { DEBUG_INFO *dbg; VARINFO *var; var = EvalExpr(&dbg, &lastScope, name, doErrors); if (var) { if (var->constant) { *addr = var->ival; *size = 4; } else if (var->address < 0x1000) { char data[20]; //if (!var->explicitreg) //ExtendedMessageBox("Address error", MB_SETFOREGROUND | //MB_SYSTEMMODAL, //"Address is a register. Using its value as the address."); ReadValue(var->address, &data, 4, var); *addr = *(int*)data; *size = 4; } else { *addr = var->address; *size = var->size; } FreeVarInfo(var); return 1; } else { return 0; } }
static void RefreshData(DEBUG_INFO *dbg_info, VARINFO *var, BOOL adding) { while (var) { char localbf[256]; if (!adding) strcpy(localbf, var->value); if ((var->lref || var->rref) && var->type < eReservedTop && var->type > eVoid) { VARINFO q = *var; q.pointer = q.rref = q.lref = 0; if (!ReadValue(var->address, &q.address, 4, var)) { sprintf(var->value, "REFERENCE: <UNKNOWN>"); } else { WatchValue(dbg_info, var->value, &q, FALSE); } } else { RefreshData(dbg_info, var->subtype, adding); WatchValue(dbg_info, var->value, var, FALSE); } if (!adding && strcmp(localbf, var->value)) { var->watchhead.col2Color = 0xff; } else { var->watchhead.col2Color = 0; } var = var->link; } }
bool JsonString::ReadArray(Token &tokenstart) { SkipSpace(); if(*current_ == ']') { Token endArray; ReadToken(endArray); return true; } int index = 0; while(true) { bool ok = ReadValue(); if(!ok) { return false; } Token token; ok = ReadToken(token); bool badTokentype = (token.type_ == tokenArraySeparator && token.type_ == tokenArrayEnd); if( !ok & badTokentype) { return false; } if(token.type_ == tokenArrayEnd) { break; } } return true; }
bool RegKey::ReadValue(const wchar_t* name, std::wstring* value) { DCHECK(value); const size_t kMaxStringLength = 1024; // 展开后的长度. // 如果1024太小, 使用其它ReadValue方式. wchar_t raw_value[kMaxStringLength]; DWORD type = REG_SZ, size = sizeof(raw_value); if(ReadValue(name, raw_value, &size, &type)) { if(type == REG_SZ) { *value = raw_value; } else if(type == REG_EXPAND_SZ) { wchar_t expanded[kMaxStringLength]; size = ExpandEnvironmentStrings(raw_value, expanded, kMaxStringLength); // 成功: 返回拷贝的字符串长度. // 失败: 如果缓冲区太小返回需要的长度. // 失败: 其它返回0. if(size==0 || size>kMaxStringLength) { return false; } *value = expanded; } else { // 不是字符串. return false; } return true; } return false; }
const char* TiXmlElement::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ) { p = SkipWhiteSpace( p, encoding ); TiXmlDocument* document = GetDocument(); if ( !p || !*p ) { if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT, 0, 0, encoding ); return 0; } if ( data ) { data->Stamp( p, encoding ); location = data->Cursor(); } if ( *p != '<' ) { if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT, p, data, encoding ); return 0; } p = SkipWhiteSpace( p+1, encoding ); // Read the name. const char* pErr = p; p = ReadName( p, &value, encoding ); if ( !p || !*p ) { if ( document ) document->SetError( TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME, pErr, data, encoding ); return 0; } TIXML_STRING endTag ("</"); endTag += value; // Check for and read attributes. Also look for an empty // tag or an end tag. while ( p && *p ) { pErr = p; p = SkipWhiteSpace( p, encoding ); if ( !p || !*p ) { if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, pErr, data, encoding ); return 0; } if ( *p == '/' ) { ++p; // Empty tag. if ( *p != '>' ) { if ( document ) document->SetError( TIXML_ERROR_PARSING_EMPTY, p, data, encoding ); return 0; } return (p+1); } else if ( *p == '>' ) { // Done with attributes (if there were any.) // Read the value -- which can include other // elements -- read the end tag, and return. ++p; p = ReadValue( p, data, encoding ); // Note this is an Element method, and will set the error if one happens. if ( !p || !*p ) { // We were looking for the end tag, but found nothing. // Fix for [ 1663758 ] Failure to report error on bad XML if ( document ) document->SetError( TIXML_ERROR_READING_END_TAG, p, data, encoding ); return 0; } // We should find the end tag now // note that: // </foo > and // </foo> // are both valid end tags. if ( StringEqual( p, endTag.c_str(), false, encoding ) ) { p += endTag.length(); p = SkipWhiteSpace( p, encoding ); if ( p && *p && *p == '>' ) { ++p; return p; } if ( document ) document->SetError( TIXML_ERROR_READING_END_TAG, p, data, encoding ); return 0; } else { if ( document ) document->SetError( TIXML_ERROR_READING_END_TAG, p, data, encoding ); return 0; } } else { // Try to read an attribute: TiXmlAttribute* attrib = new TiXmlAttribute(); if ( !attrib ) { return 0; } attrib->SetDocument( document ); pErr = p; p = attrib->Parse( p, data, encoding ); if ( !p || !*p ) { if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT, pErr, data, encoding ); delete attrib; return 0; } // Handle the strange case of double attributes: #ifdef TIXML_USE_STL TiXmlAttribute* node = attributeSet.Find( attrib->NameTStr() ); #else TiXmlAttribute* node = attributeSet.Find( attrib->Name() ); #endif if ( node ) { if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT, pErr, data, encoding ); delete attrib; return 0; } attributeSet.Add( attrib ); } } return p; }
bool CTMDParser::Parse( CTMDParsedData* pData, char* szFileName ) { try{ m_szLineData = new char [255]; m_pFile = fopen(szFileName, "rb"); if( NULL == m_pFile ) throw("함수명 : %s, 라인 : %d \n", __FUNCTION__, __LINE__); // parsing start //========================================================================================================================== if(!DataVerification(ReadLine(), "*MAP")) throw("함수명 : %s, 라인 : %d \n", __FUNCTION__, __LINE__); ReadValue(pData->MapInfo.MAP_MAPNAME, ReadLine()); ReadValue(pData->MapInfo.MAP_MAPTYPE, ReadLine()); ReadValue(pData->MapInfo.MAP_STATICOBJNUM, ReadLine()); ReadValue(pData->MapInfo.MAP_DYNAMICOBJNUM, ReadLine()); ReadValue(pData->MapInfo.MAP_MUSICNAME, ReadLine()); pData->StaticObject.reserve(pData->MapInfo.MAP_STATICOBJNUM); pData->DynamicObject.reserve(pData->MapInfo.MAP_DYNAMICOBJNUM); if(!DataVerification(ReadLine(), "}")) throw("함수명 : %s, 라인 : %d \n", __FUNCTION__, __LINE__); //========================================================================================================================== if(!DataVerification(ReadLine(), "*MAPDATA")) throw("함수명 : %s, 라인 : %d \n", __FUNCTION__, __LINE__); ReadValue(pData->BackInfo.BACK_BACKGNDTEXNAME, ReadLine()); ReadValue(pData->BackInfo.BACK_BACKGNDRECT, ReadLine()); if(!DataVerification(ReadLine(), "}")) throw("함수명 : %s, 라인 : %d \n", __FUNCTION__, __LINE__); //========================================================================================================================== if(!DataVerification(ReadLine(), "*OBJECT")) throw("함수명 : %s, 라인 : %d \n", __FUNCTION__, __LINE__); // Static Object //========================================================================================================================== if(!DataVerification(ReadLine(), "*STATIC_OBJECT")) throw("함수명 : %s, 라인 : %d \n", __FUNCTION__, __LINE__); SOBJECT* pSObj; if( 0 != pData->MapInfo.MAP_STATICOBJNUM ) pSObj= new SOBJECT [pData->MapInfo.MAP_STATICOBJNUM]; for(unsigned int i=0; i < pData->MapInfo.MAP_STATICOBJNUM ; i++){ if(!DataVerification(ReadLine(), "*SOBJECT")) continue; ReadValue(pSObj[i].SOBJECT_TEXNAME, ReadLine()); ReadValue(pSObj[i].SOBJECT_POS, ReadLine()); ReadValue(pSObj[i].SOBJECT_RECT, ReadLine()); ReadValue(pSObj[i].SOBJECT_COLOR, ReadLine()); ReadValue(pSObj[i].SOBJECT_BBOXDATA, ReadLine()); ReadValue(pSObj[i].SOBJECT_COLTYPE, ReadLine()); pData->StaticObject.push_back(&pSObj[i]); if(!DataVerification(ReadLine(), "}")) throw("함수명 : %s, 라인 : %d \n", __FUNCTION__, __LINE__); } if(!DataVerification(ReadLine(), "}")) throw("함수명 : %s, 라인 : %d \n", __FUNCTION__, __LINE__); //========================================================================================================================== // Dynamic Object if(!DataVerification(ReadLine(), "*DYNAMIC_OBJECT")) throw("함수명 : %s, 라인 : %d \n", __FUNCTION__, __LINE__); DOBJECT* pDObj; if( 0 != pData->MapInfo.MAP_DYNAMICOBJNUM ) pDObj = new DOBJECT [pData->MapInfo.MAP_DYNAMICOBJNUM]; for(unsigned int j=0; j < pData->MapInfo.MAP_DYNAMICOBJNUM ; j++){ if(!DataVerification(ReadLine(), "*DOBJECT")) continue; ReadValue(pDObj[j].DOBJECT_CLASS, ReadLine()); ReadValue(pDObj[j].DOBJECT_TEXNAME, ReadLine()); ReadValue(pDObj[j].DOBJECT_POS, ReadLine()); ReadValue(pDObj[j].DOBJECT_COLOR, ReadLine()); ReadValue(pDObj[j].DOBJECT_BBOXDATA, ReadLine()); ReadValue(pDObj[j].DOBJECT_COLTYPE, ReadLine()); pData->DynamicObject.push_back(&pDObj[j]); if(!DataVerification(ReadLine(), "}")) throw("SpotParser.cpp Error line 89"); } if(!DataVerification(ReadLine(), "}")) throw("함수명 : %s, 라인 : %d \n", __FUNCTION__, __LINE__); //========================================================================================================================== // parsing end fclose(m_pFile); SAFE_DELETE(m_szLineData); }catch(char* errmsg){ ::MessageBox(NULL, errmsg, "Error", MB_OK); fclose(m_pFile); SAFE_DELETE(m_szLineData); return false; } return true; }
const char* TiXmlElement::Parse( const char* p, TiXmlParsingData* data ) { p = SkipWhiteSpace( p ); TiXmlDocument* document = GetDocument(); if ( !p || !*p ) { if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT, 0, 0 ); return 0; } // TiXmlParsingData data( p, prevData ); if ( data ) { data->Stamp( p ); location = data->Cursor(); } if ( *p != '<' ) { if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT, p, data ); return 0; } p = SkipWhiteSpace( p+1 ); // Read the name. const char* pErr = p; p = ReadName( p, &value ); if ( !p || !*p ) { if ( document ) document->SetError( TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME, pErr, data ); return 0; } TIXML_STRING endTag ("</"); endTag += value; endTag += ">"; // Check for and read attributes. Also look for an empty // tag or an end tag. while ( p && *p ) { pErr = p; p = SkipWhiteSpace( p ); if ( !p || !*p ) { if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, pErr, data ); return 0; } if ( *p == '/' ) { ++p; // Empty tag. if ( *p != '>' ) { if ( document ) document->SetError( TIXML_ERROR_PARSING_EMPTY, p, data ); return 0; } return (p+1); } else if ( *p == '>' ) { // Done with attributes (if there were any.) // Read the value -- which can include other // elements -- read the end tag, and return. ++p; p = ReadValue( p, data ); // Note this is an Element method, and will set the error if one happens. if ( !p || !*p ) return 0; // We should find the end tag now if ( StringEqual( p, endTag.c_str(), false ) ) { p += endTag.length(); return p; } else { if ( document ) document->SetError( TIXML_ERROR_READING_END_TAG, p, data ); return 0; } } else { // Try to read an attribute: TiXmlAttribute* attrib = new TiXmlAttribute(); if ( !attrib ) { if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY, pErr, data ); return 0; } attrib->SetDocument( document ); const char* pErr = p; p = attrib->Parse( p, data ); if ( !p || !*p ) { if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT, pErr, data ); delete attrib; return 0; } // Handle the strange case of double attributes: TiXmlAttribute* node = attributeSet.Find( attrib->Name() ); if ( node ) { node->SetValue( attrib->Value() ); delete attrib; return 0; } attributeSet.Add( attrib ); } } return p; }