impstr.cpp

Go to the documentation of this file.
00001 // $Id: impstr.cpp 1282 2006-06-09 09:46:49Z alex $
00002 // Implements a class used when importing string records in the v2 file format
00003 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
00004 ================================XARAHEADERSTART===========================
00005  
00006                Xara LX, a vector drawing and manipulation program.
00007                     Copyright (C) 1993-2006 Xara Group Ltd.
00008        Copyright on certain contributions may be held in joint with their
00009               respective authors. See AUTHORS file for details.
00010 
00011 LICENSE TO USE AND MODIFY SOFTWARE
00012 ----------------------------------
00013 
00014 This file is part of Xara LX.
00015 
00016 Xara LX is free software; you can redistribute it and/or modify it
00017 under the terms of the GNU General Public License version 2 as published
00018 by the Free Software Foundation.
00019 
00020 Xara LX and its component source files are distributed in the hope
00021 that it will be useful, but WITHOUT ANY WARRANTY; without even the
00022 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00023 See the GNU General Public License for more details.
00024 
00025 You should have received a copy of the GNU General Public License along
00026 with Xara LX (see the file GPL in the root directory of the
00027 distribution); if not, write to the Free Software Foundation, Inc., 51
00028 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00029 
00030 
00031 ADDITIONAL RIGHTS
00032 -----------------
00033 
00034 Conditional upon your continuing compliance with the GNU General Public
00035 License described above, Xara Group Ltd grants to you certain additional
00036 rights. 
00037 
00038 The additional rights are to use, modify, and distribute the software
00039 together with the wxWidgets library, the wxXtra library, and the "CDraw"
00040 library and any other such library that any version of Xara LX relased
00041 by Xara Group Ltd requires in order to compile and execute, including
00042 the static linking of that library to XaraLX. In the case of the
00043 "CDraw" library, you may satisfy obligation under the GNU General Public
00044 License to provide source code by providing a binary copy of the library
00045 concerned and a copy of the license accompanying it.
00046 
00047 Nothing in this section restricts any of the rights you have under
00048 the GNU General Public License.
00049 
00050 
00051 SCOPE OF LICENSE
00052 ----------------
00053 
00054 This license applies to this program (XaraLX) and its constituent source
00055 files only, and does not necessarily apply to other Xara products which may
00056 in part share the same code base, and are subject to their own licensing
00057 terms.
00058 
00059 This license does not apply to files in the wxXtra directory, which
00060 are built into a separate library, and are subject to the wxWindows
00061 license contained within that directory in the file "WXXTRA-LICENSE".
00062 
00063 This license does not apply to the binary libraries (if any) within
00064 the "libs" directory, which are subject to a separate license contained
00065 within that directory in the file "LIBS-LICENSE".
00066 
00067 
00068 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
00069 ----------------------------------------------
00070 
00071 Subject to the terms of the GNU Public License (see above), you are
00072 free to do whatever you like with your modifications. However, you may
00073 (at your option) wish contribute them to Xara's source tree. You can
00074 find details of how to do this at:
00075   http://www.xaraxtreme.org/developers/
00076 
00077 Prior to contributing your modifications, you will need to complete our
00078 contributor agreement. This can be found at:
00079   http://www.xaraxtreme.org/developers/contribute/
00080 
00081 Please note that Xara will not accept modifications which modify any of
00082 the text between the start and end of this header (marked
00083 XARAHEADERSTART and XARAHEADEREND).
00084 
00085 
00086 MARKS
00087 -----
00088 
00089 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
00090 designs are registered or unregistered trademarks, design-marks, and/or
00091 service marks of Xara Group Ltd. All rights in these marks are reserved.
00092 
00093 
00094       Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
00095                         http://www.xara.com/
00096 
00097 =================================XARAHEADEREND============================
00098  */
00099 
00100 #include "camtypes.h"
00101 #include "impstr.h"
00102 
00103 #include "cxftags.h"
00104 //#include "cxfrec.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00105 
00106 CC_IMPLEMENT_DYNCREATE(ImportedString,  ListItem);
00107 CC_IMPLEMENT_DYNAMIC(ImportedStringList,List);
00108 
00109 // Declare smart memory handling in Debug builds
00110 #define new CAM_DEBUG_NEW
00111 
00112 /********************************************************************************************
00113 
00114 >   ImportedString::ImportedString(TextChar* pChar,CXaraFileRecord* pRecord)
00115 
00116     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00117     Created:    14/8/96
00118     Inputs:     pChar   = ptr to a char node in the tree
00119                 pRecord = ptr to string record that's been imported
00120     Returns:    -
00121     Purpose:    The constructor.
00122 
00123                 pChar should point to a TextChar that's been inserted into the tree that contains
00124                 the first character in the string.
00125 
00126                 pRecord should point to the string record imported from the file.
00127 
00128                 This constructor keeps a copy of the pChar address.
00129                 It makes a copy of pRecord, so it's safe to delete pRecord after this call
00130 
00131     Errors:     -
00132     SeeAlso:    -
00133 
00134 ********************************************************************************************/
00135 
00136 ImportedString::ImportedString(TextChar* pChar,CXaraFileRecord* pRecord)
00137 {
00138     ERROR3IF(pChar   == NULL,"pChar is NULL");
00139     ERROR3IF(pRecord == NULL,"pRecord is NULL");
00140 
00141     pFirstChar = pChar;
00142     pCopyOfStringRecord = NULL;
00143 
00144     if (pRecord != NULL)
00145     {
00146         pCopyOfStringRecord = pRecord->GetCopy();
00147 
00148         ERROR3IF(pRecord->GetTag() != TAG_TEXT_STRING,"The record is not a string record");
00149     }   
00150 }
00151 
00152 /********************************************************************************************
00153 
00154 >   ImportedString::~ImportedString()
00155 
00156     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00157     Created:    14/8/96
00158     Inputs:     -
00159     Returns:    -
00160     Purpose:    The destructor
00161                 It frees up the copy of the record it created at construction time.
00162 
00163     Errors:     -
00164     SeeAlso:    -
00165 
00166 ********************************************************************************************/
00167 
00168 ImportedString::~ImportedString()
00169 {
00170     if (pCopyOfStringRecord != NULL)
00171         delete pCopyOfStringRecord;
00172 }
00173 
00174 /********************************************************************************************
00175 
00176 >   CXaraFileRecord* ImportedString::GetRecord()
00177 
00178     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00179     Created:    14/8/96
00180     Inputs:     -
00181     Returns:    ptr to the string record
00182     Purpose:    Returns a ptr to the copy of the string record passed into the constructor
00183     Errors:     -
00184     SeeAlso:    -
00185 
00186 ********************************************************************************************/
00187 
00188 CXaraFileRecord* ImportedString::GetRecord()
00189 {
00190     return pCopyOfStringRecord;
00191 }
00192 
00193 /********************************************************************************************
00194 
00195 >   TextChar* ImportedString::GetFirstChar()
00196 
00197     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00198     Created:    14/8/96
00199     Inputs:     -
00200     Returns:    ptr to the text char
00201     Purpose:    Returns a ptr to the text char passed into the constructor
00202     Errors:     -
00203     SeeAlso:    -
00204 
00205 ********************************************************************************************/
00206 
00207 TextChar* ImportedString::GetFirstChar()
00208 {
00209     return pFirstChar;
00210 }
00211 
00212 //---------------------------------------------------------------------------------
00213 //---------------------------------------------------------------------------------
00214 
00215 /********************************************************************************************
00216 
00217 >   void ImportedStringList::AddTail(ImportedString* pItem)
00218 
00219     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00220     Created:    14/8/96
00221     Inputs:     pItem = ptr to the ImportedString object
00222     Returns:    -
00223     Purpose:    Adds the string item to the list
00224     Errors:     -
00225     SeeAlso:    -
00226 
00227 ********************************************************************************************/
00228 
00229 void ImportedStringList::AddTail(ImportedString* pItem)
00230 {
00231     List::AddTail(pItem);
00232 }
00233 
00234 /********************************************************************************************
00235 
00236 >   ImportedString* ImportedStringList::GetHead()
00237 
00238     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00239     Created:    14/8/96
00240     Inputs:     -
00241     Returns:    ptr to the head of the list
00242     Purpose:    Returns a ptr to the head of the list
00243     Errors:     -
00244     SeeAlso:    -
00245 
00246 ********************************************************************************************/
00247 
00248 ImportedString* ImportedStringList::GetHead()
00249 {
00250     return (ImportedString*)List::GetHead();
00251 }
00252 
00253 /********************************************************************************************
00254 
00255 >   ImportedString* ImportedStringList::GetNext(ImportedString* pItem)
00256 
00257     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00258     Created:    14/8/96
00259     Inputs:     pItem = ptr to a ImportedString object in the list
00260     Returns:    ptr to the next itme in the list
00261     Purpose:    Returns a ptr to the next itme in the list
00262     Errors:     -
00263     SeeAlso:    -
00264 
00265 ********************************************************************************************/
00266 
00267 ImportedString* ImportedStringList::GetNext(ImportedString* pItem)
00268 {
00269     return (ImportedString*)List::GetNext(pItem);
00270 }

Generated on Sat Nov 10 03:45:32 2007 for Camelot by  doxygen 1.4.4