mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-26 12:05:36 +01:00
New implementation of XString.
This commit is contained in:
parent
16806d435f
commit
fd0f4589ec
@ -136,13 +136,11 @@
|
||||
9AC77FB924176C04005CDD5C /* XStringWArray_test.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77ECC24176C04005CDD5C /* XStringWArray_test.h */; };
|
||||
9AC77FBA24176C04005CDD5C /* XArray_tests.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77ECD24176C04005CDD5C /* XArray_tests.h */; };
|
||||
9AC77FBB24176C04005CDD5C /* XStringWArray_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77ECE24176C04005CDD5C /* XStringWArray_test.cpp */; };
|
||||
9AC77FBF24176C04005CDD5C /* XStringW_test.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77ED224176C04005CDD5C /* XStringW_test.h */; };
|
||||
9AC77FC024176C04005CDD5C /* XObjArray_tests.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77ED324176C04005CDD5C /* XObjArray_tests.h */; };
|
||||
9AC77FC124176C04005CDD5C /* all_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77ED424176C04005CDD5C /* all_tests.cpp */; };
|
||||
9AC77FC224176C04005CDD5C /* XObjArray_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77ED524176C04005CDD5C /* XObjArray_tests.cpp */; };
|
||||
9AC77FC324176C04005CDD5C /* XArray_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77ED624176C04005CDD5C /* XArray_tests.cpp */; };
|
||||
9AC77FC424176C04005CDD5C /* all_tests.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77ED724176C04005CDD5C /* all_tests.h */; };
|
||||
9AC77FC524176C04005CDD5C /* XStringW_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77ED824176C04005CDD5C /* XStringW_test.cpp */; };
|
||||
9AC77FFD24176C04005CDD5C /* Version.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F1224176C04005CDD5C /* Version.h */; };
|
||||
9AC77FFE24176C04005CDD5C /* syslinux_mbr.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F1424176C04005CDD5C /* syslinux_mbr.h */; };
|
||||
9AC77FFF24176C04005CDD5C /* Handle.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F1524176C04005CDD5C /* Handle.h */; };
|
||||
@ -285,9 +283,7 @@
|
||||
9AC7808C24176C04005CDD5C /* remove_ref.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77FAA24176C04005CDD5C /* remove_ref.h */; };
|
||||
9AC7808D24176C04005CDD5C /* XStringWArray.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77FAC24176C04005CDD5C /* XStringWArray.h */; };
|
||||
9AC7808E24176C04005CDD5C /* XToolsCommon.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77FAD24176C04005CDD5C /* XToolsCommon.h */; };
|
||||
9AC7808F24176C04005CDD5C /* XStringW.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77FAE24176C04005CDD5C /* XStringW.h */; };
|
||||
9AC7809024176C04005CDD5C /* XStringWArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77FAF24176C04005CDD5C /* XStringWArray.cpp */; };
|
||||
9AC7809124176C04005CDD5C /* XStringW.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77FB024176C04005CDD5C /* XStringW.cpp */; };
|
||||
9AC7809524176C04005CDD5C /* XToolsCommon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77FB424176C04005CDD5C /* XToolsCommon.cpp */; };
|
||||
9AC7809724176C04005CDD5C /* XArray.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77FB624176C04005CDD5C /* XArray.h */; };
|
||||
9AC7809824176C04005CDD5C /* XObjArray.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77FB724176C04005CDD5C /* XObjArray.h */; };
|
||||
@ -310,7 +306,6 @@
|
||||
9ACFE65E24309AF80071CC93 /* remove_ref.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77FAA24176C04005CDD5C /* remove_ref.h */; };
|
||||
9ACFE66024309AF80071CC93 /* loader.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F4824176C04005CDD5C /* loader.h */; };
|
||||
9ACFE66124309AF80071CC93 /* AmlGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F1E24176C04005CDD5C /* AmlGenerator.h */; };
|
||||
9ACFE66224309AF80071CC93 /* XStringW.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77FAE24176C04005CDD5C /* XStringW.h */; };
|
||||
9ACFE66424309AF80071CC93 /* BootLog.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AF4173C242F15CB00D2644C /* BootLog.h */; };
|
||||
9ACFE66724309AF80071CC93 /* list.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F9824176C04005CDD5C /* list.h */; };
|
||||
9ACFE66924309AF80071CC93 /* XObjArray_tests.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77ED324176C04005CDD5C /* XObjArray_tests.h */; };
|
||||
@ -349,7 +344,6 @@
|
||||
9ACFE68C24309AF80071CC93 /* XToolsCommon.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77FAD24176C04005CDD5C /* XToolsCommon.h */; };
|
||||
9ACFE68E24309AF80071CC93 /* bootscreen.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F8724176C04005CDD5C /* bootscreen.h */; };
|
||||
9ACFE69024309AF80071CC93 /* Settings.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F2524176C04005CDD5C /* Settings.h */; };
|
||||
9ACFE69124309AF80071CC93 /* XStringW_test.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77ED224176C04005CDD5C /* XStringW_test.h */; };
|
||||
9ACFE69324309AF80071CC93 /* ati_reg.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F4F24176C04005CDD5C /* ati_reg.h */; };
|
||||
9ACFE69424309AF80071CC93 /* libegint.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F6124176C04005CDD5C /* libegint.h */; };
|
||||
9ACFE69524309AF80071CC93 /* memvendors.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F1D24176C04005CDD5C /* memvendors.h */; };
|
||||
@ -397,7 +391,6 @@
|
||||
9ACFE6C524309AF80071CC93 /* libscreen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F7424176C04005CDD5C /* libscreen.cpp */; };
|
||||
9ACFE6C624309AF80071CC93 /* strlen_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD2B241BC0DF00F3D247 /* strlen_test.cpp */; };
|
||||
9ACFE6C724309AF80071CC93 /* panic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77FA624176C04005CDD5C /* panic.cpp */; };
|
||||
9ACFE6C924309AF80071CC93 /* XStringW_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77ED824176C04005CDD5C /* XStringW_test.cpp */; };
|
||||
9ACFE6CA24309AF80071CC93 /* tool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F8924176C04005CDD5C /* tool.cpp */; };
|
||||
9ACFE6CB24309AF80071CC93 /* BasicIO.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AF4173D242F15CC00D2644C /* BasicIO.cpp */; };
|
||||
9ACFE6CC24309AF80071CC93 /* lib.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F9624176C04005CDD5C /* lib.cpp */; };
|
||||
@ -433,7 +426,6 @@
|
||||
9ACFE6ED24309AF80071CC93 /* LegacyBoot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F1824176C04005CDD5C /* LegacyBoot.cpp */; };
|
||||
9ACFE6EE24309AF80071CC93 /* REFIT_MENU_SCREEN.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F9124176C04005CDD5C /* REFIT_MENU_SCREEN.cpp */; };
|
||||
9ACFE6EF24309AF80071CC93 /* LegacyBiosThunk.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F3624176C04005CDD5C /* LegacyBiosThunk.cpp */; };
|
||||
9ACFE6F224309AF80071CC93 /* XStringW.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77FB024176C04005CDD5C /* XStringW.cpp */; };
|
||||
9ACFE6F324309AF80071CC93 /* lockedgraphics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F8324176C04005CDD5C /* lockedgraphics.cpp */; };
|
||||
9ACFE6F424309AF80071CC93 /* XString_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CC95241AB34800F3D247 /* XString_test.cpp */; };
|
||||
9ACFE6F524309AF80071CC93 /* device_inject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F4E24176C04005CDD5C /* device_inject.cpp */; };
|
||||
@ -498,7 +490,6 @@
|
||||
9AF41594242CD75C00D2644C /* remove_ref.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77FAA24176C04005CDD5C /* remove_ref.h */; };
|
||||
9AF41596242CD75C00D2644C /* loader.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F4824176C04005CDD5C /* loader.h */; };
|
||||
9AF41597242CD75C00D2644C /* AmlGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F1E24176C04005CDD5C /* AmlGenerator.h */; };
|
||||
9AF41598242CD75C00D2644C /* XStringW.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77FAE24176C04005CDD5C /* XStringW.h */; };
|
||||
9AF4159C242CD75C00D2644C /* list.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F9824176C04005CDD5C /* list.h */; };
|
||||
9AF4159E242CD75C00D2644C /* XObjArray_tests.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77ED324176C04005CDD5C /* XObjArray_tests.h */; };
|
||||
9AF4159F242CD75C00D2644C /* Events.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F3424176C04005CDD5C /* Events.h */; };
|
||||
@ -536,7 +527,6 @@
|
||||
9AF415C2242CD75C00D2644C /* XToolsCommon.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77FAD24176C04005CDD5C /* XToolsCommon.h */; };
|
||||
9AF415C4242CD75C00D2644C /* bootscreen.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F8724176C04005CDD5C /* bootscreen.h */; };
|
||||
9AF415C6242CD75C00D2644C /* Settings.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F2524176C04005CDD5C /* Settings.h */; };
|
||||
9AF415C7242CD75C00D2644C /* XStringW_test.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77ED224176C04005CDD5C /* XStringW_test.h */; };
|
||||
9AF415C9242CD75C00D2644C /* ati_reg.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F4F24176C04005CDD5C /* ati_reg.h */; };
|
||||
9AF415CA242CD75C00D2644C /* libegint.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F6124176C04005CDD5C /* libegint.h */; };
|
||||
9AF415CB242CD75C00D2644C /* memvendors.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F1D24176C04005CDD5C /* memvendors.h */; };
|
||||
@ -584,7 +574,6 @@
|
||||
9AF415FB242CD75C00D2644C /* libscreen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F7424176C04005CDD5C /* libscreen.cpp */; };
|
||||
9AF415FC242CD75C00D2644C /* strlen_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD2B241BC0DF00F3D247 /* strlen_test.cpp */; };
|
||||
9AF415FD242CD75C00D2644C /* panic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77FA624176C04005CDD5C /* panic.cpp */; };
|
||||
9AF415FF242CD75C00D2644C /* XStringW_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77ED824176C04005CDD5C /* XStringW_test.cpp */; };
|
||||
9AF41600242CD75C00D2644C /* tool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F8924176C04005CDD5C /* tool.cpp */; };
|
||||
9AF41601242CD75C00D2644C /* lib.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F9624176C04005CDD5C /* lib.cpp */; };
|
||||
9AF41602242CD75C00D2644C /* Injectors.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F3524176C04005CDD5C /* Injectors.cpp */; };
|
||||
@ -618,7 +607,6 @@
|
||||
9AF41623242CD75C00D2644C /* LegacyBoot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F1824176C04005CDD5C /* LegacyBoot.cpp */; };
|
||||
9AF41624242CD75C00D2644C /* REFIT_MENU_SCREEN.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F9124176C04005CDD5C /* REFIT_MENU_SCREEN.cpp */; };
|
||||
9AF41625242CD75C00D2644C /* LegacyBiosThunk.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F3624176C04005CDD5C /* LegacyBiosThunk.cpp */; };
|
||||
9AF41628242CD75C00D2644C /* XStringW.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77FB024176C04005CDD5C /* XStringW.cpp */; };
|
||||
9AF41629242CD75C00D2644C /* lockedgraphics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F8324176C04005CDD5C /* lockedgraphics.cpp */; };
|
||||
9AF4162A242CD75C00D2644C /* XString_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CC95241AB34800F3D247 /* XString_test.cpp */; };
|
||||
9AF4162B242CD75C00D2644C /* device_inject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F4E24176C04005CDD5C /* device_inject.cpp */; };
|
||||
@ -677,7 +665,6 @@
|
||||
9AF41671242CDA5800D2644C /* remove_ref.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77FAA24176C04005CDD5C /* remove_ref.h */; };
|
||||
9AF41673242CDA5800D2644C /* loader.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F4824176C04005CDD5C /* loader.h */; };
|
||||
9AF41674242CDA5800D2644C /* AmlGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F1E24176C04005CDD5C /* AmlGenerator.h */; };
|
||||
9AF41675242CDA5800D2644C /* XStringW.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77FAE24176C04005CDD5C /* XStringW.h */; };
|
||||
9AF41679242CDA5800D2644C /* list.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F9824176C04005CDD5C /* list.h */; };
|
||||
9AF4167B242CDA5800D2644C /* XObjArray_tests.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77ED324176C04005CDD5C /* XObjArray_tests.h */; };
|
||||
9AF4167C242CDA5800D2644C /* Events.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F3424176C04005CDD5C /* Events.h */; };
|
||||
@ -715,7 +702,6 @@
|
||||
9AF4169F242CDA5800D2644C /* XToolsCommon.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77FAD24176C04005CDD5C /* XToolsCommon.h */; };
|
||||
9AF416A1242CDA5800D2644C /* bootscreen.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F8724176C04005CDD5C /* bootscreen.h */; };
|
||||
9AF416A3242CDA5800D2644C /* Settings.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F2524176C04005CDD5C /* Settings.h */; };
|
||||
9AF416A4242CDA5800D2644C /* XStringW_test.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77ED224176C04005CDD5C /* XStringW_test.h */; };
|
||||
9AF416A6242CDA5800D2644C /* ati_reg.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F4F24176C04005CDD5C /* ati_reg.h */; };
|
||||
9AF416A7242CDA5800D2644C /* libegint.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F6124176C04005CDD5C /* libegint.h */; };
|
||||
9AF416A8242CDA5800D2644C /* memvendors.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77F1D24176C04005CDD5C /* memvendors.h */; };
|
||||
@ -763,7 +749,6 @@
|
||||
9AF416D8242CDA5800D2644C /* libscreen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F7424176C04005CDD5C /* libscreen.cpp */; };
|
||||
9AF416D9242CDA5800D2644C /* strlen_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD2B241BC0DF00F3D247 /* strlen_test.cpp */; };
|
||||
9AF416DA242CDA5800D2644C /* panic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77FA624176C04005CDD5C /* panic.cpp */; };
|
||||
9AF416DC242CDA5800D2644C /* XStringW_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77ED824176C04005CDD5C /* XStringW_test.cpp */; };
|
||||
9AF416DD242CDA5800D2644C /* tool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F8924176C04005CDD5C /* tool.cpp */; };
|
||||
9AF416DE242CDA5800D2644C /* lib.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F9624176C04005CDD5C /* lib.cpp */; };
|
||||
9AF416DF242CDA5800D2644C /* Injectors.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F3524176C04005CDD5C /* Injectors.cpp */; };
|
||||
@ -797,7 +782,6 @@
|
||||
9AF41700242CDA5800D2644C /* LegacyBoot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F1824176C04005CDD5C /* LegacyBoot.cpp */; };
|
||||
9AF41701242CDA5800D2644C /* REFIT_MENU_SCREEN.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F9124176C04005CDD5C /* REFIT_MENU_SCREEN.cpp */; };
|
||||
9AF41702242CDA5800D2644C /* LegacyBiosThunk.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F3624176C04005CDD5C /* LegacyBiosThunk.cpp */; };
|
||||
9AF41705242CDA5800D2644C /* XStringW.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77FB024176C04005CDD5C /* XStringW.cpp */; };
|
||||
9AF41706242CDA5800D2644C /* lockedgraphics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F8324176C04005CDD5C /* lockedgraphics.cpp */; };
|
||||
9AF41707242CDA5800D2644C /* XString_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CC95241AB34800F3D247 /* XString_test.cpp */; };
|
||||
9AF41708242CDA5800D2644C /* device_inject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F4E24176C04005CDD5C /* device_inject.cpp */; };
|
||||
@ -917,13 +901,11 @@
|
||||
9AC77ECC24176C04005CDD5C /* XStringWArray_test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XStringWArray_test.h; sourceTree = "<group>"; };
|
||||
9AC77ECD24176C04005CDD5C /* XArray_tests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XArray_tests.h; sourceTree = "<group>"; };
|
||||
9AC77ECE24176C04005CDD5C /* XStringWArray_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XStringWArray_test.cpp; sourceTree = "<group>"; };
|
||||
9AC77ED224176C04005CDD5C /* XStringW_test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XStringW_test.h; sourceTree = "<group>"; };
|
||||
9AC77ED324176C04005CDD5C /* XObjArray_tests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XObjArray_tests.h; sourceTree = "<group>"; };
|
||||
9AC77ED424176C04005CDD5C /* all_tests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = all_tests.cpp; sourceTree = "<group>"; };
|
||||
9AC77ED524176C04005CDD5C /* XObjArray_tests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XObjArray_tests.cpp; sourceTree = "<group>"; };
|
||||
9AC77ED624176C04005CDD5C /* XArray_tests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XArray_tests.cpp; sourceTree = "<group>"; };
|
||||
9AC77ED724176C04005CDD5C /* all_tests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = all_tests.h; sourceTree = "<group>"; };
|
||||
9AC77ED824176C04005CDD5C /* XStringW_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XStringW_test.cpp; sourceTree = "<group>"; };
|
||||
9AC77F1224176C04005CDD5C /* Version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Version.h; sourceTree = "<group>"; };
|
||||
9AC77F1424176C04005CDD5C /* syslinux_mbr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = syslinux_mbr.h; sourceTree = "<group>"; };
|
||||
9AC77F1524176C04005CDD5C /* Handle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Handle.h; sourceTree = "<group>"; };
|
||||
@ -1066,9 +1048,7 @@
|
||||
9AC77FAA24176C04005CDD5C /* remove_ref.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = remove_ref.h; sourceTree = "<group>"; };
|
||||
9AC77FAC24176C04005CDD5C /* XStringWArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XStringWArray.h; sourceTree = "<group>"; };
|
||||
9AC77FAD24176C04005CDD5C /* XToolsCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XToolsCommon.h; sourceTree = "<group>"; };
|
||||
9AC77FAE24176C04005CDD5C /* XStringW.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XStringW.h; sourceTree = "<group>"; };
|
||||
9AC77FAF24176C04005CDD5C /* XStringWArray.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XStringWArray.cpp; sourceTree = "<group>"; };
|
||||
9AC77FB024176C04005CDD5C /* XStringW.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XStringW.cpp; sourceTree = "<group>"; };
|
||||
9AC77FB424176C04005CDD5C /* XToolsCommon.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XToolsCommon.cpp; sourceTree = "<group>"; };
|
||||
9AC77FB624176C04005CDD5C /* XArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XArray.h; sourceTree = "<group>"; };
|
||||
9AC77FB724176C04005CDD5C /* XObjArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XObjArray.h; sourceTree = "<group>"; };
|
||||
@ -1220,8 +1200,6 @@
|
||||
9AC77ED324176C04005CDD5C /* XObjArray_tests.h */,
|
||||
9A28CC95241AB34800F3D247 /* XString_test.cpp */,
|
||||
9A28CC96241AB34800F3D247 /* XString_test.h */,
|
||||
9AC77ED824176C04005CDD5C /* XStringW_test.cpp */,
|
||||
9AC77ED224176C04005CDD5C /* XStringW_test.h */,
|
||||
9AC77ECE24176C04005CDD5C /* XStringWArray_test.cpp */,
|
||||
9AC77ECC24176C04005CDD5C /* XStringWArray_test.h */,
|
||||
);
|
||||
@ -1473,8 +1451,6 @@
|
||||
9AC77FB724176C04005CDD5C /* XObjArray.h */,
|
||||
9A28CC91241AB33700F3D247 /* XString.cpp */,
|
||||
9A28CC92241AB33700F3D247 /* XString.h */,
|
||||
9AC77FB024176C04005CDD5C /* XStringW.cpp */,
|
||||
9AC77FAE24176C04005CDD5C /* XStringW.h */,
|
||||
9AC77FAF24176C04005CDD5C /* XStringWArray.cpp */,
|
||||
9AC77FAC24176C04005CDD5C /* XStringWArray.h */,
|
||||
9AC77FB424176C04005CDD5C /* XToolsCommon.cpp */,
|
||||
@ -1508,7 +1484,6 @@
|
||||
9AC7808C24176C04005CDD5C /* remove_ref.h in Headers */,
|
||||
9AC7803124176C04005CDD5C /* loader.h in Headers */,
|
||||
9AC7800724176C04005CDD5C /* AmlGenerator.h in Headers */,
|
||||
9AC7808F24176C04005CDD5C /* XStringW.h in Headers */,
|
||||
9A105B2D24464A830006DE06 /* BmLib.h in Headers */,
|
||||
9AF4173F242F15CC00D2644C /* BootLog.h in Headers */,
|
||||
9AC7807B24176C04005CDD5C /* list.h in Headers */,
|
||||
@ -1566,7 +1541,6 @@
|
||||
9AC7800E24176C04005CDD5C /* Settings.h in Headers */,
|
||||
9A105B3924483AD50006DE06 /* image.h in Headers */,
|
||||
9A105B7A24483AE40006DE06 /* cpu.h in Headers */,
|
||||
9AC77FBF24176C04005CDD5C /* XStringW_test.h in Headers */,
|
||||
9AC7803824176C04005CDD5C /* ati_reg.h in Headers */,
|
||||
9A105B81244852D70006DE06 /* VersionString.h in Headers */,
|
||||
9AC7804824176C04005CDD5C /* libegint.h in Headers */,
|
||||
@ -1638,7 +1612,6 @@
|
||||
9ACFE65E24309AF80071CC93 /* remove_ref.h in Headers */,
|
||||
9ACFE66024309AF80071CC93 /* loader.h in Headers */,
|
||||
9ACFE66124309AF80071CC93 /* AmlGenerator.h in Headers */,
|
||||
9ACFE66224309AF80071CC93 /* XStringW.h in Headers */,
|
||||
9ACFE66424309AF80071CC93 /* BootLog.h in Headers */,
|
||||
9ACFE66724309AF80071CC93 /* list.h in Headers */,
|
||||
9ACFE66924309AF80071CC93 /* XObjArray_tests.h in Headers */,
|
||||
@ -1678,7 +1651,6 @@
|
||||
9ACFE68C24309AF80071CC93 /* XToolsCommon.h in Headers */,
|
||||
9ACFE68E24309AF80071CC93 /* bootscreen.h in Headers */,
|
||||
9ACFE69024309AF80071CC93 /* Settings.h in Headers */,
|
||||
9ACFE69124309AF80071CC93 /* XStringW_test.h in Headers */,
|
||||
9ACFE69324309AF80071CC93 /* ati_reg.h in Headers */,
|
||||
9ACFE69424309AF80071CC93 /* libegint.h in Headers */,
|
||||
9ACFE69524309AF80071CC93 /* memvendors.h in Headers */,
|
||||
@ -1736,7 +1708,6 @@
|
||||
9AF41594242CD75C00D2644C /* remove_ref.h in Headers */,
|
||||
9AF41596242CD75C00D2644C /* loader.h in Headers */,
|
||||
9AF41597242CD75C00D2644C /* AmlGenerator.h in Headers */,
|
||||
9AF41598242CD75C00D2644C /* XStringW.h in Headers */,
|
||||
9AF4159C242CD75C00D2644C /* list.h in Headers */,
|
||||
9AF4159E242CD75C00D2644C /* XObjArray_tests.h in Headers */,
|
||||
9AF4159F242CD75C00D2644C /* Events.h in Headers */,
|
||||
@ -1777,7 +1748,6 @@
|
||||
9AF415C2242CD75C00D2644C /* XToolsCommon.h in Headers */,
|
||||
9AF415C4242CD75C00D2644C /* bootscreen.h in Headers */,
|
||||
9AF415C6242CD75C00D2644C /* Settings.h in Headers */,
|
||||
9AF415C7242CD75C00D2644C /* XStringW_test.h in Headers */,
|
||||
9AF415C9242CD75C00D2644C /* ati_reg.h in Headers */,
|
||||
9AF415CA242CD75C00D2644C /* libegint.h in Headers */,
|
||||
9AF415CB242CD75C00D2644C /* memvendors.h in Headers */,
|
||||
@ -1833,7 +1803,6 @@
|
||||
9AF41671242CDA5800D2644C /* remove_ref.h in Headers */,
|
||||
9AF41673242CDA5800D2644C /* loader.h in Headers */,
|
||||
9AF41674242CDA5800D2644C /* AmlGenerator.h in Headers */,
|
||||
9AF41675242CDA5800D2644C /* XStringW.h in Headers */,
|
||||
9AF41679242CDA5800D2644C /* list.h in Headers */,
|
||||
9AF4167B242CDA5800D2644C /* XObjArray_tests.h in Headers */,
|
||||
9AF4167C242CDA5800D2644C /* Events.h in Headers */,
|
||||
@ -1874,7 +1843,6 @@
|
||||
9AF4169F242CDA5800D2644C /* XToolsCommon.h in Headers */,
|
||||
9AF416A1242CDA5800D2644C /* bootscreen.h in Headers */,
|
||||
9AF416A3242CDA5800D2644C /* Settings.h in Headers */,
|
||||
9AF416A4242CDA5800D2644C /* XStringW_test.h in Headers */,
|
||||
9AF416A6242CDA5800D2644C /* ati_reg.h in Headers */,
|
||||
9AF416A7242CDA5800D2644C /* libegint.h in Headers */,
|
||||
9AF416A8242CDA5800D2644C /* memvendors.h in Headers */,
|
||||
@ -2116,7 +2084,6 @@
|
||||
9AC7805B24176C04005CDD5C /* libscreen.cpp in Sources */,
|
||||
9A28CD31241BC0DF00F3D247 /* strlen_test.cpp in Sources */,
|
||||
9AC7808824176C04005CDD5C /* panic.cpp in Sources */,
|
||||
9AC77FC524176C04005CDD5C /* XStringW_test.cpp in Sources */,
|
||||
9AC7806F24176C04005CDD5C /* tool.cpp in Sources */,
|
||||
9AF41740242F15CC00D2644C /* BasicIO.cpp in Sources */,
|
||||
9AC7807924176C04005CDD5C /* lib.cpp in Sources */,
|
||||
@ -2155,7 +2122,6 @@
|
||||
9AC7807524176C04005CDD5C /* REFIT_MENU_SCREEN.cpp in Sources */,
|
||||
9AC7801F24176C04005CDD5C /* LegacyBiosThunk.cpp in Sources */,
|
||||
9A09863124389A6A00826276 /* menu.cpp in Sources */,
|
||||
9AC7809124176C04005CDD5C /* XStringW.cpp in Sources */,
|
||||
9AC7806924176C04005CDD5C /* lockedgraphics.cpp in Sources */,
|
||||
9A28CC97241AB34800F3D247 /* XString_test.cpp in Sources */,
|
||||
9A4185BA2439F29D00BEAFB8 /* LoadOptions_test.cpp in Sources */,
|
||||
@ -2231,7 +2197,6 @@
|
||||
9ACFE6C624309AF80071CC93 /* strlen_test.cpp in Sources */,
|
||||
9A105B88244852D70006DE06 /* VersionString.cpp in Sources */,
|
||||
9ACFE6C724309AF80071CC93 /* panic.cpp in Sources */,
|
||||
9ACFE6C924309AF80071CC93 /* XStringW_test.cpp in Sources */,
|
||||
9ACFE6CA24309AF80071CC93 /* tool.cpp in Sources */,
|
||||
9ACFE6CB24309AF80071CC93 /* BasicIO.cpp in Sources */,
|
||||
9A4F68582449D4AE004B2F7E /* stdio.cpp in Sources */,
|
||||
@ -2272,7 +2237,6 @@
|
||||
9ACFE6EE24309AF80071CC93 /* REFIT_MENU_SCREEN.cpp in Sources */,
|
||||
9ACFE6EF24309AF80071CC93 /* LegacyBiosThunk.cpp in Sources */,
|
||||
9A09863424389A6A00826276 /* menu.cpp in Sources */,
|
||||
9ACFE6F224309AF80071CC93 /* XStringW.cpp in Sources */,
|
||||
9A9AEB9F243F7B9200FBD7D8 /* XStringArray.cpp in Sources */,
|
||||
9ACFE6F324309AF80071CC93 /* lockedgraphics.cpp in Sources */,
|
||||
9A4185BD2439F29D00BEAFB8 /* LoadOptions_test.cpp in Sources */,
|
||||
@ -2349,7 +2313,6 @@
|
||||
9AF415FC242CD75C00D2644C /* strlen_test.cpp in Sources */,
|
||||
9A105B86244852D70006DE06 /* VersionString.cpp in Sources */,
|
||||
9AF415FD242CD75C00D2644C /* panic.cpp in Sources */,
|
||||
9AF415FF242CD75C00D2644C /* XStringW_test.cpp in Sources */,
|
||||
9AF41600242CD75C00D2644C /* tool.cpp in Sources */,
|
||||
9AF41742242F15D600D2644C /* BasicIO.cpp in Sources */,
|
||||
9A4F68562449D4AE004B2F7E /* stdio.cpp in Sources */,
|
||||
@ -2389,7 +2352,6 @@
|
||||
9AF41624242CD75C00D2644C /* REFIT_MENU_SCREEN.cpp in Sources */,
|
||||
9AF41625242CD75C00D2644C /* LegacyBiosThunk.cpp in Sources */,
|
||||
9A09863224389A6A00826276 /* menu.cpp in Sources */,
|
||||
9AF41628242CD75C00D2644C /* XStringW.cpp in Sources */,
|
||||
9AF41629242CD75C00D2644C /* lockedgraphics.cpp in Sources */,
|
||||
9A9AEB9D243F7B9000FBD7D8 /* XStringArray.cpp in Sources */,
|
||||
9AF4162A242CD75C00D2644C /* XString_test.cpp in Sources */,
|
||||
@ -2467,7 +2429,6 @@
|
||||
9AF416D9242CDA5800D2644C /* strlen_test.cpp in Sources */,
|
||||
9A105B87244852D70006DE06 /* VersionString.cpp in Sources */,
|
||||
9AF416DA242CDA5800D2644C /* panic.cpp in Sources */,
|
||||
9AF416DC242CDA5800D2644C /* XStringW_test.cpp in Sources */,
|
||||
9AF416DD242CDA5800D2644C /* tool.cpp in Sources */,
|
||||
9AF41743242F15D700D2644C /* BasicIO.cpp in Sources */,
|
||||
9A4F68572449D4AE004B2F7E /* stdio.cpp in Sources */,
|
||||
@ -2507,7 +2468,6 @@
|
||||
9AF41701242CDA5800D2644C /* REFIT_MENU_SCREEN.cpp in Sources */,
|
||||
9AF41702242CDA5800D2644C /* LegacyBiosThunk.cpp in Sources */,
|
||||
9A09863324389A6A00826276 /* menu.cpp in Sources */,
|
||||
9AF41705242CDA5800D2644C /* XStringW.cpp in Sources */,
|
||||
9AF41706242CDA5800D2644C /* lockedgraphics.cpp in Sources */,
|
||||
9A9AEB9E243F7B9100FBD7D8 /* XStringArray.cpp in Sources */,
|
||||
9AF41707242CDA5800D2644C /* XString_test.cpp in Sources */,
|
||||
|
@ -215,7 +215,7 @@
|
||||
|
||||
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="cpp_foundation"/>
|
||||
|
||||
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="cpp_unit_test"/>
|
||||
<entry excluding="printlib-test.cpp|poolprint-test.cpp" flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="cpp_unit_test"/>
|
||||
|
||||
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="src"/>
|
||||
|
||||
@ -439,9 +439,13 @@
|
||||
|
||||
<sourceEntries>
|
||||
|
||||
<entry excluding="MemLogLib.c" flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="MemLogLibDefault"/>
|
||||
|
||||
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="cpp_foundation"/>
|
||||
|
||||
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="cpp_unit_test"/>
|
||||
<entry excluding="printlib-test.cpp|poolprint-test.cpp" flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="cpp_unit_test"/>
|
||||
|
||||
<entry excluding="operatorNewDelete.cpp|memory.cpp|globals_dtor.cpp|globals_ctor.cpp" flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="cpp_util"/>
|
||||
|
||||
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="src"/>
|
||||
|
||||
|
@ -25,6 +25,11 @@
|
||||
<nature>org.eclipse.cdt.core.ccnature</nature>
|
||||
</natures>
|
||||
<linkedResources>
|
||||
<link>
|
||||
<name>MemLogLibDefault</name>
|
||||
<type>2</type>
|
||||
<locationURI>PARENT-2-PROJECT_LOC/Library/MemLogLibDefault</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>cpp_foundation</name>
|
||||
<type>2</type>
|
||||
@ -35,5 +40,10 @@
|
||||
<type>2</type>
|
||||
<locationURI>PARENT-2-PROJECT_LOC/rEFIt_UEFI/cpp_unit_test</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>cpp_util</name>
|
||||
<type>2</type>
|
||||
<locationURI>PARENT-2-PROJECT_LOC/rEFIt_UEFI/cpp_util</locationURI>
|
||||
</link>
|
||||
</linkedResources>
|
||||
</projectDescription>
|
||||
|
@ -4,6 +4,8 @@ prefix=$1
|
||||
|
||||
echo "
|
||||
|
||||
../src
|
||||
|
||||
" | awk '$0!=""{ printf " -I'"${prefix}"'%s", $0; }'
|
||||
|
||||
|
||||
|
@ -2,6 +2,5 @@
|
||||
SCRIPT_ABS_FILENAME=`LC_ALL=en_US.ISO8859-1 perl -e 'use Cwd "abs_path";print abs_path(shift)' "${BASH_SOURCE[0]}"`
|
||||
SCRIPT_DIR=`dirname "$SCRIPT_ABS_FILENAME"`
|
||||
|
||||
echo -g -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Wno-array-bounds -ffunction-sections -fdata-sections \
|
||||
-fno-common -m64 -fno-stack-protector -mabi=ms -maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie -fno-asynchronous-unwind-tables \
|
||||
-Wno-address -flto -Wno-unused-but-set-variable -fno-omit-frame-pointer -Wno-unknown-pragmas -Wno-unused-label
|
||||
echo -g -fshort-wchar -include ../src/Platform.h
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
|
||||
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-1797228193705432387" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="1822183346599785303" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
|
||||
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-1820751051559632536" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="1868664118498733496" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
|
||||
|
@ -19,3 +19,7 @@ environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.macosx.exe.debug
|
||||
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.macosx.exe.debug.1043399644.1294514338/LIBRARY_PATH/operation=remove
|
||||
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.macosx.exe.debug.1043399644.1294514338/append=true
|
||||
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.macosx.exe.debug.1043399644.1294514338/appendContributed=true
|
||||
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.macosx.exe.debug.1043399644.573872575/LIBRARY_PATH/delimiter=\:
|
||||
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.macosx.exe.debug.1043399644.573872575/LIBRARY_PATH/operation=remove
|
||||
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.macosx.exe.debug.1043399644.573872575/append=true
|
||||
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.macosx.exe.debug.1043399644.573872575/appendContributed=true
|
||||
|
@ -13,21 +13,17 @@
|
||||
9A0B08592402FF8200E2B470 /* all_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08512402FE9B00E2B470 /* all_tests.cpp */; };
|
||||
9A0B085A2402FF8400E2B470 /* XObjArray_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08522402FE9B00E2B470 /* XObjArray_tests.cpp */; };
|
||||
9A0B085B2402FF8700E2B470 /* XArray_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08532402FE9B00E2B470 /* XArray_tests.cpp */; };
|
||||
9A0B085C2402FF8B00E2B470 /* XStringW_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08552402FE9B00E2B470 /* XStringW_test.cpp */; };
|
||||
9A0B085E240300E000E2B470 /* Platform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B085D240300E000E2B470 /* Platform.cpp */; };
|
||||
9A0B085F240308E400E2B470 /* XStringW.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08482402FE9300E2B470 /* XStringW.cpp */; };
|
||||
9A0B08662403144C00E2B470 /* global_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08642403144C00E2B470 /* global_test.cpp */; };
|
||||
9A0B08732403B08400E2B470 /* XObjArray_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08522402FE9B00E2B470 /* XObjArray_tests.cpp */; };
|
||||
9A0B08742403B08400E2B470 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9223302402FD1000483CBA /* main.cpp */; };
|
||||
9A0B08772403B08400E2B470 /* XStringWArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08472402FE9300E2B470 /* XStringWArray.cpp */; };
|
||||
9A0B08792403B08400E2B470 /* XStringW.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08482402FE9300E2B470 /* XStringW.cpp */; };
|
||||
9A0B087A2403B08400E2B470 /* all_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08512402FE9B00E2B470 /* all_tests.cpp */; };
|
||||
9A0B087B2403B08400E2B470 /* global_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08642403144C00E2B470 /* global_test.cpp */; };
|
||||
9A0B087C2403B08400E2B470 /* XToolsCommon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08492402FE9300E2B470 /* XToolsCommon.cpp */; };
|
||||
9A0B087D2403B08400E2B470 /* XStringWArray_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B084F2402FE9B00E2B470 /* XStringWArray_test.cpp */; };
|
||||
9A0B087E2403B08400E2B470 /* XArray_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08532402FE9B00E2B470 /* XArray_tests.cpp */; };
|
||||
9A0B087F2403B08400E2B470 /* Platform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B085D240300E000E2B470 /* Platform.cpp */; };
|
||||
9A0B08802403B08400E2B470 /* XStringW_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08552402FE9B00E2B470 /* XStringW_test.cpp */; };
|
||||
9A28CD09241B8DD400F3D247 /* strncmp_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD05241B8DD400F3D247 /* strncmp_test.cpp */; };
|
||||
9A28CD0A241B8DD400F3D247 /* strncmp_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD05241B8DD400F3D247 /* strncmp_test.cpp */; };
|
||||
9A28CD0B241B8DD400F3D247 /* strncmp_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD05241B8DD400F3D247 /* strncmp_test.cpp */; };
|
||||
@ -55,24 +51,22 @@
|
||||
9A4185C02439F73A00BEAFB8 /* XStringArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A4185BE2439F73A00BEAFB8 /* XStringArray.cpp */; };
|
||||
9A4185C12439F73A00BEAFB8 /* XStringArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A4185BE2439F73A00BEAFB8 /* XStringArray.cpp */; };
|
||||
9A4185C22439F73A00BEAFB8 /* XStringArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A4185BE2439F73A00BEAFB8 /* XStringArray.cpp */; };
|
||||
9A4FFA7E2451C8330050B38B /* XString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A4FFA7C2451C8330050B38B /* XString.cpp */; };
|
||||
9A4FFA812451C88D0050B38B /* XString_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A4FFA802451C88D0050B38B /* XString_test.cpp */; };
|
||||
9A4FFA822451C88D0050B38B /* XString_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A4FFA802451C88D0050B38B /* XString_test.cpp */; };
|
||||
9A4FFA832451C88D0050B38B /* XString_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A4FFA802451C88D0050B38B /* XString_test.cpp */; };
|
||||
9A4FFA842451C9740050B38B /* XString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A4FFA7C2451C8330050B38B /* XString.cpp */; };
|
||||
9A4FFA852451C9740050B38B /* XString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A4FFA7C2451C8330050B38B /* XString.cpp */; };
|
||||
9A57C21A2418B9A00029A39F /* XObjArray_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08522402FE9B00E2B470 /* XObjArray_tests.cpp */; };
|
||||
9A57C21B2418B9A00029A39F /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9223302402FD1000483CBA /* main.cpp */; };
|
||||
9A57C21D2418B9A00029A39F /* XStringWArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08472402FE9300E2B470 /* XStringWArray.cpp */; };
|
||||
9A57C2202418B9A00029A39F /* panic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC780A32417DD2F005CDD5C /* panic.cpp */; };
|
||||
9A57C2212418B9A00029A39F /* XStringW.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08482402FE9300E2B470 /* XStringW.cpp */; };
|
||||
9A57C2222418B9A00029A39F /* all_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08512402FE9B00E2B470 /* all_tests.cpp */; };
|
||||
9A57C2232418B9A00029A39F /* global_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08642403144C00E2B470 /* global_test.cpp */; };
|
||||
9A57C2242418B9A00029A39F /* XToolsCommon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08492402FE9300E2B470 /* XToolsCommon.cpp */; };
|
||||
9A57C2252418B9A00029A39F /* XStringWArray_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B084F2402FE9B00E2B470 /* XStringWArray_test.cpp */; };
|
||||
9A57C2272418B9A00029A39F /* XArray_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08532402FE9B00E2B470 /* XArray_tests.cpp */; };
|
||||
9A57C2282418B9A00029A39F /* Platform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B085D240300E000E2B470 /* Platform.cpp */; };
|
||||
9A57C2292418B9A00029A39F /* XStringW_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A0B08552402FE9B00E2B470 /* XStringW_test.cpp */; };
|
||||
9A57C263241A752E0029A39F /* XString_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A57C261241A752E0029A39F /* XString_test.cpp */; };
|
||||
9A57C264241A752E0029A39F /* XString_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A57C261241A752E0029A39F /* XString_test.cpp */; };
|
||||
9A57C265241A752E0029A39F /* XString_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A57C261241A752E0029A39F /* XString_test.cpp */; };
|
||||
9A57C268241A799B0029A39F /* XString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A57C267241A799B0029A39F /* XString.cpp */; };
|
||||
9A57C269241A799B0029A39F /* XString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A57C267241A799B0029A39F /* XString.cpp */; };
|
||||
9A57C26A241A799B0029A39F /* XString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A57C267241A799B0029A39F /* XString.cpp */; };
|
||||
9A9223312402FD1000483CBA /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9223302402FD1000483CBA /* main.cpp */; };
|
||||
9A9AEB8D243F73CE00FBD7D8 /* unicode_conversions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9AEB8C243F73CE00FBD7D8 /* unicode_conversions.cpp */; };
|
||||
9A9AEB8E243F752C00FBD7D8 /* unicode_conversions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A9AEB8C243F73CE00FBD7D8 /* unicode_conversions.cpp */; };
|
||||
@ -120,9 +114,7 @@
|
||||
/* Begin PBXFileReference section */
|
||||
9A0B08442402FE9300E2B470 /* XStringWArray.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XStringWArray.h; sourceTree = "<group>"; };
|
||||
9A0B08452402FE9300E2B470 /* XToolsCommon.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XToolsCommon.h; sourceTree = "<group>"; };
|
||||
9A0B08462402FE9300E2B470 /* XStringW.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XStringW.h; sourceTree = "<group>"; };
|
||||
9A0B08472402FE9300E2B470 /* XStringWArray.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = XStringWArray.cpp; sourceTree = "<group>"; };
|
||||
9A0B08482402FE9300E2B470 /* XStringW.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = XStringW.cpp; sourceTree = "<group>"; };
|
||||
9A0B08492402FE9300E2B470 /* XToolsCommon.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = XToolsCommon.cpp; sourceTree = "<group>"; };
|
||||
9A0B084A2402FE9300E2B470 /* XArray.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XArray.h; sourceTree = "<group>"; };
|
||||
9A0B084B2402FE9300E2B470 /* XObjArray.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XObjArray.h; sourceTree = "<group>"; };
|
||||
@ -134,9 +126,7 @@
|
||||
9A0B08522402FE9B00E2B470 /* XObjArray_tests.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = XObjArray_tests.cpp; sourceTree = "<group>"; };
|
||||
9A0B08532402FE9B00E2B470 /* XArray_tests.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = XArray_tests.cpp; sourceTree = "<group>"; };
|
||||
9A0B08542402FE9B00E2B470 /* all_tests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = all_tests.h; sourceTree = "<group>"; };
|
||||
9A0B08552402FE9B00E2B470 /* XStringW_test.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = XStringW_test.cpp; sourceTree = "<group>"; };
|
||||
9A0B085D240300E000E2B470 /* Platform.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Platform.cpp; sourceTree = "<group>"; };
|
||||
9A0B08632403132300E2B470 /* XStringW_test.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XStringW_test.h; sourceTree = "<group>"; };
|
||||
9A0B08642403144C00E2B470 /* global_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = global_test.cpp; sourceTree = "<group>"; };
|
||||
9A0B08862403B08400E2B470 /* cpp_tests UTF32 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "cpp_tests UTF32"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
9A1A3FDC2424BC22008C89EB /* printf_lite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = printf_lite.h; sourceTree = "<group>"; };
|
||||
@ -156,12 +146,14 @@
|
||||
9A4185B02439E4D600BEAFB8 /* LoadOptions_test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoadOptions_test.h; sourceTree = "<group>"; };
|
||||
9A4185BE2439F73A00BEAFB8 /* XStringArray.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XStringArray.cpp; sourceTree = "<group>"; };
|
||||
9A4185BF2439F73A00BEAFB8 /* XStringArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XStringArray.h; sourceTree = "<group>"; };
|
||||
9A4FFA7C2451C8330050B38B /* XString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XString.cpp; sourceTree = "<group>"; };
|
||||
9A4FFA7D2451C8330050B38B /* XStringAbstract copy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "XStringAbstract copy.h"; sourceTree = "<group>"; };
|
||||
9A4FFA7F2451C88C0050B38B /* XString_test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XString_test.h; sourceTree = "<group>"; };
|
||||
9A4FFA802451C88D0050B38B /* XString_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XString_test.cpp; sourceTree = "<group>"; };
|
||||
9A57C20A2418A1FD0029A39F /* global_test.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = global_test.h; sourceTree = "<group>"; };
|
||||
9A57C22F2418B9A00029A39F /* cpp_tests UTF16 unsigned char */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "cpp_tests UTF16 unsigned char"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
9A57C261241A752E0029A39F /* XString_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XString_test.cpp; sourceTree = "<group>"; };
|
||||
9A57C262241A752E0029A39F /* XString_test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XString_test.h; sourceTree = "<group>"; };
|
||||
9A57C266241A799B0029A39F /* XString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XString.h; sourceTree = "<group>"; };
|
||||
9A57C267241A799B0029A39F /* XString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XString.cpp; sourceTree = "<group>"; };
|
||||
9A6BA73C2449977300BDA52C /* XStringAbstract.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XStringAbstract.h; sourceTree = "<group>"; };
|
||||
9A92232D2402FD1000483CBA /* cpp_tests UTF16 signed char */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "cpp_tests UTF16 signed char"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
9A9223302402FD1000483CBA /* main.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; };
|
||||
9A92234D2402FD9500483CBA /* Platform.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Platform.h; sourceTree = "<group>"; };
|
||||
@ -217,16 +209,16 @@
|
||||
9A0B08432402FE9300E2B470 /* cpp_foundation */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9A4FFA7C2451C8330050B38B /* XString.cpp */,
|
||||
9A4FFA7D2451C8330050B38B /* XStringAbstract copy.h */,
|
||||
9A57C266241A799B0029A39F /* XString.h */,
|
||||
9A6BA73C2449977300BDA52C /* XStringAbstract.h */,
|
||||
9A9AEB8C243F73CE00FBD7D8 /* unicode_conversions.cpp */,
|
||||
9A9AEB8B243F73CE00FBD7D8 /* unicode_conversions.h */,
|
||||
9A0B084A2402FE9300E2B470 /* XArray.h */,
|
||||
9A0B084B2402FE9300E2B470 /* XObjArray.h */,
|
||||
9A57C267241A799B0029A39F /* XString.cpp */,
|
||||
9A57C266241A799B0029A39F /* XString.h */,
|
||||
9A4185BE2439F73A00BEAFB8 /* XStringArray.cpp */,
|
||||
9A4185BF2439F73A00BEAFB8 /* XStringArray.h */,
|
||||
9A0B08482402FE9300E2B470 /* XStringW.cpp */,
|
||||
9A0B08462402FE9300E2B470 /* XStringW.h */,
|
||||
9A0B08472402FE9300E2B470 /* XStringWArray.cpp */,
|
||||
9A0B08442402FE9300E2B470 /* XStringWArray.h */,
|
||||
9A0B08492402FE9300E2B470 /* XToolsCommon.cpp */,
|
||||
@ -239,6 +231,8 @@
|
||||
9A0B084C2402FE9B00E2B470 /* cpp_unit_test */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9A4FFA802451C88D0050B38B /* XString_test.cpp */,
|
||||
9A4FFA7F2451C88C0050B38B /* XString_test.h */,
|
||||
9A4185AF2439E4D500BEAFB8 /* LoadOptions_test.cpp */,
|
||||
9A4185B02439E4D600BEAFB8 /* LoadOptions_test.h */,
|
||||
9A0B08512402FE9B00E2B470 /* all_tests.cpp */,
|
||||
@ -264,10 +258,6 @@
|
||||
9A0B084E2402FE9B00E2B470 /* XArray_tests.h */,
|
||||
9A0B08522402FE9B00E2B470 /* XObjArray_tests.cpp */,
|
||||
9A0B08502402FE9B00E2B470 /* XObjArray_tests.h */,
|
||||
9A57C261241A752E0029A39F /* XString_test.cpp */,
|
||||
9A57C262241A752E0029A39F /* XString_test.h */,
|
||||
9A0B08552402FE9B00E2B470 /* XStringW_test.cpp */,
|
||||
9A0B08632403132300E2B470 /* XStringW_test.h */,
|
||||
9A0B084F2402FE9B00E2B470 /* XStringWArray_test.cpp */,
|
||||
9A0B084D2402FE9B00E2B470 /* XStringWArray_test.h */,
|
||||
);
|
||||
@ -462,16 +452,16 @@
|
||||
9A4185B22439E4D600BEAFB8 /* LoadOptions_test.cpp in Sources */,
|
||||
9A0B08732403B08400E2B470 /* XObjArray_tests.cpp in Sources */,
|
||||
9A28CD20241BB61B00F3D247 /* abort.cpp in Sources */,
|
||||
9A4FFA842451C9740050B38B /* XString.cpp in Sources */,
|
||||
9A4FFA822451C88D0050B38B /* XString_test.cpp in Sources */,
|
||||
9A28CD23241BB61B00F3D247 /* strlen.cpp in Sources */,
|
||||
9A28CD4C241F4CCE00F3D247 /* xcode_utf16.cpp in Sources */,
|
||||
9A0B08742403B08400E2B470 /* main.cpp in Sources */,
|
||||
9A57C264241A752E0029A39F /* XString_test.cpp in Sources */,
|
||||
9A28CD17241BACBB00F3D247 /* strlen_test.cpp in Sources */,
|
||||
9A0B08772403B08400E2B470 /* XStringWArray.cpp in Sources */,
|
||||
9A28CD0D241B8DD400F3D247 /* strcmp_test.cpp in Sources */,
|
||||
9A28CD0A241B8DD400F3D247 /* strncmp_test.cpp in Sources */,
|
||||
9AC780AF2417DD2F005CDD5C /* panic.cpp in Sources */,
|
||||
9A0B08792403B08400E2B470 /* XStringW.cpp in Sources */,
|
||||
9A0B087A2403B08400E2B470 /* all_tests.cpp in Sources */,
|
||||
9A9AEB8E243F752C00FBD7D8 /* unicode_conversions.cpp in Sources */,
|
||||
9A0B087B2403B08400E2B470 /* global_test.cpp in Sources */,
|
||||
@ -483,8 +473,6 @@
|
||||
9A0B087E2403B08400E2B470 /* XArray_tests.cpp in Sources */,
|
||||
9AA0458B2425F94D000D6970 /* printf_lite-test.cpp in Sources */,
|
||||
9A0B087F2403B08400E2B470 /* Platform.cpp in Sources */,
|
||||
9A0B08802403B08400E2B470 /* XStringW_test.cpp in Sources */,
|
||||
9A57C269241A799B0029A39F /* XString.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@ -495,16 +483,16 @@
|
||||
9A4185B32439E4D600BEAFB8 /* LoadOptions_test.cpp in Sources */,
|
||||
9A57C21A2418B9A00029A39F /* XObjArray_tests.cpp in Sources */,
|
||||
9A28CD21241BB61B00F3D247 /* abort.cpp in Sources */,
|
||||
9A4FFA852451C9740050B38B /* XString.cpp in Sources */,
|
||||
9A4FFA832451C88D0050B38B /* XString_test.cpp in Sources */,
|
||||
9A28CD24241BB61B00F3D247 /* strlen.cpp in Sources */,
|
||||
9A28CD4D241F4CCE00F3D247 /* xcode_utf16.cpp in Sources */,
|
||||
9A57C21B2418B9A00029A39F /* main.cpp in Sources */,
|
||||
9A57C265241A752E0029A39F /* XString_test.cpp in Sources */,
|
||||
9A28CD18241BACBB00F3D247 /* strlen_test.cpp in Sources */,
|
||||
9A57C21D2418B9A00029A39F /* XStringWArray.cpp in Sources */,
|
||||
9A28CD0E241B8DD400F3D247 /* strcmp_test.cpp in Sources */,
|
||||
9A28CD0B241B8DD400F3D247 /* strncmp_test.cpp in Sources */,
|
||||
9A57C2202418B9A00029A39F /* panic.cpp in Sources */,
|
||||
9A57C2212418B9A00029A39F /* XStringW.cpp in Sources */,
|
||||
9A57C2222418B9A00029A39F /* all_tests.cpp in Sources */,
|
||||
9A9AEB8F243F752C00FBD7D8 /* unicode_conversions.cpp in Sources */,
|
||||
9A57C2232418B9A00029A39F /* global_test.cpp in Sources */,
|
||||
@ -516,8 +504,6 @@
|
||||
9A57C2272418B9A00029A39F /* XArray_tests.cpp in Sources */,
|
||||
9AA0458C2425F94D000D6970 /* printf_lite-test.cpp in Sources */,
|
||||
9A57C2282418B9A00029A39F /* Platform.cpp in Sources */,
|
||||
9A57C2292418B9A00029A39F /* XStringW_test.cpp in Sources */,
|
||||
9A57C26A241A799B0029A39F /* XString.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@ -527,16 +513,16 @@
|
||||
files = (
|
||||
9A0B085A2402FF8400E2B470 /* XObjArray_tests.cpp in Sources */,
|
||||
9A28CD1F241BB61B00F3D247 /* abort.cpp in Sources */,
|
||||
9A4FFA7E2451C8330050B38B /* XString.cpp in Sources */,
|
||||
9A4FFA812451C88D0050B38B /* XString_test.cpp in Sources */,
|
||||
9A28CD22241BB61B00F3D247 /* strlen.cpp in Sources */,
|
||||
9A28CD4B241F4CCE00F3D247 /* xcode_utf16.cpp in Sources */,
|
||||
9A9223312402FD1000483CBA /* main.cpp in Sources */,
|
||||
9A57C263241A752E0029A39F /* XString_test.cpp in Sources */,
|
||||
9A28CD16241BACBB00F3D247 /* strlen_test.cpp in Sources */,
|
||||
9A0B08562402FF7700E2B470 /* XStringWArray.cpp in Sources */,
|
||||
9A28CD0C241B8DD400F3D247 /* strcmp_test.cpp in Sources */,
|
||||
9A28CD09241B8DD400F3D247 /* strncmp_test.cpp in Sources */,
|
||||
9AC780AE2417DD2F005CDD5C /* panic.cpp in Sources */,
|
||||
9A0B085F240308E400E2B470 /* XStringW.cpp in Sources */,
|
||||
9A0B08592402FF8200E2B470 /* all_tests.cpp in Sources */,
|
||||
9A0B08662403144C00E2B470 /* global_test.cpp in Sources */,
|
||||
9A4185B12439E4D600BEAFB8 /* LoadOptions_test.cpp in Sources */,
|
||||
@ -549,8 +535,6 @@
|
||||
9A0B085B2402FF8700E2B470 /* XArray_tests.cpp in Sources */,
|
||||
9AA0458A2425F94D000D6970 /* printf_lite-test.cpp in Sources */,
|
||||
9A0B085E240300E000E2B470 /* Platform.cpp in Sources */,
|
||||
9A0B085C2402FF8B00E2B470 /* XStringW_test.cpp in Sources */,
|
||||
9A57C268241A799B0029A39F /* XString.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@ -659,7 +643,10 @@
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREFIX_HEADER = src/Platform.h;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = JIEF_DEBUG;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
JIEF_DEBUG,
|
||||
XSTRING16_DEV,
|
||||
);
|
||||
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
|
||||
GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
|
@ -25,8 +25,8 @@ printf("sizeof(long)=%lu\n", sizeof(long));
|
||||
printf("sizeof(long long)=%lu\n", sizeof(long long));
|
||||
printf("sizeof(size_t)=%lu\n", sizeof(size_t));
|
||||
#ifndef _MSC_VER
|
||||
printf("%zu\n", (size_t)MAX_UINT64);
|
||||
printf("%zd\n", (size_t)MAX_UINT64);
|
||||
//printf("%zu\n", (size_t)MAX_UINT64);
|
||||
//printf("%zd\n", (size_t)MAX_UINT64);
|
||||
#endif
|
||||
|
||||
return all_tests();
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
#include "../../Include/Library/printf_lite.h"
|
||||
#include "../../../Include/Library/printf_lite.h"
|
||||
#define F(x) x
|
||||
#define LF(x) L##x
|
||||
#define PRIF "%a"
|
||||
|
@ -53,7 +53,7 @@ size_t utf16_wcslen(const wchar_t *s)
|
||||
// wcslen seems not to work if sizeof(wchar_t) == 2
|
||||
const wchar_t* p;
|
||||
for ( p = s ; *p ; p++ );
|
||||
return (UINTN)(p-s);
|
||||
return (size_t)(p-s);
|
||||
}
|
||||
|
||||
int utf16_wcsncmp(const wchar_t *s1, const wchar_t * s2, size_t n)
|
||||
|
@ -1395,7 +1395,7 @@ EFI_STATUS SetStartupDiskVolume (
|
||||
"</dict>"
|
||||
"</dict></array>", strguid(Guid));
|
||||
DBG (" * efi-boot-device: %s\n", EfiBootDevice.c_str());
|
||||
Status = SetNvramVariable (L"efi-boot-device", &gEfiAppleBootGuid, Attributes, EfiBootDevice.size(), EfiBootDevice.c_str());
|
||||
Status = SetNvramVariable (L"efi-boot-device", &gEfiAppleBootGuid, Attributes, EfiBootDevice.sizeInBytes(), EfiBootDevice.c_str());
|
||||
}
|
||||
|
||||
return Status;
|
||||
|
@ -16,7 +16,6 @@ Headers collection for procedures
|
||||
#ifdef __cplusplus
|
||||
#include <Library/printf_lite.h>
|
||||
#include "../cpp_foundation/XString.h"
|
||||
#include "../cpp_foundation/XStringW.h"
|
||||
#include "../cpp_foundation/XArray.h"
|
||||
#include "../cpp_foundation/XObjArray.h"
|
||||
#include "../cpp_util/remove_ref.h"
|
||||
|
@ -27,10 +27,10 @@
|
||||
//#define memmove(dest,source,count) CopyMem(dest,source,(UINTN)(count))
|
||||
//#define strcmp AsciiStrCmp
|
||||
//#define strncmp(string1,string2,count) (int)(AsciiStrnCmp(string1,string2,(UINTN)(count)))
|
||||
#define strcpy(strDest,strSource) AsciiStrCpyS(strDest,AsciiStrLen(strDest)+1,strSource)
|
||||
#define strncpy(strDest,strSource,count) AsciiStrnCpyS(strDest,(UINTN)count+1,strSource,(UINTN)count)
|
||||
//#define strcpy(strDest,strSource) AsciiStrCpyS(strDest,AsciiStrLen(strDest)+1,strSource)
|
||||
//#define strncpy(strDest,strSource,count) AsciiStrnCpyS(strDest,(UINTN)count+1,strSource,(UINTN)count)
|
||||
//#define strlen(str) (size_t)(AsciiStrLen(str))
|
||||
#define strcat(strDest,strSource) AsciiStrCatS(strDest,AsciiStrLen(strDest)+1,strSource)
|
||||
//#define strcat(strDest,strSource) AsciiStrCatS(strDest,AsciiStrLen(strDest)+1,strSource)
|
||||
#define strchr(str,ch) ScanMem8((VOID *)(str),AsciiStrSize(str),(UINT8)ch)
|
||||
#define strstr(a,b) AsciiStrStr(a,b)
|
||||
|
||||
|
@ -20,7 +20,6 @@ extern "C" {
|
||||
}
|
||||
|
||||
#include "../../cpp_foundation/XString.h"
|
||||
#include "../../cpp_foundation/XStringW.h"
|
||||
|
||||
static XString stdio_static_buf;
|
||||
static XStringW stdio_static_wbuf;
|
||||
@ -46,7 +45,7 @@ const char* strerror(EFI_STATUS Status)
|
||||
n = AsciiSPrint(stdio_static_buf.dataSized(0, stdio_static_buf.allocatedSize()), stdio_static_buf.allocatedSize(), "%r", Status);
|
||||
} while ( n > stdio_static_buf.allocatedSize() - 2 );
|
||||
|
||||
return stdio_static_buf.data();
|
||||
return stdio_static_buf.s();
|
||||
}
|
||||
|
||||
//this function print guid in LittleEndian format while we need BigEndian as Apple do
|
||||
@ -58,6 +57,6 @@ const char* strguid(EFI_GUID* guid)
|
||||
n = AsciiSPrint(stdio_static_buf.dataSized(0, stdio_static_buf.allocatedSize()), stdio_static_buf.allocatedSize(), "%g", guid);
|
||||
} while ( n > stdio_static_buf.allocatedSize() - 2 );
|
||||
|
||||
return stdio_static_buf.data();
|
||||
return stdio_static_buf.s();
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
@ -26,9 +27,32 @@ inline void* memcpy(void *dst, const void *src, size_t len)
|
||||
return CopyMem(dst,src,len);
|
||||
}
|
||||
|
||||
inline char* strcat(char* s1, const char* s2)
|
||||
{
|
||||
AsciiStrCatS(s1, AsciiStrLen(s1)+1, s2);
|
||||
return s1;
|
||||
}
|
||||
|
||||
inline char* strcpy(char* dst, const char* src)
|
||||
{
|
||||
AsciiStrCpyS(dst,AsciiStrLen(dst)+1,src);
|
||||
return dst;
|
||||
}
|
||||
|
||||
inline char* strncpy(char * dst, const char * src, size_t len)
|
||||
{
|
||||
AsciiStrnCpyS(dst,(UINTN)len+1,src,(UINTN)len);
|
||||
return dst;
|
||||
}
|
||||
|
||||
//inline char* strncat(char *restrict s1, const char *restrict s2, size_t n)
|
||||
//{
|
||||
// return AsciiStrCatS(s1, AsciiStrLen(strDest)+1,strSource)
|
||||
//}
|
||||
//
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif // __CLOVER_STRING_H__
|
||||
|
@ -172,7 +172,7 @@ XArray<TYPE>::~XArray()
|
||||
if ( m_data ) free(m_data);
|
||||
}
|
||||
|
||||
/* CheckSize() */
|
||||
/* CheckSize() // nNewSize is number of TYPE, not in bytes */
|
||||
template<class TYPE>
|
||||
void XArray<TYPE>::CheckSize(xsize nNewSize, xsize nGrowBy)
|
||||
{
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -3,327 +3,141 @@
|
||||
//
|
||||
// STRING
|
||||
//
|
||||
// Developed by jief666, from 1997.
|
||||
//
|
||||
//*************************************************************************************************
|
||||
//*************************************************************************************************
|
||||
|
||||
#if !defined(__XSTRING_H__)
|
||||
#define __XSTRING_H__
|
||||
|
||||
#if !defined(__XString_H__)
|
||||
#define __XString_H__
|
||||
|
||||
#include "XToolsCommon.h"
|
||||
#include "XStringAbstract.h"
|
||||
|
||||
#define PATH_SEPARATOR '\\'
|
||||
#include "../../Include/Library/printf_lite.h"
|
||||
|
||||
extern UINTN XStringGrowByDefault;
|
||||
#ifndef XString16GrowByDefault
|
||||
#define XString16GrowByDefault 16
|
||||
#endif
|
||||
|
||||
//typedef XStringAbstract<char> XString;
|
||||
|
||||
//class XConstString;
|
||||
class XStringW;
|
||||
|
||||
class XString
|
||||
class XString : public XStringAbstract<char, XString>
|
||||
{
|
||||
public:
|
||||
XString() : XStringAbstract<char, XString>() {};
|
||||
XString(const XString& S) : XStringAbstract<char, XString>(S) {}
|
||||
|
||||
template<typename O, class OtherXStringClass>
|
||||
XString(const XStringAbstract<O, OtherXStringClass> &S) : XStringAbstract<char, XString>(S) {}
|
||||
|
||||
XString& operator=(const XString &S) { this->XStringAbstract<char, XString>::operator=(S); return *this; }
|
||||
|
||||
using XStringAbstract<char, XString>::operator =;
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
char *m_data;
|
||||
xsize m_allocatedSize;
|
||||
|
||||
// convenience method. Did it this way to avoid #define in header. They can have an impact on other headers
|
||||
xsize min(xsize x1, xsize x2) const { if ( x1 < x2 ) return x1; return x2; }
|
||||
xsize max(xsize x1, xsize x2) const { if ( x1 > x2 ) return x1; return x2; }
|
||||
|
||||
// Next 2 methods are protected intentionally. They are const method returning non-const pointer. That's intentional, but dangerous. Do not expose to public.
|
||||
// It's better practice, if you need a non-const pointer for low-level access, to use dataSized and ahev to specify the size
|
||||
// It's possible to access data(m_allocatedSize) because the real allocated size is m_allocatedSize+1
|
||||
char* _data(unsigned int ui) const { if ( ui > m_allocatedSize ) panic("char* data(unsigned int ui=0) -> ui > m_allocatedSize"); return m_data+ui; }
|
||||
char* _data(int i) const { if ( i<0 ) panic("char* data(int i) -> i < 0"); if ( (unsigned int)i > m_allocatedSize ) panic("char* data(int i) -> i > m_allocatedSize"); return m_data+i; }
|
||||
char* _data(unsigned long ui) const { if ( ui > m_allocatedSize ) panic("char* data(unsigned long ui=0) -> ui > m_allocatedSize"); return m_data+ui; }
|
||||
char* _data(long i) const { if ( i<0 ) panic("char* data(long i) -> i < 0"); if ( (unsigned long)i > m_allocatedSize ) panic("char* data(long i) -> i > m_allocatedSize"); return m_data+i; }
|
||||
char* _data(xsize ui) const { if ( ui > m_allocatedSize ) panic("char* data(xsize ui=0) -> ui > m_allocatedSize"); return m_data+ui; }
|
||||
char* _data(xisize i) const { if ( i<0 ) panic("char* data(xisize i) -> i < 0"); if ( (xsize)i > m_allocatedSize ) panic("char* data(xisize i) -> i > m_allocatedSize"); return m_data+i; }
|
||||
|
||||
static void transmitSPrintf(const char* buf, unsigned int nbchar, void* context)
|
||||
{
|
||||
((XString*)(context))->strncat(buf, nbchar);
|
||||
}
|
||||
public:
|
||||
void vSPrintf(const char* format, va_list va)
|
||||
{
|
||||
setEmpty();
|
||||
vprintf_with_callback(format, va, transmitSPrintf, this);
|
||||
}
|
||||
void SPrintf(const char* format, ...) __attribute__((__format__(__printf__, 2, 3)))
|
||||
{
|
||||
va_list va;
|
||||
|
||||
void Init(xsize aSize=0);
|
||||
XString();
|
||||
XString(const XString &aString);
|
||||
XString(XString&& aString); // Move constructor
|
||||
va_start (va, format);
|
||||
vSPrintf(format, va);
|
||||
va_end(va);
|
||||
}
|
||||
|
||||
|
||||
// XString(const XConstString &aConstString);
|
||||
// XString(const char *S);
|
||||
// XString(const char* S, xsize count);
|
||||
|
||||
// XString(const wchar_t *S);
|
||||
|
||||
// XString(uchar);
|
||||
// XString(char);
|
||||
// XString(int);
|
||||
// XString(unsigned long long);
|
||||
|
||||
~XString();
|
||||
|
||||
public:
|
||||
char *CheckSize(xsize nNewSize, xsize nGrowBy = XStringGrowByDefault);
|
||||
|
||||
public:
|
||||
const char* c_str() const { return m_data; } // same as std::string
|
||||
const char* data(xsize ui=0) const { return _data(ui); }
|
||||
const char* data(xisize i) const { return _data(i); }
|
||||
|
||||
char* dataSized(xsize ui, xsize sizeMin, xsize nGrowBy=XStringGrowByDefault) { CheckSize(ui+sizeMin, nGrowBy); return _data(ui); }
|
||||
|
||||
xsize length() const { return strlen(m_data); }
|
||||
xsize size() const { return strlen(m_data); }
|
||||
xsize allocatedSize() const { return m_allocatedSize; }
|
||||
void setLength(xsize len);
|
||||
|
||||
/* IsNull ? */
|
||||
void setEmpty() { setLength(0); }
|
||||
bool isEmpty() const { return length() == 0; }
|
||||
bool notEmpty() const { return !isEmpty(); }
|
||||
|
||||
/* Cast */
|
||||
// operator const char *() const { return data(); } // disabled during big refactoring
|
||||
// operator char *() { return data(); }
|
||||
|
||||
// int ToInt() const;
|
||||
// UINTN ToUINTN() const;
|
||||
|
||||
/* char [] */
|
||||
char operator [](int i) const { return *_data(i); }
|
||||
char operator [](unsigned int ui) const { return *_data(ui); }
|
||||
char operator [](long i) const { return *_data(i); }
|
||||
char operator [](unsigned long ui) const { return *_data(ui); }
|
||||
char operator [](xisize i) const { return *data(i); }
|
||||
char operator [](xsize ui) const { return *data(ui); }
|
||||
|
||||
/* char& [] */
|
||||
char& operator [](int i) { return *_data(i); }
|
||||
char& operator [](unsigned int ui) { return *_data(ui); }
|
||||
char& operator [](long i) { return *_data(i); }
|
||||
char& operator [](unsigned long ui) { return *_data(ui); }
|
||||
char& operator [](xisize i) { return *_data(i); }
|
||||
char& operator [](xsize ui) { return *_data(ui); }
|
||||
|
||||
char lastChar() const { if ( length() > 0 ) return data()[length()-1]; else return 0; }
|
||||
void removeLastEspCtrl();
|
||||
|
||||
void StrCpy(const char *buf);
|
||||
void StrnCpy(const char *buf, xsize len);
|
||||
void StrnCat(const char *buf, xsize len);
|
||||
void StrCat(const char *buf);
|
||||
void StrCat(const XString& S) { StrCat(S.c_str()) ; }
|
||||
void Delete(xsize pos, xsize count=1);
|
||||
|
||||
void Insert(xsize pos, const XString& Str);
|
||||
|
||||
void Cat(const XString &uneXString);
|
||||
|
||||
XString& vSPrintf(const char *Format, va_list va);
|
||||
XString& SPrintf(const char *format, ...) __attribute__((format (printf, 2, 3))); // 2 and 3 because of hidden parameter 'this'.
|
||||
|
||||
const XString& takeValueFrom(const char* S) { StrCpy(S); return *this; }
|
||||
const XString& takeValueFrom(const char* S, xsize count) { StrnCpy(S, count); return *this; }
|
||||
const XString& takeValueFrom(const wchar_t* S) { SPrintf("%ls", S); return *this; }
|
||||
|
||||
const XString& operator =(const XString& aString);
|
||||
XString& operator =(XString&& aString);
|
||||
// const XString &operator =(const XConstString &aConstString);
|
||||
|
||||
// Deactivate assignment during refactoring to avoid confusion
|
||||
// const XString &operator =(const char* S);
|
||||
// const XString &operator =(char);
|
||||
// const XString &operator =(int);
|
||||
// const XString &operator =(unsigned int);
|
||||
// const XString &operator =(long);
|
||||
// const XString &operator =(unsigned long long);
|
||||
|
||||
const XString &operator += (const XString &);
|
||||
const XString &operator += (const char* S);
|
||||
// const XString &operator += (const XConstString &aConstString);
|
||||
|
||||
// Deactivate assignment during refactoring to avoid confusion
|
||||
// const XString &operator += (char);
|
||||
// const XString &operator += (int);
|
||||
// const XString &operator += (unsigned int);
|
||||
// const XString &operator += (long);
|
||||
// const XString &operator += (unsigned long long);
|
||||
|
||||
XString SubString(xsize pos, xsize count) const;
|
||||
|
||||
xsize IdxOf(char c, xsize Pos = 0) const;
|
||||
|
||||
xsize IdxOf(const char* s, xsize s_len, xsize pos) const;
|
||||
xsize IdxOf(const char* s, xsize pos = 0) const { return IdxOf(s, strlen(s), pos); }
|
||||
xsize IdxOf(const XString &S, xsize pos = 0) const { return IdxOf(S.c_str(), S.length(), pos); }
|
||||
bool ExistIn(const char* s, xsize s_len, xsize pos = 0) const { return IdxOf(s, s_len, pos) != MAX_XSIZE; }
|
||||
bool ExistIn(const char* s, xsize pos = 0) const { return IdxOf(s, pos) != MAX_XSIZE; }
|
||||
bool ExistIn(const XString &S, xsize pos = 0) const { return IdxOf(S, pos) != MAX_XSIZE; }
|
||||
|
||||
xsize IdxOfIC(const char* s, xsize s_len, xsize pos) const;
|
||||
xsize IdxOfIC(const char* s, xsize pos = 0) const { return IdxOfIC(s, strlen(s), pos); }
|
||||
xsize IdxOfIC(const XString &S, xsize pos = 0) const { return IdxOfIC(S.c_str(), S.length(), pos); }
|
||||
bool ExistInIC(const char* s, xsize s_len, xsize pos = 0) const { return IdxOfIC(s, s_len, pos) != MAX_XSIZE; }
|
||||
bool ExistInIC(const char* s, xsize pos = 0) const { return IdxOfIC(s, pos) != MAX_XSIZE; }
|
||||
bool ExistInIC(const XString &S, xsize pos = 0) const { return IdxOfIC(S, pos) != MAX_XSIZE; }
|
||||
|
||||
#ifdef TODO_skqdjfhksqjhfksjqdf
|
||||
bool ExistInIAC(const XString &S) const { return IdxOfIC(S) != MAX_XSIZE; }
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef TODO_skqdjfhksqjhfksjqdf
|
||||
xsize IdxOfIAC(const XString &S, xsize Pos = 0) const;
|
||||
#endif
|
||||
|
||||
|
||||
xsize RIdxOf(const char* s, xsize s_len, xsize pos) const;
|
||||
xsize RIdxOf(const char* s, xsize pos = MAX_XSIZE) const { return IdxOf(s, strlen(s), pos); }
|
||||
xsize RIdxOf(const XString &S, xsize pos = MAX_XSIZE) const { return IdxOf(S.c_str(), S.length(), pos); }
|
||||
|
||||
void ToLower(bool FirstCharIsCap = false);
|
||||
bool IsLetters() const;
|
||||
bool IsLettersNoAccent() const;
|
||||
bool IsDigits() const;
|
||||
bool IsDigits(xsize pos, xsize count) const;
|
||||
|
||||
#ifdef TODO_skqdjfhksqjhfksjqdf
|
||||
bool DeleteIC(const XString &S);
|
||||
#endif
|
||||
void Replace(char c1, char c2);
|
||||
XString SubStringReplace(char c1, char c2);
|
||||
|
||||
int Compare(const char* S) const { return strcmp(data(), (S ? S : "")); }// AsciiStrCmp return 0 or !0, not usual strcmp
|
||||
#ifdef TODO_skqdjfhksqjhfksjqdf
|
||||
//IC
|
||||
int CompareIC(const char* S) const { return StringCompareIC(data(), (S ? S : "")); }
|
||||
// IA
|
||||
int CompareIA(const char* S) const { return StringCompareIA(data(), (S ? S : "")); }
|
||||
// IAC
|
||||
int CompareIAC(const char* S) const { return StringCompareIAC(data(), (S ? S : "")); }
|
||||
/*
|
||||
int CompareIACSubString(const char* S, size_t LenS) const { return SubStringCompareIAC(data(), length(), S, LenS); } //SubStringCompareIC renvoi 0 (ÈgalitÈ) si Len1 ou Len2 == 0
|
||||
int CompareIACSubString(xsize Pos, const char* S, size_t LenS) const { return SubStringCompareIAC(data(Pos), length()-Pos, S, LenS); } //SubStringCompareIC renvoi 0 (ÈgalitÈ) si Len1 ou Len2 == 0
|
||||
int CompareIACSubString(xsize Pos, xsize Len, const char* S, size_t LenS) const { return SubStringCompareIAC(data(Pos), Len, S, LenS); }
|
||||
*/
|
||||
#endif
|
||||
|
||||
// bool Equal(const char* S) const { return strcmp(data(), (S ? S : "")) == 0; };
|
||||
bool Equal(const XString& S) const { return strcmp(c_str(), S.c_str()) == 0; };
|
||||
// bool BeginEqual(const char* S) const { return StringBeginEqual(data(), S); }
|
||||
// bool SubStringEqual(xsize Pos, const char* S) const { return StringBeginEqual(data(Pos), S); }
|
||||
#ifdef TODO_skqdjfhksqjhfksjqdf
|
||||
// IC
|
||||
bool EqualIC(const char* S) const { return StringEqualIC(data(), S); }
|
||||
bool BeginEqualIC(const char* S) const { return StringBeginEqualIC(data(), S); }
|
||||
bool SubStringEqualIC(xsize Pos, const char* S) const { return StringBeginEqualIC(data(Pos), S); }
|
||||
bool EqualSubStringIC(const char* S) const { return StringBeginEqualIC(S, data()); }
|
||||
// IA
|
||||
bool EqualIA(const char* S) const { return CompareIA(S) == 0; };
|
||||
// IAC
|
||||
bool EqualIAC(const char* S) const { return CompareIAC(S) == 0; };
|
||||
bool BeginEqualIAC(const char* S) const { return StringBeginEqualIAC(data(), S); }
|
||||
bool SubStringEqualIAC(xsize Pos, const char* S) const { return StringBeginEqualIAC(data(Pos), S); }
|
||||
bool EqualSubStringIAC(const char* S) const { return StringBeginEqualIAC(S, data()); }
|
||||
|
||||
|
||||
/* bool EqualIACSubString(const char* S, size_t LenS) const { return CompareIACSubString(S, LenS) == 0; }
|
||||
bool EqualIACSubString(xsize Pos, const char* S, size_t LenS) const { return CompareIACSubString(Pos, S, LenS) == 0; }
|
||||
bool EqualIACSubString(xsize Pos, xsize Len, const char* S, size_t LenS) const { return CompareIACSubString(Pos, Len, S, LenS) == 0; }
|
||||
*/
|
||||
#endif
|
||||
|
||||
XString basename() const;
|
||||
XString dirname() const;
|
||||
|
||||
// size_t Sizeof() const { return size_t(sizeof(xsize)+length()); } // overflow ? underflow ?
|
||||
// bool ReadFromBuf(const char *buf, size_t *idx, size_t count);
|
||||
// bool WriteToBuf(char *buf, size_t *idx, size_t count) const;
|
||||
// bool ReadFromFILE(FILE *fp);
|
||||
// bool WriteToFILE(FILE *fp) const;
|
||||
// //
|
||||
// bool ReadFromXBuffer(XRBuffer &unXBuffer); // Impossible de mettre le XBuffer en const car il y a une variable d'instance de XBuffer incrÈmentÈe par ReadFromXBuffer
|
||||
// void CatToXBuffer(XBuffer *unXBuffer) const;
|
||||
//// void WriteToXBuffer(XBuffer *unXBuffer, xsize *idx) const;
|
||||
|
||||
public:
|
||||
// OpÈrateur +
|
||||
// Chaines
|
||||
friend XString operator + (const XString& p1, const XString& p2) { XString s; s=p1; s+=p2; return s; }
|
||||
// friend XString operator + (const XString& p1, const char *p2 ) { XString s; s=p1; s+=p2; return s; }
|
||||
// XString operator + (const char *p2 ) { XString s(*this); s+=p2; return s; }
|
||||
|
||||
friend XString operator + (const char *p1, const XString& p2) { XString s; s.takeValueFrom(p1); s+=p2; return s; }
|
||||
// friend XString operator + (const XConstString& p1, const XString& p2) { XString s; s=p1; s+=p2; return s; }
|
||||
// friend XString operator + (const XString& p1, const XConstString& p2) { XString s; s=p1; s+=p2; return s; }
|
||||
// friend XString operator + (const XConstString& p1, const XConstString& p2) { XString s; s=p1; s+=p2; return s; }
|
||||
// friend XString operator + (const XConstString &p1, const char *p2 ) { XString s; s=p1; s+=p2; return s; }
|
||||
// friend XString operator + (const char *p1, const XConstString &p2) { XString s; s=p1; s+=p2; return s; }
|
||||
|
||||
// deactivate during refactoring
|
||||
// // Char
|
||||
// friend XString operator + (const XString& p1, char p2 ) { XString s; s=p1; s+=p2; return s; }
|
||||
// friend XString operator + (char p1, const XString& p2 ) { XString s; s=p1; s+=p2; return s; }
|
||||
// // NumÈrique
|
||||
// friend XString operator + (const XString& p1, int p2 ) { XString s; s=p1; s+=p2; return s; }
|
||||
// friend XString operator + (int p1, const XString& p2 ) { XString s; s=p1; s+=p2; return s; }
|
||||
// friend XString operator + (const XString& p1, unsigned int p2 ) { XString s; s=p1; s+=p2; return s; }
|
||||
// friend XString operator + (unsigned int p1, const XString& p2 ) { XString s; s=p1; s+=p2; return s; }
|
||||
// friend XString operator + (const XString& p1, long p2 ) { XString s; s=p1; s+=p2; return s; }
|
||||
// friend XString operator + (long p1, const XString& p2 ) { XString s; s=p1; s+=p2; return s; }
|
||||
// friend XString operator + (const XString& p1, unsigned long long p2 ) { XString s; s=p1; s+=p2; return s; }
|
||||
// friend XString operator + (unsigned long long p1, const XString& p2 ) { XString s; s=p1; s+=p2; return s; }
|
||||
|
||||
// OpÈrateur ==
|
||||
// Chaines
|
||||
friend bool operator == (const XString& s1, const XString& s2) { return s1.Equal(s2); }
|
||||
// friend bool operator == (const XString& s1, const char* s2 ) { return s1.Equal(s2); } // during refactor
|
||||
// friend bool operator == (const char* s1, const XString& s2) { return s2.Equal(s1); } // during refactor
|
||||
// friend bool operator == (const XConstString &s1, const XString& s2) { return s1.Compare(s2) == 0; }
|
||||
// friend bool operator == (const XString &s1, const XConstString& s2) { return s1.Compare(s2) == 0; }
|
||||
// friend bool operator == (const XConstString &s1, const XConstString& s2) { return s1.Compare(s2) == 0; }
|
||||
|
||||
friend bool operator != (const XString& s1, const XString& s2) { return !s1.Equal(s2); }
|
||||
// friend bool operator != (const XString& s1, const char* s2 ) { return !s1.Equal(s2); } // during refactor
|
||||
// friend bool operator != (const char* s1, const XString& s2) { return !s2.Equal(s1); } // during refactor
|
||||
// friend bool operator != (const XConstString &s1, const XString& s2) { return s1.Compare(s2) != 0; }
|
||||
// friend bool operator != (const XString &s1, const XConstString& s2) { return s1.Compare(s2) != 0; }
|
||||
// friend bool operator != (const XConstString &s1, const XConstString& s2) { return s1.Compare(s2) != 0; }
|
||||
|
||||
// friend bool operator < (const XString& s1, const XString& s2) { return s1.Compare(s2) < 0; }
|
||||
// friend bool operator < (const XString& s1, const char* s2 ) { return s1.Compare(s2) < 0; }
|
||||
// friend bool operator < (const char* s1, const XString& s2) { return s2.Compare(s1) > 0; }
|
||||
//
|
||||
// friend bool operator > (const XString& s1, const XString& s2) { return s1.Compare(s2) > 0; }
|
||||
// friend bool operator > (const XString& s1, const char* s2 ) { return s1.Compare(s2) > 0; }
|
||||
// friend bool operator > (const char* s1, const XString& s2) { return s2.Compare(s1) < 0; }
|
||||
//
|
||||
// friend bool operator <= (const XString& s1, const XString& s2) { return s1.Compare(s2) <= 0; }
|
||||
// friend bool operator <= (const XString& s1, const char* s2 ) { return s1.Compare(s2) <= 0; }
|
||||
// friend bool operator <= (const char* s1, const XString& s2) { return s2.Compare(s1) >= 0; }
|
||||
//
|
||||
// friend bool operator >= (const XString& s1, const XString& s2) { return s1.Compare(s2) >= 0; }
|
||||
// friend bool operator >= (const XString& s1, const char* s2 ) { return s1.Compare(s2) >= 0; }
|
||||
// friend bool operator >= (const char* s1, const XString& s2) { return s2.Compare(s1) <= 0; }
|
||||
|
||||
static char to_lower(char ch) { return (((ch >= 'A') && (ch <= 'Z')) ? ((ch - 'A') + 'a') : ch); }
|
||||
};
|
||||
|
||||
extern const XString NullXString;
|
||||
class XString16 : public XStringAbstract<char16_t, XString16>
|
||||
{
|
||||
public:
|
||||
XString16() : XStringAbstract<char16_t, XString16>() {};
|
||||
XString16(const XString16& S) : XStringAbstract<char16_t, XString16>(S) {}
|
||||
|
||||
template<typename O, class OtherXStringClass>
|
||||
XString16(const XStringAbstract<O, OtherXStringClass> &S) : XStringAbstract<char16_t, XString16>(S) {}
|
||||
|
||||
XString16& operator=(const XString16 &S) { this->XStringAbstract<char16_t, XString16>::operator=(S); return *this; }
|
||||
|
||||
using XStringAbstract<char16_t, XString16>::operator =;
|
||||
};
|
||||
|
||||
class XString32 : public XStringAbstract<char32_t, XString32>
|
||||
{
|
||||
public:
|
||||
XString32() : XStringAbstract<char32_t, XString32>() {};
|
||||
XString32(const XString32& S) : XStringAbstract<char32_t, XString32>(S) {}
|
||||
|
||||
template<typename O, class OtherXStringClass>
|
||||
XString32(const XStringAbstract<O, OtherXStringClass> &S) : XStringAbstract<char32_t, XString32>(S) {}
|
||||
|
||||
XString32& operator=(const XString32 &S) { this->XStringAbstract<char32_t, XString32>::operator=(S); return *this; }
|
||||
|
||||
using XStringAbstract<char32_t, XString32>::operator =;
|
||||
};
|
||||
|
||||
class XStringW : public XStringAbstract<wchar_t, XStringW>
|
||||
{
|
||||
public:
|
||||
XStringW() : XStringAbstract<wchar_t, XStringW>() {};
|
||||
XStringW(const XStringW& S) : XStringAbstract<wchar_t, XStringW>(S) {}
|
||||
|
||||
template<class OtherXStringClass>
|
||||
XStringW(const OtherXStringClass& S) : XStringAbstract<wchar_t, XStringW>(S) {}
|
||||
|
||||
XStringW& operator=(const XStringW &S) { this->XStringAbstract<wchar_t, XStringW>::operator=(S); return *this; }
|
||||
|
||||
using XStringAbstract<wchar_t, XStringW>::operator =;
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
static void transmitSPrintf(const wchar_t* buf, unsigned int nbchar, void* context)
|
||||
{
|
||||
((XStringW*)(context))->strncat(buf, nbchar);
|
||||
}
|
||||
public:
|
||||
void vSWPrintf(const char* format, va_list va)
|
||||
{
|
||||
setEmpty();
|
||||
vwprintf_with_callback(format, va, transmitSPrintf, this);
|
||||
}
|
||||
void SWPrintf(const char* format, ...) __attribute__((__format__(__printf__, 2, 3)))
|
||||
{
|
||||
va_list va;
|
||||
|
||||
va_start (va, format);
|
||||
vSWPrintf(format, va);
|
||||
va_end(va);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
XString operator"" _XS ( const char* s, size_t len);
|
||||
XString16 operator"" _XS16 ( const char16_t* s, size_t len);
|
||||
XString32 operator"" _XS32 ( const char32_t* s, size_t len);
|
||||
XStringW operator"" _XSW ( const wchar_t* s, size_t len);
|
||||
|
||||
XString SPrintf(const char *format, ...) __attribute__((format(printf, 1, 2)));
|
||||
XString SubString(const char *s, xsize s_len, xsize pos, xsize count);
|
||||
inline XString SubString(const char *s, xsize pos, xsize count) { return SubString(s, strlen(s), pos, count); }
|
||||
inline XString SubString(const XString& S, xsize pos, xsize count) { return SubString(S.c_str(), S.length(), pos, count); }
|
||||
extern const XString NullXString;
|
||||
extern const XStringW NullXStringW;
|
||||
|
||||
|
||||
#ifdef TODO_skqdjfhksqjhfksjqdf
|
||||
XString ToAlpha(const char *S);
|
||||
XString ToAlpha(const XString &S);
|
||||
XString ToLower(const char *S, bool FirstCharIsCap = false);
|
||||
XString ToUpper(const char *S);
|
||||
#ifdef _MSC_VER
|
||||
# define __attribute__(x)
|
||||
#endif
|
||||
// Deactivate assignment during refactoring to avoid confusion
|
||||
//XString CleanCtrl(const XString &S);
|
||||
|
||||
XString SPrintf(const char* format, ...) __attribute__((__format__ (__printf__, 1, 2)));
|
||||
XStringW SWPrintf(const char* format, ...) __attribute__((__format__ (__printf__, 1, 2)));
|
||||
|
||||
#endif
|
||||
|
890
rEFIt_UEFI/cpp_foundation/XStringAbstract copy.h
Executable file
890
rEFIt_UEFI/cpp_foundation/XStringAbstract copy.h
Executable file
@ -0,0 +1,890 @@
|
||||
//*************************************************************************************************
|
||||
//*************************************************************************************************
|
||||
//
|
||||
// XSTRING
|
||||
//
|
||||
//*************************************************************************************************
|
||||
//*************************************************************************************************
|
||||
|
||||
#if !defined(__XSTRINGABSTRACT_H__)
|
||||
#define __XSTRINGABSTRACT_H__
|
||||
|
||||
#include "XToolsCommon.h"
|
||||
#include "unicode_conversions.h"
|
||||
|
||||
#ifndef DEBUG_ALL
|
||||
#define DEBUG_XStringAbstract 0
|
||||
#else
|
||||
#define DEBUG_TEXT DEBUG_ALL
|
||||
#endif
|
||||
|
||||
#if DEBUG_XStringAbstract == 0
|
||||
#define DBG_XSTRING(...)
|
||||
#else
|
||||
#define DBG_XSTRING(...) DebugLog(DEBUG_XStringAbstract, __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
//#include <type_traits>
|
||||
|
||||
#define LPATH_SEPARATOR L'\\'
|
||||
|
||||
#if __WCHAR_MAX__ <= 0xFFFFu
|
||||
#define wchar_cast char16_t
|
||||
#else
|
||||
#define wchar_cast char32_t
|
||||
#endif
|
||||
|
||||
|
||||
struct XStringAbstract__false_type {
|
||||
static constexpr bool value = false;
|
||||
};
|
||||
|
||||
struct XStringAbstract__true_type {
|
||||
static constexpr bool value = true;
|
||||
};
|
||||
|
||||
/* make unsigned */
|
||||
template <class _Tp>
|
||||
struct XStringAbstract__make_unsigned {};
|
||||
|
||||
//template <> struct __make_unsigned<bool, true> {};
|
||||
template <> struct XStringAbstract__make_unsigned< signed char> {typedef unsigned short type;};
|
||||
template <> struct XStringAbstract__make_unsigned<unsigned char> {typedef unsigned short type;};
|
||||
template <> struct XStringAbstract__make_unsigned< signed short> {typedef unsigned short type;};
|
||||
template <> struct XStringAbstract__make_unsigned<unsigned short> {typedef unsigned short type;};
|
||||
template <> struct XStringAbstract__make_unsigned< signed int> {typedef unsigned int type;};
|
||||
template <> struct XStringAbstract__make_unsigned<unsigned int> {typedef unsigned int type;};
|
||||
template <> struct XStringAbstract__make_unsigned< signed long> {typedef unsigned long type;};
|
||||
template <> struct XStringAbstract__make_unsigned<unsigned long> {typedef unsigned long type;};
|
||||
template <> struct XStringAbstract__make_unsigned< signed long long> {typedef unsigned long long type;};
|
||||
template <> struct XStringAbstract__make_unsigned<unsigned long long> {typedef unsigned long long type;};
|
||||
|
||||
/* enable_if */
|
||||
template <bool, typename T = void>
|
||||
struct XStringAbstract__enable_if_t
|
||||
{};
|
||||
|
||||
template <typename T>
|
||||
struct XStringAbstract__enable_if_t<true, T> {
|
||||
typedef T type;
|
||||
};
|
||||
//#define enable_if(x) XStringAbstract__enable_if_t(x, void)::type
|
||||
#define enable_if(x) typename enable_if_type = typename XStringAbstract__enable_if_t<x>::type
|
||||
//
|
||||
//template< bool B, class T = void >
|
||||
//using XStringAbstract__enable_if_t = typename XStringAbstract__enable_if<B,T>::type;
|
||||
|
||||
|
||||
// is_integral
|
||||
template <class _Tp> struct XStringAbstract__is_integral_st : public XStringAbstract__false_type {};
|
||||
template <> struct XStringAbstract__is_integral_st<bool> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_integral_st<char> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_integral_st<signed char> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_integral_st<unsigned char> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_integral_st<wchar_t> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_integral_st<short> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_integral_st<unsigned short> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_integral_st<int> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_integral_st<unsigned int> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_integral_st<long> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_integral_st<unsigned long> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_integral_st<long long> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_integral_st<unsigned long long> : public XStringAbstract__true_type {};
|
||||
#define is_integral(x) XStringAbstract__is_integral_st<x>::value
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define asciiToLower(ch) (((ch >= L'A') && (ch <= L'Z')) ? ((ch - L'A') + L'a') : ch)
|
||||
|
||||
template<typename S, typename O>
|
||||
int XStringAbstract__compare(const S* src, const O* other, bool ignoreCase)
|
||||
{
|
||||
// size_t len_s = length_of_utf_string(src);
|
||||
// size_t len_other = length_of_utf_string(other);
|
||||
size_t nb = 0;
|
||||
const S* src2 = src;
|
||||
const O* other2 = other;
|
||||
|
||||
char32_t src_char32;
|
||||
char32_t other_char32;
|
||||
src2 = get_char32_from_string(src2, &src_char32);
|
||||
other2 = get_char32_from_string(other2, &other_char32);
|
||||
while ( src_char32 ) {
|
||||
if ( ignoreCase ) {
|
||||
src_char32 = asciiToLower(src_char32);
|
||||
other_char32 = asciiToLower(other_char32);
|
||||
}
|
||||
if ( src_char32 != other_char32 ) break;
|
||||
src2 = get_char32_from_string(src2, &src_char32);
|
||||
other2 = get_char32_from_string(other2, &other_char32);
|
||||
nb += 1;
|
||||
};
|
||||
if ( src_char32 == other_char32 ) return 0;
|
||||
return src_char32 > other_char32 ? 1 : -1;
|
||||
}
|
||||
|
||||
template<typename O, typename P>
|
||||
size_t XStringAbstract__indexOf(const O** s, const P* other, size_t offsetRet, bool toLower)
|
||||
{
|
||||
size_t i;
|
||||
size_t Idx = 0;
|
||||
|
||||
char32_t s_char32;
|
||||
char32_t other_char32;
|
||||
|
||||
do
|
||||
{
|
||||
i = 0;
|
||||
const O* s2 = *s;
|
||||
const P* other2 = other;
|
||||
do {
|
||||
s2 = get_char32_from_string(s2, &s_char32);
|
||||
other2 = get_char32_from_string(other2, &other_char32);
|
||||
if ( toLower ) {
|
||||
s_char32 = asciiToLower(s_char32);
|
||||
other_char32 = asciiToLower(other_char32);
|
||||
}
|
||||
} while ( s_char32 && other_char32 && s_char32 == other_char32 );
|
||||
if ( other_char32 == 0 ) return Idx+offsetRet;
|
||||
*s = get_char32_from_string(*s, &s_char32);
|
||||
Idx++;
|
||||
} while (s_char32);
|
||||
return MAX_XSIZE;
|
||||
}
|
||||
|
||||
template<typename O, typename P>
|
||||
size_t XStringAbstract__indexOf(const O* s, size_t Pos, const P* other, bool toLower)
|
||||
{
|
||||
if ( *other == 0 ) return Pos;
|
||||
|
||||
char32_t char32 = 1;
|
||||
for ( size_t Idx=0 ; Idx<Pos ; Idx+=1 ) {
|
||||
s = get_char32_from_string(s, &char32);
|
||||
}
|
||||
if ( !char32 ) return MAX_XSIZE;
|
||||
return XStringAbstract__indexOf(&s, other, Pos, toLower);
|
||||
}
|
||||
|
||||
template<typename O, typename P>
|
||||
size_t XStringAbstract__rindexOf(const O* s, size_t Pos, const P* other, bool toLower)
|
||||
{
|
||||
if ( *other == 0 ) return Pos > length_of_utf_string(s) ? length_of_utf_string(s) : Pos;
|
||||
|
||||
size_t index = XStringAbstract__indexOf(&s, other, 0, toLower);
|
||||
size_t prev_index = index; // initialize to index in case of index is already == Pos
|
||||
|
||||
char32_t char32;
|
||||
s = get_char32_from_string(s, &char32);
|
||||
while ( char32 && index < Pos ) {
|
||||
prev_index = index;
|
||||
index = XStringAbstract__indexOf(&s, other, index+1, toLower);
|
||||
s = get_char32_from_string(s, &char32);
|
||||
};
|
||||
if ( index == Pos ) return index;
|
||||
if ( prev_index <= Pos ) return prev_index;
|
||||
return MAX_XSIZE;
|
||||
}
|
||||
|
||||
//template<typename O, typename P>
|
||||
//size_t XStringAbstract__rindexOf(const O* s, size_t Pos, const P* other, bool toLower)
|
||||
//{
|
||||
// size_t index = XStringAbstract__indexOf(s, 0, other, toLower);
|
||||
// size_t prev_index = index; // initialize to index in case of index is already == Pos
|
||||
// while ( index < Pos ) {
|
||||
// prev_index = index;
|
||||
// index = XStringAbstract__indexOf(s, index+1, other, toLower);
|
||||
// };
|
||||
// if ( index == Pos ) return index;
|
||||
// if ( prev_index <= Pos ) return prev_index;
|
||||
// return MAX_XSIZE;
|
||||
//}
|
||||
|
||||
|
||||
//template<class T, class SubType, size_t growBy>
|
||||
template<class T>
|
||||
class XStringAbstract
|
||||
{
|
||||
public:
|
||||
// const SubType NullXString;
|
||||
static T nullChar;
|
||||
|
||||
class XString16;
|
||||
XStringAbstract<T>(const XString16 &S)
|
||||
{
|
||||
Init(0);
|
||||
takeValueFrom(S);
|
||||
}
|
||||
|
||||
protected:
|
||||
T *m_data;
|
||||
size_t m_allocatedSize;
|
||||
|
||||
// convenience method. Did it this way to avoid #define in header. They can have an impact on other headers
|
||||
size_t min(size_t x1, size_t x2) const { if ( x1 < x2 ) return x1; return x2; }
|
||||
size_t max(size_t x1, size_t x2) const { if ( x1 > x2 ) return x1; return x2; }
|
||||
|
||||
// Methods _data is protected intentionally. They are const method returning non-const pointer. That's intentional, but dangerous. Do not expose to public.
|
||||
// If you need a non-const pointer for low-level access, to use dataSized and have to specify the size
|
||||
// pos is counted in logical char
|
||||
template<typename IntegralType, enable_if(is_integral(IntegralType))>
|
||||
T* _data(IntegralType pos) const
|
||||
{
|
||||
if ( pos<0 ) panic("T* data(int i) -> i < 0");
|
||||
size_t offset = size_of_utf_string_len(m_data, (typename XStringAbstract__make_unsigned<IntegralType>::type)pos); // If pos is too big, size_of_utf_string_len returns the end of the string
|
||||
return m_data + offset;
|
||||
}
|
||||
|
||||
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
// Init , Alloc
|
||||
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
|
||||
void Init(size_t aSize=0)
|
||||
{
|
||||
//DBG_XSTRING("Init aSize=%d\n", aSize);
|
||||
// We don't allocate any memory at first. To not have to test all the time if m_data is null, we init it to an empty string
|
||||
m_data = &nullChar;
|
||||
m_allocatedSize = 0;
|
||||
// if aSize == 0, nothing is done, because m_allocatedSize == aSize
|
||||
CheckSize(aSize, 0);
|
||||
}
|
||||
public:
|
||||
T *CheckSize(size_t nNewSize, size_t nGrowBy = 16) // nNewSize is in number of chars, NOT bytes
|
||||
{
|
||||
//DBG_XSTRING("CheckSize: m_size=%d, nNewSize=%d\n", m_size, nNewSize);
|
||||
|
||||
if ( m_allocatedSize < nNewSize )
|
||||
{
|
||||
nNewSize += nGrowBy;
|
||||
if ( m_allocatedSize == 0 ) m_data = (T*)malloc( (nNewSize+1)*sizeof(T) );
|
||||
else m_data = (T*)realloc(m_data, (nNewSize+1)*sizeof(T), (m_allocatedSize+1)*sizeof(T));
|
||||
if ( !m_data ) {
|
||||
DebugLog(2, "XStringAbstract<T>::CheckSize(%zu, %zu) : realloc(%" PRIuPTR ", %lu, %zd) returned NULL. System halted\n", nNewSize, nGrowBy, uintptr_t(m_data), nNewSize*sizeof(T), m_allocatedSize*sizeof(T));
|
||||
panic();
|
||||
}
|
||||
m_allocatedSize = nNewSize;
|
||||
m_data[m_allocatedSize] = 0; // we allocated one more char (nNewSize+1). This \0 is an extra precaution. It's not for the normal null terminator. All string operation must considered that only m_allocatedSize bytes were allocated.
|
||||
}
|
||||
return m_data;
|
||||
}
|
||||
// void setSize(size_t newSize) // nNewSize is in number of chars, NOT bytes
|
||||
// {
|
||||
// //DBG_XSTRING("setLength(%d)\n", len);
|
||||
// CheckSize(newSize);
|
||||
// // if ( len >= size() ) {
|
||||
// // DBG_XSTRING("XStringAbstract<T>::setLength(size_t len) : len >= size() (%d != %d). System halted\n", len, size());
|
||||
// // panic();
|
||||
// // }
|
||||
// m_data[newSize] = 0; // we may rewrite a 0 in nullChar, if no memory were allocated. That's ok.
|
||||
// }
|
||||
|
||||
|
||||
// T* memoryOffset(size_t i) {
|
||||
//
|
||||
// }
|
||||
|
||||
public:
|
||||
XStringAbstract<T>()
|
||||
{
|
||||
DBG_XSTRING("Construteur\n");
|
||||
Init(0);
|
||||
}
|
||||
|
||||
~XStringAbstract<T>()
|
||||
{
|
||||
//DBG_XSTRING("Destructor :%ls\n", data());
|
||||
if ( m_allocatedSize > 0 ) free((void*)m_data);
|
||||
}
|
||||
|
||||
template<typename IntegralType, enable_if(is_integral(IntegralType))>
|
||||
T* data(IntegralType pos) const { return _data(pos); }
|
||||
|
||||
// template<typename IntegralType, typename XStringAbstract__enable_if<XStringAbstract__is_integral<IntegralType>::value, IntegralType>::type* = nullptr>
|
||||
template<typename IntegralType, enable_if(is_integral(IntegralType))>
|
||||
T* dataSized(IntegralType size) const
|
||||
{
|
||||
if ( size<0 ) panic("T* dataSized(xisize i, size_t sizeMin, size_t nGrowBy) -> i < 0");
|
||||
CheckSize((typename XStringAbstract__make_unsigned<IntegralType>::type)size);
|
||||
return s();
|
||||
}
|
||||
|
||||
// Pos is counted in logical char but size is counted in physical char (char, char16_t, char32_t or wchar_t)
|
||||
template<typename IntegralType1, typename IntegralType2, enable_if(is_integral(IntegralType1) && is_integral(IntegralType2))>
|
||||
T* dataSized(IntegralType1 pos, IntegralType2 size)
|
||||
{
|
||||
if ( pos<0 ) panic("T* dataSized(xisize i, size_t sizeMin, size_t nGrowBy) -> i < 0");
|
||||
if ( size<0 ) panic("T* dataSized(xisize i, size_t sizeMin, size_t nGrowBy) -> i < 0");
|
||||
size_t offset = size_of_utf_string_len(m_data, (typename XStringAbstract__make_unsigned<IntegralType1>::type)pos); // If pos is too big, size_of_utf_string_len returns the end of the string
|
||||
CheckSize(offset + (typename XStringAbstract__make_unsigned<IntegralType2>::type)size);
|
||||
return _data(pos);
|
||||
}
|
||||
|
||||
// const T* data(unsigned int ui) const { return _data(ui); }
|
||||
// const T* data(int i) const { return _data(i); }
|
||||
// const T* data(size_t ui) const { return _data(ui); }
|
||||
// const T* data(xisize i) const { return _data(i); }
|
||||
//
|
||||
// T* dataSized(unsigned int ui, size_t sizeMin, size_t nGrowBy=16) { CheckSize(ui+sizeMin, nGrowBy); return _data(ui); }
|
||||
// T* dataSized(unsigned long ui, size_t sizeMin, size_t nGrowBy=16) { CheckSize(ui+sizeMin, nGrowBy); return _data(ui); }
|
||||
// T* dataSized(unsigned long long ui, size_t sizeMin, size_t nGrowBy=16) { CheckSize(ui+sizeMin, nGrowBy); return _data(ui); }
|
||||
// T* dataSized(int i, size_t sizeMin, size_t nGrowBy=16) { if ( i<0 ) panic("T* dataSized(xisize i, size_t sizeMin, size_t nGrowBy) -> i < 0"); CheckSize((unsigned int)i+sizeMin, nGrowBy); return _data(i); }
|
||||
// T* dataSized(long i, size_t sizeMin, size_t nGrowBy=16) { if ( i<0 ) panic("T* dataSized(xisize i, size_t sizeMin, size_t nGrowBy) -> i < 0"); CheckSize((unsigned long)i+sizeMin, nGrowBy); return _data(i); }
|
||||
// T* dataSized(long long i, size_t sizeMin, size_t nGrowBy=16) { if ( i<0 ) panic("T* dataSized(xisize i, size_t sizeMin, size_t nGrowBy) -> i < 0"); CheckSize((unsigned long long)i+sizeMin, nGrowBy); return _data(i); }
|
||||
|
||||
T* forgetDataWithoutFreeing()
|
||||
{
|
||||
T* ret = m_data;
|
||||
Init(0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
size_t length() const { return length_of_utf_string(m_data); }
|
||||
// size_t sizeZZ() const { return size_of_utf_string(m_data); }
|
||||
size_t sizeInBytes() const { return size_of_utf_string(m_data)*sizeof(T); }
|
||||
size_t allocatedSize() const { return m_allocatedSize; }
|
||||
|
||||
|
||||
const T* wc_str() const { return m_data; }
|
||||
const T* c_str() const { return m_data; }
|
||||
const T* s() const { return m_data; }
|
||||
const T* data() const { return m_data; } // todo delete
|
||||
|
||||
/* Empty ? */
|
||||
void setEmpty() { m_data[0] = 0; } // we may rewrite a 0 in nullChar if no memory were allocated (m_data == &nullChar). That's ok.
|
||||
bool isEmpty() const { return m_data == nullptr || *m_data == 0; }
|
||||
bool notEmpty() const { return !isEmpty(); }
|
||||
|
||||
|
||||
//--------------------------------------------------------------------- cast
|
||||
|
||||
// int ToInt() const;
|
||||
// size_t ToUInt() const;
|
||||
|
||||
|
||||
//--------------------------------------------------------------------- charAt, []
|
||||
|
||||
template<typename IntegralType, enable_if(is_integral(IntegralType))>
|
||||
char32_t char32At(IntegralType i) const
|
||||
{
|
||||
if (i < 0) {
|
||||
DBG_XSTRING("XStringAbstract<T>::char32At(size_t i) : i < 0. System halted\n");
|
||||
panic();
|
||||
}
|
||||
size_t nb = 0;
|
||||
const T *p = m_data;
|
||||
char32_t char32;
|
||||
do {
|
||||
p = get_char32_from_string(p, &char32);
|
||||
if (!char32) {
|
||||
panic("XStringAbstract::char32At(size_t i) : i >= length(). System halted\n");
|
||||
}
|
||||
nb += 1;
|
||||
} while (nb <= (typename XStringAbstract__make_unsigned<IntegralType>::type)i );
|
||||
return char32;
|
||||
}
|
||||
|
||||
template<typename IntegralType, enable_if(is_integral(IntegralType))>
|
||||
char16_t char16At(IntegralType i) const
|
||||
{
|
||||
char32_t char32 = char32At(i);
|
||||
if ( char32 >= 0x10000 ) return 0xFFFD; // <20> REPLACEMENT CHARACTER used to replace an unknown, unrecognized or unrepresentable character
|
||||
return (char16_t)char32;
|
||||
}
|
||||
|
||||
/* [] */
|
||||
template<typename IntegralType, enable_if(is_integral(IntegralType))>
|
||||
const char32_t operator [](IntegralType i) const { return char32At(i); }
|
||||
|
||||
|
||||
const char32_t LastChar() const { if ( length() > 0 ) return char32At(length()-1); else return 0; }
|
||||
|
||||
//--------------------------------------------------------------------- strcat, strcpy, operator =
|
||||
/* strncpy */
|
||||
template<typename O>
|
||||
void strncpy(const O* other, size_t other_len)
|
||||
{
|
||||
if ( other && *other && other_len > 0 ) {
|
||||
size_t newSize = utf_size_of_utf_string_len(m_data, other, other_len);
|
||||
CheckSize(newSize+1, 0);
|
||||
utf_string_from_utf_string_len(m_data, m_allocatedSize, other, other_len);
|
||||
m_data[newSize] = 0;
|
||||
}else{
|
||||
setEmpty();
|
||||
}
|
||||
}
|
||||
// Old name. TODO remove
|
||||
template<typename O>
|
||||
void StrnCpy(const O* other, size_t other_len) { strncpy(other, other_len); }
|
||||
|
||||
/* strcpy */
|
||||
template<typename O>
|
||||
void strcpy(const O* other)
|
||||
{
|
||||
if ( other && *other ) {
|
||||
size_t newSize = utf_size_of_utf_string(m_data, other);
|
||||
CheckSize(newSize+1, 0);
|
||||
utf_string_from_utf_string(m_data, m_allocatedSize, other);
|
||||
m_data[newSize] = 0;
|
||||
}else{
|
||||
setEmpty();
|
||||
}
|
||||
}
|
||||
/* strncat */
|
||||
template<typename O>
|
||||
void strncat(const O* other, size_t other_len)
|
||||
{
|
||||
if ( other && *other && other_len > 0 ) {
|
||||
size_t currentSize = size_of_utf_string(m_data);
|
||||
size_t newSize = currentSize + utf_size_of_utf_string_len(m_data, other, other_len);
|
||||
CheckSize(newSize+1, 0);
|
||||
utf_string_from_utf_string_len(m_data+currentSize, m_allocatedSize, other, other_len);
|
||||
m_data[newSize] = 0;
|
||||
}else{
|
||||
// nothing to do
|
||||
}
|
||||
}
|
||||
/* strcat */
|
||||
template<typename O>
|
||||
void strcat(const O* other)
|
||||
{
|
||||
if ( other && *other ) {
|
||||
size_t currentSize = size_of_utf_string(m_data); // size is number of T, not in bytes
|
||||
size_t newSize = currentSize + utf_size_of_utf_string(m_data, other); // size is number of T, not in bytes
|
||||
CheckSize(newSize+1, 0);
|
||||
utf_string_from_utf_string(m_data+currentSize, m_allocatedSize-currentSize, other);
|
||||
m_data[newSize] = 0;
|
||||
}else{
|
||||
// nothing to do
|
||||
}
|
||||
}
|
||||
/* takeValueFrom */
|
||||
template<typename O>
|
||||
XStringAbstract<T>& takeValueFrom(const XStringAbstract<O>& S) { strcpy(S.s()); return *this; }
|
||||
template<typename O>
|
||||
XStringAbstract<T>& takeValueFrom(const O* S) { strcpy(S); return *this; }
|
||||
template<typename O>
|
||||
XStringAbstract<T>& takeValueFrom(const XStringAbstract<O>& S, size_t len) { strncpy(S.data(0), len); return *this; }
|
||||
template<typename O>
|
||||
XStringAbstract<T>& takeValueFrom(const O* S, size_t len) { strncpy(S, len); return *this; }
|
||||
|
||||
/* copy ctor */
|
||||
XStringAbstract<T>(const XStringAbstract<T> &S) { Init(0); takeValueFrom(S); }
|
||||
/* ctor */
|
||||
template<typename O>
|
||||
explicit XStringAbstract<T>(const XStringAbstract<O> &S) { Init(0); takeValueFrom(S); }
|
||||
|
||||
/* Copy Assign */ // Only other XString, no litteral at the moment.
|
||||
XStringAbstract<T>& operator =(const XStringAbstract<T>& S) { strcpy(S.s()); return *this; }
|
||||
/* Assign */
|
||||
template<typename O>
|
||||
XStringAbstract<T>& operator =(const XStringAbstract<O>& S) { strcpy(S.s()); return *this; }
|
||||
|
||||
/* += */
|
||||
template<typename O>
|
||||
XStringAbstract<T>& operator += (const XStringAbstract<O>& S) { strcat(S.s()); return *this; }
|
||||
template<typename O>
|
||||
XStringAbstract<T>& operator += (const O* S) { strcat(S); return *this; }
|
||||
|
||||
// + operator
|
||||
template<typename O>
|
||||
friend XStringAbstract operator + (const XStringAbstract<T>& p1, const XStringAbstract<O>& p2) { XStringAbstract s; s=p1; s+=p2; return s; }
|
||||
template<typename O>
|
||||
friend XStringAbstract operator + (const XStringAbstract<T>& p1, const O* p2 ) { XStringAbstract s; s=p1; s+=p2; return s; }
|
||||
template<typename O>
|
||||
friend XStringAbstract operator + (const O *p1, const XStringAbstract<T>& p2) { XStringAbstract s; s.strcat(p1); s.strcat(p2.s()); return s; }
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------- indexOf, rindexOf
|
||||
|
||||
/* indexOf */
|
||||
size_t indexOf(char32_t char32Searched, size_t Pos = 0) const
|
||||
{
|
||||
char32_t buf[2] = { char32Searched, 0};
|
||||
return XStringAbstract__indexOf(m_data, Pos, buf, false);
|
||||
}
|
||||
template<typename O>
|
||||
size_t indexOf(const O* S, size_t Pos = 0) const { return XStringAbstract__indexOf(m_data, Pos, S, false); }
|
||||
template<typename O>
|
||||
size_t indexOf(const XStringAbstract<O>& S, size_t Pos = 0) const { return indexOf(S.s(), Pos); }
|
||||
// old name : todo remove
|
||||
size_t IdxOf(char c, size_t Pos = 0) const { return indexOf((char32_t)c, Pos); }
|
||||
template<typename O>
|
||||
size_t IdxOf(const XStringAbstract<O>& S, size_t Pos = 0) const { return indexOf(S, Pos); }
|
||||
/* IC */
|
||||
size_t indexOfIC(char32_t char32Searched, size_t Pos = 0) const
|
||||
{
|
||||
char32_t buf[2] = { char32Searched, 0};
|
||||
return XStringAbstract__indexOf(m_data, Pos, buf, true);
|
||||
}
|
||||
template<typename O>
|
||||
size_t indexOfIC(const O* S, size_t Pos = 0) const { return XStringAbstract__indexOf(m_data, Pos, S, true); }
|
||||
template<typename O>
|
||||
size_t indexOfIC(const XStringAbstract<O>& S, size_t Pos = 0) const { return indexOfIC(S.s(), Pos); }
|
||||
|
||||
|
||||
/* rindexOf */
|
||||
size_t rindexOf(const char32_t char32Searched, size_t Pos = MAX_XSIZE-1) const
|
||||
{
|
||||
char32_t buf[2] = { char32Searched, 0};
|
||||
return XStringAbstract__rindexOf(m_data, Pos, buf, false);
|
||||
}
|
||||
template<typename O>
|
||||
size_t rindexOf(const O* S, size_t Pos = MAX_XSIZE-1) const { return XStringAbstract__rindexOf(m_data, Pos, S, false); }
|
||||
template<typename O>
|
||||
size_t rindexOf(const XStringAbstract<O>& S, size_t Pos = MAX_XSIZE-1) const { return rindexOf(S.s(), Pos); }
|
||||
/* IC */
|
||||
size_t rindexOfIC(const char32_t char32Searched, size_t Pos = MAX_XSIZE-1) const
|
||||
{
|
||||
char32_t buf[2] = { char32Searched, 0};
|
||||
return XStringAbstract__rindexOf(m_data, Pos, buf, true);
|
||||
}
|
||||
template<typename O>
|
||||
size_t rindexOfIC(const O* S, size_t Pos = MAX_XSIZE-1) const { return XStringAbstract__rindexOf(m_data, Pos, S, true); }
|
||||
template<typename O>
|
||||
size_t rindexOfIC(const XStringAbstract<O>& S, size_t Pos = MAX_XSIZE-1) const { return rindexOf(S.s(), Pos); }
|
||||
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
XStringAbstract<T> lowerAscii()
|
||||
{
|
||||
T* s = m_data;
|
||||
while ( *s ) {
|
||||
*s = asciiToLower(*s);
|
||||
s++;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
// void deleteCountCharsAt(size_t pos, size_t count=1);
|
||||
//{
|
||||
// if ( pos < size() ) {
|
||||
// if ( count != MAX_XSIZE && pos + count < size() ) {
|
||||
// memmove( _data(pos), data(pos+count), (size()-pos-count)*sizeof(T)); // memmove handles overlapping memory move
|
||||
// setLength(size()-count);/* data()[length()-count]=0 done in setLength */
|
||||
// }else{
|
||||
// setSize(pos);/* data()[pos]=0 done in setLength */
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
// void insert(const XStringAbstract<T>& Str, size_t pos);
|
||||
//{
|
||||
// if ( pos < size() ) {
|
||||
// CheckSize(size()+Str.size());
|
||||
// memmove(_data(pos + Str.size()), data(pos), (size()-pos)*sizeof(T));
|
||||
// memmove(_data(pos), Str.data(), Str.size()*sizeof(T));
|
||||
// setLength(size()+Str.size());
|
||||
// }else{
|
||||
// StrCat(Str);
|
||||
// }
|
||||
//}
|
||||
|
||||
XStringAbstract SubString(size_t pos, size_t count) const
|
||||
{
|
||||
if ( count > length()-pos ) count = length()-pos;
|
||||
XStringAbstract ret;
|
||||
|
||||
const T* src = m_data;
|
||||
char32_t char32 = 1;
|
||||
while ( char32 && pos > 0 ) {
|
||||
src = get_char32_from_string(src, &char32);
|
||||
pos -= 1;
|
||||
};
|
||||
ret.strncat(src, count);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// todo rename to contains
|
||||
template<typename O>
|
||||
bool ExistIn(const XStringAbstract<O>& S) const { return indexOf(S) != MAX_XSIZE; }
|
||||
template<typename O>
|
||||
bool ExistIn(const O* S) const { return indexOf(S) != MAX_XSIZE; }
|
||||
template<typename O>
|
||||
size_t ExistInIC(const O* S) const { return indexOfIC(S) != MAX_XSIZE; }
|
||||
template<typename O>
|
||||
size_t ExistInIC(const XStringAbstract<O>& S) const { return indexOfIC(S) != MAX_XSIZE; }
|
||||
|
||||
|
||||
// void ToLower(bool FirstCharIsCap = false);
|
||||
// bool IsLetters() const;
|
||||
// bool IsLettersNoAccent() const;
|
||||
// bool IsDigits() const;
|
||||
//{
|
||||
// const T *p;
|
||||
//
|
||||
// p = data();
|
||||
// if ( !*p ) return false;
|
||||
// for ( ; *p ; p+=1 ) {
|
||||
// if ( *p < '0' ) return false;
|
||||
// if ( *p > '9' ) return false;
|
||||
// }
|
||||
// return true;
|
||||
//}
|
||||
// bool IsDigits(size_t pos, size_t count) const;
|
||||
//{
|
||||
// const T *p;
|
||||
// const T *q;
|
||||
//
|
||||
// if ( pos >= size() ) {
|
||||
// return false;
|
||||
// }
|
||||
// if ( pos+count > size() ) {
|
||||
// return false;
|
||||
// }
|
||||
// p = data() + pos;
|
||||
// q = p + count;
|
||||
// for ( ; p < q ; p+=1 ) {
|
||||
// if ( *p < '0' ) return false;
|
||||
// if ( *p > '9' ) return false;
|
||||
// }
|
||||
// return true;
|
||||
//}
|
||||
|
||||
// void Replace(T c1, T c2)
|
||||
// {
|
||||
// T* p;
|
||||
//
|
||||
// p = s();
|
||||
// while ( *p ) {
|
||||
// if ( *p == c1 ) *p = c2;
|
||||
// p += 1;
|
||||
// }
|
||||
// }
|
||||
// XStringAbstract SubStringReplace(T c1, T c2);
|
||||
//{
|
||||
// T* p;
|
||||
// XStringAbstract Result;
|
||||
//
|
||||
// p = s();
|
||||
// while ( *p ) {
|
||||
// if ( *p == c1 ) Result += c2;
|
||||
// else Result += *p;
|
||||
// p++;
|
||||
// }
|
||||
// return Result;
|
||||
//}
|
||||
//
|
||||
// SubType basename() const
|
||||
// {
|
||||
// size_t idx = RIdxOf(LPATH_SEPARATOR);
|
||||
// if ( idx == MAX_XSIZE ) return SubType();
|
||||
// return SubString(idx+1, size()-idx-1);
|
||||
// }
|
||||
// SubType dirname() const
|
||||
// {
|
||||
// size_t idx = RIdxOf(LPATH_SEPARATOR);
|
||||
// if ( idx == MAX_XSIZE ) return SubType();
|
||||
// return SubString(0, idx);
|
||||
// }
|
||||
// void RemoveLastEspCtrl();
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
template<typename O>
|
||||
int strcmp(const O* S) const { return XStringAbstract__compare(m_data, S, false); }
|
||||
// int Compare(const char* S) const { return ::Compare<T, char>(m_data, S); }
|
||||
// int Compare(const char16_t* S) const { return ::Compare<T, char16_t>(m_data, S); };
|
||||
// int Compare(const char32_t* S) const { return ::Compare<T, char32_t>(m_data, S); };
|
||||
// int Compare(const wchar_t* S) const { return ::Compare<T, wchar_t>(m_data, S); };
|
||||
//
|
||||
template<typename O>
|
||||
bool Equal(const O* S) const { return XStringAbstract__compare(m_data, S, false); }
|
||||
template<typename O>
|
||||
bool EqualIC(const O* S) const { return XStringAbstract__compare(m_data, S, true); }
|
||||
template<typename O>
|
||||
bool EqualIC(const XStringAbstract<O>& S) const { return XStringAbstract__compare(m_data, S.s(), true); }
|
||||
// bool BeginingEqual(const T* S) const { return (memcmp(data(), S, wcslen(S)) == 0); }
|
||||
// bool SubStringEqual(size_t Pos, const T* S) const { return (memcmp(data(Pos), S, wcslen(S)) == 0); }
|
||||
|
||||
public:
|
||||
// == operator
|
||||
template<typename O>
|
||||
friend bool operator == (const XStringAbstract<T>& s1, const XStringAbstract<O>& s2) { return s1.strcmp(s2.s()) == 0; }
|
||||
template<typename O>
|
||||
friend bool operator == (const XStringAbstract<T>& s1, const O* s2) { return s1.strcmp(s2) == 0; }
|
||||
template<typename O>
|
||||
friend bool operator == (const O* s1, const XStringAbstract<T>& s2) { return s2.strcmp(s1) == 0; }
|
||||
|
||||
template<typename O>
|
||||
friend bool operator != (const XStringAbstract<T>& s1, const XStringAbstract<O>& s2) { return !(s1 == s2); }
|
||||
template<typename O>
|
||||
friend bool operator != (const XStringAbstract<T>& s1, const O* s2) { return !(s1 == s2); }
|
||||
template<typename O>
|
||||
friend bool operator != (const O* s1, const XStringAbstract<T>& s2) { return !(s2 == s1); }
|
||||
|
||||
template<typename O>
|
||||
friend bool operator < (const XStringAbstract<T>& s1, const XStringAbstract<O>& s2) { return s1.strcmp(s2.s()) < 0; }
|
||||
template<typename O>
|
||||
friend bool operator < (const XStringAbstract<T>& s1, const O* s2 ) { return s1.strcmp(s2) < 0; }
|
||||
template<typename O>
|
||||
friend bool operator < (const O* s1, const XStringAbstract<T>& s2) { return s2.strcmp(s1) > 0; }
|
||||
|
||||
template<typename O>
|
||||
friend bool operator > (const XStringAbstract<T>& s1, const XStringAbstract<O>& s2) { return s1.strcmp(s2.s()) > 0; }
|
||||
template<typename O>
|
||||
friend bool operator > (const XStringAbstract<T>& s1, const O* s2 ) { return s1.strcmp(s2) > 0; }
|
||||
template<typename O>
|
||||
friend bool operator > (const O* s1, const XStringAbstract<T>& s2) { return s2.strcmp(s1) < 0; }
|
||||
|
||||
template<typename O>
|
||||
friend bool operator <= (const XStringAbstract<T>& s1, const XStringAbstract<O>& s2) { return s1.strcmp(s2.s()) <= 0; }
|
||||
template<typename O>
|
||||
friend bool operator <= (const XStringAbstract<T>& s1, const O* s2 ) { return s1.strcmp(s2) <= 0; }
|
||||
template<typename O>
|
||||
friend bool operator <= (const O* s1, const XStringAbstract<T>& s2) { return s2.strcmp(s1) >= 0; }
|
||||
|
||||
template<typename O>
|
||||
friend bool operator >= (const XStringAbstract<T>& s1, const XStringAbstract<O>& s2) { return s1.strcmp(s2.s()) >= 0; }
|
||||
template<typename O>
|
||||
friend bool operator >= (const XStringAbstract<T>& s1, const O* s2 ) { return s1.strcmp(s2) >= 0; }
|
||||
template<typename O>
|
||||
friend bool operator >= (const O* s1, const XStringAbstract<T>& s2) { return s2.strcmp(s1) <= 0; }
|
||||
|
||||
};
|
||||
|
||||
|
||||
template<class T>
|
||||
T XStringAbstract<T>::nullChar = 0;
|
||||
|
||||
|
||||
|
||||
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
// Constructor
|
||||
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
|
||||
|
||||
//
|
||||
//template<class T, class SubType, size_t growBy>
|
||||
//XStringAbstract<T>::XStringAbstract(const XStringAbstract &aString)
|
||||
//{
|
||||
//DBG_XSTRING("Constructor(const XStringAbstract &aString) : %ls\n", aString.data());
|
||||
// Init(aString.size());
|
||||
// memcpy(m_data, aString.m_data, aString.sizeInBytes());
|
||||
//}
|
||||
|
||||
|
||||
//
|
||||
//template<class T, class SubType, size_t growBy>
|
||||
//void XStringAbstract<T>::RemoveLastEspCtrl()
|
||||
//{
|
||||
// T *p;
|
||||
//
|
||||
// if ( size() > 0 ) {
|
||||
// p = s() + size() - 1;
|
||||
// #if __WCHAR_MIN__ < 0
|
||||
// if ( *p >= 0 && *p <= ' ' ) {
|
||||
// #else
|
||||
// if ( *p <= ' ' ) {
|
||||
// #endif
|
||||
// p -= 1;
|
||||
// #if __WCHAR_MIN__ < 0
|
||||
// while ( p>data() && *p >= 0 && *p <= ' ' ) p -= 1;
|
||||
// #else
|
||||
// while ( p>data() && *p <= ' ' ) p -= 1;
|
||||
// #endif
|
||||
// if ( p>data() ) {
|
||||
// setSize( (size_t)(p-data())+1);
|
||||
// }else{
|
||||
// #if __WCHAR_MIN__ < 0
|
||||
// if ( *p >= 0 && *p <= ' ' ) setSize(0);
|
||||
// #else
|
||||
// if ( *p <= ' ' ) setSize(0);
|
||||
// #endif
|
||||
// else setSize(1);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Functions
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//XStringAbstract operator"" _XSW ( const T* s, size_t len)
|
||||
//{
|
||||
// XStringAbstract returnValue;
|
||||
// if ( len > MAX_XSIZE ) len = MAX_XSIZE;
|
||||
// returnValue.takeValueFrom(s, len);
|
||||
// return returnValue; // don't do "return returnValue.takeValueFrom(s, len)" because it break the return value optimization.
|
||||
//}
|
||||
//
|
||||
//XStringAbstract SWPrintf(const char* format, ...)
|
||||
//{
|
||||
// va_list va;
|
||||
// XStringAbstract str;
|
||||
//
|
||||
// va_start (va, format);
|
||||
// str.vSWPrintf(format, va);
|
||||
// va_end(va);
|
||||
//
|
||||
// return str;
|
||||
//}
|
||||
//
|
||||
//XStringAbstract SubString(const T *S, size_t pos, size_t count)
|
||||
//{
|
||||
// if ( wcslen(S)-pos < count ) count = wcslen(S)-pos;
|
||||
// XStringAbstract ret;
|
||||
// ret.StrnCpy(S+pos, count);
|
||||
//// return ( XStringAbstract(S+pos, count) );
|
||||
// return ret;
|
||||
//}
|
||||
//
|
||||
//
|
||||
//XStringAbstract CleanCtrl(const XStringAbstract &S)
|
||||
//{
|
||||
// XStringAbstract ReturnValue;
|
||||
// size_t i;
|
||||
//
|
||||
// for ( i=0 ; i<S.size() ; i+=1 ) {
|
||||
//#if __WCHAR_MIN__ < 0
|
||||
// if ( S.wc_str()[i] >=0 && S.wc_str()[i] < ' ' ) ReturnValue += 'x'; /* T are signed */
|
||||
//#else
|
||||
// if ( S.wc_str()[i] < ' ' ) ReturnValue += 'x'; /* T are unsigned */
|
||||
//#endif
|
||||
// else ReturnValue += S.wc_str()[i];
|
||||
// }
|
||||
// return ReturnValue;
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#undef DBG_XSTRING
|
||||
#undef is_integral
|
||||
#undef enable_if
|
||||
#undef asciiToLower
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
//extern const XStringAbstract NullXStringAbstract;
|
||||
//
|
||||
//XStringAbstract operator"" _XSW ( const T* s, size_t len);
|
||||
//
|
||||
//XStringAbstract SWPrintf(const char* format, ...) __attribute__((__format__(__printf__, 1, 2)));
|
||||
//XStringAbstract SubString(const T *S, size_t pos, size_t count);
|
||||
//XStringAbstract CleanCtrl(const XStringAbstract &S);
|
||||
|
||||
|
||||
|
||||
#endif // __XSTRINGABSTRACT_H__
|
921
rEFIt_UEFI/cpp_foundation/XStringAbstract.h
Executable file
921
rEFIt_UEFI/cpp_foundation/XStringAbstract.h
Executable file
@ -0,0 +1,921 @@
|
||||
//*************************************************************************************************
|
||||
//*************************************************************************************************
|
||||
//
|
||||
// XSTRING
|
||||
//
|
||||
//*************************************************************************************************
|
||||
//*************************************************************************************************
|
||||
|
||||
#if !defined(__XSTRINGABSTRACT_H__)
|
||||
#define __XSTRINGABSTRACT_H__
|
||||
|
||||
#include "XToolsCommon.h"
|
||||
#include "unicode_conversions.h"
|
||||
|
||||
#ifndef DEBUG_ALL
|
||||
#define DEBUG_XStringAbstract 0
|
||||
#else
|
||||
#define DEBUG_TEXT DEBUG_ALL
|
||||
#endif
|
||||
|
||||
#if DEBUG_XStringAbstract == 0
|
||||
#define DBG_XSTRING(...)
|
||||
#else
|
||||
#define DBG_XSTRING(...) DebugLog(DEBUG_XStringAbstract, __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
//#include <type_traits>
|
||||
|
||||
#define LPATH_SEPARATOR L'\\'
|
||||
|
||||
#if __WCHAR_MAX__ <= 0xFFFFu
|
||||
#define wchar_cast char16_t
|
||||
#else
|
||||
#define wchar_cast char32_t
|
||||
#endif
|
||||
|
||||
|
||||
struct XStringAbstract__false_type {
|
||||
static constexpr bool value = false;
|
||||
bool v() const { return false; }
|
||||
};
|
||||
|
||||
struct XStringAbstract__true_type {
|
||||
static constexpr bool value = true;
|
||||
bool v() const { return true; }
|
||||
};
|
||||
|
||||
/* make unsigned */
|
||||
template <class _Tp>
|
||||
struct XStringAbstract__make_unsigned {};
|
||||
|
||||
//template <> struct __make_unsigned<bool, true> {};
|
||||
template <> struct XStringAbstract__make_unsigned< signed char> {typedef unsigned short type;};
|
||||
template <> struct XStringAbstract__make_unsigned<unsigned char> {typedef unsigned short type;};
|
||||
template <> struct XStringAbstract__make_unsigned< signed short> {typedef unsigned short type;};
|
||||
template <> struct XStringAbstract__make_unsigned<unsigned short> {typedef unsigned short type;};
|
||||
template <> struct XStringAbstract__make_unsigned< signed int> {typedef unsigned int type;};
|
||||
template <> struct XStringAbstract__make_unsigned<unsigned int> {typedef unsigned int type;};
|
||||
template <> struct XStringAbstract__make_unsigned< signed long> {typedef unsigned long type;};
|
||||
template <> struct XStringAbstract__make_unsigned<unsigned long> {typedef unsigned long type;};
|
||||
template <> struct XStringAbstract__make_unsigned< signed long long> {typedef unsigned long long type;};
|
||||
template <> struct XStringAbstract__make_unsigned<unsigned long long> {typedef unsigned long long type;};
|
||||
|
||||
/* enable_if */
|
||||
template <bool, typename T = void>
|
||||
struct XStringAbstract__enable_if_t
|
||||
{};
|
||||
|
||||
template <typename T>
|
||||
struct XStringAbstract__enable_if_t<true, T> {
|
||||
typedef T type;
|
||||
};
|
||||
//#define enable_if(x) XStringAbstract__enable_if_t(x, void)::type
|
||||
#define enable_if(x) typename enable_if_type = typename XStringAbstract__enable_if_t<x>::type
|
||||
//
|
||||
//template< bool B, class T = void >
|
||||
//using XStringAbstract__enable_if_t = typename XStringAbstract__enable_if<B,T>::type;
|
||||
|
||||
|
||||
// is_integral
|
||||
template <class _Tp> struct XStringAbstract__is_integral_st : public XStringAbstract__false_type {};
|
||||
template <> struct XStringAbstract__is_integral_st<bool> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_integral_st<char> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_integral_st<signed char> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_integral_st<unsigned char> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_integral_st<wchar_t> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_integral_st<short> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_integral_st<unsigned short> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_integral_st<int> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_integral_st<unsigned int> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_integral_st<long> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_integral_st<unsigned long> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_integral_st<long long> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_integral_st<unsigned long long> : public XStringAbstract__true_type {};
|
||||
#define is_integral(x) XStringAbstract__is_integral_st<x>::value
|
||||
|
||||
|
||||
// is_char
|
||||
template <class _Tp> struct XStringAbstract__is_char_st : public XStringAbstract__false_type {};
|
||||
template <> struct XStringAbstract__is_char_st<char> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_char_st<char[]> : public XStringAbstract__true_type {};
|
||||
template <size_t _Np> struct XStringAbstract__is_char_st<char[_Np]> : public XStringAbstract__true_type {};
|
||||
//template <> struct XStringAbstract__is_char_st<signed char> : public XStringAbstract__true_type {};
|
||||
//template <> struct XStringAbstract__is_char_st<unsigned char> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_char_st<char16_t> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_char_st<char16_t[]> : public XStringAbstract__true_type {};
|
||||
template <size_t _Np> struct XStringAbstract__is_char_st<char16_t[_Np]> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_char_st<char32_t> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_char_st<char32_t[]> : public XStringAbstract__true_type {};
|
||||
template <size_t _Np> struct XStringAbstract__is_char_st<char32_t[_Np]> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_char_st<wchar_t> : public XStringAbstract__true_type {};
|
||||
template <> struct XStringAbstract__is_char_st<wchar_t[]> : public XStringAbstract__true_type {};
|
||||
template <size_t _Np> struct XStringAbstract__is_char_st<wchar_t[_Np]> : public XStringAbstract__true_type {};
|
||||
#define is_char(x) XStringAbstract__is_char_st<x>::value
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define asciiToLower(ch) (((ch >= L'A') && (ch <= L'Z')) ? ((ch - L'A') + L'a') : ch)
|
||||
|
||||
template<typename S, typename O>
|
||||
int XStringAbstract__compare(const S* src, const O* other, bool ignoreCase)
|
||||
{
|
||||
// size_t len_s = length_of_utf_string(src);
|
||||
// size_t len_other = length_of_utf_string(other);
|
||||
size_t nb = 0;
|
||||
const S* src2 = src;
|
||||
const O* other2 = other;
|
||||
|
||||
char32_t src_char32;
|
||||
char32_t other_char32;
|
||||
src2 = get_char32_from_string(src2, &src_char32);
|
||||
other2 = get_char32_from_string(other2, &other_char32);
|
||||
while ( src_char32 ) {
|
||||
if ( ignoreCase ) {
|
||||
src_char32 = asciiToLower(src_char32);
|
||||
other_char32 = asciiToLower(other_char32);
|
||||
}
|
||||
if ( src_char32 != other_char32 ) break;
|
||||
src2 = get_char32_from_string(src2, &src_char32);
|
||||
other2 = get_char32_from_string(other2, &other_char32);
|
||||
nb += 1;
|
||||
};
|
||||
if ( src_char32 == other_char32 ) return 0;
|
||||
return src_char32 > other_char32 ? 1 : -1;
|
||||
}
|
||||
|
||||
template<typename O, typename P>
|
||||
size_t XStringAbstract__indexOf(const O** s, const P* other, size_t offsetRet, bool toLower)
|
||||
{
|
||||
size_t i;
|
||||
size_t Idx = 0;
|
||||
|
||||
char32_t s_char32;
|
||||
char32_t other_char32;
|
||||
|
||||
do
|
||||
{
|
||||
i = 0;
|
||||
const O* s2 = *s;
|
||||
const P* other2 = other;
|
||||
do {
|
||||
s2 = get_char32_from_string(s2, &s_char32);
|
||||
other2 = get_char32_from_string(other2, &other_char32);
|
||||
if ( toLower ) {
|
||||
s_char32 = asciiToLower(s_char32);
|
||||
other_char32 = asciiToLower(other_char32);
|
||||
}
|
||||
} while ( s_char32 && other_char32 && s_char32 == other_char32 );
|
||||
if ( other_char32 == 0 ) return Idx+offsetRet;
|
||||
*s = get_char32_from_string(*s, &s_char32);
|
||||
Idx++;
|
||||
} while (s_char32);
|
||||
return MAX_XSIZE;
|
||||
}
|
||||
|
||||
template<typename O, typename P>
|
||||
size_t XStringAbstract__indexOf(const O* s, size_t Pos, const P* other, bool toLower)
|
||||
{
|
||||
if ( *other == 0 ) return Pos;
|
||||
|
||||
char32_t char32 = 1;
|
||||
for ( size_t Idx=0 ; Idx<Pos ; Idx+=1 ) {
|
||||
s = get_char32_from_string(s, &char32);
|
||||
}
|
||||
if ( !char32 ) return MAX_XSIZE;
|
||||
return XStringAbstract__indexOf(&s, other, Pos, toLower);
|
||||
}
|
||||
|
||||
template<typename O, typename P>
|
||||
size_t XStringAbstract__rindexOf(const O* s, size_t Pos, const P* other, bool toLower)
|
||||
{
|
||||
if ( *other == 0 ) return Pos > length_of_utf_string(s) ? length_of_utf_string(s) : Pos;
|
||||
|
||||
size_t index = XStringAbstract__indexOf(&s, other, 0, toLower);
|
||||
size_t prev_index = index; // initialize to index in case of index is already == Pos
|
||||
|
||||
char32_t char32;
|
||||
s = get_char32_from_string(s, &char32);
|
||||
while ( char32 && index < Pos ) {
|
||||
prev_index = index;
|
||||
index = XStringAbstract__indexOf(&s, other, index+1, toLower);
|
||||
s = get_char32_from_string(s, &char32);
|
||||
};
|
||||
if ( index == Pos ) return index;
|
||||
if ( prev_index <= Pos ) return prev_index;
|
||||
return MAX_XSIZE;
|
||||
}
|
||||
|
||||
//template<typename O, typename P>
|
||||
//size_t XStringAbstract__rindexOf(const O* s, size_t Pos, const P* other, bool toLower)
|
||||
//{
|
||||
// size_t index = XStringAbstract__indexOf(s, 0, other, toLower);
|
||||
// size_t prev_index = index; // initialize to index in case of index is already == Pos
|
||||
// while ( index < Pos ) {
|
||||
// prev_index = index;
|
||||
// index = XStringAbstract__indexOf(s, index+1, other, toLower);
|
||||
// };
|
||||
// if ( index == Pos ) return index;
|
||||
// if ( prev_index <= Pos ) return prev_index;
|
||||
// return MAX_XSIZE;
|
||||
//}
|
||||
|
||||
|
||||
//template<class T, class SubType, size_t growBy>
|
||||
template<class T, class ThisXStringClass>
|
||||
class XStringAbstract
|
||||
{
|
||||
public:
|
||||
// const SubType NullXString;
|
||||
static T nullChar;
|
||||
|
||||
//class XString16;
|
||||
// XStringAbstract<T, ThisXStringClass>(const XStringAbstract<T, ThisXStringClass> &S)
|
||||
// {
|
||||
// Init(0);
|
||||
// takeValueFrom(S);
|
||||
// }
|
||||
|
||||
protected:
|
||||
T *m_data;
|
||||
size_t m_allocatedSize;
|
||||
|
||||
// convenience method. Did it this way to avoid #define in header. They can have an impact on other headers
|
||||
size_t min(size_t x1, size_t x2) const { if ( x1 < x2 ) return x1; return x2; }
|
||||
size_t max(size_t x1, size_t x2) const { if ( x1 > x2 ) return x1; return x2; }
|
||||
|
||||
// Methods _data is protected intentionally. They are const method returning non-const pointer. That's intentional, but dangerous. Do not expose to public.
|
||||
// If you need a non-const pointer for low-level access, to use dataSized and have to specify the size
|
||||
// pos is counted in logical char
|
||||
template<typename IntegralType, enable_if(is_integral(IntegralType))>
|
||||
T* _data(IntegralType pos) const
|
||||
{
|
||||
if ( pos<0 ) panic("T* data(int i) -> i < 0");
|
||||
size_t offset = size_of_utf_string_len(m_data, (typename XStringAbstract__make_unsigned<IntegralType>::type)pos); // If pos is too big, size_of_utf_string_len returns the end of the string
|
||||
return m_data + offset;
|
||||
}
|
||||
|
||||
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
// Init , Alloc
|
||||
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
|
||||
void Init(size_t aSize=0)
|
||||
{
|
||||
//DBG_XSTRING("Init aSize=%d\n", aSize);
|
||||
// We don't allocate any memory at first. To not have to test all the time if m_data is null, we init it to an empty string
|
||||
m_data = &nullChar;
|
||||
m_allocatedSize = 0;
|
||||
// if aSize == 0, nothing is done, because m_allocatedSize == aSize
|
||||
CheckSize(aSize, 0);
|
||||
}
|
||||
public:
|
||||
T *CheckSize(size_t nNewSize, size_t nGrowBy = 16) // nNewSize is in number of chars, NOT bytes
|
||||
{
|
||||
//DBG_XSTRING("CheckSize: m_size=%d, nNewSize=%d\n", m_size, nNewSize);
|
||||
|
||||
if ( m_allocatedSize < nNewSize )
|
||||
{
|
||||
nNewSize += nGrowBy;
|
||||
if ( m_allocatedSize == 0 ) m_data = (T*)malloc( (nNewSize+1)*sizeof(T) );
|
||||
else m_data = (T*)realloc(m_data, (nNewSize+1)*sizeof(T), (m_allocatedSize+1)*sizeof(T));
|
||||
if ( !m_data ) {
|
||||
DebugLog(2, "XStringAbstract<T>::CheckSize(%zu, %zu) : realloc(%" PRIuPTR ", %lu, %zd) returned NULL. System halted\n", nNewSize, nGrowBy, uintptr_t(m_data), nNewSize*sizeof(T), m_allocatedSize*sizeof(T));
|
||||
panic();
|
||||
}
|
||||
m_allocatedSize = nNewSize;
|
||||
m_data[m_allocatedSize] = 0; // we allocated one more char (nNewSize+1). This \0 is an extra precaution. It's not for the normal null terminator. All string operation must considered that only m_allocatedSize bytes were allocated.
|
||||
}
|
||||
return m_data;
|
||||
}
|
||||
// void setSize(size_t newSize) // nNewSize is in number of chars, NOT bytes
|
||||
// {
|
||||
// //DBG_XSTRING("setLength(%d)\n", len);
|
||||
// CheckSize(newSize);
|
||||
// // if ( len >= size() ) {
|
||||
// // DBG_XSTRING("XStringAbstract<T>::setLength(size_t len) : len >= size() (%d != %d). System halted\n", len, size());
|
||||
// // panic();
|
||||
// // }
|
||||
// m_data[newSize] = 0; // we may rewrite a 0 in nullChar, if no memory were allocated. That's ok.
|
||||
// }
|
||||
|
||||
|
||||
// T* memoryOffset(size_t i) {
|
||||
//
|
||||
// }
|
||||
|
||||
public:
|
||||
XStringAbstract()
|
||||
{
|
||||
DBG_XSTRING("Construteur\n");
|
||||
Init(0);
|
||||
}
|
||||
|
||||
~XStringAbstract()
|
||||
{
|
||||
//DBG_XSTRING("Destructor :%ls\n", data());
|
||||
if ( m_allocatedSize > 0 ) free((void*)m_data);
|
||||
}
|
||||
|
||||
template<typename IntegralType, enable_if(is_integral(IntegralType))>
|
||||
T* data(IntegralType pos) const { return _data(pos); }
|
||||
|
||||
// template<typename IntegralType, typename XStringAbstract__enable_if<XStringAbstract__is_integral<IntegralType>::value, IntegralType>::type* = nullptr>
|
||||
template<typename IntegralType, enable_if(is_integral(IntegralType))>
|
||||
T* dataSized(IntegralType size) const
|
||||
{
|
||||
if ( size<0 ) panic("T* dataSized(xisize i, size_t sizeMin, size_t nGrowBy) -> i < 0");
|
||||
CheckSize((typename XStringAbstract__make_unsigned<IntegralType>::type)size);
|
||||
return s();
|
||||
}
|
||||
|
||||
// Pos is counted in logical char but size is counted in physical char (char, char16_t, char32_t or wchar_t)
|
||||
template<typename IntegralType1, typename IntegralType2, enable_if(is_integral(IntegralType1) && is_integral(IntegralType2))>
|
||||
T* dataSized(IntegralType1 pos, IntegralType2 size)
|
||||
{
|
||||
if ( pos<0 ) panic("T* dataSized(xisize i, size_t sizeMin, size_t nGrowBy) -> i < 0");
|
||||
if ( size<0 ) panic("T* dataSized(xisize i, size_t sizeMin, size_t nGrowBy) -> i < 0");
|
||||
size_t offset = size_of_utf_string_len(m_data, (typename XStringAbstract__make_unsigned<IntegralType1>::type)pos); // If pos is too big, size_of_utf_string_len returns the end of the string
|
||||
CheckSize(offset + (typename XStringAbstract__make_unsigned<IntegralType2>::type)size);
|
||||
return _data(pos);
|
||||
}
|
||||
|
||||
// const T* data(unsigned int ui) const { return _data(ui); }
|
||||
// const T* data(int i) const { return _data(i); }
|
||||
// const T* data(size_t ui) const { return _data(ui); }
|
||||
// const T* data(xisize i) const { return _data(i); }
|
||||
//
|
||||
// T* dataSized(unsigned int ui, size_t sizeMin, size_t nGrowBy=16) { CheckSize(ui+sizeMin, nGrowBy); return _data(ui); }
|
||||
// T* dataSized(unsigned long ui, size_t sizeMin, size_t nGrowBy=16) { CheckSize(ui+sizeMin, nGrowBy); return _data(ui); }
|
||||
// T* dataSized(unsigned long long ui, size_t sizeMin, size_t nGrowBy=16) { CheckSize(ui+sizeMin, nGrowBy); return _data(ui); }
|
||||
// T* dataSized(int i, size_t sizeMin, size_t nGrowBy=16) { if ( i<0 ) panic("T* dataSized(xisize i, size_t sizeMin, size_t nGrowBy) -> i < 0"); CheckSize((unsigned int)i+sizeMin, nGrowBy); return _data(i); }
|
||||
// T* dataSized(long i, size_t sizeMin, size_t nGrowBy=16) { if ( i<0 ) panic("T* dataSized(xisize i, size_t sizeMin, size_t nGrowBy) -> i < 0"); CheckSize((unsigned long)i+sizeMin, nGrowBy); return _data(i); }
|
||||
// T* dataSized(long long i, size_t sizeMin, size_t nGrowBy=16) { if ( i<0 ) panic("T* dataSized(xisize i, size_t sizeMin, size_t nGrowBy) -> i < 0"); CheckSize((unsigned long long)i+sizeMin, nGrowBy); return _data(i); }
|
||||
|
||||
T* forgetDataWithoutFreeing()
|
||||
{
|
||||
T* ret = m_data;
|
||||
Init(0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
size_t length() const { return length_of_utf_string(m_data); }
|
||||
// size_t sizeZZ() const { return size_of_utf_string(m_data); }
|
||||
size_t sizeInBytes() const { return size_of_utf_string(m_data)*sizeof(T); }
|
||||
size_t allocatedSize() const { return m_allocatedSize; }
|
||||
|
||||
|
||||
const T* wc_str() const { return m_data; }
|
||||
const T* c_str() const { return m_data; }
|
||||
const T* s() const { return m_data; }
|
||||
const T* data() const { return m_data; } // todo delete
|
||||
|
||||
/* Empty ? */
|
||||
void setEmpty() { m_data[0] = 0; } // we may rewrite a 0 in nullChar if no memory were allocated (m_data == &nullChar). That's ok.
|
||||
bool isEmpty() const { return m_data == nullptr || *m_data == 0; }
|
||||
bool notEmpty() const { return !isEmpty(); }
|
||||
|
||||
|
||||
//--------------------------------------------------------------------- cast
|
||||
|
||||
// int ToInt() const;
|
||||
// size_t ToUInt() const;
|
||||
|
||||
|
||||
//--------------------------------------------------------------------- charAt, []
|
||||
|
||||
template<typename IntegralType, enable_if(is_integral(IntegralType))>
|
||||
char32_t char32At(IntegralType i) const
|
||||
{
|
||||
if (i < 0) {
|
||||
DBG_XSTRING("XStringAbstract<T>::char32At(size_t i) : i < 0. System halted\n");
|
||||
panic();
|
||||
}
|
||||
size_t nb = 0;
|
||||
const T *p = m_data;
|
||||
char32_t char32;
|
||||
do {
|
||||
p = get_char32_from_string(p, &char32);
|
||||
if (!char32) {
|
||||
panic("XStringAbstract::char32At(size_t i) : i >= length(). System halted\n");
|
||||
}
|
||||
nb += 1;
|
||||
} while (nb <= (typename XStringAbstract__make_unsigned<IntegralType>::type)i );
|
||||
return char32;
|
||||
}
|
||||
|
||||
template<typename IntegralType, enable_if(is_integral(IntegralType))>
|
||||
char16_t char16At(IntegralType i) const
|
||||
{
|
||||
char32_t char32 = char32At(i);
|
||||
if ( char32 >= 0x10000 ) return 0xFFFD; // <20> REPLACEMENT CHARACTER used to replace an unknown, unrecognized or unrepresentable character
|
||||
return (char16_t)char32;
|
||||
}
|
||||
|
||||
/* [] */
|
||||
template<typename IntegralType, enable_if(is_integral(IntegralType))>
|
||||
char32_t operator [](IntegralType i) const { return char32At(i); }
|
||||
|
||||
|
||||
char32_t LastChar() const { if ( length() > 0 ) return char32At(length()-1); else return 0; }
|
||||
|
||||
//--------------------------------------------------------------------- strcat, strcpy, operator =
|
||||
/* strncpy */
|
||||
template<typename O>
|
||||
void strncpy(const O* other, size_t other_len)
|
||||
{
|
||||
if ( other && *other && other_len > 0 ) {
|
||||
size_t newSize = utf_size_of_utf_string_len(m_data, other, other_len);
|
||||
CheckSize(newSize+1, 0);
|
||||
utf_string_from_utf_string_len(m_data, m_allocatedSize, other, other_len);
|
||||
m_data[newSize] = 0;
|
||||
}else{
|
||||
setEmpty();
|
||||
}
|
||||
}
|
||||
// Old name. TODO remove
|
||||
template<typename O>
|
||||
void StrnCpy(const O* other, size_t other_len) { strncpy(other, other_len); }
|
||||
|
||||
/* strcpy */
|
||||
template<typename O>
|
||||
void strcpy(const O* other)
|
||||
{
|
||||
if ( other && *other ) {
|
||||
size_t newSize = utf_size_of_utf_string(m_data, other);
|
||||
CheckSize(newSize+1, 0);
|
||||
utf_string_from_utf_string(m_data, m_allocatedSize, other);
|
||||
m_data[newSize] = 0;
|
||||
}else{
|
||||
setEmpty();
|
||||
}
|
||||
}
|
||||
/* strncat */
|
||||
template<typename O>
|
||||
void strncat(const O* other, size_t other_len)
|
||||
{
|
||||
if ( other && *other && other_len > 0 ) {
|
||||
size_t currentSize = size_of_utf_string(m_data);
|
||||
size_t newSize = currentSize + utf_size_of_utf_string_len(m_data, other, other_len);
|
||||
CheckSize(newSize+1, 0);
|
||||
utf_string_from_utf_string_len(m_data+currentSize, m_allocatedSize, other, other_len);
|
||||
m_data[newSize] = 0;
|
||||
}else{
|
||||
// nothing to do
|
||||
}
|
||||
}
|
||||
/* strcat */
|
||||
template<typename O>
|
||||
void strcat(const O* other)
|
||||
{
|
||||
if ( other && *other ) {
|
||||
size_t currentSize = size_of_utf_string(m_data); // size is number of T, not in bytes
|
||||
size_t newSize = currentSize + utf_size_of_utf_string(m_data, other); // size is number of T, not in bytes
|
||||
CheckSize(newSize+1, 0);
|
||||
utf_string_from_utf_string(m_data+currentSize, m_allocatedSize-currentSize, other);
|
||||
m_data[newSize] = 0;
|
||||
}else{
|
||||
// nothing to do
|
||||
}
|
||||
}
|
||||
/* takeValueFrom */
|
||||
template<typename O, class OtherXStringClass>
|
||||
ThisXStringClass& takeValueFrom(const XStringAbstract<O, OtherXStringClass>& S) { strcpy(S.s()); return *((ThisXStringClass*)this); }
|
||||
template<typename O>
|
||||
ThisXStringClass& takeValueFrom(const O* S) { strcpy(S); return *((ThisXStringClass*)this); }
|
||||
template<typename O, class OtherXStringClass>
|
||||
ThisXStringClass& takeValueFrom(const XStringAbstract<O, OtherXStringClass>& S, size_t len) { strncpy(S.data(0), len); return *((ThisXStringClass*)this); }
|
||||
template<typename O>
|
||||
ThisXStringClass& takeValueFrom(const O* S, size_t len) { strncpy(S, len); return *((ThisXStringClass*)this); }
|
||||
|
||||
/* copy ctor */
|
||||
XStringAbstract<T, ThisXStringClass>(const XStringAbstract<T, ThisXStringClass> &S) { Init(0); takeValueFrom(S); }
|
||||
/* ctor */
|
||||
template<typename O, class OtherXStringClass>
|
||||
explicit XStringAbstract<T, ThisXStringClass>(const XStringAbstract<O, OtherXStringClass>& S) { Init(0); takeValueFrom(S); }
|
||||
template<typename O>
|
||||
explicit XStringAbstract<T, ThisXStringClass>(const O* S) { Init(0); takeValueFrom(S); }
|
||||
|
||||
/* Copy Assign */ // Only other XString, no litteral at the moment.
|
||||
XStringAbstract<T, ThisXStringClass>& operator =(const XStringAbstract<T, ThisXStringClass>& S) { strcpy(S.s()); return *this; }
|
||||
/* Assign */
|
||||
template<typename O, class OtherXStringClass>
|
||||
ThisXStringClass& operator =(const XStringAbstract<O, OtherXStringClass>& S) { strcpy(S.s()); return *((ThisXStringClass*)this); }
|
||||
template<class O>
|
||||
ThisXStringClass& operator =(const O* S) { strcpy(S); return *this; }
|
||||
|
||||
/* += */
|
||||
template<typename O, class OtherXStringClass>
|
||||
ThisXStringClass& operator += (const XStringAbstract<O, OtherXStringClass>& S) { strcat(S.s()); return *((ThisXStringClass*)this); }
|
||||
template<typename O>
|
||||
ThisXStringClass& operator += (const O* S) { strcat(S); return *((ThisXStringClass*)this); }
|
||||
|
||||
// + operator
|
||||
// template<typename XStringClass, class OtherXStringClass>
|
||||
// friend ThisXStringClass operator + (const XStringClass& p1, const XStringAbstract<O, OtherXStringClass>& p2) { XStringAbstract s; s=p1; s+=p2; return s; }
|
||||
// template<typename O, enable_if(is_char(O))>
|
||||
// friend ThisXStringClass operator + (const XStringAbstract<T, ThisXStringClass>& p1, const O* p2 ) { XStringAbstract s; s=p1; s+=p2; return s; }
|
||||
// template<typename O, class OtherXStringClass, enable_if(is_char(O))>
|
||||
// friend ThisXStringClass operator + (const O *p1, const XStringAbstract<T, ThisXStringClass>& p2) { XStringAbstract s; s.strcat(p1); s.strcat(p2.s()); return s; }
|
||||
|
||||
template<typename O, class OtherXStringClass>
|
||||
ThisXStringClass operator + (const XStringAbstract<O, OtherXStringClass>& p2) const { XStringAbstract s; s=*this; s+=p2; return s; }
|
||||
template<typename O>
|
||||
ThisXStringClass operator + (const O* p2) const { XStringAbstract s; s=*this; s+=p2; return s; }
|
||||
template<typename O>
|
||||
friend ThisXStringClass operator + (const O *p1, const ThisXStringClass& p2) { XStringAbstract s; s.strcat(p1); s.strcat(p2.s()); return s; }
|
||||
|
||||
|
||||
//--------------------------------------------------------------------- indexOf, rindexOf
|
||||
|
||||
/* indexOf */
|
||||
size_t indexOf(char32_t char32Searched, size_t Pos = 0) const
|
||||
{
|
||||
char32_t buf[2] = { char32Searched, 0};
|
||||
return XStringAbstract__indexOf(m_data, Pos, buf, false);
|
||||
}
|
||||
template<typename O>
|
||||
size_t indexOf(const O* S, size_t Pos = 0) const { return XStringAbstract__indexOf(m_data, Pos, S, false); }
|
||||
template<typename O, class OtherXStringClass>
|
||||
size_t indexOf(const XStringAbstract<O, OtherXStringClass>& S, size_t Pos = 0) const { return indexOf(S.s(), Pos); }
|
||||
// old name : todo remove
|
||||
size_t IdxOf(char c, size_t Pos = 0) const { return indexOf((char32_t)c, Pos); }
|
||||
template<typename O, class OtherXStringClass>
|
||||
size_t IdxOf(const XStringAbstract<O, OtherXStringClass>& S, size_t Pos = 0) const { return indexOf(S, Pos); }
|
||||
/* IC */
|
||||
size_t indexOfIC(char32_t char32Searched, size_t Pos = 0) const
|
||||
{
|
||||
char32_t buf[2] = { char32Searched, 0};
|
||||
return XStringAbstract__indexOf(m_data, Pos, buf, true);
|
||||
}
|
||||
template<typename O>
|
||||
size_t indexOfIC(const O* S, size_t Pos = 0) const { return XStringAbstract__indexOf(m_data, Pos, S, true); }
|
||||
template<typename O, class OtherXStringClass>
|
||||
size_t indexOfIC(const XStringAbstract<O, OtherXStringClass>& S, size_t Pos = 0) const { return indexOfIC(S.s(), Pos); }
|
||||
|
||||
|
||||
/* rindexOf */
|
||||
size_t rindexOf(const char32_t char32Searched, size_t Pos = MAX_XSIZE-1) const
|
||||
{
|
||||
char32_t buf[2] = { char32Searched, 0};
|
||||
return XStringAbstract__rindexOf(m_data, Pos, buf, false);
|
||||
}
|
||||
template<typename O>
|
||||
size_t rindexOf(const O* S, size_t Pos = MAX_XSIZE-1) const { return XStringAbstract__rindexOf(m_data, Pos, S, false); }
|
||||
template<typename O, class OtherXStringClass>
|
||||
size_t rindexOf(const XStringAbstract<O, OtherXStringClass>& S, size_t Pos = MAX_XSIZE-1) const { return rindexOf(S.s(), Pos); }
|
||||
/* IC */
|
||||
size_t rindexOfIC(const char32_t char32Searched, size_t Pos = MAX_XSIZE-1) const
|
||||
{
|
||||
char32_t buf[2] = { char32Searched, 0};
|
||||
return XStringAbstract__rindexOf(m_data, Pos, buf, true);
|
||||
}
|
||||
template<typename O>
|
||||
size_t rindexOfIC(const O* S, size_t Pos = MAX_XSIZE-1) const { return XStringAbstract__rindexOf(m_data, Pos, S, true); }
|
||||
template<typename O, class OtherXStringClass>
|
||||
size_t rindexOfIC(const XStringAbstract<O, OtherXStringClass>& S, size_t Pos = MAX_XSIZE-1) const { return rindexOf(S.s(), Pos); }
|
||||
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
XStringAbstract<T, ThisXStringClass> lowerAscii()
|
||||
{
|
||||
T* s = m_data;
|
||||
while ( *s ) {
|
||||
*s = asciiToLower(*s);
|
||||
s++;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
// void deleteCountCharsAt(size_t pos, size_t count=1);
|
||||
//{
|
||||
// if ( pos < size() ) {
|
||||
// if ( count != MAX_XSIZE && pos + count < size() ) {
|
||||
// memmove( _data(pos), data(pos+count), (size()-pos-count)*sizeof(T)); // memmove handles overlapping memory move
|
||||
// setLength(size()-count);/* data()[length()-count]=0 done in setLength */
|
||||
// }else{
|
||||
// setSize(pos);/* data()[pos]=0 done in setLength */
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
// void insert(const XStringAbstract<T, ThisXStringClass>& Str, size_t pos);
|
||||
//{
|
||||
// if ( pos < size() ) {
|
||||
// CheckSize(size()+Str.size());
|
||||
// memmove(_data(pos + Str.size()), data(pos), (size()-pos)*sizeof(T));
|
||||
// memmove(_data(pos), Str.data(), Str.size()*sizeof(T));
|
||||
// setLength(size()+Str.size());
|
||||
// }else{
|
||||
// StrCat(Str);
|
||||
// }
|
||||
//}
|
||||
|
||||
XStringAbstract SubString(size_t pos, size_t count) const
|
||||
{
|
||||
if ( count > length()-pos ) count = length()-pos;
|
||||
XStringAbstract ret;
|
||||
|
||||
const T* src = m_data;
|
||||
char32_t char32 = 1;
|
||||
while ( char32 && pos > 0 ) {
|
||||
src = get_char32_from_string(src, &char32);
|
||||
pos -= 1;
|
||||
};
|
||||
ret.strncat(src, count);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// todo rename to contains
|
||||
template<typename O, class OtherXStringClass>
|
||||
bool ExistIn(const XStringAbstract<O, OtherXStringClass>& S) const { return indexOf(S) != MAX_XSIZE; }
|
||||
template<typename O>
|
||||
bool ExistIn(const O* S) const { return indexOf(S) != MAX_XSIZE; }
|
||||
template<typename O, class OtherXStringClass>
|
||||
size_t ExistInIC(const XStringAbstract<O, OtherXStringClass>& S) const { return indexOfIC(S) != MAX_XSIZE; }
|
||||
template<typename O>
|
||||
size_t ExistInIC(const O* S) const { return indexOfIC(S) != MAX_XSIZE; }
|
||||
|
||||
|
||||
// void ToLower(bool FirstCharIsCap = false);
|
||||
// bool IsLetters() const;
|
||||
// bool IsLettersNoAccent() const;
|
||||
// bool IsDigits() const;
|
||||
//{
|
||||
// const T *p;
|
||||
//
|
||||
// p = data();
|
||||
// if ( !*p ) return false;
|
||||
// for ( ; *p ; p+=1 ) {
|
||||
// if ( *p < '0' ) return false;
|
||||
// if ( *p > '9' ) return false;
|
||||
// }
|
||||
// return true;
|
||||
//}
|
||||
// bool IsDigits(size_t pos, size_t count) const;
|
||||
//{
|
||||
// const T *p;
|
||||
// const T *q;
|
||||
//
|
||||
// if ( pos >= size() ) {
|
||||
// return false;
|
||||
// }
|
||||
// if ( pos+count > size() ) {
|
||||
// return false;
|
||||
// }
|
||||
// p = data() + pos;
|
||||
// q = p + count;
|
||||
// for ( ; p < q ; p+=1 ) {
|
||||
// if ( *p < '0' ) return false;
|
||||
// if ( *p > '9' ) return false;
|
||||
// }
|
||||
// return true;
|
||||
//}
|
||||
|
||||
// void Replace(T c1, T c2)
|
||||
// {
|
||||
// T* p;
|
||||
//
|
||||
// p = s();
|
||||
// while ( *p ) {
|
||||
// if ( *p == c1 ) *p = c2;
|
||||
// p += 1;
|
||||
// }
|
||||
// }
|
||||
// XStringAbstract SubStringReplace(T c1, T c2);
|
||||
//{
|
||||
// T* p;
|
||||
// XStringAbstract Result;
|
||||
//
|
||||
// p = s();
|
||||
// while ( *p ) {
|
||||
// if ( *p == c1 ) Result += c2;
|
||||
// else Result += *p;
|
||||
// p++;
|
||||
// }
|
||||
// return Result;
|
||||
//}
|
||||
//
|
||||
// SubType basename() const
|
||||
// {
|
||||
// size_t idx = RIdxOf(LPATH_SEPARATOR);
|
||||
// if ( idx == MAX_XSIZE ) return SubType();
|
||||
// return SubString(idx+1, size()-idx-1);
|
||||
// }
|
||||
// SubType dirname() const
|
||||
// {
|
||||
// size_t idx = RIdxOf(LPATH_SEPARATOR);
|
||||
// if ( idx == MAX_XSIZE ) return SubType();
|
||||
// return SubString(0, idx);
|
||||
// }
|
||||
// void RemoveLastEspCtrl();
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
template<typename O>
|
||||
int strcmp(const O* S) const { return XStringAbstract__compare(m_data, S, false); }
|
||||
// int Compare(const char* S) const { return ::Compare<T, char>(m_data, S); }
|
||||
// int Compare(const char16_t* S) const { return ::Compare<T, char16_t>(m_data, S); };
|
||||
// int Compare(const char32_t* S) const { return ::Compare<T, char32_t>(m_data, S); };
|
||||
// int Compare(const wchar_t* S) const { return ::Compare<T, wchar_t>(m_data, S); };
|
||||
//
|
||||
template<typename O, class OtherXStringClass>
|
||||
bool Equal(const O* S) const { return XStringAbstract__compare(m_data, S, false); }
|
||||
template<typename O, class OtherXStringClass>
|
||||
bool EqualIC(const XStringAbstract<O, OtherXStringClass>& S) const { return XStringAbstract__compare(m_data, S.s(), true); }
|
||||
template<typename O>
|
||||
bool EqualIC(const O* S) const { return XStringAbstract__compare(m_data, S, true); }
|
||||
// bool BeginingEqual(const T* S) const { return (memcmp(data(), S, wcslen(S)) == 0); }
|
||||
// bool SubStringEqual(size_t Pos, const T* S) const { return (memcmp(data(Pos), S, wcslen(S)) == 0); }
|
||||
|
||||
public:
|
||||
// == operator
|
||||
template<typename O, class OtherXStringClass>
|
||||
bool operator == (const XStringAbstract<O, OtherXStringClass>& s2) const { return (*this).strcmp(s2.s()) == 0; }
|
||||
template<typename O>
|
||||
bool operator == (const O* s2) const { return (*this).strcmp(s2) == 0; }
|
||||
template<typename O>
|
||||
friend bool operator == (const O* s1, ThisXStringClass& s2) { return s2.strcmp(s1) == 0; }
|
||||
|
||||
template<typename O, class OtherXStringClass>
|
||||
bool operator != (const XStringAbstract<O, OtherXStringClass>& s2) const { return !(*this == s2); }
|
||||
template<typename O>
|
||||
bool operator != (const O* s2) const { return !(*this == s2); }
|
||||
template<typename O>
|
||||
friend bool operator != (const O* s1, const ThisXStringClass& s2) { return s2.strcmp(s1) != 0; }
|
||||
|
||||
template<typename O, class OtherXStringClass>
|
||||
bool operator < (const XStringAbstract<O, OtherXStringClass>& s2) const { return (*this).strcmp(s2.s()) < 0; }
|
||||
template<typename O>
|
||||
bool operator < (const O* s2) const { return (*this).strcmp(s2) < 0; }
|
||||
template<typename O>
|
||||
friend bool operator < (const O* s1, const ThisXStringClass& s2) { return s2.strcmp(s1) > 0; }
|
||||
|
||||
template<typename O, class OtherXStringClass>
|
||||
bool operator > (const XStringAbstract<O, OtherXStringClass>& s2) const { return (*this).strcmp(s2.s()) > 0; }
|
||||
template<typename O>
|
||||
bool operator > (const O* s2) const { return (*this).strcmp(s2) > 0; }
|
||||
template<typename O>
|
||||
friend bool operator > (const O* s1, const ThisXStringClass& s2) { return s2.strcmp(s1) < 0; }
|
||||
|
||||
template<typename O, class OtherXStringClass>
|
||||
bool operator <= (const XStringAbstract<O, OtherXStringClass>& s2) const { return (*this).strcmp(s2.s()) <= 0; }
|
||||
template<typename O>
|
||||
bool operator <= (const O* s2) const { return (*this).strcmp(s2) <= 0; }
|
||||
template<typename O>
|
||||
friend bool operator <= (const O* s1, const ThisXStringClass& s2) { return s2.strcmp(s1) >= 0; }
|
||||
|
||||
template<typename O, class OtherXStringClass>
|
||||
bool operator >= (const XStringAbstract<O, OtherXStringClass>& s2) const { return (*this).strcmp(s2.s()) >= 0; }
|
||||
template<typename O>
|
||||
bool operator >= (const O* s2) const { return (*this).strcmp(s2) >= 0; }
|
||||
template<typename O>
|
||||
friend bool operator >= (const O* s1, const ThisXStringClass& s2) { return s2.strcmp(s1) <= 0; }
|
||||
|
||||
};
|
||||
|
||||
|
||||
template<class T, class ThisXStringClass>
|
||||
T XStringAbstract<T, ThisXStringClass>::nullChar = 0;
|
||||
|
||||
|
||||
|
||||
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
// Constructor
|
||||
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
|
||||
|
||||
//
|
||||
//template<class T, class SubType, size_t growBy>
|
||||
//XStringAbstract<T>::XStringAbstract(const XStringAbstract &aString)
|
||||
//{
|
||||
//DBG_XSTRING("Constructor(const XStringAbstract &aString) : %ls\n", aString.data());
|
||||
// Init(aString.size());
|
||||
// memcpy(m_data, aString.m_data, aString.sizeInBytes());
|
||||
//}
|
||||
|
||||
|
||||
//
|
||||
//template<class T, class SubType, size_t growBy>
|
||||
//void XStringAbstract<T>::RemoveLastEspCtrl()
|
||||
//{
|
||||
// T *p;
|
||||
//
|
||||
// if ( size() > 0 ) {
|
||||
// p = s() + size() - 1;
|
||||
// #if __WCHAR_MIN__ < 0
|
||||
// if ( *p >= 0 && *p <= ' ' ) {
|
||||
// #else
|
||||
// if ( *p <= ' ' ) {
|
||||
// #endif
|
||||
// p -= 1;
|
||||
// #if __WCHAR_MIN__ < 0
|
||||
// while ( p>data() && *p >= 0 && *p <= ' ' ) p -= 1;
|
||||
// #else
|
||||
// while ( p>data() && *p <= ' ' ) p -= 1;
|
||||
// #endif
|
||||
// if ( p>data() ) {
|
||||
// setSize( (size_t)(p-data())+1);
|
||||
// }else{
|
||||
// #if __WCHAR_MIN__ < 0
|
||||
// if ( *p >= 0 && *p <= ' ' ) setSize(0);
|
||||
// #else
|
||||
// if ( *p <= ' ' ) setSize(0);
|
||||
// #endif
|
||||
// else setSize(1);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Functions
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//XStringAbstract operator"" _XSW ( const T* s, size_t len)
|
||||
//{
|
||||
// XStringAbstract returnValue;
|
||||
// if ( len > MAX_XSIZE ) len = MAX_XSIZE;
|
||||
// returnValue.takeValueFrom(s, len);
|
||||
// return returnValue; // don't do "return returnValue.takeValueFrom(s, len)" because it break the return value optimization.
|
||||
//}
|
||||
//
|
||||
//XStringAbstract SWPrintf(const char* format, ...)
|
||||
//{
|
||||
// va_list va;
|
||||
// XStringAbstract str;
|
||||
//
|
||||
// va_start (va, format);
|
||||
// str.vSWPrintf(format, va);
|
||||
// va_end(va);
|
||||
//
|
||||
// return str;
|
||||
//}
|
||||
//
|
||||
//XStringAbstract SubString(const T *S, size_t pos, size_t count)
|
||||
//{
|
||||
// if ( wcslen(S)-pos < count ) count = wcslen(S)-pos;
|
||||
// XStringAbstract ret;
|
||||
// ret.StrnCpy(S+pos, count);
|
||||
//// return ( XStringAbstract(S+pos, count) );
|
||||
// return ret;
|
||||
//}
|
||||
//
|
||||
//
|
||||
//XStringAbstract CleanCtrl(const XStringAbstract &S)
|
||||
//{
|
||||
// XStringAbstract ReturnValue;
|
||||
// size_t i;
|
||||
//
|
||||
// for ( i=0 ; i<S.size() ; i+=1 ) {
|
||||
//#if __WCHAR_MIN__ < 0
|
||||
// if ( S.wc_str()[i] >=0 && S.wc_str()[i] < ' ' ) ReturnValue += 'x'; /* T are signed */
|
||||
//#else
|
||||
// if ( S.wc_str()[i] < ' ' ) ReturnValue += 'x'; /* T are unsigned */
|
||||
//#endif
|
||||
// else ReturnValue += S.wc_str()[i];
|
||||
// }
|
||||
// return ReturnValue;
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#undef DBG_XSTRING
|
||||
#undef is_integral
|
||||
//#undef enable_if
|
||||
#undef asciiToLower
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
//extern const XStringAbstract NullXStringAbstract;
|
||||
//
|
||||
//XStringAbstract operator"" _XSW ( const T* s, size_t len);
|
||||
//
|
||||
//XStringAbstract SWPrintf(const char* format, ...) __attribute__((__format__(__printf__, 1, 2)));
|
||||
//XStringAbstract SubString(const T *S, size_t pos, size_t count);
|
||||
//XStringAbstract CleanCtrl(const XStringAbstract &S);
|
||||
|
||||
|
||||
|
||||
#endif // __XSTRINGABSTRACT_H__
|
@ -129,11 +129,11 @@ XStringArray Split(const XString &S, const XString &Separator)
|
||||
idxB = 0;
|
||||
idxE = S.IdxOf(Separator, idxB);
|
||||
while ( idxE != MAX_XSIZE ) {
|
||||
Ss.AddCopy(SubString(S, idxB, idxE-idxB));
|
||||
Ss.AddCopy(S.SubString(idxB, idxE-idxB));
|
||||
idxB = idxE + Separator.length();
|
||||
idxE = S.IdxOf(Separator, idxB);
|
||||
}
|
||||
if ( idxB < S.length() ) Ss.AddCopy(SubString(S, idxB, S.length()-idxB));
|
||||
if ( idxB < S.length() ) Ss.AddCopy(S.SubString(idxB, S.length()-idxB));
|
||||
return Ss;
|
||||
}
|
||||
|
||||
|
@ -1,625 +0,0 @@
|
||||
//*************************************************************************************************
|
||||
//*************************************************************************************************
|
||||
//
|
||||
// STRING
|
||||
//
|
||||
// Developed by jief666, from 1997.
|
||||
//
|
||||
//*************************************************************************************************
|
||||
//*************************************************************************************************
|
||||
|
||||
|
||||
#if !defined(__XStringW_CPP__)
|
||||
#define __XStringW_CPP__
|
||||
|
||||
#if 0
|
||||
#define DBG(...) DebugLog(2, __VA_ARGS__)
|
||||
#else
|
||||
#define DBG(...)
|
||||
#endif
|
||||
|
||||
#include "XToolsCommon.h"
|
||||
#include "XStringW.h"
|
||||
|
||||
#include "../../Include/Library/printf_lite.h"
|
||||
|
||||
UINTN XStringWGrowByDefault = 1024;
|
||||
const XStringW NullXStringW;
|
||||
|
||||
|
||||
void XStringW::Init(UINTN aSize)
|
||||
{
|
||||
//DBG("Init aSize=%d\n", aSize);
|
||||
m_data = (wchar_t*)malloc( (aSize+1)*sizeof(wchar_t) ); /* le 0 terminal n'est pas compté dans mSize */
|
||||
if ( !m_data ) {
|
||||
DebugLog(2, "XStringW::Init(%llu) : Xalloc returned NULL. Cpu halted\n", (aSize+1)*sizeof(wchar_t));
|
||||
panic();
|
||||
}
|
||||
m_allocatedSize = aSize;
|
||||
m_len = 0;
|
||||
m_data[0] = 0;
|
||||
}
|
||||
|
||||
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
// Constructor
|
||||
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
|
||||
XStringW::XStringW()
|
||||
{
|
||||
DBG("Construteur\n");
|
||||
Init();
|
||||
}
|
||||
|
||||
XStringW::XStringW(const XStringW &aString)
|
||||
{
|
||||
DBG("Constructor(const XStringW &aString) : %ls\n", aString.data());
|
||||
Init(aString.size());
|
||||
StrnCpy(aString.data(), aString.size());
|
||||
}
|
||||
//
|
||||
//XStringW::XStringW(const wchar_t *S)
|
||||
//{
|
||||
// if ( !S ) {
|
||||
// DebugLog(2, "XStringW(const wchar_t *S) called with NULL. Use setEmpty()\n");
|
||||
// panic();
|
||||
// }
|
||||
//DBG("Constructor(const wchar_t *S) : %ls, StrLen(S)=%d\n", S, StrLen(S));
|
||||
// Init(StrLen(S));
|
||||
// StrCpy(S);
|
||||
//}
|
||||
//
|
||||
//XStringW::XStringW(const wchar_t *S, UINTN count)
|
||||
//{
|
||||
//DBG("Constructor(const wchar_t *S, UINTN count) : %ls, %d\n", S, count);
|
||||
// Init(count);
|
||||
// StrnCpy(S, count);
|
||||
//}
|
||||
//
|
||||
//XStringW::XStringW(const wchar_t aChar)
|
||||
//{
|
||||
//DBG("Constructor(const wchar_t aChar)\n");
|
||||
// Init(1);
|
||||
// StrnCpy(&aChar, 1);
|
||||
//}
|
||||
//
|
||||
//XStringW::XStringW(const char* S)
|
||||
//{
|
||||
//DBG("Constructor(const char* S)\n");
|
||||
// xsize newLen = StrLenInWChar(S, strlen(S));
|
||||
// Init(newLen);
|
||||
// utf8ToWChar(m_data, m_allocatedSize+1, S, strlen(S)); // m_size doesn't count the NULL terminator
|
||||
// SetLength(newLen);
|
||||
//}
|
||||
wchar_t * XStringW::forgetDataWithoutFreeing()
|
||||
{
|
||||
wchar_t* ret = m_data;
|
||||
Init();
|
||||
return ret;
|
||||
}
|
||||
|
||||
XStringW& XStringW::takeValueFrom(const wchar_t* S, xsize count)
|
||||
{
|
||||
if ( !S ) {
|
||||
// DebugLog(2, "takeValueFrom(const wchar_t* S) called with NULL. Use setEmpty()\n");
|
||||
// panic();
|
||||
Init(0);
|
||||
return *this;
|
||||
}
|
||||
Init(count);
|
||||
StrCpy(S);
|
||||
return *this;
|
||||
}
|
||||
|
||||
XStringW& XStringW::takeValueFrom(const wchar_t* S)
|
||||
{
|
||||
if ( S ) return takeValueFrom(S, wcslen(S));
|
||||
Init(0);
|
||||
return *this;
|
||||
}
|
||||
|
||||
XStringW& XStringW::takeValueFrom(const char* S)
|
||||
{
|
||||
xsize newLen = utf_size_of_utf_string(m_data, S);
|
||||
Init(newLen);
|
||||
wchar_string_from_utf8_string(m_data, m_allocatedSize+1, S); // m_size doesn't count the NULL terminator
|
||||
SetLength(newLen);
|
||||
return *this;
|
||||
}
|
||||
|
||||
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
// Destructor
|
||||
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
|
||||
|
||||
XStringW::~XStringW()
|
||||
{
|
||||
DBG("Destructor :%ls\n", data());
|
||||
free((void*)m_data);
|
||||
}
|
||||
|
||||
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
//
|
||||
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
|
||||
void XStringW::SetLength(UINTN len)
|
||||
{
|
||||
//DBG("SetLength(%d)\n", len);
|
||||
CheckSize(len);
|
||||
|
||||
m_len = len;
|
||||
m_data[len] = 0;
|
||||
|
||||
if ( wcslen(data()) != len ) {
|
||||
DBG("XStringW::SetLength(UINTN len) : StrLen(data()) != len (%d != %d). System halted\n", StrLen(data()), len);
|
||||
panic();
|
||||
}
|
||||
}
|
||||
|
||||
/* CheckSize() */
|
||||
wchar_t *XStringW::CheckSize(UINTN nNewSize, UINTN nGrowBy)
|
||||
{
|
||||
//DBG("CheckSize: m_size=%d, nNewSize=%d\n", m_size, nNewSize);
|
||||
|
||||
if ( m_allocatedSize < nNewSize )
|
||||
{
|
||||
nNewSize += nGrowBy;
|
||||
m_data = (wchar_t*)realloc(m_data, (nNewSize+1)*sizeof(wchar_t), m_allocatedSize*sizeof(wchar_t));
|
||||
if ( !m_data ) {
|
||||
DBG("XStringW::CheckSize(%d, %d) : Xrealloc(%d, %d, %d) returned NULL. System halted\n", nNewSize, nGrowBy, m_size, (nNewSize+1)*sizeof(wchar_t), m_data);
|
||||
panic();
|
||||
}
|
||||
m_allocatedSize = nNewSize;
|
||||
}
|
||||
return m_data;
|
||||
}
|
||||
|
||||
void XStringW::StrnCpy(const wchar_t *buf, UINTN len)
|
||||
{
|
||||
UINTN newLen = 0;
|
||||
if ( buf && *buf && len > 0 ) {
|
||||
CheckSize(len, 0);
|
||||
while ( *buf && newLen < len ) {
|
||||
m_data[newLen++] = *buf++;
|
||||
}
|
||||
// memmove(data(), buf, len*sizeof(wchar_t));
|
||||
}
|
||||
SetLength(newLen); /* data()[len]=0 done in SetLength */
|
||||
}
|
||||
|
||||
void XStringW::StrCpy(const wchar_t *buf)
|
||||
{
|
||||
if ( buf && *buf ) {
|
||||
StrnCpy(buf, wcslen(buf));
|
||||
}else{
|
||||
SetLength(0); /* data()[0]=0 done in SetLength */
|
||||
}
|
||||
}
|
||||
|
||||
void XStringW::StrnCat(const wchar_t *buf, UINTN len)
|
||||
{
|
||||
UINTN NewLen;
|
||||
|
||||
if ( buf && *buf && len > 0 ) {
|
||||
NewLen = size()+len;
|
||||
CheckSize(NewLen, 0);
|
||||
memmove(_data(size()), buf, len*sizeof(wchar_t));
|
||||
SetLength(NewLen); /* data()[NewLen]=0 done in SetLength */
|
||||
}
|
||||
}
|
||||
|
||||
void XStringW::StrCat(const wchar_t *buf)
|
||||
{
|
||||
if ( buf && *buf ) {
|
||||
StrnCat(buf, wcslen(buf));
|
||||
}
|
||||
}
|
||||
|
||||
void XStringW::StrCat(const XStringW &uneXStringWW)
|
||||
{
|
||||
StrnCat(uneXStringWW.data(), uneXStringWW.size());
|
||||
}
|
||||
|
||||
void XStringW::Delete(UINTN pos, UINTN count)
|
||||
{
|
||||
if ( pos < size() ) {
|
||||
if ( count != MAX_XSIZE && pos + count < size() ) {
|
||||
memmove( _data(pos), data(pos+count), (size()-pos-count)*sizeof(wchar_t)); // memmove handles overlapping memory move
|
||||
SetLength(size()-count);/* data()[length()-count]=0 done in SetLength */
|
||||
}else{
|
||||
SetLength(pos);/* data()[pos]=0 done in SetLength */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void XStringW::Insert(UINTN pos, const XStringW& Str)
|
||||
{
|
||||
if ( pos < size() ) {
|
||||
CheckSize(size()+Str.size());
|
||||
memmove(_data(pos + Str.size()), data(pos), (size()-pos)*sizeof(wchar_t));
|
||||
memmove(_data(pos), Str.data(), Str.size()*sizeof(wchar_t));
|
||||
SetLength(size()+Str.size());
|
||||
}else{
|
||||
StrCat(Str);
|
||||
}
|
||||
}
|
||||
|
||||
void XStringW::Replace(wchar_t c1, wchar_t c2)
|
||||
{
|
||||
wchar_t* p;
|
||||
|
||||
p = _data(0);
|
||||
while ( *p ) {
|
||||
if ( *p == c1 ) *p = c2;
|
||||
p += 1;
|
||||
}
|
||||
}
|
||||
|
||||
XStringW XStringW::SubStringReplace(wchar_t c1, wchar_t c2)
|
||||
{
|
||||
wchar_t* p;
|
||||
XStringW Result;
|
||||
|
||||
p = _data(0);
|
||||
while ( *p ) {
|
||||
if ( *p == c1 ) Result += c2;
|
||||
else Result += *p;
|
||||
p++;
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
//static XStringW* XStringW_sprintfBuf;
|
||||
|
||||
static void XStringW_transmitSPrintf(const wchar_t* buf, unsigned int nbchar, void* context)
|
||||
{
|
||||
// (*XStringW_sprintfBuf).StrnCat(buf, nbchar);
|
||||
((XStringW*)(context))->StrnCat(buf, nbchar);
|
||||
}
|
||||
|
||||
void XStringW::vSWPrintf(const char* format, va_list va)
|
||||
{
|
||||
SetLength(0);
|
||||
|
||||
// XStringW_sprintfBuf = this;
|
||||
|
||||
vwprintf_with_callback(format, va, XStringW_transmitSPrintf, this);
|
||||
}
|
||||
|
||||
// This is an attempt to use _PPrint from IO.c. Problem is : you have to allocate the memory BEFORE calling it.
|
||||
//void XStringW::vSPrintf(const char* format, va_list va)
|
||||
//{
|
||||
// POOL_PRINT spc;
|
||||
// PRINT_STATE ps;
|
||||
//
|
||||
// ZeroMem(&spc, sizeof (spc));
|
||||
// spc.Str = data();
|
||||
// SetLength(0);
|
||||
// spc.Len = 0;
|
||||
// spc.Maxlen = m_size;
|
||||
// ZeroMem(&ps, sizeof (ps));
|
||||
// ps.Output = (IN EFI_STATUS (EFIAPI *)(VOID *context, CONST CHAR16 *str))_PoolPrint;
|
||||
// ps.Context = (void*)&spc;
|
||||
// ps.fmt.u.pw = format;
|
||||
//
|
||||
// VA_COPY(ps.args, va);
|
||||
// _PPrint (&ps);
|
||||
// va_end(ps.args);
|
||||
//}
|
||||
|
||||
void XStringW::SWPrintf(const char* format, ...)
|
||||
{
|
||||
va_list va;
|
||||
|
||||
va_start (va, format);
|
||||
vSWPrintf(format, va);
|
||||
va_end(va);
|
||||
}
|
||||
|
||||
XStringW XStringW::basename() const
|
||||
{
|
||||
UINTN idx = RIdxOf(LPATH_SEPARATOR);
|
||||
if ( idx == MAX_XSIZE ) return NullXStringW;
|
||||
return SubString(idx+1, size()-idx-1);
|
||||
}
|
||||
|
||||
XStringW XStringW::dirname() const
|
||||
{
|
||||
UINTN idx = RIdxOf(LPATH_SEPARATOR);
|
||||
if ( idx == MAX_XSIZE ) return NullXStringW;
|
||||
return SubString(0, idx);
|
||||
}
|
||||
|
||||
XStringW XStringW::SubString(UINTN pos, UINTN count) const
|
||||
{
|
||||
if ( count > size()-pos ) count = size()-pos;
|
||||
XStringW ret;
|
||||
ret.StrnCat(&(data()[pos]), count);
|
||||
return ret;
|
||||
}
|
||||
|
||||
UINTN XStringW::IdxOf(wchar_t aChar, UINTN Pos) const
|
||||
{
|
||||
UINTN Idx;
|
||||
|
||||
for ( Idx=Pos ; Idx<size() ; Idx+=1 ) {
|
||||
if ( data()[Idx] == aChar ) return Idx;
|
||||
}
|
||||
return MAX_XSIZE;
|
||||
}
|
||||
|
||||
UINTN XStringW::IdxOf(const XStringW &S, UINTN Pos) const
|
||||
{
|
||||
UINTN i;
|
||||
UINTN Idx;
|
||||
|
||||
if ( size() < S.size() ) return MAX_XSIZE;
|
||||
for ( Idx=Pos ; Idx<=size()-S.size() ; Idx+=1 ) {
|
||||
i = 0;
|
||||
while( i<S.size() && ( data()[Idx+i] - S._data(0)[i] ) == 0 ) i += 1;
|
||||
if ( i == S.size() ) return Idx;
|
||||
}
|
||||
return MAX_XSIZE;
|
||||
}
|
||||
|
||||
UINTN XStringW::RIdxOf(const wchar_t charToSearch, UINTN Pos) const
|
||||
{
|
||||
UINTN Idx;
|
||||
|
||||
if ( Pos > size() ) Pos = size();
|
||||
if ( Pos < 1 ) return MAX_XSIZE;
|
||||
for ( Idx=Pos ; Idx-- > 0 ; ) {
|
||||
if ( m_data[Idx] == charToSearch ) return Idx;
|
||||
}
|
||||
return MAX_XSIZE;
|
||||
}
|
||||
|
||||
UINTN XStringW::RIdxOf(const XStringW &S, UINTN Pos) const
|
||||
{
|
||||
UINTN i;
|
||||
UINTN Idx;
|
||||
|
||||
if ( S.size() == 0 ) return MAX_XSIZE;
|
||||
if ( Pos > size() ) Pos = size();
|
||||
if ( Pos < S.size() ) return MAX_XSIZE;
|
||||
Pos -= S.size();
|
||||
for ( Idx=Pos+1 ; Idx-- > 0 ; ) {
|
||||
i = 0;
|
||||
while( i<S.size() && data()[Idx+i] == S._data(0)[i] ) i += 1;
|
||||
if ( i == S.size() ) return Idx;
|
||||
}
|
||||
return MAX_XSIZE;
|
||||
}
|
||||
|
||||
|
||||
bool XStringW::IsDigits() const
|
||||
{
|
||||
const wchar_t *p;
|
||||
|
||||
p = data();
|
||||
if ( !*p ) return false;
|
||||
for ( ; *p ; p+=1 ) {
|
||||
if ( *p < '0' ) return false;
|
||||
if ( *p > '9' ) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool XStringW::IsDigits(UINTN pos, UINTN count) const
|
||||
{
|
||||
const wchar_t *p;
|
||||
const wchar_t *q;
|
||||
|
||||
if ( pos >= size() ) {
|
||||
return false;
|
||||
}
|
||||
if ( pos+count > size() ) {
|
||||
return false;
|
||||
}
|
||||
p = data() + pos;
|
||||
q = p + count;
|
||||
for ( ; p < q ; p+=1 ) {
|
||||
if ( *p < '0' ) return false;
|
||||
if ( *p > '9' ) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void XStringW::ToLower(bool FirstCharIsCap)
|
||||
{
|
||||
if ( size() > 0 )
|
||||
{
|
||||
unsigned int ui;
|
||||
|
||||
if ( FirstCharIsCap ) {
|
||||
// data()[0] = Majuscule(data()[0]); //keep as is
|
||||
ui = 1;
|
||||
}else{
|
||||
ui = 0;
|
||||
}
|
||||
for ( ; ui < size() ; ui++ ) {
|
||||
m_data[ui] = to_lower(m_data[ui]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if __WCHAR_MIN__ < 0
|
||||
void XStringW::RemoveLastEspCtrl()
|
||||
{
|
||||
wchar_t *p;
|
||||
|
||||
if ( size() > 0 ) {
|
||||
p = _data(0) + size() - 1;
|
||||
if ( *p >= 0 && *p <= ' ' ) {
|
||||
p -= 1;
|
||||
while ( p>data() && *p >= 0 && *p <= ' ' ) p -= 1;
|
||||
if ( p>data() ) {
|
||||
SetLength( (UINTN)(p-data())+1);
|
||||
}else{
|
||||
if ( *p >= 0 && *p <= ' ' ) SetLength(0);
|
||||
else SetLength(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
void XStringW::RemoveLastEspCtrl()
|
||||
{
|
||||
wchar_t *p;
|
||||
|
||||
if ( size() > 0 ) {
|
||||
p = _data(0) + size() - 1;
|
||||
if ( *p <= ' ' ) {
|
||||
p -= 1;
|
||||
while ( p>data() && *p <= ' ' ) p -= 1;
|
||||
if ( p>data() ) {
|
||||
SetLength( (UINTN)(p-data())+1);
|
||||
}else{
|
||||
if ( *p <= ' ' ) SetLength(0);
|
||||
else SetLength(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
//
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
//bool XStringW::ReadFromFILE(FILE *fp)
|
||||
//{
|
||||
// UINTN longueur;
|
||||
//
|
||||
// if ( fread(&longueur, sizeof(longueur), 1, fp) != 1 ) goto fin;
|
||||
// if ( longueur > 0 && fread(dataWithSizeMin(0, longueur), sizeof(wchar_t), longueur, fp) != 1 ) goto fin;
|
||||
// SetLength(longueur);
|
||||
// return true;
|
||||
// fin:
|
||||
// SetNull();
|
||||
// return false;
|
||||
//}
|
||||
//
|
||||
//bool XStringW::WriteToFILE(FILE *fp) const
|
||||
//{
|
||||
// UINTN longueur;
|
||||
//
|
||||
// longueur = length();
|
||||
// if ( fwrite(&longueur, sizeof(longueur), 1, fp) != 1 ) return false;
|
||||
// if ( longueur > 0 && fwrite(data(), sizeof(wchar_t), longueur, fp) != 1 ) return false;
|
||||
// return true;
|
||||
//}
|
||||
|
||||
|
||||
//*************************************************************************************************
|
||||
//
|
||||
// Operators =
|
||||
//
|
||||
//*************************************************************************************************
|
||||
|
||||
const XStringW &XStringW::operator =(const XStringW &aString)
|
||||
{
|
||||
//TRACE("Operator =const XStringW&\n");
|
||||
StrnCpy(aString.data(), aString.size());
|
||||
return *this;
|
||||
}
|
||||
|
||||
//
|
||||
//const XStringW &XStringW::operator =(wchar_t aChar)
|
||||
//{
|
||||
////TRACE("Operator =wchar_t \n");
|
||||
// StrnCpy(&aChar, 1);
|
||||
// return *this;
|
||||
//}
|
||||
|
||||
//const XStringW &XStringW::operator =(const wchar_t *S)
|
||||
//{
|
||||
////TRACE("Operator =const wchar_t *\n");
|
||||
// if ( S == NULL ) {
|
||||
// DBG("operator =(const wchar_t *S) called with NULL\n");
|
||||
// panic();
|
||||
// }
|
||||
// StrCpy(S);
|
||||
// return *this;
|
||||
//}
|
||||
|
||||
|
||||
|
||||
//*************************************************************************************************
|
||||
//
|
||||
// Operators +=
|
||||
//
|
||||
//*************************************************************************************************
|
||||
|
||||
XStringW &XStringW::operator +=(wchar_t aChar)
|
||||
{
|
||||
//TRACE("Operator +=wchar_t \n");
|
||||
StrnCat(&aChar, 1);
|
||||
return *this;
|
||||
}
|
||||
|
||||
XStringW &XStringW::operator +=(const XStringW &aString)
|
||||
{
|
||||
//TRACE("Operator +=const XStringW&\n");
|
||||
StrnCat(aString.data(), aString.size());
|
||||
return *this;
|
||||
}
|
||||
|
||||
XStringW &XStringW::operator +=(const wchar_t *S)
|
||||
{
|
||||
//TRACE("operator +=const wchar_t *\n");
|
||||
StrCat(S);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Functions
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
XStringW operator"" _XSW ( const wchar_t* s, size_t len)
|
||||
{
|
||||
XStringW returnValue;
|
||||
if ( len > MAX_XSIZE ) len = MAX_XSIZE;
|
||||
returnValue.takeValueFrom(s, len);
|
||||
return returnValue; // don't do "return returnValue.takeValueFrom(s, len)" because it break the return value optimization.
|
||||
}
|
||||
|
||||
XStringW SWPrintf(const char* format, ...)
|
||||
{
|
||||
va_list va;
|
||||
XStringW str;
|
||||
|
||||
va_start (va, format);
|
||||
str.vSWPrintf(format, va);
|
||||
va_end(va);
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
XStringW SubString(const wchar_t *S, UINTN pos, UINTN count)
|
||||
{
|
||||
if ( wcslen(S)-pos < count ) count = wcslen(S)-pos;
|
||||
XStringW ret;
|
||||
ret.StrnCpy(S+pos, count);
|
||||
// return ( XStringW(S+pos, count) );
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
XStringW CleanCtrl(const XStringW &S)
|
||||
{
|
||||
XStringW ReturnValue;
|
||||
UINTN i;
|
||||
|
||||
for ( i=0 ; i<S.size() ; i+=1 ) {
|
||||
#if __WCHAR_MIN__ < 0
|
||||
if ( S.wc_str()[i] >=0 && S.wc_str()[i] < ' ' ) ReturnValue += 'x'; /* wchar_t are signed */
|
||||
#else
|
||||
if ( S.wc_str()[i] < ' ' ) ReturnValue += 'x'; /* wchar_t are unsigned */
|
||||
#endif
|
||||
else ReturnValue += S.wc_str()[i];
|
||||
}
|
||||
return ReturnValue;
|
||||
}
|
||||
|
||||
#endif
|
@ -1,222 +0,0 @@
|
||||
//*************************************************************************************************
|
||||
//*************************************************************************************************
|
||||
//
|
||||
// STRING
|
||||
//
|
||||
//*************************************************************************************************
|
||||
//*************************************************************************************************
|
||||
|
||||
#if !defined(__XSTRINGW_H__)
|
||||
#define __XSTRINGW_H__
|
||||
|
||||
#include "XToolsCommon.h"
|
||||
#include "unicode_conversions.h"
|
||||
|
||||
#define LPATH_SEPARATOR L'\\'
|
||||
|
||||
extern xsize XStringWGrowByDefault;
|
||||
//extern void __GLOBAL__sub_I_XStringW();
|
||||
|
||||
class XStringW
|
||||
{
|
||||
protected:
|
||||
wchar_t *m_data;
|
||||
xsize m_len;
|
||||
xsize m_allocatedSize;
|
||||
|
||||
// convenience method. Did it this way to avoid #define in header. They can have an impact on other headers
|
||||
xsize min(xsize x1, xsize x2) const { if ( x1 < x2 ) return x1; return x2; }
|
||||
xsize max(xsize x1, xsize x2) const { if ( x1 > x2 ) return x1; return x2; }
|
||||
|
||||
// Next 2 methods are protected intentionally. They are const method returning non-const pointer. That's intentional, but dangerous. Do not expose to public.
|
||||
// It's better practice, if you need a non-const pointer for low-level access, to use dataSized and ahev to specify the size
|
||||
wchar_t* _data(unsigned int ui) const { if ( ui >= m_allocatedSize ) panic("wchar_t* data(unsigned int ui=0) -> ui >= m_allocatedSize"); return m_data+ui; }
|
||||
wchar_t* _data(int i) const { if ( i<0 ) panic("wchar_t* data(int i) -> i < 0"); if ( (unsigned int)i >= m_allocatedSize ) panic("wchar_t* data(int i) -> i >= m_allocatedSize"); return m_data+i; }
|
||||
wchar_t* _data(unsigned long ui) const { if ( ui >= m_allocatedSize ) panic("wchar_t* data(unsigned long ui=0) -> ui >= m_allocatedSize"); return m_data+ui; }
|
||||
wchar_t* _data(long i) const { if ( i<0 ) panic("wchar_t* data(long i) -> i < 0"); if ( (unsigned long)i >= m_allocatedSize ) panic("wchar_t* data(long i) -> i >= m_allocatedSize"); return m_data+i; }
|
||||
wchar_t* _data(xsize ui) const { if ( ui >= m_allocatedSize ) panic("wchar_t* data(xsize ui=0) -> ui >= m_allocatedSize"); return m_data+ui; }
|
||||
wchar_t* _data(xisize i) const { if ( i<0 ) panic("wchar_t* data(xisize i) -> i < 0"); if ( (xsize)i >= m_allocatedSize ) panic("wchar_t* data(xisize i) -> i >= m_allocatedSize"); return m_data+i; }
|
||||
|
||||
public:
|
||||
void Init(xsize aSize=0);
|
||||
XStringW();
|
||||
XStringW(const XStringW &aString);
|
||||
// XStringW(const wchar_t *);
|
||||
// XStringW(const wchar_t* S, xsize count);
|
||||
// XStringW(const wchar_t);
|
||||
// XStringW(const char*);
|
||||
|
||||
~XStringW();
|
||||
|
||||
protected:
|
||||
wchar_t *CheckSize(xsize nNewSize, xsize nGrowBy = XStringWGrowByDefault);
|
||||
|
||||
public:
|
||||
const wchar_t* wc_str() const { return m_data; } // equivalent as std::string
|
||||
const wchar_t *data(xsize ui=0) const { return m_data+ui; } // do not multiply by sizeof(wchar_t), it's done by the compiler.
|
||||
const wchar_t *data(xisize i) const { if ( i<0 ) panic("const wchar_t *data(INTN i=0) const -> i < 0"); return m_data+i; } // do not multiply by sizeof(wchar_t), it's done by the compiler.
|
||||
|
||||
wchar_t* dataSized(xsize ui, xsize sizeMin, xsize nGrowBy=XStringWGrowByDefault) { CheckSize(ui+sizeMin, nGrowBy); return _data(ui); }
|
||||
wchar_t* dataSized(xisize i, xsize sizeMin, xsize nGrowBy=XStringWGrowByDefault) { if ( i<0 ) panic("wchar_t* dataSized(xisize i, xsize sizeMin, xsize nGrowBy) -> i < 0"); CheckSize((xsize)i+sizeMin, nGrowBy); return _data(i); }
|
||||
wchar_t* forgetDataWithoutFreeing();
|
||||
|
||||
// xsize length() const { return m_len; }
|
||||
xsize size() const { return m_len; }
|
||||
xsize sizeInBytes() const { return m_len*sizeof(wchar_t); }
|
||||
xsize allocatedSize() const { return m_allocatedSize; }
|
||||
void SetLength(xsize len);
|
||||
const wchar_t* s() { return m_data; }
|
||||
|
||||
/* Empty ? */
|
||||
void setEmpty() { m_len = 0; }
|
||||
bool isEmpty() const { return size() == 0; }
|
||||
bool notEmpty() const { return !isEmpty(); }
|
||||
|
||||
/* Cast */
|
||||
// operator const wchar_t *() const { return data(); }
|
||||
|
||||
#if defined(__APPLE__) && defined(__OBJC__)
|
||||
operator NSString*() const { return [[[NSString alloc] initWithBytes:data() length:length()*sizeof(wchar_t) encoding:NSUTF32LittleEndianStringEncoding] autorelease]; }
|
||||
#endif
|
||||
|
||||
int ToInt() const;
|
||||
xsize ToUInt() const;
|
||||
|
||||
// XString mbs() const;
|
||||
|
||||
// /* wchar_t [] */
|
||||
// wchar_t operator [](int i) const { return *_data(i); }
|
||||
// wchar_t operator [](unsigned int ui) const { return *_data(ui); }
|
||||
// wchar_t operator [](long i) const { return *_data(i); }
|
||||
// wchar_t operator [](unsigned long ui) const { return *_data(ui); }
|
||||
// wchar_t operator [](xisize i) const { return *data(i); }
|
||||
// wchar_t operator [](xsize ui) const { return *data(ui); }
|
||||
//
|
||||
// /* wchar_t& [] */
|
||||
// wchar_t& operator [](int i) { return *_data(i); }
|
||||
// wchar_t& operator [](unsigned int ui) { return *_data(ui); }
|
||||
// wchar_t& operator [](long i) { return *_data(i); }
|
||||
// wchar_t& operator [](unsigned long ui) { return *_data(ui); }
|
||||
// wchar_t& operator [](xisize i) { return *_data(i); }
|
||||
// wchar_t& operator [](xsize ui) { return *_data(ui); }
|
||||
|
||||
wchar_t LastChar() const { if ( size() > 0 ) return data()[size()-1]; else return 0; }
|
||||
void RemoveLastEspCtrl();
|
||||
|
||||
void SetNull() { SetLength(0); };
|
||||
|
||||
void StrnCpy(const wchar_t *buf, xsize len);
|
||||
void StrCpy(const wchar_t *buf);
|
||||
void StrnCat(const wchar_t *buf, xsize len);
|
||||
void StrCat(const wchar_t *buf);
|
||||
void StrCat(const XStringW &uneXStringW);
|
||||
void Delete(xsize pos, xsize count=1);
|
||||
|
||||
void Insert(xsize pos, const XStringW& Str);
|
||||
|
||||
|
||||
void vSWPrintf(const char* format, va_list va);
|
||||
void SWPrintf(const char* format, ...) __attribute__((__format__(__printf__, 2, 3)));
|
||||
|
||||
const XStringW &operator =(const XStringW &aString);
|
||||
// const XStringW &operator =(const wchar_t* S) {fdsf};
|
||||
// const XStringW &operator =(wchar_t);
|
||||
|
||||
XStringW& takeValueFrom(const wchar_t* S);
|
||||
XStringW& takeValueFrom(const wchar_t* S, xsize count);
|
||||
XStringW& takeValueFrom(const char* S);
|
||||
|
||||
XStringW& operator += (const XStringW &);
|
||||
XStringW& operator += (const wchar_t* S);
|
||||
XStringW& operator += (wchar_t);
|
||||
|
||||
XStringW SubString(xsize pos, xsize count) const;
|
||||
xsize IdxOf(wchar_t c, xsize Pos = 0) const;
|
||||
xsize IdxOf(const XStringW& S, xsize Pos = 0) const;
|
||||
xsize RIdxOf(const wchar_t c, xsize Pos = MAX_XSIZE) const;
|
||||
xsize RIdxOf(const XStringW& S, xsize Pos = MAX_XSIZE) const;
|
||||
|
||||
void ToLower(bool FirstCharIsCap = false);
|
||||
bool IsLetters() const;
|
||||
bool IsLettersNoAccent() const;
|
||||
bool IsDigits() const;
|
||||
bool IsDigits(xsize pos, xsize count) const;
|
||||
|
||||
bool ExistIn(const XStringW &S) const { return IdxOf(S) != MAX_XSIZE; }
|
||||
void Replace(wchar_t c1, wchar_t c2);
|
||||
XStringW SubStringReplace(wchar_t c1, wchar_t c2);
|
||||
|
||||
int Compare(const wchar_t* S) const { return (int)memcmp(data(), S, min(wcslen(S), size())*sizeof(wchar_t)); }
|
||||
|
||||
bool Equal(const wchar_t* S) const { return Compare(S) == 0; };
|
||||
bool BeginingEqual(const wchar_t* S) const { return (memcmp(data(), S, wcslen(S)) == 0); }
|
||||
bool SubStringEqual(xsize Pos, const wchar_t* S) const { return (memcmp(data(Pos), S, wcslen(S)) == 0); }
|
||||
|
||||
XStringW basename() const;
|
||||
XStringW dirname() const;
|
||||
|
||||
// bool ReadFromBuf(const char *buf, xsize *idx, xsize count);
|
||||
// bool WriteToBuf(char *buf, xsize *idx, xsize count) const;
|
||||
// bool ReadFromFILE(FILE *fp);
|
||||
// bool WriteToFILE(FILE *fp) const;
|
||||
//
|
||||
// bool ReadFromXBuffer(XRBuffer &unXBuffer); // Impossible de mettre le XBuffer en const car il y a une variable d'instance de XBuffer incrémentée par ReadFromXBuffer
|
||||
// void CatToXBuffer(XBuffer *unXBuffer) const;
|
||||
// void WriteToXBuffer(XBuffer *unXBuffer, xsize *idx) const;
|
||||
|
||||
public:
|
||||
// + operator
|
||||
// with XStringW
|
||||
friend XStringW operator + (const XStringW& p1, const XStringW& p2) { XStringW s; s=p1; s+=p2; return s; }
|
||||
// with const wchar_t
|
||||
friend XStringW operator + (const XStringW& p1, const wchar_t *p2 ) { XStringW s; s=p1; s+=p2; return s; }
|
||||
friend XStringW operator + (const wchar_t *p1, const XStringW& p2) { XStringW s; s.StrCat(p1); s.StrCat(p2); return s; }
|
||||
// // with wchar_t
|
||||
// friend XStringW operator + (const XStringW& p1, wchar_t p2 ) { XStringW s; s=p1; s+=p2; return s; }
|
||||
// friend XStringW operator + (wchar_t p1, const XStringW& p2 ) { XStringW s; s=p1; s+=p2; return s; }
|
||||
|
||||
|
||||
// == operator
|
||||
friend bool operator == (const XStringW& s1, const XStringW& s2) { return s1.Compare(s2._data(0)) == 0; }
|
||||
// friend bool operator == (const XStringW& s1, const wchar_t* s2 ) { return s1.Compare(s2) == 0; }
|
||||
// friend bool operator == (const wchar_t* s1, const XStringW& s2) { return s2.Compare(s1) == 0; }
|
||||
|
||||
friend bool operator != (const XStringW& s1, const XStringW& s2) { return s1.Compare(s2._data(0)) != 0; }
|
||||
// friend bool operator != (const XStringW& s1, const wchar_t* s2 ) { return s1.Compare(s2) != 0; }
|
||||
// friend bool operator != (const wchar_t* s1, const XStringW& s2) { return s2.Compare(s1) != 0; }
|
||||
|
||||
friend bool operator < (const XStringW& s1, const XStringW& s2) { return s1.Compare(s2._data(0)) < 0; }
|
||||
// friend bool operator < (const XStringW& s1, const wchar_t* s2 ) { return s1.Compare(s2) < 0; }
|
||||
// friend bool operator < (const wchar_t* s1, const XStringW& s2) { return s2.Compare(s1) > 0; }
|
||||
|
||||
friend bool operator > (const XStringW& s1, const XStringW& s2) { return s1.Compare(s2._data(0)) > 0; }
|
||||
// friend bool operator > (const XStringW& s1, const wchar_t* s2 ) { return s1.Compare(s2) > 0; }
|
||||
// friend bool operator > (const wchar_t* s1, const XStringW& s2) { return s2.Compare(s1) < 0; }
|
||||
|
||||
friend bool operator <= (const XStringW& s1, const XStringW& s2) { return s1.Compare(s2._data(0)) <= 0; }
|
||||
// friend bool operator <= (const XStringW& s1, const wchar_t* s2 ) { return s1.Compare(s2) <= 0; }
|
||||
// friend bool operator <= (const wchar_t* s1, const XStringW& s2) { return s2.Compare(s1) >= 0; }
|
||||
|
||||
friend bool operator >= (const XStringW& s1, const XStringW& s2) { return s1.Compare(s2._data(0)) >= 0; }
|
||||
// friend bool operator >= (const XStringW& s1, const wchar_t* s2 ) { return s1.Compare(s2) >= 0; }
|
||||
// friend bool operator >= (const wchar_t* s1, const XStringW& s2) { return s2.Compare(s1) <= 0; }
|
||||
|
||||
static wchar_t to_lower(wchar_t ch) {
|
||||
if (ch <= L'Z')
|
||||
return ((ch >= L'A') ? ((ch - L'A') + L'a') : ch);
|
||||
else if (ch == L'Ё') return L'ё';
|
||||
else if (ch <= L'Я')
|
||||
return ((ch >= L'А') ? ((ch - L'А') + L'а') : ch); //русские буквы
|
||||
else return ch;
|
||||
}
|
||||
};
|
||||
|
||||
extern const XStringW NullXStringW;
|
||||
|
||||
XStringW operator"" _XSW ( const wchar_t* s, size_t len);
|
||||
|
||||
XStringW SWPrintf(const char* format, ...) __attribute__((__format__(__printf__, 1, 2)));
|
||||
XStringW SubString(const wchar_t *S, xsize pos, xsize count);
|
||||
XStringW CleanCtrl(const XStringW &S);
|
||||
|
||||
#endif
|
@ -130,13 +130,13 @@ XStringWArray Split(const XStringW &S, const XStringW &Separator)
|
||||
xsize idxB, idxE;
|
||||
|
||||
idxB = 0;
|
||||
idxE = S.IdxOf(Separator, idxB);
|
||||
idxE = S.indexOf(Separator, idxB);
|
||||
while ( idxE != MAX_XSIZE ) {
|
||||
Ss.AddCopy(SubString(S.wc_str(), idxB, idxE-idxB));
|
||||
idxB = idxE + Separator.size();
|
||||
idxE = S.IdxOf(Separator, idxB);
|
||||
Ss.AddCopy(S.SubString(idxB, idxE-idxB));
|
||||
idxB = idxE + Separator.length();
|
||||
idxE = S.indexOf(Separator, idxB);
|
||||
}
|
||||
if ( idxB < S.size() ) Ss.AddCopy(SubString(S.wc_str(), idxB, S.size()-idxB));
|
||||
if ( idxB < S.length() ) Ss.AddCopy(S.SubString(idxB, S.length()-idxB));
|
||||
return Ss;
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
#include "XToolsCommon.h"
|
||||
#include "XObjArray.h"
|
||||
#include "XStringW.h"
|
||||
#include "XString.h"
|
||||
|
||||
|
||||
#define XStringWArraySuper XObjArray<XStringW>
|
||||
|
@ -60,7 +60,7 @@ static inline char32_t surrogate_to_utf32(char16_t high, char16_t low) {
|
||||
#define UNI_SUR_LOW_START 0xDC00u
|
||||
|
||||
|
||||
/************************************************************* utf8 - char32 *********************************************************/
|
||||
/************************************************************* Utility *********************************************************/
|
||||
|
||||
/*
|
||||
* Size of an UTF32 char when represented in UTF8
|
||||
@ -74,6 +74,18 @@ size_t utf8_size_of_utf32_char(char32_t c) {
|
||||
else return 4;
|
||||
}
|
||||
|
||||
/*
|
||||
* Size in bytes of an utf32 string if it were converted to utf8
|
||||
* Return value : pointer to the end of string or at the error
|
||||
*/
|
||||
size_t utf8_size_of_utf32_string(const char32_t* s)
|
||||
{
|
||||
if ( !s ) return 0;
|
||||
size_t size = 0;
|
||||
while ( *s ) s = utf8_size_of_utf32_char_ptr(s, &size);
|
||||
return size;
|
||||
}
|
||||
|
||||
/*
|
||||
* Increment size and return a pointer to the next char
|
||||
* Return value : pointer to the end of string or at the error
|
||||
@ -86,63 +98,107 @@ const char32_t* utf8_size_of_utf32_char_ptr(const char32_t *s, size_t* size)
|
||||
}
|
||||
|
||||
/*
|
||||
* Store an utf32 char in dst, if there is enough room (dst_max_len is >= size of utf32 char)
|
||||
* If there is enough room, dst_max_len is decrement and dst is increment and returned
|
||||
* If there isn't enough room, dst_max_len is set to 0 and dst is returned
|
||||
* Store an utf32 char in dst, if there is enough room (dst_max_size is >= size of converted utf32 char)
|
||||
* If there is enough room, dst_max_size is decrement and dst is increment and returned
|
||||
* If there isn't enough room, dst_max_size is set to 0 and dst is returned
|
||||
*/
|
||||
char* get_utf8_from_char32(char* dst, size_t* dst_max_len, char32_t utf32_char)
|
||||
char* get_utf8_from_char32(char* dst, size_t* dst_max_size, char32_t utf32_char)
|
||||
{
|
||||
#ifdef JIEF_DEBUG
|
||||
char* dst_debug = dst;
|
||||
(void)dst_debug;
|
||||
#endif
|
||||
if ( *dst_max_len <= 0 ) return dst;
|
||||
if ( *dst_max_size <= 0 ) return dst;
|
||||
/* assertion: utf32_char is a single UTF-4 value */
|
||||
|
||||
int bits = 0; // just to silence the warning
|
||||
|
||||
if (utf32_char < 0x80) {
|
||||
*dst++ = (char)utf32_char;
|
||||
*dst_max_len -= 1;
|
||||
*dst_max_size -= 1;
|
||||
bits = -6;
|
||||
}
|
||||
else if (utf32_char < 0x800) {
|
||||
if ( *dst_max_len < 2 ) {
|
||||
*dst_max_len = 0;
|
||||
if ( *dst_max_size < 2 ) {
|
||||
*dst_max_size = 0;
|
||||
return dst;
|
||||
}
|
||||
*dst++ = (char)(((utf32_char >> 6) & 0x1F) | 0xC0);
|
||||
*dst_max_len -= 1;
|
||||
*dst_max_size -= 1;
|
||||
bits = 0;
|
||||
}
|
||||
else if (utf32_char < 0x10000) {
|
||||
if ( *dst_max_len < 3 ) {
|
||||
*dst_max_len = 0;
|
||||
if ( *dst_max_size < 3 ) {
|
||||
*dst_max_size = 0;
|
||||
return dst;
|
||||
}
|
||||
*dst++ = (char)(((utf32_char >> 12) & 0x0F) | 0xE0);
|
||||
*dst_max_len -= 1;
|
||||
*dst_max_size -= 1;
|
||||
bits = 6;
|
||||
}
|
||||
else {
|
||||
if ( *dst_max_len < 4 ) {
|
||||
*dst_max_len = 0;
|
||||
if ( *dst_max_size < 4 ) {
|
||||
*dst_max_size = 0;
|
||||
return dst;
|
||||
}
|
||||
*dst++ = (char)(((utf32_char >> 18) & 0x07) | 0xF0);
|
||||
*dst_max_len -= 1;
|
||||
*dst_max_size -= 1;
|
||||
bits = 12;
|
||||
}
|
||||
for ( ; /* *dst_max_len > 0 && */ bits >= 0 ; bits -= 6 ) { // no need to check dst_max_len, it's made before
|
||||
for ( ; /* *dst_max_size > 0 && */ bits >= 0 ; bits -= 6 ) { // no need to check dst_max_size, it's made before
|
||||
*dst++ = (char)(((utf32_char >> bits) & 0x3F) | 0x80);
|
||||
*dst_max_len -= 1;
|
||||
*dst_max_size -= 1;
|
||||
}
|
||||
#ifdef JIEF_DEBUG
|
||||
if ( *dst_max_len > 0 ) *dst = 0;
|
||||
if ( *dst_max_size > 0 ) *dst = 0;
|
||||
#endif
|
||||
return dst;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Store an utf32 char in dst, if there is enough room (dst_max_size is >= size of converted utf32 char)
|
||||
* If there is enough room, dst_max_size is decrement and dst is increment and returned
|
||||
* If there isn't enough room, dst_max_size is set to 0 and dst is returned
|
||||
*/
|
||||
char16_t* get_utf16_from_char32(char16_t* dst, size_t* dst_max_size, char32_t utf32_char)
|
||||
{
|
||||
if ( *dst_max_size <= 0 ) return dst;
|
||||
|
||||
char16_t char16_1, char16_2;
|
||||
get_char16_from_char32(utf32_char, &char16_1, &char16_2);
|
||||
if ( char16_2 != 0 ) {
|
||||
if ( *dst_max_size < 2 ) {
|
||||
*dst_max_size = 0;
|
||||
}else{
|
||||
*dst++ = char16_1;
|
||||
*dst++ = char16_2;
|
||||
*dst_max_size -= 2;
|
||||
}
|
||||
}else{
|
||||
if ( *dst_max_size < 1 ) {
|
||||
*dst_max_size = 0;
|
||||
}else{
|
||||
*dst++ = char16_1;
|
||||
*dst_max_size -= 1;
|
||||
}
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
||||
/*
|
||||
* Store an utf32 char in dst, if there is enough room (dst_max_size is >= size of converted utf32 char)
|
||||
* If there is enough room, dst_max_size is decrement and dst is increment and returned
|
||||
* If there isn't enough room, dst_max_size is set to 0 and dst is returned
|
||||
*/
|
||||
char32_t* get_utf32_from_char32(char32_t* dst, size_t* dst_max_size, char32_t utf32_char)
|
||||
{
|
||||
if ( *dst_max_size <= 0 ) return dst;
|
||||
*dst = utf32_char;
|
||||
*dst_max_size -= 1;
|
||||
return dst + 1;
|
||||
}
|
||||
|
||||
/*
|
||||
Number Bits for First Last Byte 1 Byte 2 Byte 3 cByte 4
|
||||
of bytes code point
|
||||
@ -166,7 +222,7 @@ const char* get_char32_from_utf8_string(const char* s, char32_t* char32)
|
||||
if (*s & 0x80) {
|
||||
if ((*(s+1) & 0xc0) != 0x80) { // 0xc0 = 0b11000000. Equivalent to if ( *(s+1) != 0x10xxxxxx )
|
||||
// Finished in the middle of an utf8 multibyte char
|
||||
char32 = 0;
|
||||
*char32 = 0;
|
||||
return s;
|
||||
}
|
||||
if ((*s & 0xe0) == 0xe0) { // 0xe0 == 0b11100000. Equivalent to if ( *(s) == 0x111xxxxx )
|
||||
@ -174,7 +230,7 @@ const char* get_char32_from_utf8_string(const char* s, char32_t* char32)
|
||||
// Byte 3 has to be 0x10xxxxxx
|
||||
if ((*(s+2) & 0xc0) != 0x80) { // 0xc0 = 0b11000000. Equivalent to if ( *(s+2) != 0x10xxxxxx )
|
||||
// Finished in the middle of an utf8 multibyte char
|
||||
char32 = 0;
|
||||
*char32 = 0;
|
||||
return s;
|
||||
}
|
||||
if ((*s & 0xf0) == 0xf0) { // 0xf0 = 0b1111xxxx. Equivalent to if ( *(s) == 0x1111xxxx )
|
||||
@ -182,7 +238,7 @@ const char* get_char32_from_utf8_string(const char* s, char32_t* char32)
|
||||
// Byte 4 has to be 0x10xxxxxx
|
||||
if ((*s & 0xf8) != 0xf0 || (*(s+3) & 0xc0) != 0x80) { // 0xf8 = 0b11111xxx. Equivalent to if ( *(s) != 0x11110xxx || *(s+3) != 0x10xxxxxx )
|
||||
// Finished in the middle of an utf8 multibyte char
|
||||
char32 = 0;
|
||||
*char32 = 0;
|
||||
return s;
|
||||
}
|
||||
/* 4-byte code */
|
||||
@ -213,16 +269,43 @@ const char* get_char32_from_utf8_string(const char* s, char32_t* char32)
|
||||
return s;
|
||||
}
|
||||
|
||||
/*
|
||||
* get nth char32 of an utf8 string
|
||||
* Return value : pointer to the end of string or at the error
|
||||
*/
|
||||
char32_t get_char32_from_utf8_string_at_pos(const char* s, size_t pos)
|
||||
{
|
||||
if ( !s ) return 0;
|
||||
char32_t char32;
|
||||
s = get_char32_from_utf8_string(s, &char32);
|
||||
while ( char32 && pos > 0 ) {
|
||||
s = get_char32_from_utf8_string(s, &char32);
|
||||
pos--;
|
||||
}
|
||||
return char32;
|
||||
}
|
||||
|
||||
|
||||
/************************************************************* utf8 - char32 *********************************************************/
|
||||
|
||||
//const char* utf8_move_forward(const char* s)
|
||||
//{
|
||||
//}
|
||||
|
||||
/*
|
||||
* Size in bytes of an utf32 string if it were converted to utf8
|
||||
* Return value : pointer to the end of string or at the error
|
||||
*/
|
||||
size_t utf8_size_of_utf32_string(const char32_t* s)
|
||||
size_t utf32_size_of_utf8_string(const char* s)
|
||||
{
|
||||
if ( !s ) return 0;
|
||||
size_t size = 0;
|
||||
while ( *s ) s = utf8_size_of_utf32_char_ptr(s, &size);
|
||||
char32_t char32;
|
||||
s = get_char32_from_utf8_string(s, &char32);
|
||||
while ( char32 ) {
|
||||
size += 1;
|
||||
s = get_char32_from_utf8_string(s, &char32);
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
@ -241,17 +324,24 @@ size_t utf8_size_of_utf32_string_len(const char32_t* s, size_t len)
|
||||
return size;
|
||||
}
|
||||
|
||||
size_t utf32_size_of_utf8_string(const char* s)
|
||||
size_t utf32_string_from_utf8_string(char32_t* dst, size_t dst_max_size, const char* s)
|
||||
{
|
||||
if ( !s ) return 0;
|
||||
size_t size = 0;
|
||||
if ( dst_max_size <= 0 ) return 0;
|
||||
if ( !s ) {
|
||||
*dst = 0;
|
||||
return 0;
|
||||
}
|
||||
char32_t* p = dst;
|
||||
char32_t* p_max = dst + dst_max_size - 1;
|
||||
|
||||
char32_t char32;
|
||||
s = get_char32_from_utf8_string(s, &char32);
|
||||
while ( char32 ) {
|
||||
size += 1;
|
||||
while ( char32 != 0 && p < p_max ) {
|
||||
*p++ = char32;
|
||||
s = get_char32_from_utf8_string(s, &char32);
|
||||
}
|
||||
return size;
|
||||
*p = 0;
|
||||
return (size_t)(p-dst);
|
||||
}
|
||||
|
||||
size_t utf32_size_of_utf8_string_len(const char* s, size_t len)
|
||||
@ -268,38 +358,59 @@ size_t utf32_size_of_utf8_string_len(const char* s, size_t len)
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
size_t utf32_string_from_utf8_string(char32_t* dst, size_t dst_max_len, const char* s)
|
||||
size_t utf32_string_from_utf8_string_len(char32_t* dst, size_t dst_max_size, const char* s, size_t len)
|
||||
{
|
||||
if ( !s && dst_max_len == 0 ) return 0;
|
||||
if ( dst_max_size <= 0 ) return 0;
|
||||
if ( !s || len <= 0 ) {
|
||||
*dst = 0;
|
||||
return 0;
|
||||
}
|
||||
char32_t* p = dst;
|
||||
char32_t* p_max = dst + dst_max_len - 1;
|
||||
char32_t* p_max = dst + dst_max_size - 1;
|
||||
|
||||
char32_t char32;
|
||||
s = get_char32_from_utf8_string(s, &char32);
|
||||
while ( char32 != 0 && p < p_max ) {
|
||||
while ( char32 != 0 && p < p_max && len > 0 ) {
|
||||
*p++ = char32;
|
||||
s = get_char32_from_utf8_string(s, &char32);
|
||||
len--;
|
||||
}
|
||||
*p = 0;
|
||||
return (size_t)(p-dst);
|
||||
}
|
||||
|
||||
size_t utf8_string_from_utf32_string(char* dst, size_t dst_max_len, const char32_t *s)
|
||||
size_t utf8_string_from_utf32_string(char* dst, size_t dst_max_size, const char32_t *s)
|
||||
{
|
||||
if ( !s || dst_max_len <= 1 ) {
|
||||
if ( dst_max_len > 0 ) *dst = 0;
|
||||
if ( dst_max_size <= 0 ) return 0;
|
||||
if ( !s ) {
|
||||
*dst = 0;
|
||||
return 0;
|
||||
}
|
||||
dst_max_len -= 1;
|
||||
dst_max_size -= 1;
|
||||
char* p = dst;
|
||||
while ( *s && dst_max_len > 0 ) {
|
||||
p = get_utf8_from_char32(p, &dst_max_len, *s++);
|
||||
while ( *s && dst_max_size > 0 ) {
|
||||
p = get_utf8_from_char32(p, &dst_max_size, *s++);
|
||||
}
|
||||
*p = 0;
|
||||
return (size_t)(p-dst);
|
||||
}
|
||||
|
||||
size_t utf8_string_from_utf32_string_len(char* dst, size_t dst_max_size, const char32_t *s, size_t len)
|
||||
{
|
||||
if ( dst_max_size <= 0 ) return 0;
|
||||
if ( !s || len <= 0 ) {
|
||||
*dst = 0;
|
||||
return 0;
|
||||
}
|
||||
dst_max_size -= 1;
|
||||
char* p = dst;
|
||||
while ( *s && dst_max_size > 0 && len > 0 ) {
|
||||
p = get_utf8_from_char32(p, &dst_max_size, *s++);
|
||||
len--;
|
||||
}
|
||||
*p = 0;
|
||||
return (size_t)(p-dst);
|
||||
}
|
||||
|
||||
|
||||
/************************************************************* utf8 - char16 *********************************************************/
|
||||
@ -376,49 +487,86 @@ size_t utf16_size_of_utf8_string_len(const char* s, size_t len)
|
||||
|
||||
|
||||
|
||||
size_t utf8_string_from_utf16_string(char* dst, size_t dst_max_len, const char16_t *s)
|
||||
size_t utf8_string_from_utf16_string(char* dst, size_t dst_max_size, const char16_t *s)
|
||||
{
|
||||
if ( !s || dst_max_len <= 0 ) return 0;
|
||||
if ( dst_max_size <= 0 ) return 0;
|
||||
if ( !s ) {
|
||||
*dst = 0;
|
||||
return 0;
|
||||
}
|
||||
char* p = dst;
|
||||
dst_max_len -= 1;
|
||||
while ( *s && dst_max_len > 0 ) {
|
||||
dst_max_size -= 1;
|
||||
while ( *s && dst_max_size > 0 ) {
|
||||
char32_t utf32_char;
|
||||
s = get_char32_from_utf16_string(s, &utf32_char);
|
||||
p = get_utf8_from_char32(p, &dst_max_len, utf32_char);
|
||||
p = get_utf8_from_char32(p, &dst_max_size, utf32_char);
|
||||
}
|
||||
*p = 0;
|
||||
return (size_t)(p-dst);
|
||||
}
|
||||
|
||||
size_t utf8_string_from_utf16_string_len(char* dst, size_t dst_max_size, const char16_t *s, size_t len)
|
||||
{
|
||||
if ( dst_max_size <= 0 ) return 0;
|
||||
if ( !s || len <= 0 ) {
|
||||
*dst = 0;
|
||||
return 0;
|
||||
}
|
||||
char* p = dst;
|
||||
dst_max_size -= 1;
|
||||
while ( *s && dst_max_size > 0 && len > 0 ) {
|
||||
char32_t utf32_char;
|
||||
s = get_char32_from_utf16_string(s, &utf32_char);
|
||||
p = get_utf8_from_char32(p, &dst_max_size, utf32_char);
|
||||
len--;
|
||||
}
|
||||
*p = 0;
|
||||
return (size_t)(p-dst);
|
||||
}
|
||||
|
||||
|
||||
|
||||
size_t utf16_string_from_utf8_string(char16_t* dst, size_t dst_max_len, const char* s)
|
||||
size_t utf16_string_from_utf8_string(char16_t* dst, size_t dst_max_size, const char* s)
|
||||
{
|
||||
if ( dst_max_len == 0 ) return 0;
|
||||
dst_max_len -= 1;
|
||||
if ( dst_max_size <= 0 ) return 0;
|
||||
if ( !s ) {
|
||||
*dst = 0;
|
||||
return 0;
|
||||
}
|
||||
dst_max_size -= 1;
|
||||
|
||||
// size_t dst_len = 0;
|
||||
char16_t* p = dst;
|
||||
char16_t* p_max = dst + dst_max_len;
|
||||
// char16_t* p_max = dst + dst_max_size;
|
||||
|
||||
char32_t char32;
|
||||
s = get_char32_from_utf8_string(s, &char32);
|
||||
while ( char32 && p < p_max ) {
|
||||
if ( char32 == 0 ) return (size_t)(p-dst);
|
||||
char16_t char16_1, char16_2;
|
||||
get_char16_from_char32(char32, &char16_1, &char16_2);
|
||||
if ( char16_2 != 0 ) {
|
||||
if ( p < p_max-1 ) {
|
||||
*p++ = char16_1;
|
||||
*p++ = char16_2;
|
||||
}else{
|
||||
while ( char32 && dst_max_size > 0 ) {
|
||||
p = get_utf16_from_char32(p, &dst_max_size, char32);
|
||||
s = get_char32_from_utf8_string(s, &char32);
|
||||
}
|
||||
*p = 0;
|
||||
return (size_t)(p-dst);
|
||||
}
|
||||
}else{
|
||||
*p++ = char16_1;
|
||||
|
||||
size_t utf16_string_from_utf8_string_len(char16_t* dst, size_t dst_max_size, const char* s, size_t len)
|
||||
{
|
||||
if ( dst_max_size <= 0 ) return 0;
|
||||
if ( !s || len <= 0 ) {
|
||||
*dst = 0;
|
||||
return 0;
|
||||
}
|
||||
dst_max_size -= 1;
|
||||
|
||||
// size_t dst_len = 0;
|
||||
char16_t* p = dst;
|
||||
// char16_t* p_max = dst + dst_max_size;
|
||||
|
||||
char32_t char32;
|
||||
s = get_char32_from_utf8_string(s, &char32);
|
||||
while ( char32 && dst_max_size > 0 && len > 0 ) {
|
||||
p = get_utf16_from_char32(p, &dst_max_size, char32);
|
||||
s = get_char32_from_utf8_string(s, &char32);
|
||||
len--;
|
||||
}
|
||||
*p = 0;
|
||||
return (size_t)(p-dst);
|
||||
@ -464,7 +612,12 @@ char32_t get_char32_from_char16(char16_t char16_1, char16_t char16_2)
|
||||
*/
|
||||
const char16_t* get_char32_from_utf16_string(const char16_t* s, char32_t* char32)
|
||||
{
|
||||
const char16_t char16_1 = *s++;
|
||||
const char16_t char16_1 = *s;
|
||||
if ( char16_1 == 0 ) {
|
||||
*char32 = 0;
|
||||
return s;
|
||||
}
|
||||
s++;
|
||||
if (!is_surrogate(char16_1)) {
|
||||
*char32 = char16_1;
|
||||
return s;
|
||||
@ -530,39 +683,54 @@ size_t utf32_size_of_utf16_string_len(const char16_t *s, size_t len)
|
||||
}
|
||||
|
||||
|
||||
size_t utf16_string_from_utf32_string(char16_t* dst, size_t dst_max_len, const char32_t *s)
|
||||
size_t utf16_string_from_utf32_string(char16_t* dst, size_t dst_max_size, const char32_t *s)
|
||||
{
|
||||
if ( dst_max_len == 0 ) return 0;
|
||||
if ( dst_max_size <= 0 ) return 0;
|
||||
if ( !s ) {
|
||||
*dst = 0;
|
||||
return 0;
|
||||
}
|
||||
char16_t* p = dst;
|
||||
char16_t* p_max = dst + dst_max_len - 1;
|
||||
// char16_t* p_max = dst + dst_max_size - 1;
|
||||
|
||||
while ( *s && p < p_max ) {
|
||||
char16_t char16_1, char16_2;
|
||||
get_char16_from_char32(*s++, &char16_1, &char16_2);
|
||||
if ( char16_2 != 0 ) {
|
||||
if ( p < p_max-1 ) {
|
||||
*p++ = char16_1;
|
||||
*p++ = char16_2;
|
||||
}else{
|
||||
*p = 0;
|
||||
return (size_t)(p-dst);
|
||||
}
|
||||
}else{
|
||||
*p++ = char16_1;
|
||||
}
|
||||
while ( *s && dst_max_size > 0 ) {
|
||||
p = get_utf16_from_char32(p, &dst_max_size, *s++);
|
||||
}
|
||||
*p = 0;
|
||||
return (size_t)(p-dst);
|
||||
}
|
||||
|
||||
size_t utf32_string_from_utf16_string(char32_t* dst, size_t dst_max_len, const char16_t *s)
|
||||
size_t utf16_string_from_utf32_string_len(char16_t* dst, size_t dst_max_size, const char32_t *s, size_t len)
|
||||
{
|
||||
if ( dst_max_len == 0 ) return 0;
|
||||
char32_t* p = dst;
|
||||
char32_t* p_max = dst + dst_max_len - 1;
|
||||
if ( dst_max_size <= 0 ) return 0;
|
||||
if ( !s || len <= 0 ) {
|
||||
*dst = 0;
|
||||
return 0;
|
||||
}
|
||||
char16_t* p = dst;
|
||||
// char16_t* p_max = dst + dst_max_size - 1;
|
||||
|
||||
dst_max_size--;
|
||||
while ( *s && dst_max_size > 0 && len > 0 ) {
|
||||
p = get_utf16_from_char32(p, &dst_max_size, *s++);
|
||||
len--;
|
||||
}
|
||||
*p = 0;
|
||||
return (size_t)(p-dst);
|
||||
}
|
||||
|
||||
size_t utf32_string_from_utf16_string(char32_t* dst, size_t dst_max_size, const char16_t *s)
|
||||
{
|
||||
if ( dst_max_size <= 0 ) return 0;
|
||||
if ( !s ) {
|
||||
*dst = 0;
|
||||
return 0;
|
||||
}
|
||||
char32_t* p = dst;
|
||||
char32_t* p_max = dst + dst_max_size - 1;
|
||||
|
||||
while ( *s && p < p_max ) {
|
||||
char32_t c;
|
||||
while ( *s && p < p_max ) {
|
||||
s = get_char32_from_utf16_string(s, &c);
|
||||
if ( c == 0 ) return (size_t)(p-dst);
|
||||
*p++ = c;
|
||||
@ -571,6 +739,28 @@ size_t utf32_string_from_utf16_string(char32_t* dst, size_t dst_max_len, const c
|
||||
return (size_t)(p-dst);
|
||||
}
|
||||
|
||||
size_t utf32_string_from_utf16_string_len(char32_t* dst, size_t dst_max_size, const char16_t *s, size_t len)
|
||||
{
|
||||
if ( dst_max_size <= 0 ) return 0;
|
||||
if ( !s || len <= 0 ) {
|
||||
*dst = 0;
|
||||
return 0;
|
||||
}
|
||||
char32_t* p = dst;
|
||||
char32_t* p_max = dst + dst_max_size - 1;
|
||||
|
||||
char32_t c;
|
||||
while ( *s && p < p_max && len > 0 ) {
|
||||
s = get_char32_from_utf16_string(s, &c);
|
||||
if ( c == 0 ) return (size_t)(p-dst);
|
||||
*p++ = c;
|
||||
len--;
|
||||
}
|
||||
*p = 0;
|
||||
return (size_t)(p-dst);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************* utf8 - wchar_t *********************************************************/
|
||||
@ -611,21 +801,39 @@ size_t wchar_size_of_utf8_string_len(const char* s, size_t len)
|
||||
#endif
|
||||
}
|
||||
|
||||
size_t utf8_string_from_wchar_string(char* dst, size_t dst_max_len, const wchar_t* s)
|
||||
size_t utf8_string_from_wchar_string(char* dst, size_t dst_max_size, const wchar_t* s)
|
||||
{
|
||||
#if __WCHAR_MAX__ <= 0xFFFFu
|
||||
return utf8_string_from_utf16_string(dst, dst_max_len, (char16_t*)s);
|
||||
return utf8_string_from_utf16_string(dst, dst_max_size, (char16_t*)s);
|
||||
#else
|
||||
return utf8_string_from_utf32_string(dst, dst_max_len, (char32_t*)s);
|
||||
return utf8_string_from_utf32_string(dst, dst_max_size, (char32_t*)s);
|
||||
#endif
|
||||
}
|
||||
|
||||
size_t wchar_string_from_utf8_string(wchar_t* dst, size_t dst_max_len, const char* s)
|
||||
size_t utf8_string_from_wchar_string_len(char* dst, size_t dst_max_size, const wchar_t* s, size_t len)
|
||||
{
|
||||
#if __WCHAR_MAX__ <= 0xFFFFu
|
||||
return utf16_string_from_utf8_string((char16_t*)dst, dst_max_len, s);
|
||||
return utf8_string_from_utf16_string_len(dst, dst_max_size, (char16_t*)s, len);
|
||||
#else
|
||||
return utf32_string_from_utf8_string((char32_t*)dst, dst_max_len, s);
|
||||
return utf8_string_from_utf32_string_len(dst, dst_max_size, (char32_t*)s, len);
|
||||
#endif
|
||||
}
|
||||
|
||||
size_t wchar_string_from_utf8_string(wchar_t* dst, size_t dst_max_size, const char* s)
|
||||
{
|
||||
#if __WCHAR_MAX__ <= 0xFFFFu
|
||||
return utf16_string_from_utf8_string((char16_t*)dst, dst_max_size, s);
|
||||
#else
|
||||
return utf32_string_from_utf8_string((char32_t*)dst, dst_max_size, s);
|
||||
#endif
|
||||
}
|
||||
|
||||
size_t wchar_string_from_utf8_string_len(wchar_t* dst, size_t dst_max_size, const char* s, size_t len)
|
||||
{
|
||||
#if __WCHAR_MAX__ <= 0xFFFFu
|
||||
return utf16_string_from_utf8_string_len((char16_t*)dst, dst_max_size, s, len);
|
||||
#else
|
||||
return utf32_string_from_utf8_string_len((char32_t*)dst, dst_max_size, s, len);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -668,21 +876,39 @@ size_t wchar_size_of_utf16_string_len(const char16_t* s, size_t len)
|
||||
#endif
|
||||
}
|
||||
|
||||
size_t utf16_string_from_wchar_string(char16_t* dst, size_t dst_max_len, const wchar_t* s)
|
||||
size_t utf16_string_from_wchar_string(char16_t* dst, size_t dst_max_size, const wchar_t* s)
|
||||
{
|
||||
#if __WCHAR_MAX__ <= 0xFFFFu
|
||||
return utf16_string_from_utf16_string(dst, dst_max_len, (char16_t*)s);
|
||||
return utf16_string_from_utf16_string(dst, dst_max_size, (char16_t*)s);
|
||||
#else
|
||||
return utf16_string_from_utf32_string(dst, dst_max_len, (char32_t*)s);
|
||||
return utf16_string_from_utf32_string(dst, dst_max_size, (char32_t*)s);
|
||||
#endif
|
||||
}
|
||||
|
||||
size_t wchar_string_from_utf16_string(wchar_t* dst, size_t dst_max_len, const char16_t* s)
|
||||
size_t utf16_string_from_wchar_string_len(char16_t* dst, size_t dst_max_size, const wchar_t* s, size_t len)
|
||||
{
|
||||
#if __WCHAR_MAX__ <= 0xFFFFu
|
||||
return utf16_string_from_utf16_string((char16_t*)dst, dst_max_len, s);
|
||||
return utf16_string_from_utf16_string_len(dst, dst_max_size, (char16_t*)s, len);
|
||||
#else
|
||||
return utf32_string_from_utf16_string((char32_t*)dst, dst_max_len, s);
|
||||
return utf16_string_from_utf32_string_len(dst, dst_max_size, (char32_t*)s, len);
|
||||
#endif
|
||||
}
|
||||
|
||||
size_t wchar_string_from_utf16_string(wchar_t* dst, size_t dst_max_size, const char16_t* s)
|
||||
{
|
||||
#if __WCHAR_MAX__ <= 0xFFFFu
|
||||
return utf16_string_from_utf16_string((char16_t*)dst, dst_max_size, s);
|
||||
#else
|
||||
return utf32_string_from_utf16_string((char32_t*)dst, dst_max_size, s);
|
||||
#endif
|
||||
}
|
||||
|
||||
size_t wchar_string_from_utf16_string_len(wchar_t* dst, size_t dst_max_size, const char16_t* s, size_t len)
|
||||
{
|
||||
#if __WCHAR_MAX__ <= 0xFFFFu
|
||||
return utf16_string_from_utf16_string_len((char16_t*)dst, dst_max_size, s, len);
|
||||
#else
|
||||
return utf32_string_from_utf16_string_len((char32_t*)dst, dst_max_size, s, len);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -726,21 +952,21 @@ size_t wchar_size_of_utf32_string_len(const char32_t* s, size_t len)
|
||||
#endif
|
||||
}
|
||||
|
||||
size_t utf32_string_from_wchar_string(char32_t* dst, size_t dst_max_len, const wchar_t* s)
|
||||
size_t utf32_string_from_wchar_string(char32_t* dst, size_t dst_max_size, const wchar_t* s)
|
||||
{
|
||||
#if __WCHAR_MAX__ <= 0xFFFFu
|
||||
return utf32_string_from_utf16_string(dst, dst_max_len, (char16_t*)s);
|
||||
return utf32_string_from_utf16_string(dst, dst_max_size, (char16_t*)s);
|
||||
#else
|
||||
return utf32_string_from_utf32_string(dst, dst_max_len, (char32_t*)s);
|
||||
return utf32_string_from_utf32_string(dst, dst_max_size, (char32_t*)s);
|
||||
#endif
|
||||
}
|
||||
|
||||
size_t wchar_string_from_utf32_string(wchar_t* dst, size_t dst_max_len, const char32_t* s)
|
||||
size_t wchar_string_from_utf32_string(wchar_t* dst, size_t dst_max_size, const char32_t* s)
|
||||
{
|
||||
#if __WCHAR_MAX__ <= 0xFFFFu
|
||||
return utf16_string_from_utf32_string((char16_t*)dst, dst_max_len, s);
|
||||
return utf16_string_from_utf32_string((char16_t*)dst, dst_max_size, s);
|
||||
#else
|
||||
return utf32_string_from_utf32_string((char32_t*)dst, dst_max_len, s);
|
||||
return utf32_string_from_utf32_string((char32_t*)dst, dst_max_size, s);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -754,9 +980,17 @@ size_t wchar_string_from_utf32_string(wchar_t* dst, size_t dst_max_len, const ch
|
||||
// Not efficient. Could be map to the ones provided by operating system
|
||||
size_t utf8_size_of_utf8_string(const char* s)
|
||||
{
|
||||
const char* p = s;
|
||||
while ( *p++ );
|
||||
return (size_t)(p-s-1);
|
||||
if ( !s ) return 0;
|
||||
char32_t char32 = 1;
|
||||
const char* p = s; // = get_char32_from_utf8_string(s, &char32);
|
||||
while ( char32 ) {
|
||||
p = get_char32_from_utf8_string(p, &char32);
|
||||
}
|
||||
return (uintptr_t(p)-uintptr_t(s));
|
||||
//
|
||||
// const char* p = s;
|
||||
// while ( *p++ );
|
||||
// return (size_t)(p-s-1);
|
||||
}
|
||||
|
||||
size_t utf8_size_of_utf8_string_len(const char* s, size_t len)
|
||||
@ -768,14 +1002,21 @@ size_t utf8_size_of_utf8_string_len(const char* s, size_t len)
|
||||
p = get_char32_from_utf8_string(p, &char32);
|
||||
len -= 1;
|
||||
}
|
||||
return (uintptr_t(p)-uintptr_t(s));
|
||||
return (size_t)(p-s);// p-s is in number of char32_t, not bytes. Careful, uintptr_t(p)-uintptr_t(s) would be in bytes
|
||||
}
|
||||
|
||||
size_t utf16_size_of_utf16_string(const char16_t* s)
|
||||
{
|
||||
const char16_t* p = s;
|
||||
while ( *p++ );
|
||||
return (size_t)(p-s-1);
|
||||
if ( !s ) return 0;
|
||||
char32_t char32 = 1;
|
||||
const char16_t* p = s; // = get_char32_from_utf8_string(s, &char32);
|
||||
while ( char32 ) {
|
||||
p = get_char32_from_utf16_string(p, &char32);
|
||||
}
|
||||
return (size_t)(p-s);// p-s is in number of char32_t, not bytes. Careful, uintptr_t(p)-uintptr_t(s) would be in bytes
|
||||
// const char16_t* p = s;
|
||||
// while ( *p++ );
|
||||
// return (size_t)(p-s-1);
|
||||
}
|
||||
|
||||
size_t utf16_size_of_utf16_string_len(const char16_t* s, size_t len)
|
||||
@ -796,14 +1037,14 @@ size_t utf32_size_of_utf32_string(const char32_t* s)
|
||||
{
|
||||
const char32_t* p = s;
|
||||
while ( *p++ );
|
||||
return (size_t)(p-s-1);
|
||||
return ((size_t)(p-s-1)); // p-s is in number of char32_t, not bytes. // Let's hope that p-s-1 is not > MAX_SIZET
|
||||
}
|
||||
|
||||
size_t utf32_size_of_utf32_string_len(const char32_t* s, size_t len)
|
||||
{
|
||||
const char32_t* p = s;
|
||||
while ( *p++ && len > 0 ) len -= 1;
|
||||
return (size_t)(p-s-1);
|
||||
return ((size_t)(p-s-1)); // p-s is in number of char32_t, not bytes. // Let's hope that p-s-1 is not > MAX_SIZET
|
||||
}
|
||||
|
||||
size_t wchar_size_of_wchar_string(const wchar_t* s)
|
||||
@ -826,58 +1067,129 @@ size_t wchar_size_of_wchar_string_len(const wchar_t* s, size_t len)
|
||||
|
||||
|
||||
|
||||
size_t utf8_string_from_utf8_string(char* dst, size_t dst_max_len, const char *s)
|
||||
size_t utf8_string_from_utf8_string(char* dst, size_t dst_max_size, const char *s)
|
||||
{
|
||||
if ( !s || dst_max_len <= 1 ) {
|
||||
if ( dst_max_len > 0 ) *dst = 0;
|
||||
if ( !s || dst_max_size <= 1 ) {
|
||||
if ( dst_max_size > 0 ) *dst = 0;
|
||||
return 0;
|
||||
}
|
||||
dst_max_len -= 1;
|
||||
dst_max_size -= 1;
|
||||
char* p = dst;
|
||||
char32_t char32;
|
||||
s = get_char32_from_utf8_string(s, &char32);
|
||||
while ( char32 && dst_max_len > 0 ) {
|
||||
p = get_utf8_from_char32(p, &dst_max_len, char32);
|
||||
while ( char32 && dst_max_size > 0 ) {
|
||||
p = get_utf8_from_char32(p, &dst_max_size, char32);
|
||||
s = get_char32_from_utf8_string(s, &char32);
|
||||
}
|
||||
*p = 0;
|
||||
return uintptr_t(p)-uintptr_t(dst)-1;
|
||||
}
|
||||
|
||||
size_t utf16_string_from_utf16_string(char16_t* dst, size_t dst_max_len, const char16_t *s)
|
||||
size_t utf8_string_from_utf8_string_len(char* dst, size_t dst_max_size, const char *s, size_t len)
|
||||
{
|
||||
if ( !s || dst_max_len <= 1 ) {
|
||||
if ( dst_max_len > 0 ) *dst = 0;
|
||||
if ( !s || len <= 0 || dst_max_size <= 1 ) {
|
||||
if ( dst_max_size > 0 ) *dst = 0;
|
||||
return 0;
|
||||
}
|
||||
size_t s_len = utf16_size_of_utf16_string(s);
|
||||
if ( dst_max_len > s_len ) dst_max_len = s_len;
|
||||
else dst_max_len -= 1;
|
||||
memcpy((void*)dst, (void*)s, dst_max_len * sizeof(char16_t));
|
||||
dst[dst_max_len] = 0;
|
||||
return dst_max_len * sizeof(char16_t);
|
||||
dst_max_size -= 1;
|
||||
char* p = dst;
|
||||
char32_t char32;
|
||||
s = get_char32_from_utf8_string(s, &char32);
|
||||
while ( char32 && dst_max_size > 0 && len > 0) {
|
||||
p = get_utf8_from_char32(p, &dst_max_size, char32);
|
||||
s = get_char32_from_utf8_string(s, &char32);
|
||||
len--;
|
||||
}
|
||||
*p = 0;
|
||||
return uintptr_t(p)-uintptr_t(dst)-1;
|
||||
}
|
||||
|
||||
size_t utf32_string_from_utf32_string(char32_t* dst, size_t dst_max_len, const char32_t *s)
|
||||
size_t utf16_string_from_utf16_string(char16_t* dst, size_t dst_max_size, const char16_t *s)
|
||||
{
|
||||
if ( !s || dst_max_len <= 1 ) {
|
||||
if ( dst_max_len > 0 ) *dst = 0;
|
||||
if ( !s || dst_max_size <= 1 ) {
|
||||
if ( dst_max_size > 0 ) *dst = 0;
|
||||
return 0;
|
||||
}
|
||||
dst_max_size -= 1;
|
||||
char16_t* p = dst;
|
||||
char32_t char32;
|
||||
s = get_char32_from_utf16_string(s, &char32);
|
||||
while ( char32 && dst_max_size > 0 ) {
|
||||
p = get_utf16_from_char32(p, &dst_max_size, char32);
|
||||
s = get_char32_from_utf16_string(s, &char32);
|
||||
}
|
||||
*p = 0;
|
||||
return uintptr_t(p)-uintptr_t(dst)-1;
|
||||
// size_t s_len = utf16_size_of_utf16_string(s);
|
||||
// if ( dst_max_size > s_len ) dst_max_size = s_len;
|
||||
// else dst_max_size -= 1;
|
||||
// memcpy((void*)dst, (void*)s, dst_max_size * sizeof(char16_t));
|
||||
// dst[dst_max_size] = 0;
|
||||
// return dst_max_size * sizeof(char16_t);
|
||||
}
|
||||
|
||||
size_t utf16_string_from_utf16_string_len(char16_t* dst, size_t dst_max_size, const char16_t *s, size_t len)
|
||||
{
|
||||
if ( !s || len <= 0 || dst_max_size <= 1 ) {
|
||||
if ( dst_max_size > 0 ) *dst = 0;
|
||||
return 0;
|
||||
}
|
||||
dst_max_size -= 1;
|
||||
char16_t* p = dst;
|
||||
char32_t char32;
|
||||
s = get_char32_from_utf16_string(s, &char32);
|
||||
while ( char32 && dst_max_size > 0 && len > 0) {
|
||||
p = get_utf16_from_char32(p, &dst_max_size, char32);
|
||||
s = get_char32_from_utf16_string(s, &char32);
|
||||
len--;
|
||||
}
|
||||
*p = 0;
|
||||
return uintptr_t(p)-uintptr_t(dst)-1;
|
||||
}
|
||||
|
||||
size_t utf32_string_from_utf32_string(char32_t* dst, size_t dst_max_size, const char32_t *s)
|
||||
{
|
||||
if ( !s || dst_max_size <= 1 ) {
|
||||
if ( dst_max_size > 0 ) *dst = 0;
|
||||
return 0;
|
||||
}
|
||||
size_t s_len = utf32_size_of_utf32_string(s);
|
||||
if ( dst_max_len > s_len ) dst_max_len = s_len;
|
||||
else dst_max_len -= 1;
|
||||
memcpy((void*)dst, (void*)s, dst_max_len * sizeof(char32_t));
|
||||
dst[dst_max_len] = 0;
|
||||
return dst_max_len * sizeof(char32_t);
|
||||
if ( dst_max_size > s_len ) dst_max_size = s_len;
|
||||
else dst_max_size -= 1;
|
||||
memcpy((void*)dst, (void*)s, dst_max_size * sizeof(char32_t));
|
||||
dst[dst_max_size] = 0;
|
||||
return dst_max_size * sizeof(char32_t);
|
||||
}
|
||||
|
||||
size_t wchar_string_from_wchar_string(wchar_t* dst, size_t dst_max_len, const wchar_t *s)
|
||||
size_t utf32_string_from_utf32_string_len(char32_t* dst, size_t dst_max_size, const char32_t *s, size_t len)
|
||||
{
|
||||
if ( !s || len <= 0 || dst_max_size <= 1 ) {
|
||||
if ( dst_max_size > 0 ) *dst = 0;
|
||||
return 0;
|
||||
}
|
||||
size_t s_len = utf32_size_of_utf32_string_len(s, len);
|
||||
if ( dst_max_size > s_len ) dst_max_size = s_len;
|
||||
else dst_max_size -= 1;
|
||||
memcpy((void*)dst, (void*)s, dst_max_size * sizeof(char32_t));
|
||||
dst[dst_max_size] = 0;
|
||||
return dst_max_size * sizeof(char32_t);
|
||||
}
|
||||
|
||||
size_t wchar_string_from_wchar_string(wchar_t* dst, size_t dst_max_size, const wchar_t *s)
|
||||
{
|
||||
#if __WCHAR_MAX__ <= 0xFFFFu
|
||||
return utf16_string_from_utf16_string((char16_t*)dst, dst_max_len, (char16_t*)s);
|
||||
return utf16_string_from_utf16_string((char16_t*)dst, dst_max_size, (char16_t*)s);
|
||||
#else
|
||||
return utf32_string_from_utf32_string((char32_t*)dst, dst_max_len, (char32_t*)s);
|
||||
return utf32_string_from_utf32_string((char32_t*)dst, dst_max_size, (char32_t*)s);
|
||||
#endif
|
||||
}
|
||||
|
||||
size_t wchar_string_from_wchar_string_len(wchar_t* dst, size_t dst_max_size, const wchar_t *s, size_t len)
|
||||
{
|
||||
#if __WCHAR_MAX__ <= 0xFFFFu
|
||||
return utf16_string_from_utf16_string_len((char16_t*)dst, dst_max_size, (char16_t*)s, len);
|
||||
#else
|
||||
return utf32_string_from_utf32_string_len((char32_t*)dst, dst_max_size, (char32_t*)s, len);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ typedef uint16_t char16_t;
|
||||
#endif
|
||||
|
||||
#ifndef __WCHAR_MAX__
|
||||
#define __WCHAR_MAX__ 0xFFFFu
|
||||
#define __WCHAR_MAX__ WCHAR_MAX
|
||||
#endif
|
||||
|
||||
#if __WCHAR_MAX__ <= 0xFFFFu
|
||||
@ -41,9 +41,6 @@ typedef uint16_t char16_t;
|
||||
|
||||
/****** utility *****/
|
||||
|
||||
|
||||
/****** utf8 - utf32 *****/
|
||||
|
||||
/*
|
||||
* Size of an UTF32 char when represented in UTF8
|
||||
* Return value : size
|
||||
@ -57,11 +54,25 @@ size_t utf8_size_of_utf32_char(char32_t c);
|
||||
const char32_t* utf8_size_of_utf32_char_ptr(const char32_t *s, size_t* size);
|
||||
|
||||
/*
|
||||
* Store an utf32 char in dst, if there is enough room (dst_max_len is >= size of utf32 char)
|
||||
* If there is enough room, dst_max_len is decrement and dst is increment and returned
|
||||
* If there isn't enough room, dst_max_len is set to 0 and dst is returned
|
||||
* Store an utf32 char in dst, if there is enough room (dst_max_size is >= size of converted utf32 char)
|
||||
* If there is enough room, dst_max_size is decrement and dst is increment and returned
|
||||
* If there isn't enough room, dst_max_size is set to 0 and dst is returned
|
||||
*/
|
||||
char* get_utf8_from_char32(char* dst, size_t* dst_max_len, char32_t utf32_char);
|
||||
char* get_utf8_from_char32(char* dst, size_t* dst_max_size, char32_t utf32_char);
|
||||
|
||||
/*
|
||||
* Store an utf32 char in dst, if there is enough room (dst_max_size is >= size of converted utf32 char)
|
||||
* If there is enough room, dst_max_size is decrement and dst is increment and returned
|
||||
* If there isn't enough room, dst_max_size is set to 0 and dst is returned
|
||||
*/
|
||||
char16_t* get_utf16_from_char32(char16_t* dst, size_t* dst_max_size, char32_t utf32_char);
|
||||
|
||||
/*
|
||||
* Store an utf32 char in dst, if there is enough room (dst_max_size is >= size of converted utf32 char)
|
||||
* If there is enough room, dst_max_size is decrement and dst is increment and returned
|
||||
* If there isn't enough room, dst_max_size is set to 0 and dst is returned
|
||||
*/
|
||||
char32_t* get_utf32_from_char32(char32_t* dst, size_t* dst_max_size, char32_t utf32_char);
|
||||
|
||||
/*
|
||||
* char32 will be set to 0 at the end of string or at error
|
||||
@ -69,8 +80,15 @@ char* get_utf8_from_char32(char* dst, size_t* dst_max_len, char32_t utf32_char);
|
||||
*/
|
||||
const char* get_char32_from_utf8_string(const char* s, char32_t* char32);
|
||||
|
||||
/*
|
||||
* get nth char32 of an utf8 string
|
||||
* Return value : pointer to the end of string or at the error
|
||||
*/
|
||||
char32_t get_char32_from_utf8_string_at_pos(const char* s, size_t n);
|
||||
|
||||
|
||||
/****** utf8 - utf32 *****/
|
||||
|
||||
/*
|
||||
* Size in bytes of an utf32 string if it were converted to utf8
|
||||
* Return value : pointer to the end of string or at the error
|
||||
@ -85,8 +103,10 @@ size_t utf8_size_of_utf32_string_len(const char32_t* s, size_t len);
|
||||
size_t utf32_size_of_utf8_string(const char* s);
|
||||
size_t utf32_size_of_utf8_string_len(const char* s, size_t len);
|
||||
|
||||
size_t utf32_string_from_utf8_string(char32_t* dst, size_t dst_max_len, const char* s);
|
||||
size_t utf8_string_from_utf32_string(char* dst, size_t dst_max_len, const char32_t *s);
|
||||
size_t utf32_string_from_utf8_string(char32_t* dst, size_t dst_max_size, const char* s);
|
||||
size_t utf32_string_from_utf8_string_len(char32_t* dst, size_t dst_max_size, const char* s, size_t len);
|
||||
size_t utf8_string_from_utf32_string(char* dst, size_t dst_max_size, const char32_t *s);
|
||||
size_t utf8_string_from_utf32_string_len(char* dst, size_t dst_max_size, const char32_t *s, size_t len);
|
||||
|
||||
|
||||
/****** utf8 - utf16 *****/
|
||||
@ -103,8 +123,10 @@ size_t utf8_size_of_utf16_string_len(const char16_t* s, size_t len);
|
||||
size_t utf16_size_of_utf8_string(const char* s);
|
||||
size_t utf16_size_of_utf8_string_len(const char* s, size_t len);
|
||||
|
||||
size_t utf8_string_from_utf16_string(char* dst, size_t dst_max_len, const char16_t *s);
|
||||
size_t utf16_string_from_utf8_string(char16_t* dst, size_t dst_max_len, const char* s);
|
||||
size_t utf8_string_from_utf16_string(char* dst, size_t dst_max_size, const char16_t *s);
|
||||
size_t utf8_string_from_utf16_string_len(char* dst, size_t dst_max_size, const char16_t *s, size_t len);
|
||||
size_t utf16_string_from_utf8_string(char16_t* dst, size_t dst_max_size, const char* s);
|
||||
size_t utf16_string_from_utf8_string_len(char16_t* dst, size_t dst_max_size, const char* s, size_t len);
|
||||
|
||||
|
||||
/****** utf16 - utf32 *****/
|
||||
@ -120,8 +142,10 @@ size_t utf16_size_of_utf32_string_len(const char32_t *s, size_t len);
|
||||
size_t utf32_size_of_utf16_string(const char16_t *s);
|
||||
size_t utf32_size_of_utf16_string_len(const char16_t *s, size_t len);
|
||||
|
||||
size_t utf16_string_from_utf32_string(char16_t* dst, size_t dst_max_len, const char32_t *s);
|
||||
size_t utf32_string_from_utf16_string(char32_t* dst, size_t dst_max_len, const char16_t *s);
|
||||
size_t utf16_string_from_utf32_string(char16_t* dst, size_t dst_max_size, const char32_t *s);
|
||||
size_t utf16_string_from_utf32_string_len(char16_t* dst, size_t dst_max_size, const char32_t *s, size_t len);
|
||||
size_t utf32_string_from_utf16_string(char32_t* dst, size_t dst_max_size, const char16_t *s);
|
||||
size_t utf32_string_from_utf16_string_len(char32_t* dst, size_t dst_max_size, const char16_t *s, size_t len);
|
||||
|
||||
|
||||
/****** utf8 - wchar_t *****/
|
||||
@ -131,8 +155,10 @@ size_t utf8_size_of_wchar_string_len(const wchar_t* s, size_t len);
|
||||
size_t wchar_size_of_utf8_string(const char* s);
|
||||
size_t wchar_size_of_utf8_string_len(const char* s, size_t len);
|
||||
|
||||
size_t utf8_string_from_wchar_string(char* dst, size_t dst_max_len, const wchar_t* s);
|
||||
size_t wchar_string_from_utf8_string(wchar_t* dst, size_t dst_max_len, const char* s);
|
||||
size_t utf8_string_from_wchar_string(char* dst, size_t dst_max_size, const wchar_t* s);
|
||||
size_t utf8_string_from_wchar_string_len(char* dst, size_t dst_max_size, const wchar_t* s, size_t len);
|
||||
size_t wchar_string_from_utf8_string(wchar_t* dst, size_t dst_max_size, const char* s);
|
||||
size_t wchar_string_from_utf8_string_len(wchar_t* dst, size_t dst_max_size, const char* s, size_t len);
|
||||
|
||||
|
||||
/****** utf16 - wchar_t *****/
|
||||
@ -141,8 +167,10 @@ size_t utf16_size_of_wchar_string_len(const wchar_t* s, size_t len);
|
||||
size_t wchar_size_of_utf16_string(const char16_t *s);
|
||||
size_t wchar_size_of_utf16_string_len(const char16_t *s, size_t len);
|
||||
|
||||
size_t utf16_string_from_wchar_string(char16_t* dst, size_t dst_max_len, const wchar_t* s);
|
||||
size_t wchar_string_from_utf16_string(wchar_t* dst, size_t dst_max_len, const char16_t* s);
|
||||
size_t utf16_string_from_wchar_string(char16_t* dst, size_t dst_max_size, const wchar_t* s);
|
||||
size_t utf16_string_from_wchar_string_len(char16_t* dst, size_t dst_max_size, const wchar_t* s, size_t len);
|
||||
size_t wchar_string_from_utf16_string(wchar_t* dst, size_t dst_max_size, const char16_t* s);
|
||||
size_t wchar_string_from_utf16_string_len(wchar_t* dst, size_t dst_max_size, const char16_t* s, size_t len);
|
||||
|
||||
|
||||
/****** utf32 - wchar_t *****/
|
||||
@ -151,8 +179,10 @@ size_t utf32_size_of_wchar_string_len(const wchar_t* s, size_t len);
|
||||
size_t wchar_size_of_utf32_string(const char32_t *s);
|
||||
size_t wchar_size_of_utf32_string_len(const char32_t *s, size_t len);
|
||||
|
||||
size_t utf32_string_from_wchar_string(char32_t* dst, size_t dst_max_len, const wchar_t* s);
|
||||
size_t wchar_string_from_utf32_string(wchar_t* dst, size_t dst_max_len, const char32_t* s);
|
||||
size_t utf32_string_from_wchar_string(char32_t* dst, size_t dst_max_size, const wchar_t* s);
|
||||
size_t utf32_string_from_wchar_string_len(char32_t* dst, size_t dst_max_size, const wchar_t* s, size_t len);
|
||||
size_t wchar_string_from_utf32_string(wchar_t* dst, size_t dst_max_size, const char32_t* s);
|
||||
size_t wchar_string_from_utf32_string_len(wchar_t* dst, size_t dst_max_size, const char32_t* s, size_t len);
|
||||
|
||||
|
||||
/****** no conversion *****/
|
||||
@ -166,10 +196,14 @@ size_t utf32_size_of_utf32_string_len(const char32_t* s, size_t len);
|
||||
size_t wchar_size_of_wchar_string(const wchar_t* s);
|
||||
size_t wchar_size_of_wchar_string_len(const wchar_t* s, size_t len);
|
||||
|
||||
size_t utf8_string_from_utf8_string(char* dst, size_t dst_max_len, const char *s);
|
||||
size_t utf16_string_from_utf16_string(char16_t* dst, size_t dst_max_len, const char16_t *s);
|
||||
size_t utf32_string_from_utf32_string(char32_t* dst, size_t dst_max_len, const char32_t *s);
|
||||
size_t wchar_string_from_wchar_string(wchar_t* dst, size_t dst_max_len, const wchar_t *s);
|
||||
size_t utf8_string_from_utf8_string(char* dst, size_t dst_max_size, const char *s);
|
||||
size_t utf8_string_from_utf8_string_len(char* dst, size_t dst_max_size, const char *s, size_t len);
|
||||
size_t utf16_string_from_utf16_string(char16_t* dst, size_t dst_max_size, const char16_t *s);
|
||||
size_t utf16_string_from_utf16_string_len(char16_t* dst, size_t dst_max_size, const char16_t *s, size_t len);
|
||||
size_t utf32_string_from_utf32_string(char32_t* dst, size_t dst_max_size, const char32_t *s);
|
||||
size_t utf32_string_from_utf32_string_len(char32_t* dst, size_t dst_max_size, const char32_t *s, size_t len);
|
||||
size_t wchar_string_from_wchar_string(wchar_t* dst, size_t dst_max_size, const wchar_t *s);
|
||||
size_t wchar_string_from_wchar_string_len(wchar_t* dst, size_t dst_max_size, const wchar_t *s, size_t len);
|
||||
|
||||
/****** convenience *****/
|
||||
|
||||
@ -186,6 +220,12 @@ inline const char16_t* get_char32_from_string(const char16_t* s, char32_t* char3
|
||||
inline const char32_t* get_char32_from_string(const char32_t* s, char32_t* char32) { *char32 = *s; return s+1; }
|
||||
inline const wchar_t* get_char32_from_string(const wchar_t* s, char32_t* char32) { return (wchar_t*)get_char32_from_string((wchar_cast*)s, char32); }
|
||||
|
||||
inline char* store_utf_from_char32(char* dst, size_t* dst_max_size, char32_t utf32_char) { return get_utf8_from_char32(dst, dst_max_size, utf32_char); }
|
||||
inline char16_t* store_utf_from_char32(char16_t* dst, size_t* dst_max_size, char32_t utf32_char) { return get_utf16_from_char32(dst, dst_max_size, utf32_char); }
|
||||
inline char32_t* store_utf_from_char32(char32_t* dst, size_t* dst_max_size, char32_t utf32_char) { return get_utf32_from_char32(dst, dst_max_size, utf32_char); }
|
||||
inline wchar_t* store_utf_from_char32(wchar_t* dst, size_t* dst_max_size, char32_t utf32_char) { return (wchar_t*)store_utf_from_char32((wchar_cast*)dst, dst_max_size, utf32_char); }
|
||||
|
||||
|
||||
|
||||
inline size_t length_of_utf_string(const char* s) { return utf32_size_of_utf8_string(s); };
|
||||
inline size_t length_of_utf_string(const char16_t* s) { return utf32_size_of_utf16_string(s); };
|
||||
@ -240,34 +280,59 @@ inline size_t utf_size_of_utf_string_len(const char16_t*, const char32_t* s, siz
|
||||
inline size_t utf_size_of_utf_string_len(const char32_t*, const char32_t* s, size_t len) { return utf32_size_of_utf32_string_len(s, len); }
|
||||
inline size_t utf_size_of_utf_string_len(const wchar_t* t, const char32_t* s, size_t len) { return utf_size_of_utf_string_len((wchar_cast*)t, s, len); }
|
||||
|
||||
inline size_t utf_size_of_utf_string_len(const char* t, const wchar_t* s, size_t len) { return utf_size_of_utf_string_len((wchar_cast*)t, (wchar_cast*)s, len); }
|
||||
inline size_t utf_size_of_utf_string_len(const char16_t* t, const wchar_t* s, size_t len) { return utf_size_of_utf_string_len((wchar_cast*)t, (wchar_cast*)s, len); }
|
||||
inline size_t utf_size_of_utf_string_len(const char32_t* t, const wchar_t* s, size_t len) { return utf_size_of_utf_string_len((wchar_cast*)t, (wchar_cast*)s, len); }
|
||||
inline size_t utf_size_of_utf_string_len(const char* t, const wchar_t* s, size_t len) { return utf_size_of_utf_string_len(t, (wchar_cast*)s, len); }
|
||||
inline size_t utf_size_of_utf_string_len(const char16_t* t, const wchar_t* s, size_t len) { return utf_size_of_utf_string_len(t, (wchar_cast*)s, len); }
|
||||
inline size_t utf_size_of_utf_string_len(const char32_t* t, const wchar_t* s, size_t len) { return utf_size_of_utf_string_len(t, (wchar_cast*)s, len); }
|
||||
inline size_t utf_size_of_utf_string_len(const wchar_t* t, const wchar_t* s, size_t len) { return utf_size_of_utf_string_len((wchar_cast*)t, (wchar_cast*)s, len); }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
inline size_t utf_string_from_utf_string(char* dst, size_t dst_max_len, const char* s) { return utf8_string_from_utf8_string(dst, dst_max_len, s); }
|
||||
inline size_t utf_string_from_utf_string(char16_t* dst, size_t dst_max_len, const char* s) { return utf16_string_from_utf8_string(dst, dst_max_len, s); }
|
||||
inline size_t utf_string_from_utf_string(char32_t* dst, size_t dst_max_len, const char* s) { return utf32_string_from_utf8_string(dst, dst_max_len, s); }
|
||||
inline size_t utf_string_from_utf_string(wchar_t* dst, size_t dst_max_len, const char* s) { return utf_string_from_utf_string((wchar_cast*)dst, dst_max_len, s); }
|
||||
inline size_t utf_string_from_utf_string(char* dst, size_t dst_max_size, const char* s) { return utf8_string_from_utf8_string(dst, dst_max_size, s); }
|
||||
inline size_t utf_string_from_utf_string(char16_t* dst, size_t dst_max_size, const char* s) { return utf16_string_from_utf8_string(dst, dst_max_size, s); }
|
||||
inline size_t utf_string_from_utf_string(char32_t* dst, size_t dst_max_size, const char* s) { return utf32_string_from_utf8_string(dst, dst_max_size, s); }
|
||||
inline size_t utf_string_from_utf_string(wchar_t* dst, size_t dst_max_size, const char* s) { return utf_string_from_utf_string((wchar_cast*)dst, dst_max_size, s); }
|
||||
|
||||
inline size_t utf_string_from_utf_string(char* dst, size_t dst_max_len, const char16_t *s) { return utf8_string_from_utf16_string(dst, dst_max_len, s); }
|
||||
inline size_t utf_string_from_utf_string(char16_t* dst, size_t dst_max_len, const char16_t *s) { return utf16_string_from_utf16_string(dst, dst_max_len, s); }
|
||||
inline size_t utf_string_from_utf_string(char32_t* dst, size_t dst_max_len, const char16_t *s) { return utf32_string_from_utf16_string(dst, dst_max_len, s); }
|
||||
inline size_t utf_string_from_utf_string(wchar_t* dst, size_t dst_max_len, const char16_t *s) { return utf_string_from_utf_string((wchar_cast*)dst, dst_max_len, s); }
|
||||
inline size_t utf_string_from_utf_string(char* dst, size_t dst_max_size, const char16_t *s) { return utf8_string_from_utf16_string(dst, dst_max_size, s); }
|
||||
inline size_t utf_string_from_utf_string(char16_t* dst, size_t dst_max_size, const char16_t *s) { return utf16_string_from_utf16_string(dst, dst_max_size, s); }
|
||||
inline size_t utf_string_from_utf_string(char32_t* dst, size_t dst_max_size, const char16_t *s) { return utf32_string_from_utf16_string(dst, dst_max_size, s); }
|
||||
inline size_t utf_string_from_utf_string(wchar_t* dst, size_t dst_max_size, const char16_t *s) { return utf_string_from_utf_string((wchar_cast*)dst, dst_max_size, s); }
|
||||
|
||||
inline size_t utf_string_from_utf_string(char* dst, size_t dst_max_size, const char32_t *s) { return utf8_string_from_utf32_string(dst, dst_max_size, s); }
|
||||
inline size_t utf_string_from_utf_string(char16_t* dst, size_t dst_max_size, const char32_t *s) { return utf16_string_from_utf32_string(dst, dst_max_size, s); }
|
||||
inline size_t utf_string_from_utf_string(char32_t* dst, size_t dst_max_size, const char32_t *s) { return utf32_string_from_utf32_string(dst, dst_max_size, s); }
|
||||
inline size_t utf_string_from_utf_string(wchar_t* dst, size_t dst_max_size, const char32_t *s) { return utf_string_from_utf_string((wchar_cast*)dst, dst_max_size, s); }
|
||||
|
||||
inline size_t utf_string_from_utf_string(char* dst, size_t dst_max_size, const wchar_t *s) { return utf_string_from_utf_string(dst, dst_max_size, (wchar_cast*)s); }
|
||||
inline size_t utf_string_from_utf_string(char16_t* dst, size_t dst_max_size, const wchar_t *s) { return utf_string_from_utf_string(dst, dst_max_size, (wchar_cast*)s); }
|
||||
inline size_t utf_string_from_utf_string(char32_t* dst, size_t dst_max_size, const wchar_t *s) { return utf_string_from_utf_string(dst, dst_max_size, (wchar_cast*)s); }
|
||||
inline size_t utf_string_from_utf_string(wchar_t* dst, size_t dst_max_size, const wchar_t *s) { return utf_string_from_utf_string(dst, dst_max_size, (wchar_cast*)s); }
|
||||
|
||||
|
||||
|
||||
|
||||
inline size_t utf_string_from_utf_string_len(char* dst, size_t dst_max_size, const char* s, size_t len) { return utf8_string_from_utf8_string_len(dst, dst_max_size, s, len); }
|
||||
inline size_t utf_string_from_utf_string_len(char16_t* dst, size_t dst_max_size, const char* s, size_t len) { return utf16_string_from_utf8_string_len(dst, dst_max_size, s, len); }
|
||||
inline size_t utf_string_from_utf_string_len(char32_t* dst, size_t dst_max_size, const char* s, size_t len) { return utf32_string_from_utf8_string_len(dst, dst_max_size, s, len); }
|
||||
inline size_t utf_string_from_utf_string_len(wchar_t* dst, size_t dst_max_size, const char* s, size_t len) { return utf_string_from_utf_string_len((wchar_cast*)dst, dst_max_size, s, len); }
|
||||
|
||||
inline size_t utf_string_from_utf_string_len(char* dst, size_t dst_max_size, const char16_t * s, size_t len) { return utf8_string_from_utf16_string_len(dst, dst_max_size, s, len); }
|
||||
inline size_t utf_string_from_utf_string_len(char16_t* dst, size_t dst_max_size, const char16_t * s, size_t len) { return utf16_string_from_utf16_string_len(dst, dst_max_size, s, len); }
|
||||
inline size_t utf_string_from_utf_string_len(char32_t* dst, size_t dst_max_size, const char16_t * s, size_t len) { return utf32_string_from_utf16_string_len(dst, dst_max_size, s, len); }
|
||||
inline size_t utf_string_from_utf_string_len(wchar_t* dst, size_t dst_max_size, const char16_t * s, size_t len) { return utf_string_from_utf_string_len((wchar_cast*)dst, dst_max_size, s, len); }
|
||||
|
||||
inline size_t utf_string_from_utf_string_len(char* dst, size_t dst_max_size, const char32_t * s, size_t len) { return utf8_string_from_utf32_string_len(dst, dst_max_size, s, len); }
|
||||
inline size_t utf_string_from_utf_string_len(char16_t* dst, size_t dst_max_size, const char32_t * s, size_t len) { return utf16_string_from_utf32_string_len(dst, dst_max_size, s, len); }
|
||||
inline size_t utf_string_from_utf_string_len(char32_t* dst, size_t dst_max_size, const char32_t * s, size_t len) { return utf32_string_from_utf32_string_len(dst, dst_max_size, s, len); }
|
||||
inline size_t utf_string_from_utf_string_len(wchar_t* dst, size_t dst_max_size, const char32_t * s, size_t len) { return utf_string_from_utf_string_len((wchar_cast*)dst, dst_max_size, s, len); }
|
||||
|
||||
inline size_t utf_string_from_utf_string_len(char* dst, size_t dst_max_size, const wchar_t * s, size_t len) { return utf_string_from_utf_string_len(dst, dst_max_size, (wchar_cast*)s, len); }
|
||||
inline size_t utf_string_from_utf_string_len(char16_t* dst, size_t dst_max_size, const wchar_t * s, size_t len) { return utf_string_from_utf_string_len(dst, dst_max_size, (wchar_cast*)s, len); }
|
||||
inline size_t utf_string_from_utf_string_len(char32_t* dst, size_t dst_max_size, const wchar_t * s, size_t len) { return utf_string_from_utf_string_len(dst, dst_max_size, (wchar_cast*)s, len); }
|
||||
inline size_t utf_string_from_utf_string_len(wchar_t* dst, size_t dst_max_size, const wchar_t * s, size_t len) { return utf_string_from_utf_string_len(dst, dst_max_size, (wchar_cast*)s, len); }
|
||||
|
||||
inline size_t utf_string_from_utf_string(char* dst, size_t dst_max_len, const char32_t *s) { return utf8_string_from_utf32_string(dst, dst_max_len, s); }
|
||||
inline size_t utf_string_from_utf_string(char16_t* dst, size_t dst_max_len, const char32_t *s) { return utf16_string_from_utf32_string(dst, dst_max_len, s); }
|
||||
inline size_t utf_string_from_utf_string(char32_t* dst, size_t dst_max_len, const char32_t *s) { return utf32_string_from_utf32_string(dst, dst_max_len, s); }
|
||||
inline size_t utf_string_from_utf_string(wchar_t* dst, size_t dst_max_len, const char32_t *s) { return utf_string_from_utf_string((wchar_cast*)dst, dst_max_len, s); }
|
||||
|
||||
inline size_t utf_string_from_utf_string(char* dst, size_t dst_max_len, const wchar_t *s) { return utf_string_from_utf_string(dst, dst_max_len, (wchar_cast*)s); }
|
||||
inline size_t utf_string_from_utf_string(char16_t* dst, size_t dst_max_len, const wchar_t *s) { return utf_string_from_utf_string(dst, dst_max_len, (wchar_cast*)s); }
|
||||
inline size_t utf_string_from_utf_string(char32_t* dst, size_t dst_max_len, const wchar_t *s) { return utf_string_from_utf_string(dst, dst_max_len, (wchar_cast*)s); }
|
||||
inline size_t utf_string_from_utf_string(wchar_t* dst, size_t dst_max_len, const wchar_t *s) { return utf_string_from_utf_string(dst, dst_max_len, (wchar_cast*)s); }
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include <Platform.h>
|
||||
#include "../cpp_foundation/XString.h"
|
||||
#include "../cpp_foundation/XStringArray.h"
|
||||
#include "../cpp_foundation/XStringW.h"
|
||||
#include "global_test.h"
|
||||
|
||||
|
||||
@ -40,7 +39,7 @@ CHAR16 *Old1_RemoveLoadOption(IN CONST CHAR16 *LoadOptions, IN CONST CHAR16 *Loa
|
||||
if (Placement == NULL) return EfiStrDuplicate(LoadOptions);
|
||||
|
||||
// Get placement of option in original options
|
||||
Offset = (Placement - LoadOptions);
|
||||
Offset = UINTN(Placement - LoadOptions);
|
||||
Length = StrLen(LoadOptions);
|
||||
OptionLength = StrLen(LoadOption);
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include <Platform.h>
|
||||
#include "../cpp_foundation/XStringWArray.h"
|
||||
#include "../cpp_foundation/XStringW.h"
|
||||
|
||||
int XStringWArray_tests()
|
||||
{
|
||||
|
@ -1,191 +0,0 @@
|
||||
#include <Platform.h>
|
||||
#include "../cpp_foundation/XStringW.h"
|
||||
#include "../cpp_foundation/unicode_conversions.h"
|
||||
#include "global_test.h"
|
||||
|
||||
|
||||
//#include <wchar.h>
|
||||
|
||||
|
||||
int XStringW_tests()
|
||||
{
|
||||
|
||||
#ifdef JIEF_DEBUG
|
||||
|
||||
XStringW a = L"toto"_XSW;
|
||||
|
||||
// DebugLog(2, "XStringW_tests -> Enter\n");
|
||||
#endif
|
||||
|
||||
if ( global_str3 != L"global_str3"_XSW ) return 1;
|
||||
if ( global_str4 != L"global_str4"_XSW ) return 2;
|
||||
|
||||
// Check default ctor
|
||||
{
|
||||
XStringW str;
|
||||
if (str.size() != 0) return 3;
|
||||
if (str.wc_str() == NULL) return 4;
|
||||
}
|
||||
|
||||
|
||||
// Check ctor with value (or check takeValueFrom while we are waiting to put back ctor(const char*)
|
||||
#ifdef XSTRINGW_HAS_CTOR_LITTERAL
|
||||
{
|
||||
{
|
||||
XStringW str("");
|
||||
if ( str != "" ) return 100;
|
||||
}
|
||||
{
|
||||
XStringW str("1");
|
||||
if ( str != "1" ) return 101;
|
||||
}
|
||||
}
|
||||
#else
|
||||
{
|
||||
XStringW str;
|
||||
str.takeValueFrom("");
|
||||
if (str.size() != 0) return 110;
|
||||
str.takeValueFrom("1");
|
||||
if ( str != L"1"_XSW ) return 111;
|
||||
str.StrCat(L"2");
|
||||
if ( str != L"12"_XSW ) return 112;
|
||||
}
|
||||
#endif
|
||||
|
||||
// // check [] operator
|
||||
// {
|
||||
// XStringW str;
|
||||
// str.takeValueFrom("01234567890123456789");
|
||||
// wchar_t c;
|
||||
// c = str[(char)1];
|
||||
// if ( c != '1' ) return 201;
|
||||
// c = str[(unsigned char)2];
|
||||
// if ( c != '2' ) return 202;
|
||||
// c = str[(short)3];
|
||||
// if ( c != '3' ) return 203;
|
||||
// c = str[(unsigned short)4];
|
||||
// if ( c != '4' ) return 204;
|
||||
// c = str[(int)5];
|
||||
// if ( c != '5' ) return 205;
|
||||
// c = str[(unsigned int)6];
|
||||
// if ( c != '6' ) return 206;
|
||||
// c = str[(long)7];
|
||||
// if ( c != '7' ) return 207;
|
||||
// c = str[(unsigned long)8];
|
||||
// if ( c != '8' ) return 208;
|
||||
// c = str[(long long)9];
|
||||
// if ( c != '9' ) return 209;
|
||||
// c = str[(unsigned long long)10];
|
||||
// if ( c != '0' ) return 210;
|
||||
// }
|
||||
|
||||
// Quick check of StrnCpy,StrnCat,Insert,+=
|
||||
{
|
||||
XStringW str;
|
||||
str.takeValueFrom(L"12");
|
||||
XStringW str2;
|
||||
if ( !str2.isEmpty() ) return 10;
|
||||
str2.StrnCpy(str.data(), 2);
|
||||
if ( str2 != L"12"_XSW ) return 11;
|
||||
str2.StrnCat(L"345", 2);
|
||||
if ( str2 != L"1234"_XSW ) return 12;
|
||||
str2.Insert(1, str);
|
||||
if ( str2 != L"112234"_XSW ) return 13;
|
||||
str2 += L"6";
|
||||
if ( str2 != L"1122346"_XSW ) return 14;
|
||||
}
|
||||
|
||||
//wchar_t c2 = L'Ň';
|
||||
//printf("1=%lc\n", c2);
|
||||
//const char* s1 = "𐌾";
|
||||
XStringW str2;
|
||||
str2.SWPrintf("%c", 'a'); // signle UTF8 ascii char
|
||||
if ( str2 != L"a"_XSW ) return 20;
|
||||
str2.takeValueFrom(L"ab"); // UTF16(32) string containing ascii char
|
||||
if ( str2 != L"ab"_XSW ) return 21;
|
||||
#ifdef _MSC_VER
|
||||
// IMPORTANT : you can't pass a litteral char in a vararg function with Visual Studio (Microsoft strikes again :-).
|
||||
// At least, you got a warning C4066
|
||||
// IMPORTANT2 : Litteral string containing UTF16 char are WRONG. And you don't get a warning !!! If litteral is only ascii, it's ok.
|
||||
// Maybe it's compilation option but I didn't find them.
|
||||
wchar_t c = 'Ň'; // using an imtermediary var for Microsoft.
|
||||
|
||||
|
||||
wchar_t s[2]; // wchar_t s2[] = L"Ň";
|
||||
s[0] = 'Ň';
|
||||
s[1] = 0;
|
||||
|
||||
str2.SWPrintf("%lc", c); // UTF16(32) char. (2 bytes in total if UTF16)
|
||||
if (str2 != s) return 22;
|
||||
str2.takeValueFrom("");
|
||||
if (str2.size() != 0) return 221;
|
||||
str2.takeValueFrom(s); // this is a UTF8 string 2 bytes long
|
||||
if (str2 != s) return 23;
|
||||
#else
|
||||
str2.SWPrintf("%lc", L'Ň'); // signe UTF16(32) char. (2 bytes in total if UTF16)
|
||||
if ( str2 != L"Ň"_XSW ) return 22;
|
||||
str2.takeValueFrom("");
|
||||
if (str2.size() != 0) return 221;
|
||||
#ifdef XSTRINGW_HAS_CTOR_LITTERAL
|
||||
str2.takeValueFrom("Ň"); // this is a UTF8 string 2 bytes long
|
||||
if (str2 != "Ň") return 23; // utf8 litteral are converted to an XStringW if ctor is available.
|
||||
#endif
|
||||
str2.takeValueFrom("");
|
||||
if (str2.size() != 0) return 231;
|
||||
#ifdef XSTRINGW_HAS_CTOR_LITTERAL
|
||||
str2.takeValueFrom(L"Ň"); // this is a UTF8 string 2 bytes long
|
||||
if (str2 != "Ň") return 24;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if __WCHAR_MAX__ > 0xFFFFu
|
||||
str2.SWPrintf("%lc", L'𐌾'); // L'𐌾' // this char cannot convert to an UTF16 char. So it doesn't compile with -fshort-wchar
|
||||
if ( str2 != L"𐌾" ) return 30;
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef _MSC_VER
|
||||
// "𐌾" in UTF16 is 2 char : 0xd800, 0xdf3e
|
||||
|
||||
str2.takeValueFrom(L"𐌾"); // this is a UTF8 string 4 bytes long
|
||||
if ( str2 != L"𐌾"_XSW ) return 31;
|
||||
str2.takeValueFrom(L"𐌾"); // this is a UTF16 or UTF32 string (depending of -fshort-wchar)
|
||||
if ( str2 != L"𐌾"_XSW ) return 32;
|
||||
|
||||
#ifdef XSTRINGW_HAS_CTOR_LITTERAL
|
||||
{
|
||||
XStringW str3("a");
|
||||
if ( str3 != L"a" ) return 40;
|
||||
XStringW str4("aŇ𐌾");
|
||||
if ( str4 != L"aŇ𐌾" ) return 41;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
{
|
||||
XStringW utf16;
|
||||
utf16.takeValueFrom(L"Выход из подменю, обновление главного меню");
|
||||
for ( size_t i = 0 ; i < utf16.size() ; i++ ) {
|
||||
if ( utf16.wc_str()[i] != utf16.wc_str()[i] ) {
|
||||
return 100;
|
||||
}
|
||||
}
|
||||
XStringW utf16_2;
|
||||
utf16_2.takeValueFrom("Выход из подменю, обновление главного меню");
|
||||
if ( utf16 != utf16_2 ) {
|
||||
return 101;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifndef _MSC_VER
|
||||
wchar_t* s = XStringW().takeValueFrom("aa").forgetDataWithoutFreeing();
|
||||
if ( memcmp(s, L"aa", sizeof(L"aa")*sizeof(wchar_t) ) == 0 ) return 102; // sizeof(L"aa") include null terminator
|
||||
#endif
|
||||
// XStringW CommonName(L"EFI\\CLOVER\\misc\\screenshot");
|
||||
// for (UINTN Index = 0; Index < 20; Index++) {
|
||||
// XStringW Name = CommonName + SPrintf("%lld", Index) + L".png";
|
||||
// DebugLog(2, "XStringW_test shot: %s\n", Name.data());
|
||||
// }
|
||||
return 0;
|
||||
}
|
@ -1 +0,0 @@
|
||||
int XStringW_tests();
|
File diff suppressed because it is too large
Load Diff
@ -1 +1 @@
|
||||
int XString_tests();
|
||||
int XStringx_tests();
|
||||
|
@ -1,5 +1,4 @@
|
||||
#include <Platform.h> // Only use angled for Platform, else, xcode project won't compile
|
||||
#include "../cpp_foundation/XStringW.h"
|
||||
#include "../cpp_foundation/XArray.h"
|
||||
#include "../cpp_foundation/XObjArray.h"
|
||||
|
||||
@ -9,7 +8,6 @@
|
||||
#include "XObjArray_tests.h"
|
||||
#include "XStringWArray_test.h"
|
||||
#include "XString_test.h"
|
||||
#include "XStringW_test.h"
|
||||
#include "strcmp_test.h"
|
||||
#include "strncmp_test.h"
|
||||
#include "strlen_test.h"
|
||||
@ -33,7 +31,13 @@ bool all_tests()
|
||||
bool all_ok = true;
|
||||
int ret;
|
||||
|
||||
#ifdef JIEF_DEBUG
|
||||
#ifdef XSTRING16_DEV
|
||||
ret = XStringx_tests();
|
||||
if ( ret != 0 ) {
|
||||
DebugLog(2, "XString16_tests() failed at test %d\n", ret);
|
||||
all_ok = false;
|
||||
}
|
||||
return ret;
|
||||
// ret = XUINTN_tests();
|
||||
// if ( ret != 0 ) {
|
||||
// DebugLog(2, "XUINTN_tests() failed at test %d\n", ret);
|
||||
@ -92,18 +96,6 @@ bool all_tests()
|
||||
DebugLog(2, "XObjArray_tests() failed at test %d\n", ret);
|
||||
all_ok = false;
|
||||
}
|
||||
#ifndef _MSC_VER
|
||||
ret = XString_tests();
|
||||
if ( ret != 0 ) {
|
||||
DebugLog(2, "XString_tests() failed at test %d\n", ret);
|
||||
all_ok = false;
|
||||
}
|
||||
ret = XStringW_tests();
|
||||
if ( ret != 0 ) {
|
||||
DebugLog(2, "XStringW_tests() failed at test %d\n", ret);
|
||||
all_ok = false;
|
||||
}
|
||||
#endif
|
||||
ret = XStringWArray_tests();
|
||||
if ( ret != 0 ) {
|
||||
DebugLog(2, "XStringWArray_tests() failed at test %d\n", ret);
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include <Platform.h>
|
||||
#include "global_test.h"
|
||||
#include "../cpp_foundation/XString.h"
|
||||
#include "../cpp_foundation/XStringW.h"
|
||||
|
||||
|
||||
|
||||
|
@ -1,12 +1,11 @@
|
||||
#include "../cpp_foundation/XString.h"
|
||||
#include "../cpp_foundation/XStringW.h"
|
||||
|
||||
class XStringWTest : public XStringW
|
||||
{
|
||||
public:
|
||||
XStringWTest(const wchar_t *S) : XStringW()
|
||||
{
|
||||
StrCpy(S);
|
||||
strcpy(S);
|
||||
}
|
||||
};
|
||||
|
||||
@ -15,7 +14,7 @@ class XStringTest : public XString
|
||||
public:
|
||||
XStringTest(const char *S) : XString()
|
||||
{
|
||||
StrCpy(S);
|
||||
strcpy(S);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
*/
|
||||
|
||||
#include "loader.h"
|
||||
#include "../cpp_foundation/XStringW.h"
|
||||
#include "../cpp_foundation/XString.h"
|
||||
#include "entry_scan.h"
|
||||
#include "../Platform/Settings.h"
|
||||
#include "../Platform/Hibernate.h"
|
||||
@ -251,7 +251,7 @@ UINT8 GetOSTypeFromPath(IN CONST CHAR16 *Path)
|
||||
// (StriCmp(Path, L"\\bootmgr.efi") == 0) || //never worked, just extra icon in menu
|
||||
(StriCmp(Path, L"\\EFI\\MICROSOFT\\BOOT\\cdboot.efi") == 0)) {
|
||||
return OSTYPE_WINEFI;
|
||||
} else if (StrniCmp(Path, LINUX_FULL_LOADER_PATH.wc_str(), LINUX_FULL_LOADER_PATH.size()) == 0) {
|
||||
} else if (LINUX_FULL_LOADER_PATH.EqualIC(Path)) {
|
||||
return OSTYPE_LINEFI;
|
||||
} else if (StriStr(Path, L"grubx64.efi") != NULL) {
|
||||
return OSTYPE_LINEFI;
|
||||
@ -301,7 +301,7 @@ STATIC CONST CHAR16 *LinuxIconNameFromPath(IN CONST CHAR16 *Path,
|
||||
}
|
||||
|
||||
// Try to open the linux issue
|
||||
if ((RootDir != NULL) && (StrniCmp(Path, LINUX_FULL_LOADER_PATH.wc_str(), LINUX_FULL_LOADER_PATH.size()) == 0)) {
|
||||
if ((RootDir != NULL) && LINUX_FULL_LOADER_PATH.EqualIC(Path)) {
|
||||
CHAR8 *Issue = NULL;
|
||||
UINTN IssueLen = 0;
|
||||
if (!EFI_ERROR(egLoadFile(RootDir, LINUX_ISSUE_PATH.wc_str(), (UINT8 **)&Issue, &IssueLen)) && (Issue != NULL)) {
|
||||
@ -1259,7 +1259,7 @@ VOID ScanLoader(VOID)
|
||||
if (FileExists(SelfRootDir, File.wc_str())) {
|
||||
XStringW LoaderTitle = SWPrintf("%s OS EFI boot menu", OSName.c_str());
|
||||
XString IconXS = OSName + ",linux"_XS;
|
||||
IconXS.ToLower(); //to avoid misconception
|
||||
IconXS.lowerAscii(); //to avoid misconception
|
||||
DBG(" found entry %s\n", IconXS.c_str());
|
||||
XImage ImageX; //will the image be destroyed or rewritten by next image after the cycle end?
|
||||
ImageX = ThemeX.LoadOSIcon(IconXS);
|
||||
|
@ -1069,7 +1069,7 @@ VOID REFIT_MENU_SCREEN::TextMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamT
|
||||
// determine width of the menu
|
||||
TextMenuWidth = 50; // minimum
|
||||
for (i = 0; i <= ScrollState.MaxIndex; i++) {
|
||||
ItemWidth = Entries[i].Title.size();
|
||||
ItemWidth = Entries[i].Title.length();
|
||||
|
||||
if (TextMenuWidth < ItemWidth) {
|
||||
TextMenuWidth = ItemWidth;
|
||||
@ -1636,7 +1636,7 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
|
||||
|
||||
for (INTN i = ScrollState.FirstVisible, j = 0; i <= ScrollState.LastVisible; i++, j++) {
|
||||
REFIT_ABSTRACT_MENU_ENTRY *Entry = &Entries[i];
|
||||
TitleLen = Entry->Title.size();
|
||||
TitleLen = Entry->Title.length();
|
||||
|
||||
Entry->Place.XPos = EntriesPosX;
|
||||
Entry->Place.YPos = EntriesPosY + j * ThemeX.TextHeight;
|
||||
@ -1656,7 +1656,7 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
|
||||
if ( Entry->getREFIT_INPUT_DIALOG() ) {
|
||||
REFIT_INPUT_DIALOG* inputDialogEntry = Entry->getREFIT_INPUT_DIALOG();
|
||||
if (inputDialogEntry->Item && inputDialogEntry->Item->ItemType == BoolValue) {
|
||||
Entry->Place.Width = ResultString.size() * ScaledWidth;
|
||||
Entry->Place.Width = ResultString.length() * ScaledWidth;
|
||||
//possible artefacts
|
||||
DrawMenuText(XStringW().takeValueFrom(" "), 0, EntriesPosX, Entry->Place.YPos, 0xFFFF);
|
||||
DrawMenuText(ResultString, (i == ScrollState.CurrentSelection) ? (MenuWidth) : 0,
|
||||
@ -1667,7 +1667,7 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
|
||||
// text input
|
||||
ResultString += ((REFIT_INPUT_DIALOG*)(Entry))->Item->SValue;
|
||||
ResultString += L" ";
|
||||
Entry->Place.Width = ResultString.size() * ScaledWidth;
|
||||
Entry->Place.Width = ResultString.length() * ScaledWidth;
|
||||
// Slice - suppose to use Row as Cursor in text
|
||||
DrawMenuText(ResultString, (i == ScrollState.CurrentSelection) ? MenuWidth : 0,
|
||||
EntriesPosX,
|
||||
@ -1714,7 +1714,7 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
|
||||
// last selection
|
||||
REFIT_ABSTRACT_MENU_ENTRY *EntryL = &Entries[ScrollState.LastSelection];
|
||||
REFIT_ABSTRACT_MENU_ENTRY *EntryC = &Entries[ScrollState.CurrentSelection];
|
||||
TitleLen = EntryL->Title.size();
|
||||
TitleLen = EntryL->Title.length();
|
||||
ResultString = EntryL->Title;
|
||||
//clovy//PlaceCentre = (TextHeight - (INTN)(Buttons[2]->Height * GlobalConfig.Scale)) / 2;
|
||||
//clovy//PlaceCentre = (PlaceCentre>0)?PlaceCentre:0;
|
||||
@ -1774,7 +1774,7 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
|
||||
|
||||
// current selection
|
||||
ResultString = EntryC->Title;
|
||||
TitleLen = EntryC->Title.size();
|
||||
TitleLen = EntryC->Title.length();
|
||||
if ( EntryC->getREFIT_MENU_SWITCH() ) {
|
||||
if (EntryC->getREFIT_MENU_SWITCH()->Item->IValue == 3) {
|
||||
OldChosenItem = (OldChosenTheme == 0xFFFF) ? 0: OldChosenTheme + 1;;
|
||||
|
@ -40,8 +40,8 @@
|
||||
#include "../refit/lib.h"
|
||||
|
||||
#include "../cpp_foundation/XObjArray.h"
|
||||
#include "../cpp_foundation/XString.h"
|
||||
#include "../cpp_foundation/XStringWArray.h"
|
||||
#include "../cpp_foundation/XStringW.h"
|
||||
#include "../libeg/XPointer.h"
|
||||
#include "../libeg/XCinema.h"
|
||||
#include "menu_items/menu_items.h"
|
||||
|
@ -40,8 +40,8 @@
|
||||
#include "../../refit/lib.h"
|
||||
#ifdef __cplusplus
|
||||
#include "../../cpp_foundation/XObjArray.h"
|
||||
#include "../../cpp_foundation/XString.h"
|
||||
#include "../../cpp_foundation/XStringWArray.h"
|
||||
#include "../../cpp_foundation/XStringW.h"
|
||||
#include "../../libeg/XPointer.h"
|
||||
#endif
|
||||
|
||||
|
@ -42,7 +42,6 @@
|
||||
#include "../../cpp_foundation/XObjArray.h"
|
||||
#include "../../cpp_foundation/XStringWArray.h"
|
||||
#include "../../cpp_foundation/XString.h"
|
||||
#include "../../cpp_foundation/XStringW.h"
|
||||
#include "../../libeg/XPointer.h"
|
||||
#endif
|
||||
|
||||
|
@ -454,7 +454,7 @@ INTN renderSVGtext(XImage* TextBufferXY_ptr, INTN posX, INTN posY, INTN textType
|
||||
XImage& TextBufferXY = *TextBufferXY_ptr;
|
||||
INTN Width;
|
||||
// UINTN i;
|
||||
UINTN len;
|
||||
// UINTN len;
|
||||
NSVGparser* p;
|
||||
NSVGrasterizer* rast;
|
||||
if (!textFace[textType].valid) {
|
||||
@ -492,7 +492,6 @@ INTN renderSVGtext(XImage* TextBufferXY_ptr, INTN posX, INTN posY, INTN textType
|
||||
nsvg__xformIdentity(text->xform);
|
||||
p->text = text;
|
||||
|
||||
len = string.size();
|
||||
Width = TextBufferXY.GetWidth();
|
||||
if ( fontSVG->unitsPerEm < 1.f ) {
|
||||
fontSVG->unitsPerEm = 1000.f;
|
||||
@ -508,8 +507,9 @@ INTN renderSVGtext(XImage* TextBufferXY_ptr, INTN posX, INTN posY, INTN textType
|
||||
x = (float)posX; //0.f;
|
||||
y = (float)posY + fontSVG->bbox[1] * Scale;
|
||||
p->isText = TRUE;
|
||||
for (UINTN i=0; i < len; i++) {
|
||||
CHAR16 letter = string.wc_str()[i];
|
||||
size_t len = string.length();
|
||||
for (size_t i=0; i < len; i++) {
|
||||
CHAR16 letter = string.char16At(i);
|
||||
if (!letter) {
|
||||
break;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
#ifndef LIBEG_VECTORGRAPHICS_H_
|
||||
#define LIBEG_VECTORGRAPHICS_H_
|
||||
|
||||
#include "../cpp_foundation/XStringW.h"
|
||||
#include "../cpp_foundation/XString.h"
|
||||
#include "../Platform/plist.h"
|
||||
#include "XImage.h"
|
||||
|
||||
|
@ -14,7 +14,7 @@ extern "C" {
|
||||
}
|
||||
#include "../cpp_foundation/XToolsCommon.h"
|
||||
#include "../cpp_foundation/XArray.h"
|
||||
#include "../cpp_foundation/XStringW.h"
|
||||
#include "../cpp_foundation/XString.h"
|
||||
#include "../libeg/libeg.h"
|
||||
#include "XImage.h"
|
||||
#include "XTheme.h"
|
||||
|
@ -13,7 +13,7 @@ extern "C" {
|
||||
}
|
||||
#include "../cpp_foundation/XToolsCommon.h"
|
||||
#include "../cpp_foundation/XArray.h"
|
||||
#include "../cpp_foundation/XStringW.h"
|
||||
#include "../cpp_foundation/XString.h"
|
||||
#include "../libeg/libeg.h"
|
||||
//#include "lodepng.h"
|
||||
//
|
||||
|
@ -396,7 +396,7 @@ const XImage& XTheme::LoadOSIcon(const XString& Full)
|
||||
XString Third;
|
||||
const XImage *ReturnImage;
|
||||
UINTN Comma = Full.IdxOf(',');
|
||||
UINTN Size = Full.size();
|
||||
UINTN Size = Full.length();
|
||||
// DBG("IconName=%ls comma=%lld size=%lld\n", OSIconName, Comma, Size);
|
||||
if (Comma != MAX_XSIZE) { //Comma
|
||||
First = "os_"_XS + Full.SubString(0, Comma);
|
||||
|
@ -242,12 +242,13 @@
|
||||
cpp_foundation/unicode_conversions.h
|
||||
cpp_foundation/XArray.h
|
||||
cpp_foundation/XObjArray.h
|
||||
cpp_foundation/XString.cpp
|
||||
cpp_foundation/XString.h
|
||||
# cpp_foundation/XString.cpp
|
||||
# cpp_foundation/XString.h
|
||||
cpp_foundation/XStringArray.cpp
|
||||
cpp_foundation/XStringArray.h
|
||||
cpp_foundation/XStringW.cpp
|
||||
cpp_foundation/XStringW.h
|
||||
# cpp_foundation/XStringW.cpp
|
||||
# cpp_foundation/XStringW.h
|
||||
cpp_foundation/XStringUtf.cpp
|
||||
cpp_foundation/XStringWArray.cpp
|
||||
cpp_foundation/XStringWArray.h
|
||||
cpp_foundation/XToolsCommon.cpp
|
||||
@ -275,10 +276,11 @@
|
||||
cpp_unit_test/XArray_tests.h
|
||||
cpp_unit_test/XObjArray_tests.cpp
|
||||
cpp_unit_test/XObjArray_tests.h
|
||||
cpp_unit_test/XString_test.cpp
|
||||
cpp_unit_test/XString_test.h
|
||||
cpp_unit_test/XStringW_test.cpp
|
||||
cpp_unit_test/XStringW_test.h
|
||||
# cpp_unit_test/XString_test.cpp
|
||||
# cpp_unit_test/XString_test.h
|
||||
# cpp_unit_test/XStringW_test.cpp
|
||||
# cpp_unit_test/XStringW_test.h
|
||||
cpp_unit_test/XStringx_test.cpp
|
||||
cpp_unit_test/XStringWArray_test.cpp
|
||||
cpp_unit_test/XStringWArray_test.h
|
||||
# cpp_unit_test/XUINTN_test.cpp
|
||||
|
@ -60,8 +60,8 @@
|
||||
#include "../libeg/libeg.h"
|
||||
#ifdef __cplusplus
|
||||
#include "../cpp_foundation/XObjArray.h"
|
||||
#include "../cpp_foundation/XString.h"
|
||||
#include "../cpp_foundation/XStringWArray.h"
|
||||
#include "../cpp_foundation/XStringW.h"
|
||||
#include "../libeg/XTheme.h"
|
||||
extern XTheme ThemeX; //global variable defined in lib.cpp
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef __MENU_H__
|
||||
#define __MENU_H__
|
||||
|
||||
#include "../cpp_foundation/XStringW.h"
|
||||
#include "../cpp_foundation/XString.h"
|
||||
#include "../gui/menu_items/menu_items.h"
|
||||
|
||||
//VOID AddMenuInfoLine(IN REFIT_MENU_SCREEN *Screen, IN CONST CHAR16 *InfoLine);
|
||||
|
Loading…
Reference in New Issue
Block a user