int XMLWriter::BeginNode(CString name) { depth += 4; PrepareOffset(); // update children list of the parent if (!has_children.empty()) { bool child = has_children.back(); if (!child) { has_children.pop_back(); has_children.push_back(true); } bool p = in_params.back(); if (p) { ret += _T(">\n"); in_params.pop_back(); in_params.push_back(false); } } stack.push_back(name); has_children.push_back(false); has_params.push_back(false); in_params.push_back(true); if (use_depth) ret += offset_string; ret += _T("<") + name; // hlbka v urovniach... return ((depth+4)>>2); }
int XMLWriter::EndNode() { bool child = has_children.back(); bool param = has_params.back(); CString name = stack.back(); if (child) { if (use_depth) ret += offset_string; ret += _T("</") + name + _T(">\n"); } else { if (!param) { ret += _T(" />\n"); } else { ret += _T("/>\n"); } } depth -= 4; if (use_depth) PrepareOffset(); has_children.pop_back(); has_params.pop_back(); in_params.pop_back(); stack.pop_back(); return ((depth+4)>>2); }
void zst_save(FILE *fp, bool Thumbnail, bool Compress) { PrepareOffset(); PrepareSaveState(); unpackfunct(); if (SFXEnable) { SfxRomBuffer -= SfxCROM; SfxLastRamAdr -= SfxRAMMem; } if (SA1Enable) { SaveSA1(); //Convert SA-1 stuff to standard, non displacement format } if (!Compress || !zst_save_compressed(fp)) //If we don't want compressed or compression failed { fwrite(zst_header_cur, 1, sizeof(zst_header_cur)-1, fp); //-1 for null fhandle = fp; //Set global file handle copy_state_data(0, write_save_state_data, csm_save_zst_new); if (Thumbnail) { CapturePicture(); fwrite(PrevPicture, 1, 64*56*sizeof(unsigned short), fp); } } if (SFXEnable) { SfxRomBuffer += SfxCROM; SfxLastRamAdr += SfxRAMMem; } if (SA1Enable) { RestoreSA1(); //Convert back SA-1 stuff } ResetOffset(); ResetState(); }