#include <cxfrec.h>
Inheritance diagram for CXaraFileRecord:
Public Member Functions | |
CXaraFileRecord (UINT32 Tag, INT32 Size=-1) | |
Creates a record object. These are used by CXaraFile for reading and writing records. | |
virtual | ~CXaraFileRecord () |
Default destructor. | |
void | DumpTypes (void) |
Dumps the type list to TRACE. | |
void | WriteAsText (CCLexFile *pFile) |
virtual CXaraFileRecord * | GetCopy () |
Copy function. | |
virtual BOOL | Init (BOOL ZeroMemBlock=FALSE) |
You must call this function before use use any of the Write functions. It initialises the record ready for writing data to (i.e. allocates a buffer). | |
virtual BOOL | Reinit (UINT32 ThisTag, INT32 Size) |
Allows you to reinit the record with a different record tag & size. | |
virtual BOOL | WriteBYTE (BYTE b) |
Writes a BYTE to the record's data section. | |
virtual BOOL | WriteUINT32 (UINT32 n) |
Writes the UINT32 to the record's data section. | |
virtual BOOL | WriteINT32 (INT32 n) |
virtual BOOL | WriteReference (INT32 n) |
virtual BOOL | WriteUINT16 (UINT16 n) |
virtual BOOL | WriteINT16 (INT16 n) |
virtual BOOL | WriteBuffer (BYTE *pBuf, size_t BufSize) |
Writes out a buffer of BYTEs to the record's data section. | |
virtual BOOL | WriteFLOAT (FLOAT f) |
virtual BOOL | WriteDOUBLE (double d) |
virtual BOOL | WriteFIXED16 (FIXED16 n) |
virtual BOOL | WriteANGLE (ANGLE a) |
virtual BOOL | WriteWCHAR (WCHAR w) |
virtual BOOL | WriteWCHARs (const WCHAR *pw, UINT32 Count) |
virtual BOOL | WriteCoord (const DocCoord &Coord) |
Writes out the coord. | |
virtual BOOL | WriteCoordTrans (const DocCoord &Coord, INT32 dx, INT32 dy) |
virtual BOOL | WriteCoordInterleaved (const DocCoord &Coord) |
Writes out the coord to the record, in an interleaved format. | |
virtual BOOL | WriteCoordTransInterleaved (const DocCoord &Coord, INT32 dx, INT32 dy) |
virtual BOOL | WritePath (Path *pPath) |
virtual BOOL | WritePathRelative (Path *pPath) |
virtual BOOL | WritePathTrans (Path *pPath, INT32 dx, INT32 dy) |
virtual BOOL | WritePathRelativeTrans (Path *pPath, INT32 dx, INT32 dy) |
virtual BOOL | WriteXOrd (INT32 XOrdinate) |
Writes out the x ordinate to the record. | |
virtual BOOL | WriteYOrd (INT32 YOrdinate) |
virtual BOOL | WriteCCPanose (const CCPanose &MyCCPanose) |
Writes a CCPanose structure to th file. | |
virtual BOOL | WriteASCII (const TCHAR *pStr) |
Writes out the string as an ASCII string. | |
virtual BOOL | WriteUnicode (const TCHAR *pStr) |
Writes out the string as a Unicode string. | |
virtual BOOL | WriteBSTR (_bstr_t bstr) |
virtual BOOL | WriteUTF16STR (const StringVar &pvstr) |
Writes out the string as a Unicode string Writes a variable length string as a stream of UTF16 unicode characters. | |
virtual BOOL | WriteMatrix (const Matrix &m) |
virtual BOOL | WriteMatrixTrans (const Matrix &m, INT32 dx, INT32 dy) |
virtual UINT32 | GetTag () |
virtual UINT32 | GetSize () |
Returns the size of the record. | |
virtual BYTE * | GetBuffer () |
virtual FTTypeList * | GetTypeList (void) |
virtual INT32 | GetRecordNumber () |
Returns the record's number. This value is set by a call to SetRecordNumber(). | |
virtual void | SetRecordNumber (UINT32 n) |
Sets the record's number. This value is read by a call to GetRecordNumber(). | |
virtual BOOL | IsDataSectionFull () |
virtual void | ResetReadPos () |
Resets the read position, so that the next Read() func call starts from the beginning of the data section. | |
virtual BOOL | ReadBYTE (BYTE *pb) |
Reads a BYTE from the record's data section. | |
virtual BOOL | ReadBYTEtoBOOL (BOOL *pb) |
Reads a BYTE from the record's data section. | |
virtual BOOL | ReadBYTEnoError (BYTE *pb) |
Dangerous, no-error version of CXaraFileRecord::ReadBYTE(). | |
virtual BOOL | ReadUINT32 (UINT32 *pn) |
virtual BOOL | ReadINT32 (INT32 *pn) |
virtual BOOL | ReadINT32noError (INT32 *pn) |
virtual BOOL | ReadUINT16 (UINT16 *pn) |
virtual BOOL | ReadINT16 (INT16 *pn) |
virtual BOOL | ReadBuffer (BYTE *pBuf, UINT32 BufSize) |
virtual BOOL | ReadBuffernoError (BYTE *pBuf, UINT32 BufSize) |
virtual BOOL | ReadFLOAT (FLOAT *pf) |
virtual BOOL | ReadDOUBLE (double *pd) |
virtual BOOL | ReadDOUBLEnoError (double *pd) |
virtual BOOL | ReadFIXED16 (FIXED16 *pn) |
virtual BOOL | ReadANGLE (ANGLE *pa) |
virtual BOOL | ReadWCHAR (WCHAR *pw) |
virtual BOOL | ReadCoord (DocCoord *pCoord) |
virtual BOOL | ReadCoordTrans (DocCoord *pCoord, INT32 dx, INT32 dy) |
virtual BOOL | ReadCoordInterleaved (DocCoord *pCoord) |
virtual BOOL | ReadCoordTransInterleaved (DocCoord *pCoord, INT32 dx, INT32 dy) |
virtual BOOL | ReadPath (Path *pPath) |
virtual BOOL | ReadPathRelative (Path *pPath) |
virtual BOOL | ReadPathTrans (Path *pPath, INT32 dx, INT32 dy) |
virtual BOOL | ReadPathRelativeTrans (Path *pPath, INT32 dx, INT32 dy) |
virtual BOOL | ReadXOrd (INT32 *pXOrdinate) |
Reads the x ordinate from the record. | |
virtual BOOL | ReadYOrd (INT32 *pYOrdinate) |
virtual BOOL | ReadCCPanose (CCPanose *pPanose) |
virtual BOOL | ReadUnicode (StringBase *pStr) |
virtual BOOL | ReadUnicode (TCHAR *pStr, UINT32 MaxChars) |
virtual BOOL | ReadASCII (TCHAR *pStr, UINT32 MaxChars) |
virtual BOOL | ReadBSTR (_bstr_t *bstr, UINT32 MaxChars) |
virtual BOOL | ReadUTF16STR (StringVar *pvstr, UINT32 MaxChars) |
Reads a BSTR from the record's data section (i.e. a run of WCHARs)Reads a BSTR from the record's data section (i.e. a run of WCHARs). | |
virtual BOOL | ReadMatrix (Matrix *pMatrix) |
virtual BOOL | ReadMatrixTrans (Matrix *pMatrix, INT32 dx, INT32 dy) |
Private Member Functions | |
CC_DECLARE_DYNAMIC (CXaraFileRecord) | |
void | SetUpVars (UINT32 ThisTag, INT32 Size) |
Sets up the member vars for this record. | |
void | FreeBuffer () |
Deallocates the associated buffer, if it has one. Can be safely called if the record no longer has a buffer. | |
BOOL | AllocBuffer (INT32 Size) |
Allocates a buffer of the given size. | |
BOOL | ExtendBuffer (INT32 Size) |
Extends the buffer by the given amount of bytes. | |
Private Attributes | |
BOOL | Initialised |
UINT32 | Tag |
UINT32 | BufferSize |
UINT32 | KnownSize |
BOOL | SizeIsKnown |
INT32 | RecordNumber |
void * | pBuffer |
UINT32 | CurrentPos |
BOOL | Overflow |
FTTypeList * | m_pTypeList |
Definition at line 129 of file cxfrec.h.
|
Creates a record object. These are used by CXaraFile for reading and writing records.
Definition at line 163 of file cxfrec.cpp.
|
|
Default destructor.
Definition at line 212 of file cxfrec.cpp. 00213 { 00214 FreeBuffer(); 00215 }
|
|
Allocates a buffer of the given size.
Definition at line 484 of file cxfrec.cpp. 00485 { 00486 ERROR3IF(Size < 0,"Buffer size is < 0, it's a bit difficult to allocate that many bytes"); 00487 00488 FreeBuffer(); 00489 00490 if (Size == 0) 00491 return TRUE; 00492 00493 if (Size > 0) 00494 pBuffer = CCMalloc(Size); 00495 00496 if (pBuffer != NULL) 00497 { 00498 BufferSize = Size; 00499 return TRUE; 00500 } 00501 else 00502 return FALSE; 00503 }
|
|
|
|
Dumps the type list to TRACE.
Definition at line 279 of file cxfrec.cpp. 00280 { 00281 TRACEUSER( "Gerry", _T("Tag:% 5d Size:% 6d Data:"), Tag, GetSize()); 00282 00283 if (m_pTypeList == NULL || 00284 m_pTypeList->GetCount() == 0) 00285 { 00286 TRACEUSER( "Gerry", _T(" None\n")); 00287 return; 00288 } 00289 00290 BYTE* pPtr = m_pTypeList->GetBuffer(); 00291 DWORD Count = m_pTypeList->GetCount(); 00292 DWORD Index; 00293 for (Index = 0; Index < Count; Index++) 00294 { 00295 PTSTR pType = NULL; 00296 DWORD len = 0; 00297 switch (pPtr[Index]) 00298 { 00299 case FTT_BYTE: pType = _T(" Byte"); break; 00300 case FTT_UINT32: pType = _T(" ULong"); break; 00301 case FTT_INT32: pType = _T(" Long"); break; 00302 case FTT_UINT16: pType = _T(" UInt16"); break; 00303 case FTT_INT16: pType = _T(" Int16"); break; 00304 case FTT_FLOAT: pType = _T(" Float"); break; 00305 case FTT_DOUBLE: pType = _T(" Double"); break; 00306 case FTT_WCHAR: pType = _T(" WChar"); break; 00307 case FTT_ASCII: pType = _T(" Ascii"); break; 00308 case FTT_UNICODE: pType = _T(" Unicode"); break; 00309 case FTT_COORD: pType = _T(" Coord"); break; 00310 case FTT_INTCOORD: pType = _T(" IntCoord"); break; 00311 case FTT_BINHEX: 00312 { 00313 pType = _T(" Buffer"); 00314 len = *((DWORD*)(pPtr+Index+1)); // Get the length (BYTE pointer arithmetic) 00315 Index += 4; // and skip it 00316 break; 00317 } 00318 default: pType = _T(" <BAD TYPE>"); break; 00319 } 00320 00321 if (pType) 00322 TRACEUSER("Gerry", pType); 00323 if (len != 0) 00324 TRACEUSER( "Gerry", _T("(%d)"), len); 00325 } 00326 TRACEUSER( "Gerry", _T("\n")); 00327 }
|
|
Extends the buffer by the given amount of bytes.
Definition at line 519 of file cxfrec.cpp. 00520 { 00521 ERROR3IF(pBuffer == NULL,"No buffer to extend"); 00522 if (pBuffer == NULL) 00523 return FALSE; 00524 00525 pBuffer = CCRealloc(pBuffer,BufferSize+Size); 00526 00527 if (pBuffer != NULL) 00528 { 00529 BufferSize += Size; 00530 return TRUE; 00531 } 00532 else 00533 return FALSE; 00534 }
|
|
Deallocates the associated buffer, if it has one. Can be safely called if the record no longer has a buffer.
Definition at line 449 of file cxfrec.cpp. 00450 { 00451 if (pBuffer != NULL) 00452 { 00453 CCFree(pBuffer); 00454 pBuffer = NULL; 00455 BufferSize = 0; 00456 } 00457 00458 if (m_pTypeList != NULL) 00459 { 00460 delete m_pTypeList; 00461 m_pTypeList = NULL; 00462 } 00463 00464 Initialised = FALSE; 00465 }
|
|
Definition at line 185 of file cxfrec.h. 00185 { return (BYTE*)pBuffer; }
|
|
Copy function.
Definition at line 368 of file cxfrec.cpp. 00369 { 00370 BOOL ok = TRUE; 00371 UINT32 Size = GetSize(); 00372 00373 CXaraFileRecord* pRecord = new CXaraFileRecord(GetTag(),Size); 00374 00375 if (pRecord != NULL && Size > 0) 00376 { 00377 ok = pRecord->Init(); 00378 00379 if (ok) 00380 { 00381 BYTE* pSrcBuf = GetBuffer(); 00382 BYTE* pDestBuf = pRecord->GetBuffer(); 00383 00384 ok = (pSrcBuf != NULL) && (pDestBuf != NULL); 00385 if (ok) memcpy(pDestBuf,pSrcBuf,Size); 00386 } 00387 } 00388 00389 if (pRecord != NULL && RecordNumber > 0) 00390 pRecord->SetRecordNumber(RecordNumber); 00391 00392 if (!ok && pRecord != NULL) 00393 { 00394 delete pRecord; 00395 pRecord = NULL; 00396 } 00397 00398 return pRecord; 00399 }
|
|
Returns the record's number. This value is set by a call to SetRecordNumber().
Definition at line 552 of file cxfrec.cpp. 00553 { 00554 ERROR3IF(RecordNumber == 0,"Record number has not been set, or set incorrectly"); 00555 00556 return RecordNumber; 00557 }
|
|
Returns the size of the record.
If it is not known (i.e. when creating a rec of unknown length for writing purposes) the current write position in the buffer is returned. This is the dangerous case, because it is possible that the size returned is not the correct final size.
Definition at line 423 of file cxfrec.cpp. 00424 { 00425 if (SizeIsKnown) 00426 return BufferSize; 00427 else 00428 { 00429 //TRACEUSER( "Markn", _T("*+*+* Getting the size of a record, yet don't know it's exact size\n")); 00430 return CurrentPos; 00431 } 00432 }
|
|
Definition at line 183 of file cxfrec.h. 00183 { return Tag; }
|
|
Definition at line 187 of file cxfrec.h. 00187 { return(m_pTypeList); };
|
|
You must call this function before use use any of the Write functions. It initialises the record ready for writing data to (i.e. allocates a buffer).
Definition at line 234 of file cxfrec.cpp. 00235 { 00236 if (!Initialised) 00237 { 00238 ERROR2IF(SizeIsKnown && KnownSize < 0,FALSE,"A -ve size has been given"); 00239 00240 ERROR3IF(pBuffer != NULL,"Initialising the record, yet it already has a buffer"); 00241 00242 if (SizeIsKnown) 00243 Initialised = AllocBuffer(KnownSize); 00244 else 00245 Initialised = AllocBuffer(CXF_RECORD_CHUNK); 00246 } 00247 00248 if (Initialised && ZeroMemBlock) 00249 { 00250 BYTE* pBuf = GetBuffer(); 00251 if (pBuf != NULL) 00252 { 00253 for (UINT32 i=0;i<BufferSize;i++) 00254 pBuf[i] = 0; 00255 } 00256 } 00257 00258 if (Initialised) 00259 { 00260 m_pTypeList = new FTTypeList; 00261 if (m_pTypeList == NULL) 00262 TRACEUSER( "Gerry", _T("Failed to create FTTypeList\n")); 00263 } 00264 00265 return Initialised; 00266 }
|
|
Definition at line 192 of file cxfrec.h. 00192 { return (!(SizeIsKnown && CurrentPos < KnownSize)); }
|
|
Definition at line 1305 of file cxfrec.cpp. 01306 { 01307 BOOL ok = ReadBuffer((BYTE*)pa,sizeof(ANGLE)); 01308 *pa = LEtoNative(*pa); 01309 return ok; 01310 }
|
|
Definition at line 1546 of file cxfrec.cpp. 01547 { 01548 BOOL ok = TRUE; 01549 BYTE b = 1; 01550 TCHAR* pBuf = pStr; 01551 TCHAR* pBufEnd = pBuf + MaxChars; 01552 01553 while (ok && b != 0) 01554 { 01555 ok = ReadBYTE(&b); 01556 if (ok) ok = (pBuf < pBufEnd); 01557 if (ok) *pBuf++ = b; 01558 } 01559 01560 return ok; 01561 }
|
|
|
|
Definition at line 1229 of file cxfrec.cpp. 01230 { 01231 ERROR3IF(pBuf == NULL,"pBuf is NULL"); 01232 if (pBuf == NULL) 01233 return FALSE; 01234 01235 BOOL ok = TRUE; 01236 01237 for (UINT32 i=0;ok && i < BufSize;i++) 01238 ok = ReadBYTE(pBuf+i); 01239 01240 return ok; 01241 }
|
|
Definition at line 1249 of file cxfrec.cpp. 01250 { 01251 ERROR3IF(pBuf == NULL,"pBuf is NULL"); 01252 if (pBuf == NULL) 01253 return FALSE; 01254 01255 BOOL ok = TRUE; 01256 01257 if (CurrentPos >= BufferSize) 01258 { 01259 pBuf = NULL; 01260 return ok; 01261 } 01262 else 01263 { 01264 for (UINT32 i=0;ok && i < BufSize;i++) 01265 { 01266 ok = ReadBYTE(pBuf+i); 01267 } 01268 } 01269 01270 return ok; 01271 }
|
|
Reads a BYTE from the record's data section.
Definition at line 1148 of file cxfrec.cpp. 01149 { 01150 ERROR3IF(pBYTE == NULL,"pBYTE is NULL"); 01151 if (pBYTE == NULL) 01152 return FALSE; 01153 01154 ERROR3IF(CurrentPos >= BufferSize,"No more data in record"); 01155 if (CurrentPos >= BufferSize) 01156 return FALSE; 01157 01158 BYTE* pBuf = (BYTE*)pBuffer; 01159 *pBYTE = pBuf[CurrentPos++]; 01160 01161 return TRUE; 01162 }
|
|
Dangerous, no-error version of CXaraFileRecord::ReadBYTE().
See Also: ReadBuffernoError() . Definition at line 1212 of file cxfrec.cpp. 01213 { 01214 ERROR3IF(pBYTE == NULL, "pBYTE is NULL"); 01215 if (pBYTE == NULL) 01216 return FALSE; 01217 01218 // if we run out of buffer, fail quietly (no error!). 01219 if (CurrentPos >= BufferSize) 01220 return FALSE; 01221 01222 BYTE* pBuf = (BYTE*)pBuffer; 01223 *pBYTE = pBuf[CurrentPos++]; 01224 01225 return TRUE; 01226 }
|
|
Reads a BYTE from the record's data section.
Definition at line 1180 of file cxfrec.cpp. 01181 { 01182 ERROR3IF(pbool == NULL,"pbool is NULL"); 01183 if (pbool == NULL) 01184 return FALSE; 01185 01186 ERROR3IF(CurrentPos >= BufferSize,"No more data in record"); 01187 if (CurrentPos >= BufferSize) 01188 return FALSE; 01189 01190 BYTE* pBuf = (BYTE*)pBuffer; 01191 *pbool = (BOOL)pBuf[CurrentPos++]; 01192 01193 return TRUE; 01194 }
|
|
Definition at line 1416 of file cxfrec.cpp. 01417 { 01418 BOOL ok = TRUE; 01419 01420 BYTE value; 01421 01422 PORTNOTE("other","Removed CCPanose usage - read to NULL") 01423 #ifndef EXCLUDE_FROM_XARALX 01424 if (ok) ok = pMyCCPanose->SetFamilyType(value); 01425 if (ok) ok = pMyCCPanose->SetSerifStyle(value); 01426 if (ok) ok = pMyCCPanose->SetWeight(value); 01427 if (ok) ok = pMyCCPanose->SetProportion(value); 01428 if (ok) ok = pMyCCPanose->SetContrast(value); 01429 if (ok) ok = pMyCCPanose->SetStrokeVariation(value); 01430 if (ok) ok = pMyCCPanose->SetArmStyle(value); 01431 if (ok) ok = pMyCCPanose->SetLetterform(value); 01432 if (ok) ok = pMyCCPanose->SetMidline(value); 01433 if (ok) ok = pMyCCPanose->SetXHeight(value); 01434 #else 01435 if (ok) ok = ReadBYTE(&value); // pMyCCPanose->SetFamilyType(value); 01436 if (ok) ok = ReadBYTE(&value); // pMyCCPanose->SetSerifStyle(value); 01437 if (ok) ok = ReadBYTE(&value); // pMyCCPanose->SetWeight(value); 01438 if (ok) ok = ReadBYTE(&value); // pMyCCPanose->SetProportion(value); 01439 if (ok) ok = ReadBYTE(&value); // pMyCCPanose->SetContrast(value); 01440 if (ok) ok = ReadBYTE(&value); // pMyCCPanose->SetStrokeVariation(value); 01441 if (ok) ok = ReadBYTE(&value); // pMyCCPanose->SetArmStyle(value); 01442 if (ok) ok = ReadBYTE(&value); // pMyCCPanose->SetLetterform(value); 01443 if (ok) ok = ReadBYTE(&value); // pMyCCPanose->SetMidline(value); 01444 if (ok) ok = ReadBYTE(&value); // pMyCCPanose->SetXHeight(value); 01445 #endif 01446 return ok; 01447 }
|
|
Reimplemented in CamelotFileRecord. Definition at line 1359 of file cxfrec.cpp. 01360 { 01361 if (pCoord != NULL) 01362 return ReadINT32(&(pCoord->x)) && ReadINT32(&(pCoord->y)); 01363 else 01364 return FALSE; 01365 }
|
|
Reimplemented in CamelotFileRecord. Definition at line 1382 of file cxfrec.cpp. 01383 { 01384 return ReadCoordTransInterleaved(pCoord,0,0); 01385 }
|
|
Definition at line 1367 of file cxfrec.cpp. 01368 { 01369 if (pCoord != NULL) 01370 { 01371 if (ReadINT32(&(pCoord->x)) && ReadINT32(&(pCoord->y))) 01372 { 01373 pCoord->x += dx; 01374 pCoord->y += dy; 01375 return TRUE; 01376 } 01377 } 01378 01379 return FALSE; 01380 }
|
|
Definition at line 1387 of file cxfrec.cpp. 01388 { 01389 BOOL ok = TRUE; 01390 01391 if (pCoord != NULL) 01392 { 01393 BYTE b; 01394 INT32 x = 0; 01395 INT32 y = 0; 01396 01397 if (ok) { ok = ReadBYTE(&b); x += (b << 24); } 01398 if (ok) { ok = ReadBYTE(&b); y += (b << 24); } 01399 01400 if (ok) { ok = ReadBYTE(&b); x += (b << 16); } 01401 if (ok) { ok = ReadBYTE(&b); y += (b << 16); } 01402 01403 if (ok) { ok = ReadBYTE(&b); x += (b << 8); } 01404 if (ok) { ok = ReadBYTE(&b); y += (b << 8); } 01405 01406 if (ok) { ok = ReadBYTE(&b); x += (b << 0); } 01407 if (ok) { ok = ReadBYTE(&b); y += (b << 0); } 01408 01409 pCoord->x = x + dx; 01410 pCoord->y = y + dy; 01411 } 01412 01413 return ok; 01414 }
|
|
Definition at line 1334 of file cxfrec.cpp. 01335 { 01336 DoubleUnion f; 01337 BOOL ok = ReadBuffer((BYTE*)&(f.u_INT64),sizeof(f.u_INT64)); 01338 *pd = LEtoNative(f); 01339 return ok; 01340 }
|
|
Definition at line 1342 of file cxfrec.cpp. 01343 { 01344 DoubleUnion f; 01345 BOOL ok = ReadBuffernoError((BYTE*)&(f.u_INT64),sizeof(f.u_INT64)); 01346 *pd = LEtoNative(f); 01347 return ok; 01348 }
|
|
Definition at line 1298 of file cxfrec.cpp. 01299 { 01300 BOOL ok = ReadBuffer((BYTE*)pn,sizeof(FIXED16)); 01301 *pn = LEtoNative(*pn); 01302 return ok; 01303 }
|
|
Definition at line 1326 of file cxfrec.cpp. 01327 { 01328 FloatUnion f; 01329 BOOL ok = ReadBuffer((BYTE*)&(f.u_INT32),sizeof(f.u_INT32)); 01330 *pf = LEtoNative(f); 01331 return ok; 01332 }
|
|
Definition at line 1319 of file cxfrec.cpp. 01320 { 01321 BOOL ok = ReadBuffer((BYTE*)pn,sizeof(INT16)); 01322 *pn = LEtoNative(*pn); 01323 return ok; 01324 }
|
|
Definition at line 1282 of file cxfrec.cpp. 01283 { 01284 // return ReadBuffer((BYTE*)pINT32,sizeof(INT32)); 01285 BOOL ok = ReadBuffer((BYTE*)pINT32,sizeof(INT32)); 01286 *pINT32 = LEtoNative(*pINT32); 01287 return ok; 01288 }
|
|
Definition at line 1290 of file cxfrec.cpp. 01291 { 01292 // return ReadBuffernoError((BYTE*)pINT32,sizeof(INT32)); 01293 BOOL ok = ReadBuffernoError((BYTE*)pINT32,sizeof(INT32)); 01294 *pINT32 = LEtoNative(*pINT32); 01295 return ok; 01296 }
|
|
Reimplemented in CamelotFileRecord. Definition at line 1933 of file cxfrec.cpp. 01934 { 01935 return ReadMatrixTrans(pMatrix,0,0); 01936 }
|
|
Definition at line 1938 of file cxfrec.cpp. 01939 { 01940 BOOL ok = TRUE; 01941 01942 FIXED16 a; 01943 FIXED16 b; 01944 FIXED16 c; 01945 FIXED16 d; 01946 INT32 e; 01947 INT32 f; 01948 01949 if (ok) ok = ReadFIXED16(&a); 01950 if (ok) ok = ReadFIXED16(&b); 01951 if (ok) ok = ReadFIXED16(&c); 01952 if (ok) ok = ReadFIXED16(&d); 01953 if (ok) ok = ReadINT32(&e); 01954 if (ok) ok = ReadINT32(&f); 01955 01956 (*pMatrix) = Matrix(a,b,c,d,e+dx,f+dy); 01957 01958 return ok; 01959 }
|
|
Reimplemented in CamelotFileRecord. Definition at line 1707 of file cxfrec.cpp. 01708 { 01709 return ReadPathTrans(pPath,0,0); 01710 }
|
|
Reimplemented in CamelotFileRecord. Definition at line 1828 of file cxfrec.cpp. 01829 { 01830 return ReadPathRelativeTrans(pPath,0,0); 01831 }
|
|
Definition at line 1834 of file cxfrec.cpp. 01835 { 01836 if (pPath == NULL) 01837 return FALSE; 01838 01839 INT32 NumCoords = INT32(GetSize())/(sizeof(BYTE)+sizeof(INT32)+sizeof(INT32)); 01840 01841 if (NumCoords < 0) 01842 return TRUE; 01843 01844 BOOL ok = pPath->ClearPath(FALSE) && pPath->MakeSpaceAtEnd(NumCoords); 01845 01846 #ifndef RELPATHINTERLEAVE 01847 01848 if (ok) 01849 { 01850 INT32 i; 01851 01852 PathVerb* pVerb = pPath->GetVerbArray(); 01853 01854 ok = (pVerb != NULL); 01855 for (i=0;ok && i<NumCoords;i++) 01856 ok = ReadBYTE(pVerb+i); 01857 01858 DocCoord* pCoord = pPath->GetCoordArray(); 01859 01860 if (ok) ok = (pCoord != NULL); 01861 if (ok) ok = ReadCoordTrans(pCoord,dx,dy); 01862 01863 if (ok) 01864 { 01865 INT32 RelX,RelY; 01866 01867 for (i=1;ok && i<NumCoords;i++) 01868 { 01869 ok = ReadINT32(&RelX); 01870 if (ok) ok = ReadINT32(&RelY); 01871 01872 pCoord[i].x = pCoord[i-1].x - RelX; 01873 pCoord[i].y = pCoord[i-1].y - RelY; 01874 } 01875 } 01876 } 01877 #else 01878 if (ok) 01879 { 01880 PathVerb* pVerb = pPath->GetVerbArray(); 01881 DocCoord* pCoord = pPath->GetCoordArray(); 01882 ok = (pVerb != NULL) && (pCoord != NULL); 01883 01884 if (ok) ok = ReadBYTE(pVerb); 01885 if (ok) ok = ReadCoordTransInterleaved(pCoord,dx,dy); 01886 01887 if (ok) 01888 { 01889 DocCoord TempCoord; 01890 01891 for (INT32 i=1;ok && i<NumCoords;i++) 01892 { 01893 ok = ReadBYTE(pVerb+i); 01894 if (ok) ok = ReadCoordTransInterleaved(&TempCoord,0,0); 01895 01896 pCoord[i].x = pCoord[i-1].x - TempCoord.x; 01897 pCoord[i].y = pCoord[i-1].y - TempCoord.y; 01898 } 01899 } 01900 } 01901 #endif 01902 01903 if (ok) ok = pPath->ExternalArraysAdded(NumCoords); 01904 01905 return ok; 01906 }
|
|
Definition at line 1713 of file cxfrec.cpp. 01714 { 01715 if (pPath == NULL) 01716 return FALSE; 01717 01718 INT32 NumCoords; 01719 if (!ReadINT32(&NumCoords)) 01720 return FALSE; 01721 01722 if (NumCoords < 0) 01723 return TRUE; 01724 01725 BOOL ok = pPath->ClearPath(FALSE) && pPath->MakeSpaceAtEnd(NumCoords); 01726 01727 if (ok) 01728 { 01729 INT32 i; 01730 01731 PathVerb* pVerb = pPath->GetVerbArray(); 01732 01733 ok = (pVerb != NULL); 01734 for (i=0;ok && i<NumCoords;i++) 01735 ok = ReadBYTE(pVerb+i); 01736 01737 DocCoord* pCoord = pPath->GetCoordArray(); 01738 01739 if (ok) ok = (pCoord != NULL); 01740 for (i=0;ok && i<NumCoords;i++) 01741 ok = ReadCoordTrans(pCoord+i,dx,dy); 01742 01743 if (ok) ok = pPath->ExternalArraysAdded(NumCoords); 01744 } 01745 01746 return ok; 01747 }
|
|
Definition at line 1312 of file cxfrec.cpp. 01313 { 01314 BOOL ok = ReadBuffer((BYTE*)pn,sizeof(UINT16)); 01315 *pn = LEtoNative(*pn); 01316 return ok; 01317 }
|
|
Definition at line 1273 of file cxfrec.cpp. 01274 { 01275 // return ReadBuffer((BYTE*)pUINT32,sizeof(UINT32)); 01276 BOOL ok = ReadBuffer((BYTE*)pUINT32,sizeof(UINT32)); 01277 *pUINT32 = LEtoNative(*pUINT32); 01278 return ok; 01279 }
|
|
Definition at line 1466 of file cxfrec.cpp. 01467 { 01468 BOOL ok = TRUE; 01469 BYTE* pBuf = (BYTE*)pStr; 01470 01471 #ifdef _UNICODE 01472 BYTE b1 = 1; 01473 BYTE b2 = 1; 01474 BYTE* pBufEnd = pBuf + ( MaxChars * sizeof(wchar_t) ); 01475 01476 while (ok && !(b1 == 0 && b2 == 0)) 01477 { 01478 ok = ReadBYTE( &b1 ) && ReadBYTE( &b2 ); 01479 01480 if (ok) ok = (pBuf < pBufEnd); 01481 if (ok) *pBuf++ = b1; 01482 if (ok) ok = (pBuf < pBufEnd); 01483 if (ok) *pBuf++ = b2; 01484 01485 // Yick, Linux has 4 byte unicdoe chars 01486 if (sizeof(TCHAR) == 4) 01487 { 01488 *pBuf++ = '\0'; 01489 *pBuf++ = '\0'; 01490 } 01491 } 01492 #else 01493 BYTE* pBufEnd = pBuf+MaxChars; 01494 WCHAR wc = 1; 01495 BYTE* pwcBuf = (BYTE*)&wc; 01496 01497 while (ok && wc != 0) 01498 { 01499 // Read in the two bytes that make up the Unicode value, and stuff them into 'wc' 01500 ok = ReadBYTE(pwcBuf) && ReadBYTE(pwcBuf+1); 01501 01502 // Check for buffer overflow 01503 if (ok) ok = (pBuf < pBufEnd); 01504 01505 if (ok) 01506 { 01507 // Convert to an ASCII or DBCS 01508 if (UnicodeManager::IsDBCSOS()) 01509 { 01510 UINT32 AsciiCode = UnicodeManager::UnicodeToMultiByte(wc); 01511 BYTE LeadByte = 0; 01512 BYTE TrailByte = 0; 01513 UnicodeManager::DecomposeMultiBytes(AsciiCode, &LeadByte, &TrailByte); 01514 01515 if (LeadByte == 0) 01516 *pBuf++ = TrailByte; 01517 else 01518 { 01519 if (UnicodeManager::IsDBCSLeadByte(LeadByte)) 01520 { 01521 ok = (pBuf < pBufEnd-1); 01522 if (ok) 01523 { 01524 *pBuf++ = LeadByte; 01525 *pBuf++ = TrailByte; 01526 } 01527 } 01528 else 01529 *pBuf++ = TrailByte; 01530 } 01531 } 01532 else 01533 { 01534 UINT32 AsciiCode = UnicodeManager::UnicodeToMultiByte(wc); 01535 *pBuf++ = BYTE(AsciiCode & 0xff); 01536 } 01537 } 01538 } 01539 01540 #endif // _UNICODE 01541 01542 return ok; 01543 }
|
|
Definition at line 1449 of file cxfrec.cpp. 01450 { 01451 // ASUMPTION!!!! 01452 // This function assumes the pStr->MaxLength() will return the max buffer size -1, 01453 // i.e. a value is returned that excludes room for a zero-terminated character. 01454 // 01455 // As the func that does all the hard work takes a TCHAR*, we need to pass in the total buffer 01456 // size, otherwise it will fail for strings that exactly fit into the StringBase object. 01457 // 01458 // This is why MaxLength()+1 is passed in. 01459 01460 if (pStr != NULL) 01461 return ReadUnicode((TCHAR*)(*pStr),pStr->MaxLength()+1); 01462 01463 return FALSE; 01464 }
|
|
Reads a BSTR from the record's data section (i.e. a run of WCHARs)Reads a BSTR from the record's data section (i.e. a run of WCHARs).
Definition at line 1636 of file cxfrec.cpp. 01637 { 01638 #ifdef _UNICODE 01639 BOOL ok = TRUE; 01640 pvstr->Empty(); 01641 WCHAR c = 0; 01642 01643 do 01644 { 01645 ok = ReadWCHAR(&c); // Read two bytes into the WCHAR buffer 01646 if (!ok) c = 0; // If the read failed then write a terminator 01647 *pvstr += c; // Add the character to the VSTR 01648 } 01649 while (c!=0 && ((UINT32)(pvstr->Length()))<MaxChars);// Until end of string or out of room in buffer 01650 01651 //TRACEUSER("Phil", _T("ReadUTF16: %s\n"), (TCHAR*)*pvstr); 01652 01653 return ok; // If we terminated due to Read failure tell the caller 01654 #else 01655 ERROR3("StringVar only holds UNICODE data in UNICODE builds"); 01656 return FALSE; 01657 #endif 01658 }
|
|
Definition at line 1350 of file cxfrec.cpp. 01351 { 01352 *pw = 0; 01353 BOOL ok = ReadBuffer((BYTE*)pw, SIZEOF_XAR_UTF16); //sizeof(WCHAR)); 2-byte UNICODE stored in Xar files 01354 *pw = LEtoNative(*pw); 01355 *pw = UTF16ToNative(*pw); 01356 return ok; 01357 }
|
|
Reads the x ordinate from the record.
Reimplemented in CamelotFileRecord. Definition at line 2003 of file cxfrec.cpp. 02004 { 02005 return ReadINT32(pXOrdinate); 02006 }
|
|
Reimplemented in CamelotFileRecord. Definition at line 2008 of file cxfrec.cpp. 02009 { 02010 return ReadINT32(pYOrdinate); 02011 }
|
|
Allows you to reinit the record with a different record tag & size.
Definition at line 347 of file cxfrec.cpp. 00348 { 00349 FreeBuffer(); 00350 SetUpVars(ThisTag,ThisSize); 00351 return Init(); 00352 }
|
|
Resets the read position, so that the next Read() func call starts from the beginning of the data section.
Definition at line 1128 of file cxfrec.cpp. 01129 { 01130 CurrentPos = 0; 01131 }
|
|
Sets the record's number. This value is read by a call to GetRecordNumber().
Definition at line 575 of file cxfrec.cpp. 00576 { 00577 ERROR3IF(n < 1,"Record number is invalid. Must be >= 1"); 00578 00579 RecordNumber = n; 00580 }
|
|
Sets up the member vars for this record.
Definition at line 184 of file cxfrec.cpp. 00185 { 00186 Tag = ThisTag; 00187 KnownSize = Size; 00188 SizeIsKnown = (Size != CXF_UNKNOWN_SIZE); 00189 RecordNumber= 0; 00190 00191 pBuffer = NULL; 00192 BufferSize = 0; 00193 CurrentPos = 0; 00194 Overflow = FALSE; 00195 m_pTypeList = NULL; 00196 Initialised = FALSE; 00197 }
|
|
Definition at line 660 of file cxfrec.cpp. 00661 { 00662 ENTERWRITEFUNCTION(FTT_INT32); 00663 a = NativetoLE(a); 00664 BOOL ok = WriteBuffer((BYTE*)&a,sizeof(ANGLE)); 00665 LEAVEWRITEFUNCTION; 00666 return (ok); 00667 }
|
|
Writes out the string as an ASCII string.
Definition at line 954 of file cxfrec.cpp. 00955 { 00956 ERROR3IF(pStr == NULL,"NULL pStr"); 00957 if (pStr == NULL) 00958 return FALSE; 00959 00960 ENTERWRITEFUNCTION(FTT_ASCII); 00961 size_t len = camStrlen(pStr); 00962 BOOL ok= TRUE; 00963 00964 #ifdef _UNICODE 00965 // Writing a Unicode string at pStr as an ASCII string 00966 // Just write out the first byte of each unicode char. 00967 00968 for (size_t i=0;ok && i<=len;i++) 00969 { 00970 PORTNOTE( "record", "UNICODE characters that don't fit into 1 mb character need better handling" ) 00971 char acTmp[MB_CUR_MAX]; 00972 if( 1 == wctomb( acTmp, pStr[i] ) ) 00973 ok = WriteBYTE( acTmp[0] ); 00974 else 00975 ok = WriteBYTE( '.' ); 00976 } 00977 00978 LEAVEWRITEFUNCTION; 00979 return ok; 00980 #else 00981 // pStr points at an ASCII string, so write it out 00982 ok = WriteBuffer((BYTE*)pStr,len+1); 00983 LEAVEWRITEFUNCTION; 00984 return (ok); 00985 #endif 00986 }
|
|
|
|
|
|
Writes out a buffer of BYTEs to the record's data section.
Definition at line 799 of file cxfrec.cpp. 00800 { 00801 ERROR3IF(pBuf == NULL,"NULL pBuf param"); 00802 00803 BOOL ok = (pBuf != NULL); 00804 ENTERWRITEFUNCTION(FTT_BINHEX); 00805 STORELENGTH( DWORD(BufSize) ); 00806 00807 for (UINT32 i=0;i<BufSize && ok;i++) 00808 ok = WriteBYTE(pBuf[i]); 00809 00810 LEAVEWRITEFUNCTION; 00811 return ok; 00812 }
|
|
Writes a BYTE to the record's data section.
Definition at line 1075 of file cxfrec.cpp. 01076 { 01077 ERROR3IF(!Initialised,"Writing to an uninitialised record"); 01078 01079 if (Overflow) 01080 return FALSE; 01081 01082 ENTERWRITEFUNCTION(FTT_BYTE); 01083 BOOL ok = TRUE; 01084 01085 if (CurrentPos >= BufferSize) 01086 { 01087 if (SizeIsKnown) 01088 { 01089 ERROR3("Record Write Overflow"); 01090 Overflow = TRUE; 01091 LEAVEWRITEFUNCTION; 01092 return FALSE; 01093 } 01094 else 01095 { 01096 while (ok && CurrentPos >= BufferSize) 01097 ok = ExtendBuffer(CXF_RECORD_CHUNK); 01098 } 01099 } 01100 01101 if (ok) 01102 { 01103 BYTE* pBuf = (BYTE*)pBuffer; 01104 01105 if (CurrentPos < BufferSize) 01106 pBuf[CurrentPos++] = b; 01107 } 01108 01109 LEAVEWRITEFUNCTION; 01110 return ok; 01111 }
|
|
Writes a CCPanose structure to th file.
Definition at line 826 of file cxfrec.cpp. 00827 { 00828 BOOL ok = TRUE; 00829 00830 PORTNOTE("other","Removed CCPanose usage - write NULL") 00831 #ifndef EXCLUDE_FROM_XARALX 00832 if (ok) ok = WriteBYTE(MyCCPanose.GetFamilyType()); 00833 if (ok) ok = WriteBYTE(MyCCPanose.GetSerifStyle()); 00834 if (ok) ok = WriteBYTE(MyCCPanose.GetWeight()); 00835 if (ok) ok = WriteBYTE(MyCCPanose.GetProportion()); 00836 if (ok) ok = WriteBYTE(MyCCPanose.GetContrast()); 00837 if (ok) ok = WriteBYTE(MyCCPanose.GetStrokeVariation()); 00838 if (ok) ok = WriteBYTE(MyCCPanose.GetArmStyle()); 00839 if (ok) ok = WriteBYTE(MyCCPanose.GetLetterform()); 00840 if (ok) ok = WriteBYTE(MyCCPanose.GetMidline()); 00841 if (ok) ok = WriteBYTE(MyCCPanose.GetXHeight()); 00842 #else 00843 if (ok) ok = WriteBYTE( 0 ); 00844 if (ok) ok = WriteBYTE( 0 ); 00845 if (ok) ok = WriteBYTE( 0 ); 00846 if (ok) ok = WriteBYTE( 0 ); 00847 if (ok) ok = WriteBYTE( 0 ); 00848 if (ok) ok = WriteBYTE( 0 ); 00849 if (ok) ok = WriteBYTE( 0 ); 00850 if (ok) ok = WriteBYTE( 0 ); 00851 if (ok) ok = WriteBYTE( 0 ); 00852 if (ok) ok = WriteBYTE( 0 ); 00853 #endif 00854 return ok; 00855 }
|
|
Writes out the coord.
Reimplemented in CamelotFileRecord. Definition at line 713 of file cxfrec.cpp. 00714 { 00715 ENTERWRITEFUNCTION(FTT_COORD); 00716 BOOL ok = WriteINT32(Coord.x) && WriteINT32(Coord.y); 00717 LEAVEWRITEFUNCTION; 00718 return (ok); 00719 }
|
|
Writes out the coord to the record, in an interleaved format.
This version interleaves the bytes of the X & Y components, to try and maximise the run of common bytes, in order to improve the zlib compression. It writes out the top byte of x, then top byte of y, then next byte of x, then next byte of y, and so on.
Reimplemented in CamelotFileRecord. Definition at line 752 of file cxfrec.cpp. 00753 { 00754 ENTERWRITEFUNCTION(FTT_INTCOORD); 00755 BOOL ok = WriteCoordTransInterleaved(Coord,0,0); 00756 LEAVEWRITEFUNCTION; 00757 return (ok); 00758 }
|
|
Definition at line 721 of file cxfrec.cpp. 00722 { 00723 ENTERWRITEFUNCTION(FTT_COORD); 00724 BOOL ok = WriteINT32(Coord.x + dx) && WriteINT32(Coord.y + dy); 00725 LEAVEWRITEFUNCTION; 00726 return (ok); 00727 }
|
|
Definition at line 760 of file cxfrec.cpp. 00761 { 00762 ENTERWRITEFUNCTION(FTT_INTCOORD); 00763 INT32 x = Coord.x + dx; 00764 INT32 y = Coord.y + dy; 00765 00766 BOOL ok = TRUE; 00767 00768 if (ok) ok = WriteBYTE(BYTE((x >> 24) & 0xff)); 00769 if (ok) ok = WriteBYTE(BYTE((y >> 24) & 0xff)); 00770 00771 if (ok) ok = WriteBYTE(BYTE((x >> 16) & 0xff)); 00772 if (ok) ok = WriteBYTE(BYTE((y >> 16) & 0xff)); 00773 00774 if (ok) ok = WriteBYTE(BYTE((x >> 8) & 0xff)); 00775 if (ok) ok = WriteBYTE(BYTE((y >> 8) & 0xff)); 00776 00777 if (ok) ok = WriteBYTE(BYTE((x >> 0) & 0xff)); 00778 if (ok) ok = WriteBYTE(BYTE((y >> 0) & 0xff)); 00779 00780 LEAVEWRITEFUNCTION; 00781 return ok; 00782 }
|
|
Definition at line 669 of file cxfrec.cpp. 00670 { 00671 ENTERWRITEFUNCTION(FTT_DOUBLE); 00672 DoubleUnion u=NativetoLEU(d); 00673 BOOL ok = WriteBuffer((BYTE*)&(u.u_INT64),sizeof(u.u_INT64)); 00674 LEAVEWRITEFUNCTION; 00675 return (ok); 00676 }
|
|
Definition at line 651 of file cxfrec.cpp. 00652 { 00653 ENTERWRITEFUNCTION(FTT_INT32); 00654 f = NativetoLE(f); 00655 BOOL ok = WriteBuffer((BYTE*)&f,sizeof(FIXED16)); 00656 LEAVEWRITEFUNCTION; 00657 return (ok); 00658 }
|
|
Definition at line 624 of file cxfrec.cpp. 00625 { 00626 ENTERWRITEFUNCTION(FTT_FLOAT); 00627 FloatUnion u=NativetoLEU(f); 00628 BOOL ok = WriteBuffer((BYTE*)&(u.u_INT32),sizeof(u.u_INT32)); 00629 LEAVEWRITEFUNCTION; 00630 return (ok); 00631 }
|
|
Definition at line 642 of file cxfrec.cpp. 00643 { 00644 ENTERWRITEFUNCTION(FTT_INT16); 00645 f = NativetoLE(f); 00646 BOOL ok = WriteBuffer((BYTE*)&f,sizeof(INT16)); 00647 LEAVEWRITEFUNCTION; 00648 return (ok); 00649 }
|
|
Definition at line 606 of file cxfrec.cpp. 00607 { 00608 ENTERWRITEFUNCTION(FTT_INT32); 00609 n = NativetoLE(n); 00610 BOOL ok = WriteBuffer((BYTE*)&n,sizeof(INT32)); 00611 LEAVEWRITEFUNCTION; 00612 return (ok); 00613 }
|
|
Reimplemented in CamelotFileRecord. Definition at line 1908 of file cxfrec.cpp. 01909 { 01910 return WriteMatrixTrans(m,0,0); 01911 }
|
|
Definition at line 1913 of file cxfrec.cpp. 01914 { 01915 BOOL ok = TRUE; 01916 01917 FIXED16 abcd[4]; // matrix components 01918 INT32 ef[2]; // translation 01919 01920 m.GetComponents(&abcd[0], &ef[0]); 01921 01922 if (ok) ok = WriteFIXED16(abcd[0]); 01923 if (ok) ok = WriteFIXED16(abcd[1]); 01924 if (ok) ok = WriteFIXED16(abcd[2]); 01925 if (ok) ok = WriteFIXED16(abcd[3]); 01926 01927 if (ok) ok = WriteINT32(ef[0]+dx); 01928 if (ok) ok = WriteINT32(ef[1]+dy); 01929 01930 return ok; 01931 }
|
|
Reimplemented in CamelotFileRecord. Definition at line 1663 of file cxfrec.cpp. 01664 { 01665 return WritePathTrans(pPath,0,0); 01666 }
|
|
Reimplemented in CamelotFileRecord. Definition at line 1749 of file cxfrec.cpp. 01750 { 01751 return WritePathRelativeTrans(pPath,0,0); 01752 }
|
|
Definition at line 1754 of file cxfrec.cpp. 01755 { 01756 if (pPath == NULL) 01757 return FALSE; 01758 01759 BOOL ok = TRUE; 01760 01761 INT32 NumCoords = pPath->GetNumCoords(); 01762 01763 #ifndef RELPATHINTERLEAVE 01764 01765 // Write out path verbs 01766 if (ok) 01767 { 01768 PathVerb* pVerb = pPath->GetVerbArray(); 01769 if (pVerb != NULL) 01770 { 01771 for (INT32 i=0;ok && i < NumCoords;i++) 01772 ok = WriteBYTE(pVerb[i]); 01773 } 01774 else 01775 ok = FALSE; 01776 } 01777 01778 // Write out coord array 01779 if (ok) 01780 { 01781 DocCoord* pCoord = pPath->GetCoordArray(); 01782 if (pCoord != NULL) 01783 { 01784 ok = WriteCoordTrans(pCoord[0],dx,dy); 01785 01786 for (INT32 i=1;ok && i < NumCoords;i++) 01787 { 01788 INT32 RelX = pCoord[i-1].x - pCoord[i].x; 01789 INT32 RelY = pCoord[i-1].y - pCoord[i].y; 01790 01791 ok = WriteINT32(RelX); 01792 if (ok) ok = WriteINT32(RelY); 01793 } 01794 } 01795 else 01796 ok = FALSE; 01797 } 01798 #else 01799 if (ok) 01800 { 01801 PathVerb* pVerb = pPath->GetVerbArray(); 01802 DocCoord* pCoord = pPath->GetCoordArray(); 01803 if (pVerb != NULL && pCoord != NULL && NumCoords > 0) 01804 { 01805 DocCoord TempCoord; 01806 01807 ok = WriteBYTE(pVerb[0]); 01808 if (ok) ok = WriteCoordTransInterleaved(pCoord[0],dx,dy); 01809 01810 for (INT32 i=1;ok && i < NumCoords;i++) 01811 { 01812 ok = WriteBYTE(pVerb[i]); 01813 01814 TempCoord.x = pCoord[i-1].x - pCoord[i].x; 01815 TempCoord.y = pCoord[i-1].y - pCoord[i].y; 01816 01817 if (ok) ok = WriteCoordTransInterleaved(TempCoord,0,0); 01818 } 01819 } 01820 else 01821 ok = FALSE; 01822 } 01823 #endif 01824 01825 return ok; 01826 }
|
|
Definition at line 1668 of file cxfrec.cpp. 01669 { 01670 if (pPath == NULL) 01671 return FALSE; 01672 01673 INT32 NumCoords = pPath->GetNumCoords(); 01674 01675 // Write out num coords 01676 BOOL ok = WriteINT32(NumCoords); 01677 01678 // Write out path verbs 01679 if (ok) 01680 { 01681 PathVerb* pVerb = pPath->GetVerbArray(); 01682 if (pVerb != NULL) 01683 { 01684 for (INT32 i=0;ok && i < NumCoords;i++) 01685 ok = WriteBYTE(pVerb[i]); 01686 } 01687 else 01688 ok = FALSE; 01689 } 01690 01691 // Write out coord array 01692 if (ok) 01693 { 01694 DocCoord* pCoord = pPath->GetCoordArray(); 01695 if (pCoord != NULL) 01696 { 01697 for (INT32 i=0;ok && i < NumCoords;i++) 01698 ok = WriteCoordTrans(pCoord[i],dx,dy); 01699 } 01700 else 01701 ok = FALSE; 01702 } 01703 01704 return ok; 01705 }
|
|
Definition at line 615 of file cxfrec.cpp. 00616 { 00617 ENTERWRITEFUNCTION(FTT_REFERENCE); 00618 n = NativetoLE(n); 00619 BOOL ok = WriteBuffer((BYTE*)&n,sizeof(INT32)); 00620 LEAVEWRITEFUNCTION; 00621 return (ok); 00622 }
|
|
Definition at line 633 of file cxfrec.cpp. 00634 { 00635 ENTERWRITEFUNCTION(FTT_UINT16); 00636 f = NativetoLE(f); 00637 BOOL ok = WriteBuffer((BYTE*)&f,sizeof(UINT16)); 00638 LEAVEWRITEFUNCTION; 00639 return (ok); 00640 }
|
|
Writes the UINT32 to the record's data section.
Definition at line 597 of file cxfrec.cpp. 00598 { 00599 ENTERWRITEFUNCTION(FTT_UINT32); 00600 n = NativetoLE(n); 00601 BOOL ok = WriteBuffer((BYTE*)&n,sizeof(UINT32)); 00602 LEAVEWRITEFUNCTION; 00603 return (ok); 00604 }
|
|
Writes out the string as a Unicode string.
Definition at line 872 of file cxfrec.cpp. 00873 { 00874 ERROR3IF(pStr == NULL,"NULL pStr"); 00875 if (pStr == NULL) 00876 return FALSE; 00877 00878 ENTERWRITEFUNCTION(FTT_UNICODE); 00879 BOOL ok = TRUE; 00880 00881 #ifdef _UNICODE 00882 00883 // We must cope with byte-order differences between native storage and XAR file storage: 00884 // Native may be big-endian or little-endian, XAR is always little-endian 00885 // Native WCHAR may be 16 or 32 bits, XAR is always 16 bits 00886 // These differences are handled in WriteWCHAR 00887 WCHAR c = 0; 00888 INT32 i = 0; 00889 00890 do 00891 { 00892 c = pStr[i++]; 00893 ok = WriteWCHAR(c); // Read two bytes into the WCHAR buffer 00894 if (!ok) c = 0; // If the read failed then write a terminator 00895 } 00896 while (c!=0);// Until end of string or no longer OK to write 00897 00898 #else 00899 // pStr points to an ASCII or DBCS string, and we want it written as a Unicode string 00900 // Write out each char separately, converting it to the correct Unicode value 00901 // using TextManager::MultiByteToUnicode() 00902 00903 // skip along the string, saving each character in turn 00904 TCHAR* pCurrentChar = pStr; 00905 00906 while (*pCurrentChar!=0 && ok) 00907 { 00908 // Convert the char to Unicode 00909 UINT32 mc = 0; 00910 if (UnicodeManager::IsDBCSOS() && UnicodeManager::IsDBCSLeadByte(*pCurrentChar)) 00911 { 00912 mc = UnicodeManager::ComposeMultiBytes(*pCurrentChar, *(pCurrentChar+1)); 00913 pCurrentChar += 2; 00914 } 00915 else 00916 { 00917 mc = *pCurrentChar; 00918 pCurrentChar += 1; 00919 } 00920 00921 WCHAR wc = UnicodeManager::MultiByteToUnicode(mc); 00922 00923 ok = WriteBuffer( (BYTE*)&wc, sizeof(WCHAR) ); 00924 } 00925 00926 // Now write a zero terminator 00927 if (ok) 00928 { 00929 WCHAR wc = 0; 00930 ok = WriteBuffer( (BYTE*)&wc, sizeof(WCHAR) ); 00931 } 00932 00933 #endif // _UNICODE 00934 00935 LEAVEWRITEFUNCTION; 00936 return ok; 00937 }
|
|
Writes out the string as a Unicode string Writes a variable length string as a stream of UTF16 unicode characters.
Definition at line 1034 of file cxfrec.cpp. 01035 { 01036 #ifdef _UNICODE 01037 ENTERWRITEFUNCTION(FTT_UNICODE); 01038 01039 BOOL ok = TRUE; 01040 WCHAR c = 0; 01041 INT32 i = 0; 01042 01043 do 01044 { 01045 c = pvstr.CharAt(i++); 01046 ok = WriteWCHAR(c); // Read two bytes into the WCHAR buffer 01047 if (!ok) c = 0; // If the read failed then write a terminator 01048 } 01049 while (c!=0);// Until end of string or no longer OK to write 01050 01051 LEAVEWRITEFUNCTION; 01052 01053 return ok; // If we terminated due to Read failure tell the caller 01054 #else 01055 ERROR3("StringVar only holds UNICODE data in UNICODE builds"); 01056 return FALSE; 01057 #endif 01058 }
|
|
Definition at line 678 of file cxfrec.cpp. 00679 { 00680 ENTERWRITEFUNCTION(FTT_WCHAR); 00681 w = NativeToUTF16(w); 00682 w = NativetoLE(w); 00683 BOOL ok = WriteBuffer((BYTE*)&w, SIZEOF_XAR_UTF16); //sizeof(WCHAR)); 2-byte UNICODE stored in Xar files 00684 LEAVEWRITEFUNCTION; 00685 return (ok); 00686 }
|
|
Definition at line 688 of file cxfrec.cpp. 00689 { 00690 BOOL ok = TRUE; 00691 UINT32 i; 00692 for (i = 0; ok && i < Count; i++) 00693 ok = WriteWCHAR(pw[i]); 00694 return (ok); 00695 }
|
|
Writes out the x ordinate to the record.
Reimplemented in CamelotFileRecord. Definition at line 1977 of file cxfrec.cpp. 01978 { 01979 return WriteINT32(XOrdinate); 01980 }
|
|
Reimplemented in CamelotFileRecord. Definition at line 1982 of file cxfrec.cpp. 01983 { 01984 return WriteINT32(YOrdinate); 01985 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|