1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_soltools.hxx" 30 31 32 #include <st_gilrw.hxx> 33 34 #include <gen_info.hxx> 35 #include <gi_list.hxx> 36 #include <gi_parse.hxx> 37 #include <simstr.hxx> 38 #include <st_list.hxx> 39 40 41 using namespace std; 42 43 44 ST_InfoListReader::ST_InfoListReader() 45 { 46 dpParser = new GenericInfo_Parser; 47 } 48 49 ST_InfoListReader::~ST_InfoListReader() 50 { 51 delete dpParser; 52 } 53 54 55 bool 56 ST_InfoListReader::LoadList( List_GenericInfo & o_rList, 57 const Simstr & i_sFileName ) 58 { 59 aListStack.push_back(&o_rList); 60 return dpParser->LoadList(*this, i_sFileName); 61 } 62 63 ST_InfoListReader::E_Error 64 ST_InfoListReader::GetLastError( UINT32 * o_pErrorLine ) const 65 { 66 return dpParser->GetLastError(o_pErrorLine); 67 } 68 69 void 70 ST_InfoListReader::AddKey( const char * i_sKey, 71 UINT32 i_nKeyLength, 72 const char * i_sValue, 73 UINT32 i_nValueLength, 74 const char * i_sComment, 75 UINT32 i_nCommentLength ) 76 { 77 Simstr sKey(i_sKey, i_nKeyLength); 78 Simstr sValue(i_sValue, i_nValueLength); 79 Simstr sComment(i_sComment, i_nCommentLength); 80 81 pCurKey = new GenericInfo(sKey, sValue, sComment); 82 aListStack.back()->InsertInfo( pCurKey ); 83 } 84 85 void 86 ST_InfoListReader::OpenList() 87 { 88 if ( pCurKey == 0 ) 89 { 90 cerr << "error: '{' without key found." << endl; 91 exit(1); 92 } 93 94 aListStack.push_back( & pCurKey->SubList() ); 95 } 96 97 void 98 ST_InfoListReader::CloseList() 99 { 100 if ( aListStack.size() == 0 ) 101 { 102 cerr << "error: '}' without corresponding '}' found." << endl; 103 exit(1); 104 } 105 106 aListStack.pop_back(); 107 } 108 109 110 #if 0 111 ST_InfoListWriter::ST_InfoListWriter() 112 { 113 114 } 115 116 ST_InfoListWriter::~ST_InfoListWriter() 117 118 bool 119 ST_InfoListWriter::SaveList( const Simstr & i_sFileName, 120 List_GenericInfo & io_rList ) 121 { 122 123 } 124 125 E_Error 126 ST_InfoListWriter::GetLastError() const 127 { 128 return dpParser->GetLastError(o_pErrorLine); 129 } 130 131 bool 132 ST_InfoListWriter::Start_CurList() 133 { 134 135 } 136 137 bool 138 ST_InfoListWriter::NextOf_CurList() 139 { 140 141 } 142 143 void 144 ST_InfoListWriter::Get_CurKey( char * o_rKey ) const 145 { 146 147 } 148 149 void 150 ST_InfoListWriter::Get_CurValue( char * o_rValue ) const 151 { 152 153 } 154 155 void 156 ST_InfoListWriter::Get_CurComment( char * o_rComment ) const 157 { 158 159 } 160 161 bool 162 ST_InfoListWriter::HasSubList_CurKey() const 163 { 164 165 } 166 167 void 168 ST_InfoListWriter::Push_CurList() 169 { 170 171 } 172 173 void 174 ST_InfoListWriter::Pop_CurList() 175 { 176 177 } 178 #endif 179 180 181