Diffs für einige Headerdateien von C++Builder 2007 gesucht
-
Für ein kleines Tool, an dem ich gerade arbeite, muß ich ein paar C++Builder-Headerdateien patchen. Nun würde ich damit gerne C++Builder 2006, 2007 und 2009 unterstützen - leider habe ich aber nur 2006 und 2009. Daher meine Bitte:
Könnte sich jemand, der im Besitz von C++Builder 6 oder 2006 sowie C++Builder 2007 ist, die Mühe machen, Diff-Dateien für ein paar Headerdateien generieren, so daß ich die Headerdateien von C++Builder 2007 rekonstruieren kann?Für meine Zwecke benötige ich Diffs für $(BDS)\include\stdio.h, $(BDS)\include\vcl\dstring.h und $(BDS)\include\vcl\wstring.h .
Zum Erstellen von Diffs/Patches eignen sich WinMerge oder diff aus den GNU diffutils (http://gnuwin32.sourceforge.net/packages/diffutils.htm oder http://sourceforge.net/projects/unxutils; Benutzung:
diff --unified cb2006file cb2007file > out.diff
).Ich wäre hocherfreut, falls jemand die Zeit investieren könnte!
Vielen Dank vorab
-
Hallo @audacia
Ich habe leider nur den BCB2009 und BCB6.
--- Bcb6_dstring.h 2002-02-13 07:00:00.000000000 +0100 +++ Bcb2009_dstring.h 2008-09-05 08:15:10.000000000 +0200 @@ -1,8 +1,5 @@ -// DSTRING.H - Support for delphi strings in C++ +// DSTRING.H - Support for delphi AnsiString in C++ // (AnsiString and template<sz> SmallString) -// $Revision: 1.35.1.0.1.0 $ -// $Date: 25 Jan 2002 12:54:18 $ -// // Copyright (c) 1997, 2002 Borland Software Corporation #ifndef DSTRING_H @@ -12,7 +9,7 @@ #include <sysmac.h> #include <stdarg.h> - +#include <StrHlpr.hpp> namespace System { @@ -20,91 +17,102 @@ class RTL_DELPHIRETURN Currency; class RTL_DELPHIRETURN WideString; + ///////////////////////////////////////////////////////////////////////////// - // AnsiString: String class compatible with Delphi's Native 'string' type + // AnsiStringBase: Base type of operations common to all + // specialization of AnsiStringT<CP> ///////////////////////////////////////////////////////////////////////////// - class RTL_DELPHIRETURN AnsiString + class RTL_DELPHIRETURN AnsiStringBase { - friend AnsiString __fastcall operator +(const char*, const AnsiString& rhs); public: // the TStringFloatFormat enum is used by FloatToStrF enum TStringFloatFormat {sffGeneral, sffExponent, sffFixed, sffNumber, sffCurrency}; - static AnsiString __fastcall StringOfChar(char ch, int count); - static AnsiString __fastcall LoadStr(int ident); - static AnsiString __fastcall LoadStr(HINSTANCE hInstance, int ident); - static AnsiString __fastcall FmtLoadStr(int ident, const TVarRec *args, - int size); + static AnsiStringBase __fastcall LoadStr(int ident, int codePage); + static AnsiStringBase __fastcall LoadStr(HINSTANCE hInstance, int ident, int codePage); + static AnsiStringBase __fastcall FmtLoadStr(int ident, const TVarRec *args, + int size, int codePage); - AnsiString& __fastcall LoadString(HINSTANCE hInstance, int ident); + AnsiStringBase& __fastcall LoadString(HINSTANCE hInstance, int ident, int codePage); - // Delphi style 'Format' - // - static AnsiString __fastcall Format(const AnsiString& format, - const TVarRec *args, int size); + // String of specified character + static AnsiStringBase __fastcall StringOfChar(char ch, int count); - // C style 'sprintf' (NOTE: Target buffer is the string) + // Delphi style 'Format' // - AnsiString& __cdecl sprintf(const char* format, ...); // Returns *this - int __cdecl printf(const char* format, ...); // Returns formatted length - int __cdecl vprintf(const char* format, va_list); // Returns formatted length - - - // Like above, but appends to the string rather than overwrite - AnsiString& __cdecl cat_sprintf(const char* format, ...); // Returns *this - int __cdecl cat_printf(const char* format, ...); // Returns formatted length - int __cdecl cat_vprintf(const char* format, va_list); // Returns formatted length - - static AnsiString __fastcall FormatFloat(const AnsiString& format, - const long double& value); - static AnsiString __fastcall FloatToStrF(long double value, - TStringFloatFormat format, int precision, int digits); - static AnsiString __fastcall IntToHex(int value, int digits); - static AnsiString __fastcall CurrToStr(Currency value); - static AnsiString __fastcall CurrToStrF(Currency value, - TStringFloatFormat format, int digits); - + static AnsiStringBase __fastcall Format(const AnsiStringBase& format, + const TVarRec *args, int size, + int codePage); + + int __cdecl vprintf(int codePage, const char* format, va_list); // Returns formatted length + int __cdecl cat_vprintf(int codePage, const char* format, va_list); // Returns formatted length + + static AnsiStringBase __fastcall FormatFloat(const AnsiStringBase& format, + const long double& value, + int codePage); + static AnsiStringBase __fastcall FloatToStrF(long double value, + TStringFloatFormat format, + int precision, int digits, + int codePage); + static AnsiStringBase __fastcall IntToHex(int value, int digits, int codePage); + static AnsiStringBase __fastcall CurrToStr(Currency value, int codePage); + static AnsiStringBase __fastcall CurrToStrF(Currency value, + TStringFloatFormat format, + int digits, int codePage); // Constructors - __fastcall AnsiString(): Data(0) {} - __fastcall AnsiString(const char* src); - __fastcall AnsiString(const AnsiString& src); -// __fastcall AnsiString(const char* src, unsigned char len); - __fastcall AnsiString(const char* src, unsigned int len); - __fastcall AnsiString(const wchar_t* src); - __fastcall AnsiString(char src); - __fastcall AnsiString(short); - __fastcall AnsiString(unsigned short); - __fastcall AnsiString(int src); - __fastcall AnsiString(unsigned int); - __fastcall AnsiString(long); - __fastcall AnsiString(unsigned long); - __fastcall AnsiString(__int64); - __fastcall AnsiString(unsigned __int64); - __fastcall AnsiString(double src); - __fastcall AnsiString(const WideString &src); + protected: + __fastcall AnsiStringBase(): Data(0) {} + __fastcall AnsiStringBase(const AnsiStringBase& src); + __fastcall AnsiStringBase(const char* src, int codePage); + __fastcall AnsiStringBase(const char* src, int byteLen, int codePage); + __fastcall AnsiStringBase(const wchar_t* src, int numwchar, int codePage); + __fastcall AnsiStringBase(const char16_t* src, int numChar16, int codePage); + __fastcall AnsiStringBase(const char32_t* src, int numChar32, int codePage); + + __fastcall AnsiStringBase(double src, int codePage); + __fastcall AnsiStringBase(wchar_t src, int codePage); + __fastcall AnsiStringBase(const WideString &src, int codePage); + __fastcall AnsiStringBase(const UnicodeString &src, int codePage); +#if !defined(_DELPHI_STRING_UNICODE) + __fastcall AnsiStringBase(const AnsiString &src, int /*codePage*/): Data(0) { + *this = *((AnsiStringBase*)&src); + } +#endif // Destructor - __fastcall ~AnsiString(); + public: + __fastcall ~AnsiStringBase(); + protected: // Assignments - AnsiString& __fastcall operator =(const AnsiString& rhs); - AnsiString& __fastcall operator +=(const AnsiString& rhs); + AnsiStringBase& __fastcall operator =(const AnsiStringBase& rhs); + + // Flat helpers + static void __fastcall _AnsiCat(AnsiStringBase& dst, const AnsiStringBase& src); + static void __fastcall _AnsiCat(AnsiStringBase& dst, const AnsiStringBase& src1, const AnsiStringBase& src2); + static void __fastcall _AnsiFromPWChar(AnsiStringBase& dst, const wchar_t* src, int len, int codePage); // Comparisons - bool __fastcall operator ==(const AnsiString& rhs) const; - bool __fastcall operator !=(const AnsiString& rhs) const; - bool __fastcall operator <(const AnsiString& rhs) const; - bool __fastcall operator >(const AnsiString& rhs) const; - bool __fastcall operator <=(const AnsiString& rhs) const; - bool __fastcall operator >=(const AnsiString& rhs) const; - int __fastcall AnsiCompare(const AnsiString& rhs) const; - int __fastcall AnsiCompareIC(const AnsiString& rhs) const; //ignorecase + bool __fastcall operator ==(const AnsiStringBase& rhs) const; + bool __fastcall operator !=(const AnsiStringBase& rhs) const; + bool __fastcall operator <(const AnsiStringBase& rhs) const; + bool __fastcall operator >(const AnsiStringBase& rhs) const; + bool __fastcall operator <=(const AnsiStringBase& rhs) const { return !operator>(rhs); } + bool __fastcall operator >=(const AnsiStringBase& rhs) const { return !operator<(rhs); } + int __fastcall AnsiCompare(const AnsiStringBase& rhs) const; + int __fastcall AnsiCompareIC(const AnsiStringBase& rhs) const; //ignorecase + public: + // -------------------------------------------------------------------- // Accessing character at specified index - + // NOTE: To be compatible with Delphi, 'idx' is one-based + // -------------------------------------------------------------------- char __fastcall operator [](const int idx) const { ThrowIfOutOfRange(idx); // Should Range-checking be optional to avoid overhead ?? +#if !defined(_STRINGCHECKS_OFF) + const_cast<AnsiStringBase*>(this)->EnsureAnsi(); +#endif return Data[idx-1]; } @@ -127,12 +135,12 @@ class TCharProxy { public: - TCharProxy(AnsiString& strRef, int index) : m_Ref(strRef), m_Index(index) {} + TCharProxy(AnsiStringBase& strRef, int index) : m_Ref(strRef), m_Index(index) {} TCharProxy& operator=(char c) { m_Ref.Unique(); m_Ref.Data[m_Index-1] = c; return *this; } operator char() const { return m_Ref.Data[m_Index-1]; } protected: - AnsiString& m_Ref; + AnsiStringBase& m_Ref; int m_Index; }; @@ -148,48 +156,57 @@ char& __fastcall operator [](const int idx) { ThrowIfOutOfRange(idx); // Should Range-checking be optional to avoid overhead ?? - Unique(); // Ensure we're not ref-counted + Unique(); // Ensure we're not ref-counted (and Ansi) return Data[idx-1]; } #endif // Concatenation - AnsiString __fastcall operator +(const AnsiString& rhs) const; - - // C string operator - char* __fastcall c_str() const { return (Data)? Data: "";} - - // Read access to raw Data ptr. Will be NULL for an empty string. - const void* __fastcall data() const { return Data; } + AnsiStringBase __fastcall operator +(const AnsiStringBase& rhs) const; // Query attributes of string int __fastcall Length() const; bool __fastcall IsEmpty() const { return Data == NULL; } // Make string unique (refcnt == 1) - AnsiString& __fastcall Unique(); + AnsiStringBase& __fastcall Unique() { + System::UniqueString(*PAnsiString(this)); + return *this; + } + + // Ensure our payload is Ansi + AnsiStringBase& __fastcall EnsureAnsi() { + if (Data && (((reinterpret_cast<StrRec*>(Data)[-1]).elemSize) == 2)) + Strhlpr::AnsiFromUnicode(*PRawByteString(this), *(reinterpret_cast<UnicodeString*>(this))); + return *this; + } // Modify string - AnsiString& __fastcall Insert(const AnsiString& str, int index); - AnsiString& __fastcall Delete(int index, int count); - AnsiString& __fastcall SetLength(int newLength); - - int __fastcall Pos(const AnsiString& subStr) const; - AnsiString __fastcall LowerCase() const; - AnsiString __fastcall UpperCase() const; - AnsiString __fastcall Trim() const; - AnsiString __fastcall TrimLeft() const; - AnsiString __fastcall TrimRight() const; - AnsiString __fastcall SubString(int index, int count) const; + AnsiStringBase& __fastcall Insert(const AnsiStringBase& str, int index); + AnsiStringBase& __fastcall Delete(int index, int count); + AnsiStringBase& __fastcall SetLength(int newLength, int codePage); + + int __fastcall Pos(const AnsiStringBase& subStr) const; + AnsiStringBase __fastcall LowerCase(int codePage) const; + AnsiStringBase __fastcall UpperCase(int codePage) const; + AnsiStringBase __fastcall Trim(int codePage) const; + AnsiStringBase __fastcall TrimLeft(int codePage) const; + AnsiStringBase __fastcall TrimRight(int codePage) const; + AnsiStringBase __fastcall SubString(int index, int count) const; int __fastcall ToInt() const; int __fastcall ToIntDef(int defaultValue) const; double __fastcall ToDouble() const; + bool __fastcall IsDelimiter(const AnsiStringBase& delimiters, int index) const; + bool __fastcall IsPathDelimiter(int index) const; + int __fastcall LastDelimiter(const AnsiStringBase& delimiters) const; + char* __fastcall LastChar() const; + // Convert to Unicode - int __fastcall WideCharBufSize() const; - wchar_t* __fastcall WideChar(wchar_t* dest, int destSize) const; + int __fastcall WideCharBufSize(int codePage) const; + wchar_t* __fastcall WideChar(wchar_t* dest, int destSize, int codePage) const; // MBCS support enum TStringMbcsByteType @@ -198,35 +215,360 @@ TStringMbcsByteType __fastcall ByteType(int index) const; bool __fastcall IsLeadByte(int index) const; bool __fastcall IsTrailByte(int index) const; - bool __fastcall IsDelimiter(const AnsiString& delimiters, int index) const; - bool __fastcall IsPathDelimiter(int index) const; - int __fastcall LastDelimiter(const AnsiString& delimiters) const; - int __fastcall AnsiPos(const AnsiString& subStr) const; + int __fastcall AnsiPos(const AnsiStringBase& subStr) const; char* __fastcall AnsiLastChar() const; + DynamicArray<System::Byte> __fastcall BytesOf() const; + + unsigned short ElementSize() const { return Data ? GetRec().elemSize : (unsigned short)1; } + int RefCount() const { return Data ? GetRec().refCnt : 0; } + + unsigned short CodePage() const { return Data ? GetRec().codePage : (unsigned short)System::DefaultSystemCodePage; } + + AnsiStringBase& swap(AnsiStringBase& other); + protected: - void ThrowIfOutOfRange(int idx) const; + void __cdecl ThrowIfOutOfRange(int idx) const; struct StrRec { - int allocSiz; + unsigned short codePage; + unsigned short elemSize; int refCnt; int length; }; - const StrRec &GetRec() const; - StrRec &GetRec(); + const StrRec& GetRec() const; + StrRec& GetRec(); - private: - // assert(offsetof(AnsiString, Data) == 0); + protected: char *Data; }; - extern AnsiString __fastcall operator +(const char*, const AnsiString&); + + ///////////////////////////////////////////////////////////////////////////// + // AnsiStringT<CP> - C++ implementation of Delphi's AnsiString(CP) type + ///////////////////////////////////////////////////////////////////////////// + template <unsigned short CP> + class RTL_DELPHIRETURN AnsiStringT : public AnsiStringBase + { + public: + static AnsiStringT __fastcall LoadStr(int ident) { + return AnsiStringBase::LoadStr(ident, CP); + } + + static AnsiStringT __fastcall LoadStr(HINSTANCE hInstance, int ident) { + return AnsiStringBase::LoadStr(hInstance, ident, CP); + } + + static AnsiStringT __fastcall FmtLoadStr(int ident, const TVarRec *args, + int size) { + return AnsiStringBase::FmtLoadStr(ident, args, CP); + } + + AnsiStringT& __fastcall LoadString(HINSTANCE hInstance, int ident) { + return AnsiStringBase::LoadString(hInstance, ident, CP); + } + + // String of specified character + static AnsiStringT __fastcall StringOfChar(char ch, int count) { + return AnsiStringBase::StringOfChar(ch, count); + } + + // Delphi style 'Format' + // + static AnsiStringT __fastcall Format(const AnsiStringT& format, + const TVarRec *args, int size) { + return AnsiStringBase::Format(format, args, size, CP); + } + + // C style 'sprintf' (NOTE: Target buffer is the string) + // + AnsiStringT& __cdecl sprintf(const char* format, ...) { + va_list paramList; + va_start(paramList, format); + AnsiStringBase::vprintf(CP, format, paramList); + va_end(paramList); + return *this; + } + + int __cdecl printf(const char* format, ...) { + int rc; + va_list paramList; + va_start(paramList, format); + rc = AnsiStringBase::vprintf(CP, format, paramList); + va_end(paramList); + return rc; + } + + int __cdecl vprintf(const char* format, va_list list) { + return AnsiStringBase::vprintf(CP, format, list); + } + + // Like above, but appends to the string rather than overwrite + AnsiStringT& __cdecl cat_sprintf(const char* format, ...) { + va_list paramList; + va_start(paramList, format); + AnsiStringBase::cat_vprintf(CP, format, paramList); + va_end(paramList); + return *this; + } + + int __cdecl cat_printf(const char* format, ...) { + int rc; + va_list paramList; + va_start(paramList, format); + rc = AnsiStringBase::cat_vprintf(CP, format, paramList); + va_end(paramList); + return rc; + } + + int __cdecl cat_vprintf(const char* format, va_list list) { + return AnsiStringBase::cat_vprintf(CP, format, list); + } + + static AnsiStringT __fastcall FormatFloat(const AnsiStringT& format, + const long double& value) { + return AnsiStringBase::FormatFloat(format, value, CP); + } + + static AnsiStringT __fastcall FloatToStrF(long double value, + TStringFloatFormat format, + int precision, int digits) { + return AnsiStringBase::FloatToStrF(value, format, precision, digits, CP); + } + + static AnsiStringT __fastcall IntToHex(int value, int digits) { + return AnsiStringBase::IntToHex(value, digits, CP); + } + + static AnsiStringT __fastcall CurrToStr(Currency value) { + return AnsiStringBase::CurrToStr(value, CP); + } + + static AnsiStringT __fastcall CurrToStrF(Currency value, + TStringFloatFormat format, + int digits) { + return AnsiStringBase::CurrToStrF(value, format, digits, CP); + } + + // Constructors + __fastcall AnsiStringT() : AnsiStringBase() {} + __fastcall AnsiStringT(const char* src) : AnsiStringBase(src, CP){} + + __fastcall AnsiStringT(const AnsiStringT& src) : AnsiStringBase(*((AnsiStringBase*)(&src))){} + __fastcall AnsiStringT(const AnsiStringBase& src): AnsiStringBase(src) {} + + // Construct one AnsiStringT<CP> from one with another codepage affinity + template <unsigned short OTHER_CP> + AnsiStringT<CP>(const AnsiStringT<OTHER_CP>& src) : AnsiStringBase() { + // Short-circuit case of LStrAddRef to preserve + // payload as it could be in Unicode format + #pragma option push -w-8011 + if (this == &src) { + if (Data && reinterpret_cast<const StrRec*>(Data)[-1].refCnt > 0) { + reinterpret_cast<StrRec*>(Data)[-1].refCnt++; + } + return; + } + #pragma option pop + + // CodePage FFFF is a general receiver requiring no conversion + if ((OTHER_CP == CP) || (CP == 0xFFFF)) { + Data = static_cast<char*>(const_cast<void*>(src.data())); + if (Data && reinterpret_cast<const StrRec*>(Data)[-1].refCnt > 0) { + reinterpret_cast<StrRec*>(Data)[-1].refCnt++; + } + return; + } + + // Up & down convert for other other code pages + if (src.data()) { + UnicodeString ustr(src); + *this = ustr; + } + } + + __fastcall AnsiStringT(const char* src, int byteLen) : AnsiStringBase(src, byteLen, CP){} + __fastcall AnsiStringT(const wchar_t* src, int numwchar = -1): AnsiStringBase(src, numwchar, CP){} + __fastcall AnsiStringT(const char16_t* src, int numChar16 = -1) : AnsiStringBase(src, numChar16, CP){} + __fastcall AnsiStringT(const char32_t* src, int numChar32 = -1) : AnsiStringBase(src, numChar32, CP){} + + __fastcall AnsiStringT(char src) { sprintf("%c", src);} + __fastcall AnsiStringT(wchar_t src): AnsiStringBase(src, CP) {} + __fastcall AnsiStringT(short src) { sprintf("%hd", src); } + __fastcall AnsiStringT(unsigned short src) { sprintf("%hu", src); } + __fastcall AnsiStringT(int src) { sprintf("%i", src); } + __fastcall AnsiStringT(unsigned int src) { sprintf("%u", src); } + __fastcall AnsiStringT(long src) { sprintf("%ld", src); } + __fastcall AnsiStringT(unsigned long src) { sprintf("%lu", src); } + __fastcall AnsiStringT(__int64 src) { sprintf("%Li", src); } + __fastcall AnsiStringT(unsigned __int64 src) { sprintf("%Lu", src); } + + __fastcall AnsiStringT(double src): AnsiStringBase(src, CP){} + __fastcall AnsiStringT(const WideString &src): AnsiStringBase(src, CP){} + __fastcall AnsiStringT(const UnicodeString &src): AnsiStringBase(src, CP){} + + // Assignments + AnsiStringT& __fastcall operator =(const AnsiStringT& rhs) { + AnsiStringBase::operator =(rhs); + return *this; + } + + AnsiStringT& __fastcall operator +=(const AnsiStringT& rhs) { + _AnsiCat(*this, rhs); + return *this; + } + + // Comparisons + bool __fastcall operator ==(const AnsiStringT& rhs) const { + return AnsiStringBase::operator==(rhs); + } + bool __fastcall operator !=(const AnsiStringT& rhs) const { + return AnsiStringBase::operator !=(rhs); + } + bool __fastcall operator <(const AnsiStringT& rhs) const { + return AnsiStringBase::operator<(rhs); + } + bool __fastcall operator >(const AnsiStringT& rhs) const { + return AnsiStringBase::operator >(rhs); + } + bool __fastcall operator <=(const AnsiStringT& rhs) const { + return !operator>(rhs); + } + bool __fastcall operator >=(const AnsiStringT& rhs) const { + return !operator<(rhs); + } + int __fastcall AnsiCompare(const AnsiStringT& rhs) const { + return AnsiStringBase::AnsiCompare(rhs); + } + int __fastcall AnsiCompareIC(const AnsiStringT& rhs) const { + return AnsiStringBase::AnsiCompareIC(rhs); + } + + // Concatenation + AnsiStringT __fastcall operator +(const AnsiStringT& rhs) const { + AnsiStringT<CP> dst; + _AnsiCat(dst, *this, rhs); + return dst; + } + + // C string operator + char* __fastcall c_str() const { + if (!Data) { + return const_cast<char*>(""); + } +#if !defined(_STRINGCHECKS_OFF) + const_cast<AnsiStringT*>(this)->EnsureAnsi(); +#endif + return Data; + } + + // Read access to raw Data ptr. Will be NULL for an empty string. + const void* __fastcall data() const { return Data; } + + // Make string unique (refcnt == 1) + AnsiStringT& __fastcall Unique() { + System::UniqueString(*PAnsiString(this)); + return *this; + } + + // Ensure our payload is narrow + AnsiStringT& __fastcall EnsureAnsi() { + if (Data && (((reinterpret_cast<StrRec*>(Data)[-1]).elemSize) == 2)) { + UniqueString(*reinterpret_cast<UnicodeString*>(this)); + Strhlpr::AnsiFromUnicode(*PRawByteString(this), *(reinterpret_cast<UnicodeString*>(this))); + } + return *this; + } + + // Modify string + AnsiStringT& __fastcall Insert(const AnsiStringT& str, int index) { + AnsiStringBase::Insert(str, index); + return *this; + } + + AnsiStringT& __fastcall Delete(int index, int count) { + AnsiStringBase::Delete(index, count); + return *this; + } + + AnsiStringT& __fastcall SetLength(int newLength) { + AnsiStringBase::SetLength(newLength, CP); + return *this; + } + + int __fastcall Pos(const AnsiStringT& subStr) const { + return AnsiStringBase::Pos(subStr); + } + + AnsiStringT __fastcall LowerCase() const { + return AnsiStringBase::LowerCase(CP); + } + + AnsiStringT __fastcall UpperCase() const { + return AnsiStringBase::UpperCase(CP); + } + + AnsiStringT __fastcall Trim() const { + return AnsiStringBase::Trim(CP); + } + + AnsiStringT __fastcall TrimLeft() const { + return AnsiStringBase::TrimLeft(CP); + } + + AnsiStringT __fastcall TrimRight() const { + return AnsiStringBase::TrimRight(CP); + } + + AnsiStringT __fastcall SubString(int index, int count) const { + return AnsiStringBase::SubString(index, count); + } + + bool __fastcall IsDelimiter(const AnsiStringT& delimiters, int index) const { + return AnsiStringBase::IsDelimiter(delimiters, index); + } + + int __fastcall LastDelimiter(const AnsiStringT& delimiters) const { + return AnsiStringBase::LastDelimiter(delimiters); + } + + int __fastcall WideCharBufSize() const { + return AnsiStringBase::WideCharBufSize(CP); + } + + wchar_t* __fastcall WideChar(wchar_t* dest, int destSize) const { + return AnsiStringBase::WideChar(dest, destSize, CP); + } + + int __fastcall AnsiPos(const AnsiStringT& subStr) const { + return AnsiStringBase::AnsiPos(subStr); + } + + unsigned short ElementSize() const { return Data ? GetRec().elemSize : (unsigned short)1; } + int RefCount() const { return Data ? GetRec().refCnt : 0; } + + unsigned short CodePage() const { + return Data ? GetRec().codePage : + (CP ? (unsigned short)CP : (unsigned short)System::DefaultSystemCodePage); + } + + AnsiStringT& swap(AnsiStringT& other) { + AnsiStringBase::swap(other); + return *this; + } + }; + + template <unsigned short CP> + AnsiStringT<CP> __fastcall operator+(const char* p, const AnsiStringT<CP>& str) { + AnsiStringT<CP> tmp(p); + return tmp + str; + } #if defined(VCL_IOSTREAM) // see <sysclass.h> - ostream& operator << (ostream& os, const AnsiString& arg); - istream& operator >> (istream& is, AnsiString& arg); + std::ostream& operator << (std::ostream& os, const AnsiString& arg); + std::istream& operator >> (std::istream& is, AnsiString& arg); #endif #if !defined(__CODEGUARD__) @@ -241,17 +583,17 @@ #define __DSTRING_INLINE inline #endif - __DSTRING_INLINE const AnsiString::StrRec &AnsiString::GetRec() const + __DSTRING_INLINE const AnsiStringBase::StrRec &AnsiStringBase::GetRec() const { return reinterpret_cast<const StrRec *>(Data)[-1]; } - __DSTRING_INLINE AnsiString::StrRec &AnsiString::GetRec() + __DSTRING_INLINE AnsiStringBase::StrRec& AnsiStringBase::GetRec() { return reinterpret_cast<StrRec *>(Data)[-1]; } - __DSTRING_INLINE int __fastcall AnsiString::Length() const + __DSTRING_INLINE int __fastcall AnsiStringBase::Length() const { return (Data)? GetRec().length : 0; } @@ -284,21 +626,18 @@ __fastcall SmallString(const AnsiString& src) { long len = src.Length(); - Len = (unsigned char)((len > sz)? sz: len); + Len = (unsigned char)((len > sz) ? sz : len); strncpy(Data, src.c_str(), Len); } char& __fastcall operator [](const unsigned char idx) - {return Data[idx-1];} + { return Data[idx-1]; } SmallString& __fastcall operator =(const SmallString& rhs); __fastcall operator AnsiString() const; }; - // used when SmallStrings are in unions (can't have a ctor) - // must cast DummySmallString to SmallString to do anything useful - template<unsigned char sz> __fastcall SmallString<sz>::SmallString(const char* src) { @@ -336,10 +675,10 @@ #if defined(VCL_IOSTREAM) // see sysclass.h template<unsigned char sz> - ostream& operator <<(ostream& os, const SmallString<sz>& arg); + std::ostream& operator <<(std::ostream& os, const SmallString<sz>& arg); template<unsigned char sz> - istream& operator >>(istream& is, SmallString<sz>& arg); + std::istream& operator >>(std::istream& is, SmallString<sz>& arg); #endif } @@ -351,12 +690,13 @@ // namespace Sysutils { - extern PACKAGE AnsiString __fastcall IntToStr(int Value)/* overload */; - extern PACKAGE AnsiString __fastcall IntToStr(__int64 Value)/* overload */; + extern PACKAGE String __fastcall IntToStr(int Value)/* overload */; + extern PACKAGE String __fastcall IntToStr(__int64 Value)/* overload */; } #pragma option push -w-inl +#if !defined(_DELPHI_STRING_UNICODE) inline AnsiString __fastcall IntToStr(bool value) { return Sysutils::IntToStr(int(value)); @@ -373,6 +713,7 @@ { return Sysutils::IntToStr(int(value)); } +#endif #pragma option pop
--- Bcb6_wstring.h 2002-02-13 07:00:00.000000000 +0100 +++ Bcb2009_wstring.h 2008-09-29 22:13:50.000000000 +0200 @@ -1,35 +1,78 @@ // wstring.h - support for delphi widestrings in c++ // (WideString) -// $Revision: 1.12.1.0.1.1 $ -// copyright (c) 1997, 2002 Borland Software Corporation +// 1.1 +// copyright (c) 1997, 1999 Borland International #ifndef WSTRING_H #define WSTRING_H #pragma delphiheader begin -#include <wtypes.h> #include <sysmac.h> #include <dstring.h> -#include <stdarg.h> +#include <StrHlpr.hpp> + +// Define this macro under Windows +#if defined(_Windows) && !defined(WIDESTRING_NO_BSTR) +#define WIDESTRING_IS_BSTR +#endif + +//NOTE: sysmac.h defines WIDECHAR_IS_WCHAR when appropriate! namespace System { - // NOTE: WideString uses BSTRs as its underlying implementation (i.e. SysAlloc/FreeString etc.) - // class RTL_DELPHIRETURN WideString { - friend WideString __fastcall PACKAGE operator +(const wchar_t*, const WideString& rhs); //!! not implemented? public: + // the TStringFloatFormat enum is used by FloatToStrF + enum TStringFloatFormat + {sffGeneral, sffExponent, sffFixed, sffNumber, sffCurrency}; + + // String of specified character + static WideString __fastcall StringOfChar(WideChar ch, int count); + + // Delphi style 'Format' + // + static WideString __fastcall Format(const WideString& format, + const TVarRec *args, int size); + + // C style 'sprintf' (NOTE: Target buffer is the string) + // + WideString& __cdecl sprintf(const wchar_t* format, ...); // Returns *this + int __cdecl printf(const wchar_t* format, ...); // Returns formatted length + int __cdecl vprintf(const wchar_t* format, va_list); // Returns formatted length + + + // Like above, but appends to the string rather than overwrite + WideString& __cdecl cat_sprintf(const wchar_t* format, ...); // Returns *this + int __cdecl cat_printf(const wchar_t* format, ...); // Returns formatted length + int __cdecl cat_vprintf(const wchar_t* format, va_list); // Returns formatted length + + static WideString __fastcall FormatFloat(const WideString& format, + const long double& value); + static WideString __fastcall FloatToStrF(long double value, + TStringFloatFormat format, + int precision, int digits); + static WideString __fastcall IntToHex(int value, int digits); + static WideString __fastcall CurrToStr(Currency value); + static WideString __fastcall CurrToStrF(Currency value, + TStringFloatFormat format, + int digits); + // Constructors - // __fastcall WideString(): Data(0) {} __fastcall WideString(const char* src); __fastcall WideString(const WideString& src); - __fastcall WideString(const AnsiString& src); + __fastcall WideString(const WideChar* src, int len); + __fastcall WideString(const WideChar* src); + __fastcall WideString(const char16_t* src, int numChar16 = -1); + __fastcall WideString(const char32_t* src, int numChar32 = -1); + __fastcall explicit WideString(const WideChar src); +#if !defined(WIDECHAR_IS_WCHAR) __fastcall WideString(const wchar_t* src, int len); __fastcall WideString(const wchar_t* src); __fastcall explicit WideString(const wchar_t src); +#endif __fastcall explicit WideString(char src); __fastcall explicit WideString(short src); __fastcall explicit WideString(unsigned short); @@ -42,17 +85,27 @@ __fastcall explicit WideString(float src); __fastcall explicit WideString(double src); __fastcall explicit WideString(long double src); + __fastcall WideString(const UnicodeString& src); +#if !defined(ANSISTRING_AS_TEMPLATE) + __fastcall WideString(const AnsiString &src): Data(0) { + Strhlpr::WideFromAnsi(*this, *PRawByteString(&src)); + } +#else + template <unsigned short codePage> + __fastcall WideString(const AnsiStringT<codePage> &src): Data(0) { + Strhlpr::WideFromAnsi(*this, *PRawByteString(&src)); + } +#endif // Destructor - // __fastcall ~WideString(); // Assignments // WideString& __fastcall operator =(const WideString& rhs); - WideString& __fastcall operator =(BSTR rhs); - WideString& __fastcall operator =(const char* rhs); - WideString& __fastcall operator =(const AnsiString& rhs); +#ifdef WIDESTRING_IS_BSTR + WideString& __fastcall operator =(BSTR rhs); +#endif WideString& __fastcall operator +=(const WideString& rhs); // Comparisons @@ -64,21 +117,93 @@ bool __fastcall operator <=(const WideString& rhs) const; bool __fastcall operator >=(const WideString& rhs) const; - // Index - // - wchar_t& __fastcall operator [](const int idx) { return Data[idx-1]; } +#ifdef WIDESTRING_IS_BSTR +#if !defined(WIDE_BSTR_GLOBAL_OPERATOR) + bool __fastcall operator ==(const BSTR w) const; + bool __fastcall operator !=(const BSTR w) const; + bool __fastcall operator < (const BSTR w) const; + bool __fastcall operator > (const BSTR w) const; + bool __fastcall operator <=(const BSTR w) const; + bool __fastcall operator >=(const BSTR w) const; +#endif // WIDE_BSTR_GLOBAL_OPERATOR +#endif + + bool __fastcall operator ==(const char* s) const + { return operator ==(WideString(s)); } + bool __fastcall operator !=(const char* s) const + { return operator !=(WideString(s)); } + bool __fastcall operator < (const char* s) const + { return operator < (WideString(s)); } + bool __fastcall operator > (const char* s) const + { return operator > (WideString(s)); } + bool __fastcall operator <=(const char* s) const + { return operator <= (WideString(s)); } + bool __fastcall operator >=(const char* s) const + { return operator >= (WideString(s)); } + + // -------------------------------------------------------------------- + // Accessing character at specified index + // NOTE: To be compatible with Delphi, 'idx' is one-based + // -------------------------------------------------------------------- + WideChar & __fastcall operator [](const int idx) { return Data[idx-1]; } + const WideChar& __fastcall operator [](const int idx) const { return Data[idx-1]; } // Concatenation // WideString __fastcall operator +(const WideString& rhs) const; - // Access Data - // - BSTR __fastcall c_bstr() const { return Data; } - operator BSTR() const { return Data; } + // C string operator + WideChar* __fastcall c_bstr() const { return Data; } + + // Read access to raw Data ptr. + WideChar* __fastcall data() { return Data; } + + // Query attributes of string + int __fastcall Length() const; + bool __fastcall IsEmpty() const { return Data == 0; } + + // Modify string + void __fastcall Insert(const WideString& str, int index); + void __fastcall Delete(int index, int count); + void __fastcall SetLength(int newLength); + + int __fastcall Pos(const WideString& subStr) const; + WideString __fastcall LowerCase() const; + WideString __fastcall UpperCase() const; + WideString __fastcall Trim() const; + WideString __fastcall TrimLeft() const; + WideString __fastcall TrimRight() const; + WideString __fastcall SubString(int index, int count) const; + + int __fastcall ToInt() const; + int __fastcall ToIntDef(int defaultValue) const; + double __fastcall ToDouble() const; + + bool __fastcall IsDelimiter(const WideString& delimiters, int index) const; + bool __fastcall IsPathDelimiter(int index) const; + int __fastcall LastDelimiter(const WideString& delimiters) const; + wchar_t* __fastcall LastChar() const; + +#ifdef WIDESTRING_IS_BSTR + // The implicit operator BSTR() has been the source of many issues + // mainly involving the compiler resorted to incorrrect/non-portable + // pointer conversion/comparisons. For backward compatibility you can + // enable the operator by defining NO_WIDESTRING_BSTR_OPERATOR_EXPLICIT +# if !defined(NO_WIDESTRING_BSTR_OPERATOR_EXPLICIT) +# define WIDESTRING_BSTR_OPERATOR_EXPLICIT explicit +# else +# define WIDESTRING_BSTR_OPERATOR_EXPLICIT +# endif + WIDESTRING_BSTR_OPERATOR_EXPLICIT + operator BSTR() const { return Data; } +#endif // Access internal data (Be careful when using!!) // +#ifdef WIDESTRING_IS_BSTR + // these are definitely going away: we can either act like a BSTR + // or a Pascal WideString. the former is what we need. + // --xmsb (2002-01-24 23:06) BSTR* __fastcall operator& () { return &Data; @@ -99,25 +224,52 @@ return Copy(Data); } - // Query attributes of object - // - int __fastcall Length() const; - bool __fastcall IsEmpty() const; +#endif // WIDESTRING_IS_BSTR - // Modify string - // - void __fastcall Insert(const WideString& str, int index); - void __fastcall Delete(int index, int count); - void __fastcall SetLength(int newLength); + wchar_t* __fastcall Copy(wchar_t *, int len) const; - int __fastcall Pos(const WideString& subStr) const; - WideString __fastcall SubString(int index, int count) const; + WideString& swap(WideString& other); private: - int __cdecl vprintf(const wchar_t *fmt, va_list); - int __cdecl printf(const wchar_t *fmt, ...); - wchar_t *Data; + // Initialize from a zero-terminated wide string + void __fastcall InitStr(const WideChar*, int); + WideChar* Data; }; + + inline bool __fastcall operator ==(const char* str, const WideString& rhs) { + return rhs.operator==(WideString(str)); + } + + inline bool __fastcall operator !=(const char* str, const WideString& rhs) { + return rhs.operator!=(WideString(str)); + } + + inline bool __fastcall operator < (const char* str, const WideString& rhs) { + return rhs.operator>(WideString(str)); + } + + inline bool __fastcall operator > (const char* str, const WideString& rhs) { + return rhs.operator<(WideString(str)); + } + + inline bool __fastcall operator <=(const char* str, const WideString& rhs) { + return rhs.operator>=(WideString(str)); + } + + inline bool __fastcall operator >=(const char* str, const WideString& rhs) { + return rhs.operator<=(WideString(str)); + } + + +#ifdef WIDESTRING_IS_BSTR + bool __fastcall operator ==(const BSTR w, const WideString& rhs); + bool __fastcall operator !=(const BSTR w, const WideString& rhs); + bool __fastcall operator < (const BSTR w, const WideString& rhs); + bool __fastcall operator > (const BSTR w, const WideString& rhs); + bool __fastcall operator <=(const BSTR w, const WideString& rhs); + bool __fastcall operator >=(const BSTR w, const WideString& rhs); +#endif + } using namespace System; #pragma delphiheader end.
--- Bcb6_stdio.h 2002-02-13 07:00:00.000000000 +0100 +++ Bcb2009_stdio.h 2008-08-29 21:00:00.000000000 +0200 @@ -4,8 +4,15 @@ */ -/* $Copyright: 1987$ */ -/* $Revision: 9.15 $ */ +/* + * C/C++ Run Time Library - Version 14.0 + * + * Copyright (c) 1987, 2008 by Embarcadero Technologies + * All Rights Reserved. + * + */ + +/* $Revision: 22413 $ */ #ifndef __STDIO_H #define __STDIO_H @@ -34,7 +41,11 @@ /* Definition of the file position type */ -typedef long fpos_t; +typedef long fpos_t; + +#if !defined(__STDC__) + typedef long off_t; +#endif /* An external reference to _floatconvert (using #pragma extref _floatconvert) * forces floating point format conversions to be linked. @@ -64,7 +75,9 @@ /* End-of-file constant definition */ #define EOF (-1) /* End of file indicator */ +#ifndef WEOF #define WEOF (_WINT_T)(0xFFFF) /* wide-character end of file indicator */ +#endif /* WEOF */ /* Default buffer size use by "setbuf" function */ @@ -86,6 +99,8 @@ */ #define TMP_MAX 0xFFFF +#if !defined(_FILE_DEFINED) +#define _FILE_DEFINED /* Definition of the control structure for streams */ typedef struct @@ -100,6 +115,7 @@ char fd; /* File descriptor */ unsigned char token; /* Used for validity checking */ } FILE; /* This is the FILE object */ +#endif /* Number of files that can be open simultaneously */ @@ -169,8 +185,10 @@ int _RTLENTRY _EXPFUNC fscanf(FILE * __stream, const char * __format, ...); int _RTLENTRY _EXPFUNC fwscanf(FILE *__stream, const wchar_t *__format, ...); int _RTLENTRY _EXPFUNC fseek(FILE * __stream, long __offset, int __whence); +int _RTLENTRY _EXPFUNC _fseeki64(FILE * __stream, __int64 __offset, int __whence); int _RTLENTRY _EXPFUNC fsetpos(FILE * __stream, const fpos_t*__pos); long _RTLENTRY _EXPFUNC ftell(FILE * __stream); +__int64 _RTLENTRY _EXPFUNC _ftelli64(FILE * __stream); _SIZE_T _RTLENTRY _EXPFUNC fwrite(const void * __ptr, _SIZE_T __size, _SIZE_T __n, FILE * __stream); char * _RTLENTRY _EXPFUNC gets(char * __s); @@ -199,6 +217,15 @@ int __type, _SIZE_T __size); int _RTLENTRY _EXPFUNC sprintf(char * __buffer, const char * __format, ...); int _RTLENTRY _EXPFUNC swprintf(wchar_t * __buffer, const wchar_t * __format, ...); + +#ifdef __cplusplus +} +extern "C++" { +int _RTLENTRY _EXPFUNC swprintf(wchar_t * s, _SIZE_T __nsize, const wchar_t * format, ...); +} +extern "C" { +#endif + int _RTLENTRY _EXPFUNC snprintf(char * __buffer, _SIZE_T __nsize, const char * __format, ...); int _RTLENTRY _EXPFUNC snwprintf(wchar_t * __buffer, _SIZE_T __nsize, @@ -265,8 +292,8 @@ int _RTLENTRY _EXPFUNC _fileno(FILE _FAR *__fp); int _RTLENTRY _EXPFUNC _flushall(void); int _RTLENTRY _EXPFUNC _fcloseall(void); -FILE * _RTLENTRY _EXPFUNC _fdopen(int __handle, char * __type); -FILE * _RTLENTRY _EXPFUNC _wfdopen(int __handle, wchar_t * __type); +FILE * _RTLENTRY _EXPFUNC _fdopen(int __handle, const char * __type); +FILE * _RTLENTRY _EXPFUNC _wfdopen(int __handle, const wchar_t * __type); int _RTLENTRY _EXPFUNC _fgetchar(void); _WINT_T _RTLENTRY _EXPFUNC _fgetwchar(void); int _RTLENTRY _EXPFUNC _fputchar(int __c); @@ -286,20 +313,22 @@ int _RTLENTRY _EXPFUNC _putw(int __w, FILE * __stream); int _RTLENTRY _EXPFUNC _rmtmp(void); char * _RTLENTRY _EXPFUNC _strerror(const char * __s); -char * _RTLENTRY _EXPFUNC _tempnam(char * __dir, char * __pfx); -wchar_t * _RTLENTRY _EXPFUNC _wtempnam(wchar_t * __dir, wchar_t * __pfx); +char * _RTLENTRY _EXPFUNC _tempnam(const char * __dir, const char * __pfx); +wchar_t * _RTLENTRY _EXPFUNC _wtempnam(const wchar_t * __dir, const wchar_t * __pfx); int _RTLENTRY _EXPFUNC _fgetc(FILE * __stream); /* used by getc() macro */ _WINT_T _RTLENTRY _EXPFUNC _fgetwc(FILE * __stream); int _RTLENTRY _EXPFUNC _fputc(char __c, FILE * __stream); /* used by putc() macro */ _WINT_T _RTLENTRY _EXPFUNC _fputwc(wchar_t __c, FILE * __stream); #if !defined(__STDC__) int _RTLENTRY _EXPFUNC flushall(void); -FILE * _RTLENTRY _EXPFUNC fdopen(int __handle, char * __type); +FILE * _RTLENTRY _EXPFUNC fdopen(int __handle, const char * __type); int _RTLENTRY _EXPFUNC fputchar(int __c); int _RTLENTRY _EXPFUNC fgetchar(void); int _RTLENTRY _EXPFUNC fileno(FILE * __fp); int _RTLENTRY _EXPFUNC fcloseall(void); -char * _RTLENTRY _EXPFUNC tempnam(char * __dir, char * __pfx); +int _RTLENTRY _EXPFUNC fseeko(FILE * __stream, off_t __offset, int __whence); +off_t _RTLENTRY _EXPFUNC ftello(FILE * __stream); +char * _RTLENTRY _EXPFUNC tempnam(const char * __dir, const char * __pfx); int _RTLENTRY _EXPFUNC rmtmp(void); int _RTLENTRY _EXPFUNC unlink(const char * __path); int _RTLENTRY _EXPFUNC getw(FILE * __stream); @@ -315,6 +344,14 @@ #if !defined(__CODEGUARD__) +#if defined (__cplusplus) +#if !defined(__STDC__) +inline int _RTLENTRY ferror(FILE *__f) { return __f->flags & _F_ERR; } +inline int _RTLENTRY feof(FILE *__f) { return __f->flags & _F_EOF; } +inline int _RTLENTRY _fileno(FILE *__f) { return __f->fd; } +inline int _RTLENTRY fileno(FILE *__f) { return _fileno(__f); } +#endif +#else #define ferror(__f) ((__f)->flags & _F_ERR) #define feof(__f) ((__f)->flags & _F_EOF) #define fileno(__f) ((__f)->fd) @@ -333,9 +370,12 @@ #define putchar(__c) putc((__c), stdout) #define putwchar(__c) putwc((__c), stdout) -#endif +#endif /* __cplusplus */ +#endif /* __CODEGUARD__ */ +#if !defined(__cplusplus) #define ungetc(__c,__f) ungetc((__c),__f) /* traditionally a macro */ +#endif #if !defined(RC_INVOKED) @@ -417,8 +457,10 @@ using std::freopen; using std::fscanf; using std::fseek; + using std::_fseeki64; using std::fsetpos; using std::ftell; + using std::_ftelli64; using std::fwprintf; using std::fwrite; using std::fwscanf; @@ -469,6 +511,7 @@ using std::wscanf; #if !defined(__STDC__) + using std::off_t; using std::_snprintf; using std::_snwprintf; using std::_vsnprintf; @@ -479,6 +522,8 @@ using std::fileno; using std::flushall; using std::fputchar; + using std::fseeko; + using std::ftello; using std::getw; using std::putw; using std::rmtmp;
Ich hoffe, daß ich dir weiterhelfen konnte.
MfG Stephan
-
Stephan schrieb:
Ich habe leider nur den BCB2009 und BCB6.
Das ist nett, danke, aber die beiden habe ich auch
Ich benötige aber die Headerdateien von C++Builder 2007.
-
Ich habe die gewünschten Dateien (Patches mit WinMerge) zwischen BCB6 und CB2007 erstellt. Kann ich sie dir irgendwie schicken? Ich möchte das jetzt ungern hier reinstellen.
Du kannst mir ja eine EMail schicken.
-
audacia schrieb:
Stephan schrieb:
Ich habe leider nur den BCB2009 und BCB6.
Das ist nett, danke, aber die beiden habe ich auch
Ich benötige aber die Headerdateien von C++Builder 2007.
Sofern die Emailadresse aus deinem Impressum funktioniert, hast du Post...
-
Beide Mails sind angekommen. Vielen Dank!