CFx SDK Documentation 2026 SP0
Loading...
Searching...
No Matches
OdStringBuf.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2024, Open Design Alliance (the "Alliance").
3// All rights reserved.
4//
5// This software and its documentation and related materials are owned by
6// the Alliance. The software may only be incorporated into application
7// programs owned by members of the Alliance, subject to a signed
8// Membership Agreement and Supplemental Software License Agreement with the
9// Alliance. The structure and organization of this software are the valuable
10// trade secrets of the Alliance and its suppliers. The software is also
11// protected by copyright law and international treaty provisions. Application
12// programs incorporating this software must include the following statement
13// with their copyright notices:
14//
15// This application incorporates Open Design Alliance software pursuant to a license
16// agreement with Open Design Alliance.
17// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.
18// All rights reserved.
19//
20// By use of this software, its documentation or related materials, you
21// acknowledge and accept the above terms.
23
24#ifndef __ODSTRINGBUF_H_
25#define __ODSTRINGBUF_H_
26
27#include "DbRootExport.h"
28#include "OdStreamBuf.h"
29
30#include "TD_PackPush.h"
31
39class DBROOT_EXPORT OdStringBuf : public OdRxObject
40{
41public:
46 {
47 CharFormat_Undefined = 0, // Can't determine character format
50 CharFormat_UTF16LE, // UTF16 LittleEndian
51 CharFormat_UTF16BE, // UTF16 BigEndian
52 CharFormat_UTF32LE, // UTF32 LittleEndian
53 CharFormat_UTF32BE // UTF32 BigEndian
54 };
55protected:
58public:
66
68
73
77 inline OdStreamBuf* getIOPtr() const
78 {
79 return ((OdStreamBuf*)(m_pIo.get()));
80 }
81
86 {
87 return m_cf;
88 }
89protected:
91 OdChar ReadChar(OdChar &secChr) const;
94 // Conversions
99 OdChar FromUTF32LE(OdUInt32 chr, OdChar &secChr) const;
100 OdChar FromUTF32BE(OdUInt32 chr, OdChar &secChr) const;
101 // Cross-platform swap bytes
102 static void Swap2BytesNumber(OdUInt16& W);
103 static void Swap4BytesNumber(OdUInt32& DW);
104 static void Swap2BytesChar(OdChar& W);
105
106public:
107 // Static
138 // Save to stream
151 static void WriteString(OdStringBuf::CharFormat type, OdStreamBuf &io, const char *text);
159 // Additional
166 static void WriteNL(OdStringBuf::CharFormat type, OdStreamBuf &io, bool use_odc = true);
173 static void WriteSpace(OdStringBuf::CharFormat type, OdStreamBuf &io, bool use_odc = true);
180 static void WriteTab(OdStringBuf::CharFormat type, OdStreamBuf &io, bool use_odc = true);
181 // Types
238};
239
241
242#include "TD_PackPop.h"
243
244#endif //__ODSTRINGBUF_H_
OdSmartPtr< OdStreamBuf > OdStreamBufPtr
#define DBROOT_EXPORT
unsigned int OdUInt32
short OdInt16
signed char OdInt8
unsigned short OdUInt16
int OdInt32
unsigned char OdUInt8
wchar_t OdChar
OdSmartPtr< OdStringBuf > OdStringBufPtr
static OdUInt32 GetUnicodeHeaderForType(OdStringBuf::CharFormat type)
static void DefaultUTF16Type(OdStringBuf::CharFormat &type)
static void Swap2BytesChar(OdChar &W)
OdChar FromANSI(OdUInt8 chr) const
static void DefaultUTF32Type(OdStringBuf::CharFormat &type)
OdStringBuf::CharFormat DetermineCharFormat() const
static void WriteOdFloat(OdStringBuf::CharFormat type, OdStreamBuf &io, float var)
ODRX_DECLARE_MEMBERS(OdStringBuf)
OdChar FromUTF8(OdUInt8 chr) const
static void WriteUnicodeHeader(OdStringBuf::CharFormat type, OdStreamBuf &io)
static void WriteOdUInt32(OdStringBuf::CharFormat type, OdStreamBuf &io, OdUInt32 var)
static void Swap4BytesNumber(OdUInt32 &DW)
static void Swap2BytesNumber(OdUInt16 &W)
static OdInt64 GetUnicodeHeaderSizeForType(OdStringBuf::CharFormat type)
static void WriteString(OdStringBuf::CharFormat type, OdStreamBuf &io, const char *text)
static void WriteString(OdStringBuf::CharFormat type, OdStreamBuf &io, const OdChar *text)
static OdInt64 GetUnicodeBitSizeForType(OdStringBuf::CharFormat type)
static void WriteTab(OdStringBuf::CharFormat type, OdStreamBuf &io, bool use_odc=true)
virtual OdString getString()
OdInt64 GetUnicodeHeaderSize() const
OdInt64 GetUnicodeBitSize() const
static void WriteNL(OdStringBuf::CharFormat type, OdStreamBuf &io, bool use_odc=true)
OdChar FromUTF16BE(OdUInt16 chr) const
static void WriteOdInt16(OdStringBuf::CharFormat type, OdStreamBuf &io, OdInt16 var)
OdChar FromUTF16LE(OdUInt16 chr) const
static void WriteOdInt8(OdStringBuf::CharFormat type, OdStreamBuf &io, OdInt8 var)
static void WriteOdUInt16(OdStringBuf::CharFormat type, OdStreamBuf &io, OdUInt16 var)
static void WriteOdInt32(OdStringBuf::CharFormat type, OdStreamBuf &io, OdInt32 var)
static void WriteOdUInt8(OdStringBuf::CharFormat type, OdStreamBuf &io, OdUInt8 var)
OdChar ReadChar(OdChar &secChr) const
CharFormat m_cf
Definition OdStringBuf.h:57
void init(OdStreamBuf *pIo, CharFormat cf=CharFormat_Undefined)
@ CharFormat_Undefined
Definition OdStringBuf.h:47
CharFormat getCharFormat()
Definition OdStringBuf.h:85
static void DefaultingType(OdStringBuf::CharFormat &type)
OdStreamBufPtr m_pIo
Definition OdStringBuf.h:56
OdChar FromUTF32BE(OdUInt32 chr, OdChar &secChr) const
OdStreamBuf * getIOPtr() const
Definition OdStringBuf.h:77
static void WriteOdDouble(OdStringBuf::CharFormat type, OdStreamBuf &io, double var)
OdChar FromUTF32LE(OdUInt32 chr, OdChar &secChr) const
static void WriteSpace(OdStringBuf::CharFormat type, OdStreamBuf &io, bool use_odc=true)
GLuint GLsizei GLsizei GLint GLenum * type
Definition gles2_ext.h:274