Xerces-C++: PlatformUtils.hpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22#if !defined(XERCESC_INCLUDE_GUARD_PLATFORMUTILS_HPP)
23#define XERCESC_INCLUDE_GUARD_PLATFORMUTILS_HPP
24
28
31
33
34class XMLMsgLoader;
38class XMLMutex;
39
40
41
42
43
44
45
47{
48public :
50
51protected :
53
54private :
57};
58
59
69{
70public :
71
74
88
100#ifdef OS390
102#endif
103
109
115
122
125
133
137
138
141
174 , const char* const nlsHome = 0
177
229 , XMLSize_t maxDOMSubAllocationSize
231 , const char* const nlsHome = 0
234
242
260 (
262 );
263
265
268
274
290
303
316
329
342
355
368
380
398 (
403 );
404
420 (
423 , const XMLByte* const toFlush
425 );
426
438
440
441
466 (
467 const XMLCh* const srcPath
469 );
470
485 (
487 );
488
499
511
524
540 );
541
562 (
563 const XMLCh* const basePath
564 , const XMLCh* const relativePath
566 );
568
571
583
586
595
605
613 static void lockMutex(void* const mtxHandle);
614
625
639
641
642
645
654
656
657
673
679
692
699
708
709private :
710
711
712
714
717
723 static XMLMsgLoader* loadAMsgSet(const XMLCh* const msgDomain);
724
735
747
755 static int searchSlashDotDotSlash(XMLCh* const srcPath);
756
758
761
768 static bool fgMemMgrAdopted;
769
771};
772
773
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
801{
802
803
804
805
806#ifdef XML_PLATFORM_NEW_BLOCK_ALIGNMENT
807 const XMLSize_t alignment = XML_PLATFORM_NEW_BLOCK_ALIGNMENT;
808#else
809 const XMLSize_t alignment = (sizeof(void*) >= sizeof(double)) ? sizeof(void*) : sizeof(double);
810#endif
811
812
813 XMLSize_t current = ptrSize % alignment;
814
815
816 return (current == 0)
817 ? ptrSize
818 : (ptrSize + alignment - current);
819}
820
821
822
823
824
825
829
830
831
832
836
838
839#endif
#define MakeXMLException(theType, expKeyword)
Definition XMLException.hpp:178
XERCES_CPP_NAMESPACE_BEGIN typedef void * FileHandle
Definition XMLFileMgr.hpp:30
#define XERCES_CPP_NAMESPACE_BEGIN
Definition XercesDefs.hpp:112
unsigned char XMLByte
Definition XercesDefs.hpp:65
#define XMLUTIL_EXPORT
Definition XercesDefs.hpp:162
#define XERCES_CPP_NAMESPACE_END
Definition XercesDefs.hpp:113
size_t XMLSize_t
Definition Xerces_autoconf_config.hpp:112
char16_t XMLCh
Definition Xerces_autoconf_config.hpp:120
XMLUInt64 XMLFilePos
Definition Xerces_autoconf_config.hpp:139
Configurable memory manager.
Definition MemoryManager.hpp:40
Receive notification of panic.
Definition PanicHandler.hpp:45
PanicReasons
Definition PanicHandler.hpp:51
Definition PlatformUtils.hpp:47
virtual ~XMLDeleter()
Definition PlatformUtils.hpp:826
XMLDeleter()
Definition PlatformUtils.hpp:833
Definition XMLFileMgr.hpp:35
Definition XMLMutexMgr.hpp:34
Definition XMLNetAccessor.hpp:96
Utilities that must be implemented in a platform-specific way.
Definition PlatformUtils.hpp:69
static XMLMsgLoader * loadMsgSet(const XMLCh *const msgDomain)
Loads the message set from among the available domains.
static XMLFileMgr * fgFileMgr
Definition PlatformUtils.hpp:123
static void lockMutex(void *const mtxHandle)
Locks a mutex handle.
static void removeDotDotSlash(XMLCh *const srcPath, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Remove occurrences of the dot dot slash.
static XMLCh * getCurrentDirectory(MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Gets the current working directory.
static XMLSize_t readFileBuffer(FileHandle theFile, const XMLSize_t toRead, XMLByte *const toFill, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Reads the file buffer.
static XMLMutexMgr * fgMutexMgr
Definition PlatformUtils.hpp:124
static XMLFilePos curFilePos(FileHandle theFile, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Get the current file position.
static XMLMutexMgr * makeMutexMgr(MemoryManager *const manager)
Factory method for creating MutexMgr object.
static void Initialize(XMLSize_t initialDOMHeapAllocSize, XMLSize_t maxDOMHeapAllocSize, XMLSize_t maxDOMSubAllocationSize, const char *const locale=XMLUni::fgXercescDefaultLocale, const char *const nlsHome=0, PanicHandler *const panicHandler=0, MemoryManager *const memoryManager=0)
Perform per-process parser initialization.
static bool isAnySlash(XMLCh c)
Check if a character is a slash.
static void resetFile(FileHandle theFile, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Resets the file handle.
static void closeMutex(void *const mtxHandle, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Closes a mutex handle.
static bool fgSSE2ok
Definition PlatformUtils.hpp:135
static bool isNELRecognized()
Return the value of fgNEL flag.
static void strictIANAEncoding(const bool state)
This function enables/disables strict IANA encoding names checking.
static unsigned long getCurrentMillis()
Gets the system time in milliseconds.
static XMLSize_t alignPointerForNewBlockAllocation(XMLSize_t ptrSize)
Aligns the specified pointer per platform block allocation requirements.
static FileHandle openFile(const XMLCh *const fileName, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Opens a named file.
static FileHandle openFileToWrite(const char *const fileName, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Open a named file to write.
static bool fgXMLChBigEndian
Definition PlatformUtils.hpp:134
static FileHandle openStdInHandle(MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Opens the standard input as a file.
static XMLNetAccessor * fgNetAccessor
The network accessor.
Definition PlatformUtils.hpp:87
static void writeBufferToFile(FileHandle const theFile, XMLSize_t toWrite, const XMLByte *const toFlush, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Writes the buffer to the file.
static FileHandle openFileToWrite(const XMLCh *const fileName, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Open a named file to write.
static XMLFilePos fileSize(FileHandle theFile, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Returns the file size.
static bool isRelative(const XMLCh *const toCheck, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Determines if a path is relative or absolute.
static void recognizeNEL(bool state, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
This function enables the recognition of NEL(0x85) char and LSEP (0x2028) as newline chars which is d...
static MemoryManager * fgMemoryManager
The configurable memory manager.
Definition PlatformUtils.hpp:121
static FileHandle openFile(const char *const fileName, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Opens the file.
static bool isStrictIANAEncoding()
Returns whether a strict IANA encoding name check is enabled or disabled.
static void closeFile(FileHandle theFile, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Closes the file handle.
static XMLCh * getFullPath(const XMLCh *const srcPath, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Gets the full path from a relative path.
static XMLMutex * fgAtomicMutex
Global mutex for fast or infrequent operations.
Definition PlatformUtils.hpp:132
static void Initialize(const char *const locale=XMLUni::fgXercescDefaultLocale, const char *const nlsHome=0, PanicHandler *const panicHandler=0, MemoryManager *const memoryManager=0)
Perform per-process parser initialization.
static PanicHandler * fgUserPanicHandler
The Panic Handler.
Definition PlatformUtils.hpp:108
static void panic(const PanicHandler::PanicReasons reason)
The panic mechanism.
static XMLCh * weavePaths(const XMLCh *const basePath, const XMLCh *const relativePath, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Utility to join two paths.
static XMLTransService * fgTransService
The transcoding service.
Definition PlatformUtils.hpp:99
static XMLFileMgr * makeFileMgr(MemoryManager *const manager)
Make a new file object appropriate for the platform.
static PanicHandler * fgDefaultPanicHandler
The Panic Handler.
Definition PlatformUtils.hpp:114
static void Terminate()
Perform per-process parser termination.
static void unlockMutex(void *const mtxHandle)
Unlocks a mutex.
static void * makeMutex(MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Make a new mutex.
static void removeDotSlash(XMLCh *const srcPath, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Remove occurrences of the pair of dot slash.
Definition TransService.hpp:53
static const char fgXercescDefaultLocale[]
Definition XMLUni.hpp:305