diff options
author | Bernard Normier <bernard@zeroc.com> | 2016-05-12 10:21:51 -0400 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2016-05-12 10:21:51 -0400 |
commit | 6ea27c2fc2478cea6a42bad30e746f7ebf9c69af (patch) | |
tree | a52106addf73a73fbeb5e33c26ff9f8908b62a24 /cpp/include | |
parent | UWP test suite fixes (diff) | |
download | ice-6ea27c2fc2478cea6a42bad30e746f7ebf9c69af.tar.bz2 ice-6ea27c2fc2478cea6a42bad30e746f7ebf9c69af.tar.xz ice-6ea27c2fc2478cea6a42bad30e746f7ebf9c69af.zip |
Renamed ICE_UTIL_API to ICE_API and other cleanups
Diffstat (limited to 'cpp/include')
35 files changed, 123 insertions, 2079 deletions
diff --git a/cpp/include/Ice/Config.h b/cpp/include/Ice/Config.h index 83817d599c0..c6672061f1d 100644 --- a/cpp/include/Ice/Config.h +++ b/cpp/include/Ice/Config.h @@ -33,18 +33,6 @@ #endif // -// Automatically link Ice[D|++11|++11D].lib with Visual C++ -// - -#if !defined(ICE_BUILDING_ICE) && defined(ICE_API_EXPORTS) -# define ICE_BUILDING_ICE -#endif - -#if defined(_MSC_VER) && !defined(ICE_BUILDING_ICE) -# pragma comment(lib, ICE_LIBNAME("Ice")) -#endif - -// // Define the Ice and IceInternal namespace, so that we can use the following // everywhere in our code: // @@ -59,16 +47,6 @@ namespace IceInternal { } -#ifndef ICE_API -# if defined(ICE_STATIC_LIBS) -# define ICE_API /**/ -# elif defined(ICE_API_EXPORTS) -# define ICE_API ICE_DECLSPEC_EXPORT -# else -# define ICE_API ICE_DECLSPEC_IMPORT -# endif -#endif - namespace Ice { diff --git a/cpp/include/IceUtil/Atomic.h b/cpp/include/IceUtil/Atomic.h index 85a6942e076..d8fde15de2a 100644 --- a/cpp/include/IceUtil/Atomic.h +++ b/cpp/include/IceUtil/Atomic.h @@ -68,7 +68,7 @@ typedef int ATOMIC_T; // This is temporary and very partial placeholder for std::atomic, // which is not yet widely available. // -class ICE_UTIL_API Atomic : public IceUtil::noncopyable +class ICE_API Atomic : public IceUtil::noncopyable { public: diff --git a/cpp/include/IceUtil/Cond.h b/cpp/include/IceUtil/Cond.h index c57a8a555ff..dd052cc6a41 100644 --- a/cpp/include/IceUtil/Cond.h +++ b/cpp/include/IceUtil/Cond.h @@ -27,7 +27,7 @@ class Semaphore public: Semaphore(long = 0); - ICE_UTIL_API ~Semaphore(); + ICE_API ~Semaphore(); void wait() const; bool timedWait(const IceUtil::Time&) const; @@ -55,7 +55,7 @@ class Mutex; // Condition variable implementation. Conforms to the same semantics // as a POSIX threads condition variable. // -class ICE_UTIL_API Cond : private noncopyable +class ICE_API Cond : private noncopyable { public: diff --git a/cpp/include/IceUtil/Config.h b/cpp/include/IceUtil/Config.h index 2f9e6a5530e..aa86962edd5 100644 --- a/cpp/include/IceUtil/Config.h +++ b/cpp/include/IceUtil/Config.h @@ -126,11 +126,11 @@ // Let's use these extensions with Ice: // #if defined(ICE_API_EXPORTS) -# define ICE_UTIL_API ICE_DECLSPEC_EXPORT +# define ICE_API ICE_DECLSPEC_EXPORT #elif defined(ICE_STATIC_LIBS) -# define ICE_UTIL_API /**/ +# define ICE_API /**/ #else -# define ICE_UTIL_API ICE_DECLSPEC_IMPORT +# define ICE_API ICE_DECLSPEC_IMPORT #endif @@ -188,7 +188,7 @@ #endif #ifdef __IBMCPP__ -// TODO: better fix for this warning + // TODO: better fix for this warning # pragma report(disable, "1540-0198") // private inheritance without private keyword #endif @@ -252,7 +252,7 @@ namespace IceUtil // // By deriving from this class, other classes are made non-copyable. // -class ICE_UTIL_API noncopyable +class ICE_API noncopyable { protected: diff --git a/cpp/include/IceUtil/CountDownLatch.h b/cpp/include/IceUtil/CountDownLatch.h index 1797f6f35b9..53bcd74cf35 100644 --- a/cpp/include/IceUtil/CountDownLatch.h +++ b/cpp/include/IceUtil/CountDownLatch.h @@ -19,7 +19,7 @@ namespace IceUtilInternal // See java.util.concurrent.CountDownLatch in Java 1.5 // -class ICE_UTIL_API CountDownLatch +class ICE_API CountDownLatch { public: diff --git a/cpp/include/IceUtil/CtrlCHandler.h b/cpp/include/IceUtil/CtrlCHandler.h index a131de55d22..e5692d96990 100644 --- a/cpp/include/IceUtil/CtrlCHandler.h +++ b/cpp/include/IceUtil/CtrlCHandler.h @@ -44,7 +44,7 @@ namespace IceUtil typedef void (*CtrlCHandlerCallback)(int); -class ICE_UTIL_API CtrlCHandler +class ICE_API CtrlCHandler { public: @@ -55,7 +55,7 @@ public: CtrlCHandlerCallback getCallback() const; }; -class ICE_UTIL_API CtrlCHandlerException : public Exception +class ICE_API CtrlCHandlerException : public Exception { public: diff --git a/cpp/include/IceUtil/Exception.h b/cpp/include/IceUtil/Exception.h index c3f5b799910..65a003b85bb 100644 --- a/cpp/include/IceUtil/Exception.h +++ b/cpp/include/IceUtil/Exception.h @@ -18,7 +18,7 @@ namespace IceUtil { -class ICE_UTIL_API Exception : public std::exception +class ICE_API Exception : public std::exception { public: @@ -50,9 +50,9 @@ private: mutable ::std::string _str; // Initialized lazily in what(). }; -ICE_UTIL_API std::ostream& operator<<(std::ostream&, const Exception&); +ICE_API std::ostream& operator<<(std::ostream&, const Exception&); -class ICE_UTIL_API NullHandleException : public Exception +class ICE_API NullHandleException : public Exception { public: @@ -65,7 +65,7 @@ public: virtual void ice_throw() const; }; -class ICE_UTIL_API IllegalArgumentException : public Exception +class ICE_API IllegalArgumentException : public Exception { public: @@ -89,7 +89,7 @@ private: // // IllegalConversionException is raised to report a string conversion error // -class ICE_UTIL_API IllegalConversionException : public Exception +class ICE_API IllegalConversionException : public Exception { public: @@ -110,7 +110,7 @@ private: }; -class ICE_UTIL_API SyscallException : public Exception +class ICE_API SyscallException : public Exception { public: @@ -129,7 +129,7 @@ private: const int _error; }; -class ICE_UTIL_API FileLockException : public Exception +class ICE_API FileLockException : public Exception { public: @@ -151,7 +151,7 @@ private: std::string _path; }; -class ICE_UTIL_API OptionalNotSetException : public Exception +class ICE_API OptionalNotSetException : public Exception { public: @@ -165,7 +165,7 @@ public: }; #ifndef _WIN32 -class ICE_UTIL_API IconvInitializationException : public Exception +class ICE_API IconvInitializationException : public Exception { public: @@ -193,7 +193,7 @@ namespace IceUtilInternal enum StackTraceImpl { STNone, STDbghelp, STLibbacktrace, STLibbacktracePlus, STBacktrace }; -ICE_UTIL_API StackTraceImpl stackTraceImpl(); +ICE_API StackTraceImpl stackTraceImpl(); } diff --git a/cpp/include/IceUtil/FileUtil.h b/cpp/include/IceUtil/FileUtil.h index ed07ceab344..c42d3265225 100644 --- a/cpp/include/IceUtil/FileUtil.h +++ b/cpp/include/IceUtil/FileUtil.h @@ -22,28 +22,28 @@ namespace IceUtilInternal { -extern const ICE_UTIL_API std::string pathsep; -extern const ICE_UTIL_API std::string separator; +extern const ICE_API std::string pathsep; +extern const ICE_API std::string separator; // // Detemine if path is an absolute path. // -ICE_UTIL_API bool isAbsolutePath(const std::string&); +ICE_API bool isAbsolutePath(const std::string&); // // Determine if a file exists. // -ICE_UTIL_API bool fileExists(const std::string&); +ICE_API bool fileExists(const std::string&); // // Determine if a directory exists. // -ICE_UTIL_API bool directoryExists(const std::string&); +ICE_API bool directoryExists(const std::string&); // // Determine if a directory exists and is empty. // -ICE_UTIL_API bool isEmptyDirectory(const std::string&); +ICE_API bool isEmptyDirectory(const std::string&); #ifdef _WIN32 @@ -81,28 +81,28 @@ typedef struct stat structstat; // // OS stat // -ICE_UTIL_API int stat(const std::string&, structstat*); -ICE_UTIL_API int remove(const std::string&); -ICE_UTIL_API int rename(const std::string&, const std::string&); -ICE_UTIL_API int rmdir(const std::string&); +ICE_API int stat(const std::string&, structstat*); +ICE_API int remove(const std::string&); +ICE_API int rename(const std::string&, const std::string&); +ICE_API int rmdir(const std::string&); -ICE_UTIL_API int mkdir(const std::string&, int); -ICE_UTIL_API FILE* fopen(const std::string&, const std::string&); -ICE_UTIL_API FILE* freopen(const std::string&, const std::string&, FILE*); -ICE_UTIL_API int open(const std::string&, int); +ICE_API int mkdir(const std::string&, int); +ICE_API FILE* fopen(const std::string&, const std::string&); +ICE_API FILE* freopen(const std::string&, const std::string&, FILE*); +ICE_API int open(const std::string&, int); #ifndef ICE_OS_WINRT -ICE_UTIL_API int getcwd(std::string&); +ICE_API int getcwd(std::string&); #endif -ICE_UTIL_API int unlink(const std::string&); -ICE_UTIL_API int close(int); +ICE_API int unlink(const std::string&); +ICE_API int close(int); // // This class is used to implement process file locking. This class // is not intended to do file locking within the same process. // -class ICE_UTIL_API FileLock : public IceUtil::Shared, public IceUtil::noncopyable +class ICE_API FileLock : public IceUtil::Shared, public IceUtil::noncopyable { public: // @@ -132,7 +132,7 @@ private: typedef IceUtil::Handle<FileLock> FileLockPtr; -class ICE_UTIL_API ifstream : public std::ifstream +class ICE_API ifstream : public std::ifstream { public: @@ -155,7 +155,7 @@ private: void open(const char*, std::ios_base::openmode mode = std::ios_base::in); }; -class ICE_UTIL_API ofstream : public std::ofstream +class ICE_API ofstream : public std::ofstream { public: diff --git a/cpp/include/IceUtil/InputUtil.h b/cpp/include/IceUtil/InputUtil.h index 633e9881258..9f44936a91b 100644 --- a/cpp/include/IceUtil/InputUtil.h +++ b/cpp/include/IceUtil/InputUtil.h @@ -19,7 +19,7 @@ namespace IceUtilInternal // // Portable strtoll/_strtoi64 // -ICE_UTIL_API IceUtil::Int64 strToInt64(const char*, char**, int); +ICE_API IceUtil::Int64 strToInt64(const char*, char**, int); // // stringToInt64 converts a string into a signed 64-bit integer. @@ -40,7 +40,7 @@ ICE_UTIL_API IceUtil::Int64 strToInt64(const char*, char**, int); // - result == 0 indicates that no digits were available for conversion // - result == "Int64 Min" or result == "Int64 Max" indicate underflow or overflow. // -ICE_UTIL_API bool stringToInt64(const std::string&, IceUtil::Int64&); +ICE_API bool stringToInt64(const std::string&, IceUtil::Int64&); } diff --git a/cpp/include/IceUtil/Mutex.h b/cpp/include/IceUtil/Mutex.h index ed1cd05940a..9b88540bcee 100644 --- a/cpp/include/IceUtil/Mutex.h +++ b/cpp/include/IceUtil/Mutex.h @@ -33,7 +33,7 @@ class Cond; // `IceUtil::noncopyable' inaccessible in `IceInternal::Outgoing' due // to ambiguity // -class ICE_UTIL_API Mutex +class ICE_API Mutex { public: diff --git a/cpp/include/IceUtil/MutexProtocol.h b/cpp/include/IceUtil/MutexProtocol.h index 613bf18b1dd..2c0f084f387 100644 --- a/cpp/include/IceUtil/MutexProtocol.h +++ b/cpp/include/IceUtil/MutexProtocol.h @@ -21,7 +21,7 @@ enum MutexProtocol PrioNone }; -ICE_UTIL_API MutexProtocol getDefaultMutexProtocol(); +ICE_API MutexProtocol getDefaultMutexProtocol(); } // End namespace IceUtil diff --git a/cpp/include/IceUtil/Options.h b/cpp/include/IceUtil/Options.h index 3042ac34cbf..2826b7e29bd 100644 --- a/cpp/include/IceUtil/Options.h +++ b/cpp/include/IceUtil/Options.h @@ -22,7 +22,7 @@ namespace IceUtilInternal { -class ICE_UTIL_API APIException : public IceUtil::Exception +class ICE_API APIException : public IceUtil::Exception { public: @@ -38,9 +38,9 @@ public: ::std::string reason; }; -ICE_UTIL_API ::std::ostream& operator<<(::std::ostream&, const APIException&); +ICE_API ::std::ostream& operator<<(::std::ostream&, const APIException&); -class ICE_UTIL_API BadOptException : public IceUtil::Exception +class ICE_API BadOptException : public IceUtil::Exception { public: @@ -56,9 +56,9 @@ public: ::std::string reason; }; -ICE_UTIL_API ::std::ostream& operator<<(::std::ostream&, const BadOptException&); +ICE_API ::std::ostream& operator<<(::std::ostream&, const BadOptException&); -class ICE_UTIL_API Options +class ICE_API Options { public: diff --git a/cpp/include/IceUtil/OutputUtil.h b/cpp/include/IceUtil/OutputUtil.h index b090bad24b8..a3a251b28ce 100644 --- a/cpp/include/IceUtil/OutputUtil.h +++ b/cpp/include/IceUtil/OutputUtil.h @@ -18,7 +18,7 @@ namespace IceUtilInternal { -ICE_UTIL_API std::string int64ToString(IceUtil::Int64); +ICE_API std::string int64ToString(IceUtil::Int64); // ---------------------------------------------------------------------- // OutputBase @@ -31,7 +31,7 @@ ICE_UTIL_API std::string int64ToString(IceUtil::Int64); // manually I've decided to leave them as virtual. // -class ICE_UTIL_API OutputBase : private ::IceUtil::noncopyable +class ICE_API OutputBase : private ::IceUtil::noncopyable { public: @@ -74,21 +74,21 @@ protected: bool _separator; }; -class ICE_UTIL_API NextLine +class ICE_API NextLine { }; -extern ICE_UTIL_API NextLine nl; +extern ICE_API NextLine nl; -class ICE_UTIL_API Separator +class ICE_API Separator { }; -extern ICE_UTIL_API Separator sp; +extern ICE_API Separator sp; // ---------------------------------------------------------------------- // Output // ---------------------------------------------------------------------- -class ICE_UTIL_API Output : public OutputBase +class ICE_API Output : public OutputBase { public: @@ -148,10 +148,10 @@ operator<<(Output& o, const Separator&) return o; } -class ICE_UTIL_API StartBlock +class ICE_API StartBlock { }; -extern ICE_UTIL_API StartBlock sb; +extern ICE_API StartBlock sb; template<> inline Output& @@ -161,10 +161,10 @@ operator<<(Output& o, const StartBlock&) return o; } -class ICE_UTIL_API EndBlock +class ICE_API EndBlock { }; -extern ICE_UTIL_API EndBlock eb; +extern ICE_API EndBlock eb; template<> inline Output& @@ -174,10 +174,10 @@ operator<<(Output& o, const EndBlock&) return o; } -class ICE_UTIL_API StartPar +class ICE_API StartPar { }; -extern ICE_UTIL_API StartPar spar; +extern ICE_API StartPar spar; template<> inline Output& @@ -187,10 +187,10 @@ operator<<(Output& o, const StartPar&) return o; } -class ICE_UTIL_API EndPar +class ICE_API EndPar { }; -extern ICE_UTIL_API EndPar epar; +extern ICE_API EndPar epar; template<> inline Output& @@ -200,13 +200,13 @@ operator<<(Output& o, const EndPar&) return o; } -ICE_UTIL_API Output& operator<<(Output&, std::ios_base& (*)(std::ios_base&)); +ICE_API Output& operator<<(Output&, std::ios_base& (*)(std::ios_base&)); // ---------------------------------------------------------------------- // XMLOutput // ---------------------------------------------------------------------- -class ICE_UTIL_API XMLOutput : public OutputBase +class ICE_API XMLOutput : public OutputBase { public: @@ -265,10 +265,10 @@ operator<<(XMLOutput& o, const Separator&) return o; } -class ICE_UTIL_API EndElement +class ICE_API EndElement { }; -extern ICE_UTIL_API EndElement ee; +extern ICE_API EndElement ee; template<> inline XMLOutput& @@ -278,7 +278,7 @@ operator<<(XMLOutput& o, const EndElement&) return o; } -class ICE_UTIL_API StartElement +class ICE_API StartElement { public: @@ -301,7 +301,7 @@ operator<<(XMLOutput& o, const StartElement& e) return o; } -class ICE_UTIL_API Attribute +class ICE_API Attribute { public: @@ -326,15 +326,15 @@ operator<<(XMLOutput& o, const Attribute& e) return o; } -class ICE_UTIL_API StartEscapes +class ICE_API StartEscapes { }; -extern ICE_UTIL_API StartEscapes startEscapes; +extern ICE_API StartEscapes startEscapes; -class ICE_UTIL_API EndEscapes +class ICE_API EndEscapes { }; -extern ICE_UTIL_API EndEscapes endEscapes; +extern ICE_API EndEscapes endEscapes; template<> inline XMLOutput& @@ -352,7 +352,7 @@ operator<<(XMLOutput& o, const EndEscapes&) return o; } -ICE_UTIL_API XMLOutput& operator<<(XMLOutput&, std::ios_base& (*)(std::ios_base&)); +ICE_API XMLOutput& operator<<(XMLOutput&, std::ios_base& (*)(std::ios_base&)); } diff --git a/cpp/include/IceUtil/Random.h b/cpp/include/IceUtil/Random.h index ee562df75e1..51425808cc6 100644 --- a/cpp/include/IceUtil/Random.h +++ b/cpp/include/IceUtil/Random.h @@ -16,8 +16,8 @@ namespace IceUtilInternal { -ICE_UTIL_API void generateRandom(char*, size_t); -ICE_UTIL_API unsigned int random(int = 0); +ICE_API void generateRandom(char*, size_t); +ICE_API unsigned int random(int = 0); } diff --git a/cpp/include/IceUtil/RecMutex.h b/cpp/include/IceUtil/RecMutex.h index a4f3dac54cc..2f245fcc550 100644 --- a/cpp/include/IceUtil/RecMutex.h +++ b/cpp/include/IceUtil/RecMutex.h @@ -26,7 +26,7 @@ class Cond; // // Recursive Mutex implementation. // -class ICE_UTIL_API RecMutex +class ICE_API RecMutex { public: diff --git a/cpp/include/IceUtil/SHA1.h b/cpp/include/IceUtil/SHA1.h index cec16a80752..32b64406870 100644 --- a/cpp/include/IceUtil/SHA1.h +++ b/cpp/include/IceUtil/SHA1.h @@ -18,11 +18,11 @@ namespace IceUtilInternal { -ICE_UTIL_API void +ICE_API void sha1(const unsigned char*, std::size_t, std::vector<unsigned char>&); #ifndef ICE_OS_WINRT -class ICE_UTIL_API SHA1 +class ICE_API SHA1 { public: diff --git a/cpp/include/IceUtil/Shared.h b/cpp/include/IceUtil/Shared.h index 9403fa73d79..cb3af36a7a2 100644 --- a/cpp/include/IceUtil/Shared.h +++ b/cpp/include/IceUtil/Shared.h @@ -31,7 +31,7 @@ namespace IceUtil { -class ICE_UTIL_API SimpleShared +class ICE_API SimpleShared { public: @@ -81,7 +81,7 @@ private: bool _noDelete; }; -class ICE_UTIL_API Shared +class ICE_API Shared { public: diff --git a/cpp/include/IceUtil/StringConverter.h b/cpp/include/IceUtil/StringConverter.h index 1849412427d..59621a58071 100644 --- a/cpp/include/IceUtil/StringConverter.h +++ b/cpp/include/IceUtil/StringConverter.h @@ -25,14 +25,14 @@ enum ConversionFlags typedef unsigned char Byte; -ICE_UTIL_API bool +ICE_API bool isLegalUTF8Sequence(const Byte* source, const Byte* end); // // Provides bytes to toUTF8. Can raise std::bad_alloc or Ice::MemoryLimitException // when too many bytes are requested. // -class ICE_UTIL_API UTF8Buffer +class ICE_API UTF8Buffer { public: virtual Byte* getMoreBytes(size_t howMany, Byte* firstUnused) = 0; @@ -73,7 +73,7 @@ typedef IceUtil::Handle<WstringConverter> WstringConverterPtr; // // Converts to and from UTF-16 or UTF-32 depending on sizeof(wchar_t) // -class ICE_UTIL_API UnicodeWstringConverter : public WstringConverter +class ICE_API UnicodeWstringConverter : public WstringConverter { public: @@ -92,7 +92,7 @@ private: // // Converts to/from UTF-8 using MultiByteToWideChar and WideCharToMultiByte // -class ICE_UTIL_API WindowsStringConverter : public StringConverter +class ICE_API WindowsStringConverter : public StringConverter { public: @@ -111,22 +111,22 @@ private: // // Retrieve the per process narrow string converter. // -ICE_UTIL_API StringConverterPtr getProcessStringConverter(); +ICE_API StringConverterPtr getProcessStringConverter(); // // Set the per process narrow string converter. // -ICE_UTIL_API void setProcessStringConverter(const StringConverterPtr&); +ICE_API void setProcessStringConverter(const StringConverterPtr&); // // Retrieve the per process wide string converter. // -ICE_UTIL_API WstringConverterPtr getProcessWstringConverter(); +ICE_API WstringConverterPtr getProcessWstringConverter(); // // Set the per process wide string converter. // -ICE_UTIL_API void setProcessWstringConverter(const WstringConverterPtr&); +ICE_API void setProcessWstringConverter(const WstringConverterPtr&); // @@ -137,7 +137,7 @@ ICE_UTIL_API void setProcessWstringConverter(const WstringConverterPtr&); // If the WstringConverter parameter is null, the input's wstring // encoding is UTF-16 or UTF-32 depending on the size of wchar_t. // -ICE_UTIL_API std::string +ICE_API std::string wstringToString(const std::wstring&, const StringConverterPtr& = 0, const WstringConverterPtr& = 0, ConversionFlags = lenientConversion); @@ -149,7 +149,7 @@ wstringToString(const std::wstring&, const StringConverterPtr& = 0, // If the WstringConverter parameter is null, the result's wstring // encoding is UTF-16 or UTF-32 depending on the size of wchar_t. // -ICE_UTIL_API std::wstring +ICE_API std::wstring stringToWstring(const std::string&, const StringConverterPtr& = 0, const WstringConverterPtr& = 0, ConversionFlags = lenientConversion); @@ -159,7 +159,7 @@ stringToWstring(const std::string&, const StringConverterPtr& = 0, // UTF-8 using the given converter. If the converter is null, returns // the given string. // -ICE_UTIL_API std::string +ICE_API std::string nativeToUTF8(const std::string&, const StringConverterPtr&); // @@ -167,7 +167,7 @@ nativeToUTF8(const std::string&, const StringConverterPtr&); // encoding using the given converter. If the converter is null, // returns the given string. // -ICE_UTIL_API std::string +ICE_API std::string UTF8ToNative(const std::string&, const StringConverterPtr&); } diff --git a/cpp/include/IceUtil/StringUtil.h b/cpp/include/IceUtil/StringUtil.h index 8aca611fac3..2e0763e7a46 100644 --- a/cpp/include/IceUtil/StringUtil.h +++ b/cpp/include/IceUtil/StringUtil.h @@ -20,29 +20,29 @@ namespace IceUtilInternal // Add escape sequences (like "\n", or "\0xxx") to make a string // readable in ASCII. // -ICE_UTIL_API std::string escapeString(const std::string&, const std::string&); +ICE_API std::string escapeString(const std::string&, const std::string&); // // Remove escape sequences added by escapeString. Throws IllegalArgumentException // for an invalid input string. // -ICE_UTIL_API std::string unescapeString(const std::string&, std::string::size_type, std::string::size_type); +ICE_API std::string unescapeString(const std::string&, std::string::size_type, std::string::size_type); // // Split a string using the given delimiters. Considers single and double quotes; // returns false for unbalanced quote, true otherwise. // -ICE_UTIL_API bool splitString(const std::string&, const std::string&, std::vector<std::string>&); +ICE_API bool splitString(const std::string&, const std::string&, std::vector<std::string>&); // // Join a list of strings using the given delimiter. // -ICE_UTIL_API std::string joinString(const std::vector<std::string>&, const std::string&); +ICE_API std::string joinString(const std::vector<std::string>&, const std::string&); // // Trim white space // -ICE_UTIL_API std::string trim(const std::string&); +ICE_API std::string trim(const std::string&); // // If a single or double quotation mark is found at the start @@ -51,7 +51,7 @@ ICE_UTIL_API std::string trim(const std::string&); // 0 is returned. If no matching closing quote is found, then // std::string::npos is returned. // -ICE_UTIL_API std::string::size_type checkQuote(const std::string&, std::string::size_type = 0); +ICE_API std::string::size_type checkQuote(const std::string&, std::string::size_type = 0); // // Match `s' against the pattern `pat'. A * in the pattern acts @@ -59,16 +59,16 @@ ICE_UTIL_API std::string::size_type checkQuote(const std::string&, std::string:: // other than a period (`.'). We match by hand here because // it's portable across platforms (whereas regex() isn't). // -ICE_UTIL_API bool match(const std::string&, const std::string&, bool = false); +ICE_API bool match(const std::string&, const std::string&, bool = false); // // Get the error message for the last error code or given error code. // -ICE_UTIL_API std::string lastErrorToString(); +ICE_API std::string lastErrorToString(); #ifdef _WIN32 -ICE_UTIL_API std::string errorToString(int, LPCVOID = NULL); +ICE_API std::string errorToString(int, LPCVOID = NULL); #else -ICE_UTIL_API std::string errorToString(int); +ICE_API std::string errorToString(int); #endif // @@ -76,15 +76,15 @@ ICE_UTIL_API std::string errorToString(int); // UTF8 string/characters but ignore non ASCII characters. Unlike, the // C methods, these methods are not local dependent. // -ICE_UTIL_API std::string toLower(const std::string&); -ICE_UTIL_API std::string toUpper(const std::string&); -ICE_UTIL_API bool isAlpha(char); -ICE_UTIL_API bool isDigit(char); +ICE_API std::string toLower(const std::string&); +ICE_API std::string toUpper(const std::string&); +ICE_API bool isAlpha(char); +ICE_API bool isDigit(char); // // Remove all whitespace from a string // -ICE_UTIL_API std::string removeWhitespace(const std::string&); +ICE_API std::string removeWhitespace(const std::string&); } diff --git a/cpp/include/IceUtil/Thread.h b/cpp/include/IceUtil/Thread.h index c3f17ce0e88..b00b124b895 100644 --- a/cpp/include/IceUtil/Thread.h +++ b/cpp/include/IceUtil/Thread.h @@ -25,7 +25,7 @@ namespace IceUtil class Time; -class ICE_UTIL_API ThreadControl +class ICE_API ThreadControl { public: @@ -112,7 +112,7 @@ private: #endif }; -class ICE_UTIL_API Thread : public virtual IceUtil::Shared +class ICE_API Thread : public virtual IceUtil::Shared { public: diff --git a/cpp/include/IceUtil/ThreadException.h b/cpp/include/IceUtil/ThreadException.h index e646708bb0d..8f380206d5c 100644 --- a/cpp/include/IceUtil/ThreadException.h +++ b/cpp/include/IceUtil/ThreadException.h @@ -16,7 +16,7 @@ namespace IceUtil { -class ICE_UTIL_API ThreadSyscallException : public SyscallException +class ICE_API ThreadSyscallException : public SyscallException { public: @@ -28,7 +28,7 @@ public: virtual void ice_throw() const; }; -class ICE_UTIL_API ThreadLockedException : public Exception +class ICE_API ThreadLockedException : public Exception { public: @@ -40,7 +40,7 @@ public: virtual void ice_throw() const; }; -class ICE_UTIL_API ThreadStartedException : public Exception +class ICE_API ThreadStartedException : public Exception { public: @@ -52,7 +52,7 @@ public: virtual void ice_throw() const; }; -class ICE_UTIL_API ThreadNotStartedException : public Exception +class ICE_API ThreadNotStartedException : public Exception { public: @@ -64,7 +64,7 @@ public: virtual void ice_throw() const; }; -class ICE_UTIL_API BadThreadControlException : public Exception +class ICE_API BadThreadControlException : public Exception { public: @@ -76,7 +76,7 @@ public: virtual void ice_throw() const; }; -class ICE_UTIL_API InvalidTimeoutException : public Exception +class ICE_API InvalidTimeoutException : public Exception { public: diff --git a/cpp/include/IceUtil/Time.h b/cpp/include/IceUtil/Time.h index 002760330b2..5b57972f136 100644 --- a/cpp/include/IceUtil/Time.h +++ b/cpp/include/IceUtil/Time.h @@ -19,7 +19,7 @@ namespace IceUtil { -class ICE_UTIL_API Time +class ICE_API Time { public: @@ -203,7 +203,7 @@ private: Int64 _usec; }; -ICE_UTIL_API std::ostream& operator<<(std::ostream&, const Time&); +ICE_API std::ostream& operator<<(std::ostream&, const Time&); } // End namespace IceUtil diff --git a/cpp/include/IceUtil/Timer.h b/cpp/include/IceUtil/Timer.h index 9f703f194e5..f0555280a9f 100644 --- a/cpp/include/IceUtil/Timer.h +++ b/cpp/include/IceUtil/Timer.h @@ -28,7 +28,7 @@ typedef IceUtil::Handle<Timer> TimerPtr; // Extend the TimerTask class and override the runTimerTask() method to execute // code at a specific time or repeatedly. // -class ICE_UTIL_API TimerTask +class ICE_API TimerTask #ifndef ICE_CPP11_MAPPING : public virtual IceUtil::Shared #endif @@ -46,7 +46,7 @@ ICE_DEFINE_PTR(TimerTaskPtr, TimerTask); // repeated execution. Tasks are executed by the dedicated timer thread // sequentially. // -class ICE_UTIL_API Timer : public virtual IceUtil::Shared, private IceUtil::Thread +class ICE_API Timer : public virtual IceUtil::Shared, private IceUtil::Thread { public: diff --git a/cpp/include/IceUtil/UUID.h b/cpp/include/IceUtil/UUID.h index 801d0525a3c..76b77203ed5 100644 --- a/cpp/include/IceUtil/UUID.h +++ b/cpp/include/IceUtil/UUID.h @@ -15,7 +15,7 @@ namespace IceUtil { -ICE_UTIL_API std::string generateUUID(); +ICE_API std::string generateUUID(); } diff --git a/cpp/include/Slice/CPlusPlusUtil.h b/cpp/include/Slice/CPlusPlusUtil.h deleted file mode 100644 index 5a3ad0f4b14..00000000000 --- a/cpp/include/Slice/CPlusPlusUtil.h +++ /dev/null @@ -1,71 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef C_PLUS_PLUS_UTIL_H -#define C_PLUS_PLUS_UTIL_H - -#include <Slice/Parser.h> -#include <IceUtil/OutputUtil.h> - -namespace Slice -{ - -extern FeatureProfile featureProfile; -extern std::string paramPrefix; - -struct ToIfdef -{ - char operator()(char); -}; - -void printHeader(::IceUtilInternal::Output&); -void printVersionCheck(::IceUtilInternal::Output&); -void printDllExportStuff(::IceUtilInternal::Output&, const std::string&); - -const int TypeContextInParam = 1; -const int TypeContextAMIEnd = 2; -const int TypeContextAMIPrivateEnd = 4; -const int TypeContextAMICallPrivateEnd = 8; -const int TypeContextUseWstring = 16; -const int TypeContextLocal = 32; - -bool isMovable(const TypePtr&); - -std::string typeToString(const TypePtr&, const StringList& = StringList(), int = 0, bool = false); -std::string typeToString(const TypePtr&, bool, const StringList& = StringList(), int = 0, bool = false); -std::string returnTypeToString(const TypePtr&, bool, const StringList& = StringList(), int = 0, bool = false); -std::string inputTypeToString(const TypePtr&, bool, const StringList& = StringList(), int = 0, bool = false); -std::string outputTypeToString(const TypePtr&, bool, const StringList& = StringList(), int = 0, bool = false); -std::string operationModeToString(Operation::Mode, bool cpp11 = false); -std::string opFormatTypeToString(const OperationPtr&); - -std::string fixKwd(const std::string&); - -void writeMarshalUnmarshalCode(::IceUtilInternal::Output&, const TypePtr&, bool, int, const std::string&, - bool, const StringList& = StringList(), int = 0, const std::string& = "", - bool = true); - -void writeMarshalCode(::IceUtilInternal::Output&, const ParamDeclList&, const OperationPtr&, bool, int = 0); -void writeUnmarshalCode(::IceUtilInternal::Output&, const ParamDeclList&, const OperationPtr&, bool, int = 0); -void writeAllocateCode(::IceUtilInternal::Output&, const ParamDeclList&, const OperationPtr&, bool, int = 0, bool = false); - -std::string getEndArg(const TypePtr&, const StringList&, const std::string&); -void writeEndCode(::IceUtilInternal::Output&, const ParamDeclList&, const OperationPtr&, bool = false); - -bool findMetaData(const std::string&, const ClassDeclPtr&, std::string&); -bool findMetaData(const std::string&, const StringList&, std::string&); -std::string findMetaData(const StringList&, int = 0); -bool inWstringModule(const SequencePtr&); - -std::string getDataMemberRef(const DataMemberPtr&); - -std::string classDefToDelegateString(const ClassDefPtr&, int = 0, bool = false); -} - -#endif diff --git a/cpp/include/Slice/Checksum.h b/cpp/include/Slice/Checksum.h deleted file mode 100644 index 3744d8a6ad4..00000000000 --- a/cpp/include/Slice/Checksum.h +++ /dev/null @@ -1,26 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef SLICE_CHECKSUM_H -#define SLICE_CHECKSUM_H - -#include <Slice/Parser.h> -#include <map> -#include <vector> - -namespace Slice -{ - -typedef std::map<std::string, std::vector<unsigned char> > ChecksumMap; - -ChecksumMap createChecksums(const UnitPtr&); - -} - -#endif diff --git a/cpp/include/Slice/FileTracker.h b/cpp/include/Slice/FileTracker.h deleted file mode 100644 index 1c18c97742f..00000000000 --- a/cpp/include/Slice/FileTracker.h +++ /dev/null @@ -1,73 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef FILE_TRACKER_H -#define FILE_TRACKER_H - -#include <IceUtil/Shared.h> -#include <Slice/Parser.h> - -namespace Slice -{ - -class FileException : public ::IceUtil::Exception -{ -public: - - FileException(const char*, int, const std::string&); - ~FileException() ICE_NOEXCEPT; - virtual std::string ice_id() const; - virtual void ice_print(std::ostream&) const; -#ifndef ICE_CPP11_MAPPING - virtual FileException* ice_clone() const; -#endif - virtual void ice_throw() const; - - std::string reason() const; - -private: - - static const char* _name; - const std::string _reason; -}; - -class FileTracker; -typedef IceUtil::Handle<FileTracker> FileTrackerPtr; - -class FileTracker : public ::IceUtil::SimpleShared -{ -public: - - FileTracker(); - ~FileTracker(); - - static FileTrackerPtr instance(); - - void setSource(const std::string&); - void setOutput(const std::string&, bool); - void addFile(const std::string&); - void addDirectory(const std::string&); - - void cleanup(); - void dumpxml(); - -private: - - std::string escape(const std::string&) const; - - std::list<std::pair< std::string, bool> > _files; - std::string _source; - std::map<std::string, std::string> _errors; - std::map<std::string, std::list<std::string> > _generated; - std::map<std::string, std::list<std::string> >::iterator _curr; -}; - -} - -#endif diff --git a/cpp/include/Slice/JavaUtil.h b/cpp/include/Slice/JavaUtil.h deleted file mode 100644 index 6473f406e0e..00000000000 --- a/cpp/include/Slice/JavaUtil.h +++ /dev/null @@ -1,258 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef JAVA_UTIL_H -#define JAVA_UTIL_H - -#include <Slice/Parser.h> -#include <IceUtil/OutputUtil.h> - -namespace Slice -{ - -// -// Compute Java serialVersionUID for a Slice class -// -long -computeSerialVersionUUID(const ClassDefPtr&); - -// -// Compute Java serialVersionUID for a Slice class -// -long -computeSerialVersionUUID(const ExceptionPtr&); - -// -// Compute Java serialVersionUID for a Slice struct -// -long -computeSerialVersionUUID(const StructPtr&); - -class JavaOutput : public ::IceUtilInternal::Output -{ -public: - - JavaOutput(); - JavaOutput(std::ostream&); - JavaOutput(const char*); - - // - // Open a file to hold the source for a Java class. The first - // argument is the class name (including an optional leading - // package). Intermediate directories will be created as - // necessary to open the file in the package. The second - // argument specifies a directory prefix in which to locate - // the class. - // - // After successfully opening the file, the function invokes - // printHeader() and then emits a "package" statement if - // necessary. - // - void openClass(const std::string&, const std::string&, const std::string& = std::string()); - - virtual void printHeader(); -}; - -class JavaGenerator : private ::IceUtil::noncopyable -{ -public: - - virtual ~JavaGenerator(); - - // - // Validate all metadata in the unit with a "java:" prefix. - // - static void validateMetaData(const UnitPtr&); - - void close(); - -protected: - - JavaGenerator(const std::string&); - - // - // Given the fully-scoped Java class name, create any intermediate - // package directories and open the class file, - // - void open(const std::string&, const std::string&); - - ::IceUtilInternal::Output& output() const; - - // - // Check a symbol against any of the Java keywords. If a - // match is found, return the symbol with a leading underscore. - // - std::string fixKwd(const std::string&) const; - - // - // Convert a Slice scoped name into a Java name. - // - std::string convertScopedName(const std::string&, - const std::string& = std::string(), - const std::string& = std::string()) const; - - - // - // Returns the package prefix for a give Slice file. - // - std::string getPackagePrefix(const ContainedPtr&) const; - - // - // Returns the Java package of a Contained entity. - // - std::string getPackage(const ContainedPtr&) const; - - // - // Returns the Java name for a Contained entity. If the optional - // package argument matches the entity's package name, then the - // package is removed from the result. - // - std::string getAbsolute(const ContainedPtr&, - const std::string& = std::string(), - const std::string& = std::string(), - const std::string& = std::string()) const; - - // - // Return the method call necessary to obtain the static type ID for an object type. - // - std::string getStaticId(const TypePtr&, const std::string&) const; - - // - // Determines whether an operation should use the optional mapping. - // - bool useOptionalMapping(const OperationPtr&); - - // - // Returns the optional type corresponding to the given Slice type. - // - std::string getOptionalFormat(const TypePtr&); - - // - // Get the Java name for a type. If an optional scope is provided, - // the scope will be removed from the result if possible. - // - enum TypeMode - { - TypeModeIn, - TypeModeOut, - TypeModeMember, - TypeModeReturn - }; - std::string typeToString(const TypePtr&, TypeMode, const std::string& = std::string(), - const StringList& = StringList(), bool = true, bool = false) const; - - // - // Get the Java object name for a type. For primitive types, this returns the - // Java class type (e.g., Integer). For all other types, this function delegates - // to typeToString. - // - std::string typeToObjectString(const TypePtr&, TypeMode, const std::string& = std::string(), - const StringList& = StringList(), bool = true) const; - - // - // Generate code to marshal or unmarshal a type. - // - enum OptionalMode - { - OptionalNone, - OptionalInParam, - OptionalOutParam, - OptionalReturnParam, - OptionalMember - }; - - void writeMarshalUnmarshalCode(::IceUtilInternal::Output&, const std::string&, const TypePtr&, OptionalMode, - bool, int, const std::string&, bool, int&, bool = false, - const StringList& = StringList(), const std::string& patchParams = ""); - - // - // Generate code to marshal or unmarshal a dictionary type. - // - void writeDictionaryMarshalUnmarshalCode(::IceUtilInternal::Output&, const std::string&, const DictionaryPtr&, - const std::string&, bool, int&, bool, - const StringList& = StringList()); - - // - // Generate code to marshal or unmarshal a sequence type. - // - void writeSequenceMarshalUnmarshalCode(::IceUtilInternal::Output&, const std::string&, const SequencePtr&, - const std::string&, bool, int&, bool, const StringList& = StringList()); - - // - // Search metadata for an entry with the given prefix and return the entire string. - // - static bool findMetaData(const std::string&, const StringList&, std::string&); - - // - // Get custom type metadata. If metadata is found, the abstract and - // concrete types are extracted and the function returns true. If an - // abstract type is not specified, it is set to an empty string. - // - static bool getTypeMetaData(const StringList&, std::string&, std::string&); - - // - // Determine whether a custom type is defined. The function checks the - // metadata of the type's original definition, as well as any optional - // metadata that typically represents a data member or parameter. - // - static bool hasTypeMetaData(const TypePtr&, const StringList& = StringList()); - - // - // Obtain the concrete and abstract types for a dictionary or sequence type. - // The functions return true if a custom type was defined and false to indicate - // the default mapping was used. - // - bool getDictionaryTypes(const DictionaryPtr&, const std::string&, const StringList&, - std::string&, std::string&) const; - bool getSequenceTypes(const SequencePtr&, const std::string&, const StringList&, std::string&, std::string&) const; - - bool sequenceHasHolder(const SequencePtr&) const; - - virtual JavaOutput* createOutput(); - - static const std::string _getSetMetaData; - -private: - - class MetaDataVisitor : public ParserVisitor - { - public: - - virtual bool visitUnitStart(const UnitPtr&); - virtual bool visitModuleStart(const ModulePtr&); - virtual void visitClassDecl(const ClassDeclPtr&); - virtual bool visitClassDefStart(const ClassDefPtr&); - virtual bool visitExceptionStart(const ExceptionPtr&); - virtual bool visitStructStart(const StructPtr&); - virtual void visitOperation(const OperationPtr&); - virtual void visitDataMember(const DataMemberPtr&); - virtual void visitSequence(const SequencePtr&); - virtual void visitDictionary(const DictionaryPtr&); - virtual void visitEnum(const EnumPtr&); - virtual void visitConst(const ConstPtr&); - - private: - - StringList getMetaData(const ContainedPtr&); - void validateType(const SyntaxTreeBasePtr&, const StringList&, const std::string&, const std::string&); - void validateGetSet(const SyntaxTreeBasePtr&, const StringList&, const std::string&, const std::string&); - - StringSet _history; - }; - - friend class JavaGenerator::MetaDataVisitor; - - std::string _dir; - ::IceUtilInternal::Output* _out; - mutable std::map<std::string, std::string> _filePackagePrefix; -}; - -} - -#endif diff --git a/cpp/include/Slice/ObjCUtil.h b/cpp/include/Slice/ObjCUtil.h deleted file mode 100644 index 7c8236ede63..00000000000 --- a/cpp/include/Slice/ObjCUtil.h +++ /dev/null @@ -1,127 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef OBJC_UTIL_H -#define OBJC_UTIL_H - -#include <Slice/Parser.h> -#include <IceUtil/OutputUtil.h> - -namespace Slice -{ - -enum BaseType -{ - BaseTypeNone, - BaseTypeObject, - BaseTypeException -}; - -class ObjCGenerator : private ::IceUtil::noncopyable -{ -public: - - virtual ~ObjCGenerator() {}; - - // - // Validate all metadata in the unit with an "objc:" prefix. - // - static void validateMetaData(const UnitPtr&); - -protected: - struct ModulePrefix - { - ModulePtr m; - std::string name; - }; - - static bool addModule(const ModulePtr&, const std::string&); - static ModulePrefix modulePrefix(const ModulePtr&); - static std::string moduleName(const ModulePtr&); - static ModulePtr findModule(const ContainedPtr&, int = 0, bool = false); - static void modulePrefixError(const ModulePtr&, const std::string&); - static std::string fixId(const std::string&, int = 0, bool = false); - static std::string fixId(const ContainedPtr&, int = 0, bool = false); - static std::string fixName(const ContainedPtr&, int = 0, bool = false); - static std::string fixScoped(const ContainedPtr&, int = 0, bool = false); - static std::string getParamId(const ContainedPtr&); - static std::string getFactoryMethod(const ContainedPtr&, bool); - static std::string typeToString(const TypePtr&); - static std::string inTypeToString(const TypePtr&, bool, bool = false, bool = false); - static std::string outTypeToString(const TypePtr&, bool, bool = false, bool = false); - static std::string typeToObjCTypeString(const TypePtr&); - static bool isValueType(const TypePtr&); - static bool isString(const TypePtr&); - static bool isClass(const TypePtr&); - static bool mapsToPointerType(const TypePtr&); - static std::string getBuiltinName(const BuiltinPtr&); - static std::string getBuiltinSelector(const BuiltinPtr&, bool); - static std::string getOptionalHelperGetter(const TypePtr&); - static std::string getOptionalStreamHelper(const TypePtr&); - static StringList splitScopedName(const std::string&); - static std::string getOptionalFormat(const TypePtr&); - - // - // Generate code to marshal or unmarshal a type - // - void writeMarshalUnmarshalCode(::IceUtilInternal::Output&, const TypePtr&, const std::string&, bool, bool) const; - void writeOptMemberMarshalUnmarshalCode(::IceUtilInternal::Output&, const TypePtr&, const std::string&, bool) const; - void writeOptParamMarshalUnmarshalCode(::IceUtilInternal::Output&, const TypePtr&, const std::string&, int, - bool) const; - -private: - - class MetaDataVisitor : public ParserVisitor - { - public: - MetaDataVisitor(); - - virtual bool visitUnitStart(const UnitPtr&); - virtual bool visitModuleStart(const ModulePtr&); - virtual void visitModuleEnd(const ModulePtr&); - virtual void visitClassDecl(const ClassDeclPtr&); - virtual bool visitClassDefStart(const ClassDefPtr&); - virtual void visitClassDefEnd(const ClassDefPtr&); - virtual bool visitExceptionStart(const ExceptionPtr&); - virtual void visitExceptionEnd(const ExceptionPtr&); - virtual bool visitStructStart(const StructPtr&); - virtual void visitStructEnd(const StructPtr&); - virtual void visitOperation(const OperationPtr&); - virtual void visitParamDecl(const ParamDeclPtr&); - virtual void visitDataMember(const DataMemberPtr&); - virtual void visitSequence(const SequencePtr&); - virtual void visitDictionary(const DictionaryPtr&); - virtual void visitEnum(const EnumPtr&); - virtual void visitConst(const ConstPtr&); - - private: - - void validate(const ContainedPtr&); - - static Slice::StringList getMetaData(const ContainedPtr&); - static void modulePrefixError(const ModulePtr&, const std::string&); - - static const std::string _objcPrefix; // "objc:" - static const std::string _msg; // "ignoring invalid metadata" - - StringSet _history; - }; - - - // - // Map of module scoped name to ModulePtr. Used to verify that objc:prefix metadata directives are consistent. - // - - typedef std::map<std::string, ModulePrefix> ModuleMap; - static ModuleMap _modules; -}; - -} - -#endif diff --git a/cpp/include/Slice/PHPUtil.h b/cpp/include/Slice/PHPUtil.h deleted file mode 100644 index e98130e9345..00000000000 --- a/cpp/include/Slice/PHPUtil.h +++ /dev/null @@ -1,50 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef SLICE_PHP_UTIL_H -#define SLICE_PHP_UTIL_H - -#include <Slice/Parser.h> - -namespace Slice -{ -namespace PHP -{ - -// -// Convert a scoped name into a PHP name. -// -std::string scopedToName(const std::string&, bool); - -// -// Check the given identifier against PHP's list of reserved words. If it matches -// a reserved word, then an escaped version is returned with a leading underscore. -// -std::string fixIdent(const std::string&); - -// -// Get the fully-qualified name of the given definition. If a suffix is provided, -// it is prepended to the definition's unqualified name. If the nameSuffix -// is provided, it is appended to the container's name. -// -// COMPILERFIX: MSVC 6 seems to have a problem with const std::string -// = std::string(), const std::string = std::string(). -// -std::string getAbsolute(const Slice::ContainedPtr&, bool, const std::string& = "", const std::string& = ""); - -// -// Since PHP uses the backslash character as the namespace separator, we have -// to escape backslash characters when they appear in a string literal. -// -std::string escapeName(const std::string&); - -} -} - -#endif diff --git a/cpp/include/Slice/Parser.h b/cpp/include/Slice/Parser.h deleted file mode 100644 index a142ec921d0..00000000000 --- a/cpp/include/Slice/Parser.h +++ /dev/null @@ -1,1100 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef SLICE_PARSER_H -#define SLICE_PARSER_H - -#include <IceUtil/Shared.h> -#include <IceUtil/Handle.h> -#include <string> -#include <vector> -#include <list> -#include <stack> -#include <map> -#include <set> -#include <stdio.h> - - -namespace Slice -{ - -#if defined(_WIN32) && !defined(__MINGW32__) - -const IceUtil::Int64 Int32Max = 0x7fffffffi64; -const IceUtil::Int64 Int32Min = -Int32Max - 1i64; - -#else - -# if defined(INT32_MIN) && defined(INT32_MAX) - -const IceUtil::Int64 Int32Max = INT32_MAX; -const IceUtil::Int64 Int32Min = INT32_MIN; - -# else - -const IceUtil::Int64 Int32Max = 0x7fffffffLL; -const IceUtil::Int64 Int32Min = -Int32Max - 1LL; - -# endif - -#endif - -const IceUtil::Int64 Int16Max = 0x7fff; -const IceUtil::Int64 Int16Min = -Int16Max - 1; -const IceUtil::Int64 ByteMax = 0xff; -const IceUtil::Int64 ByteMin = 0x00; - -enum FeatureProfile -{ - Ice, - IceE -}; - -enum NodeType -{ - Dummy, - Real -}; - -// -// Format preference for classes and exceptions. -// -enum FormatType -{ - DefaultFormat, // No preference was specified. - CompactFormat, // Minimal format. - SlicedFormat // Full format. -}; - -class GrammarBase; -class SyntaxTreeBase; -class Type; -class Builtin; -class Contained; -class Container; -class Module; -class Constructed; -class ClassDecl; -class ClassDef; -class Proxy; -class Exception; -class Struct; -class Operation; -class ParamDecl; -class DataMember; -class Sequence; -class Dictionary; -class Enum; -class Enumerator; -class Const; -class Unit; -class CICompare; -class DerivedToBaseCompare; -class ModulePartialCompare; - -typedef ::IceUtil::Handle<GrammarBase> GrammarBasePtr; -typedef ::IceUtil::Handle<SyntaxTreeBase> SyntaxTreeBasePtr; -typedef ::IceUtil::Handle<Type> TypePtr; -typedef ::IceUtil::Handle<Builtin> BuiltinPtr; -typedef ::IceUtil::Handle<Contained> ContainedPtr; -typedef ::IceUtil::Handle<Container> ContainerPtr; -typedef ::IceUtil::Handle<Module> ModulePtr; -typedef ::IceUtil::Handle<Constructed> ConstructedPtr; -typedef ::IceUtil::Handle<ClassDecl> ClassDeclPtr; -typedef ::IceUtil::Handle<ClassDef> ClassDefPtr; -typedef ::IceUtil::Handle<Proxy> ProxyPtr; -typedef ::IceUtil::Handle<Exception> ExceptionPtr; -typedef ::IceUtil::Handle<Struct> StructPtr; -typedef ::IceUtil::Handle<Operation> OperationPtr; -typedef ::IceUtil::Handle<ParamDecl> ParamDeclPtr; -typedef ::IceUtil::Handle<DataMember> DataMemberPtr; -typedef ::IceUtil::Handle<Sequence> SequencePtr; -typedef ::IceUtil::Handle<Dictionary> DictionaryPtr; -typedef ::IceUtil::Handle<Enum> EnumPtr; -typedef ::IceUtil::Handle<Enumerator> EnumeratorPtr; -typedef ::IceUtil::Handle<Const> ConstPtr; -typedef ::IceUtil::Handle<Unit> UnitPtr; - -typedef std::list<TypePtr> TypeList; -typedef std::list<ExceptionPtr> ExceptionList; -typedef std::set<std::string> StringSet; -typedef std::list<std::string> StringList; -typedef std::pair<TypePtr, std::string> TypeString; -typedef std::list<TypeString> TypeStringList; -typedef std::list<ContainedPtr> ContainedList; -typedef std::list<ModulePtr> ModuleList; -typedef std::list<ConstructedPtr> ConstructedList; -typedef std::list<ClassDefPtr> ClassList; -typedef std::list<ExceptionPtr> ExceptionList; -typedef std::list<StructPtr> StructList; -typedef std::list<SequencePtr> SequenceList; -typedef std::list<DictionaryPtr> DictionaryList; -typedef std::list<EnumPtr> EnumList; -typedef std::list<ConstPtr> ConstList; -typedef std::list<OperationPtr> OperationList; -typedef std::list<DataMemberPtr> DataMemberList; -typedef std::list<ParamDeclPtr> ParamDeclList; -typedef std::list<EnumeratorPtr> EnumeratorList; - -struct ConstDef -{ - TypePtr type; - SyntaxTreeBasePtr value; - std::string valueAsString; - std::string valueAsLiteral; -}; - -struct OptionalDef -{ - TypePtr type; - std::string name; - bool optional; - int tag; -}; - -// ---------------------------------------------------------------------- -// CICompare -- function object to do case-insensitive string comparison. -// ---------------------------------------------------------------------- - -class CICompare : public std::binary_function<std::string, std::string, bool> -{ -public: - - bool operator()(const std::string&, const std::string&) const; -}; - -#if defined(__SUNPRO_CC) -bool cICompare(const std::string&, const std::string&); -#endif - -// ---------------------------------------------------------------------- -// DerivedToBaseCompare -- function object to do sort exceptions into -// most-derived to least-derived order. -// ---------------------------------------------------------------------- - -class DerivedToBaseCompare : public std::binary_function<std::string, std::string, bool> -{ -public: - - bool operator()(const ExceptionPtr&, const ExceptionPtr&) const; -}; - -#if defined(__SUNPRO_CC) -bool derivedToBaseCompare(const ExceptionPtr&, const ExceptionPtr&); -#endif - -// ---------------------------------------------------------------------- -// ParserVisitor -// ---------------------------------------------------------------------- - -class ParserVisitor -{ -public: - - virtual ~ParserVisitor() { } - virtual bool visitUnitStart(const UnitPtr&) { return true; } - virtual void visitUnitEnd(const UnitPtr&) { } - virtual bool visitModuleStart(const ModulePtr&) { return true; } - virtual void visitModuleEnd(const ModulePtr&) { } - virtual void visitClassDecl(const ClassDeclPtr&) { } - virtual bool visitClassDefStart(const ClassDefPtr&) { return true; } - virtual void visitClassDefEnd(const ClassDefPtr&) { } - virtual bool visitExceptionStart(const ExceptionPtr&) { return true; } - virtual void visitExceptionEnd(const ExceptionPtr&) { } - virtual bool visitStructStart(const StructPtr&) { return true; } - virtual void visitStructEnd(const StructPtr&) { } - virtual void visitOperation(const OperationPtr&) { } - virtual void visitParamDecl(const ParamDeclPtr&) { } - virtual void visitDataMember(const DataMemberPtr&) { } - virtual void visitSequence(const SequencePtr&) { } - virtual void visitDictionary(const DictionaryPtr&) { } - virtual void visitEnum(const EnumPtr&) { } - virtual void visitConst(const ConstPtr&) { } -}; - -// ---------------------------------------------------------------------- -// DefinitionContext -// ---------------------------------------------------------------------- - -class DefinitionContext : public ::IceUtil::SimpleShared -{ -public: - - DefinitionContext(int, const StringList&); - - std::string filename() const; - int includeLevel() const; - bool seenDefinition() const; - - void setFilename(const std::string&); - void setSeenDefinition(); - - bool hasMetaData() const; - void setMetaData(const StringList&); - std::string findMetaData(const std::string&) const; - StringList getMetaData() const; - -private: - - int _includeLevel; - StringList _metaData; - std::string _filename; - bool _seenDefinition; -}; -typedef ::IceUtil::Handle<DefinitionContext> DefinitionContextPtr; - -// ---------------------------------------------------------------------- -// GrammarBase -// ---------------------------------------------------------------------- - -class GrammarBase : public ::IceUtil::SimpleShared -{ -}; - -// ---------------------------------------------------------------------- -// SyntaxTreeBase -// ---------------------------------------------------------------------- - -class SyntaxTreeBase : public GrammarBase -{ -public: - - virtual void destroy(); - UnitPtr unit() const; - DefinitionContextPtr definitionContext() const; // May be nil - virtual void visit(ParserVisitor*, bool); - -protected: - - SyntaxTreeBase(const UnitPtr&); - - UnitPtr _unit; - DefinitionContextPtr _definitionContext; -}; - -// ---------------------------------------------------------------------- -// Type -// ---------------------------------------------------------------------- - -class Type : public virtual SyntaxTreeBase -{ -public: - - virtual bool isLocal() const = 0; - virtual std::string typeId() const = 0; - virtual bool usesClasses() const = 0; - virtual size_t minWireSize() const = 0; - virtual bool isVariableLength() const = 0; - -protected: - - Type(const UnitPtr&); -}; - -// ---------------------------------------------------------------------- -// Builtin -// ---------------------------------------------------------------------- - -class Builtin : public virtual Type -{ -public: - - enum Kind - { - KindByte, - KindBool, - KindShort, - KindInt, - KindLong, - KindFloat, - KindDouble, - KindString, - KindObject, - KindObjectProxy, - KindLocalObject, - KindValue - }; - - virtual bool isLocal() const; - virtual std::string typeId() const; - virtual bool usesClasses() const; - virtual size_t minWireSize() const; - virtual bool isVariableLength() const; - - Kind kind() const; - std::string kindAsString() const; - - static const char* builtinTable[]; - -protected: - - Builtin(const UnitPtr&, Kind); - friend class Unit; - - Kind _kind; -}; - -// ---------------------------------------------------------------------- -// Contained -// ---------------------------------------------------------------------- - -class Contained : public virtual SyntaxTreeBase -{ -public: - - ContainerPtr container() const; - std::string name() const; - std::string scoped() const; - std::string scope() const; - std::string flattenedScope() const; - std::string file() const; - std::string line() const; - std::string comment() const; - - int includeLevel() const; - void updateIncludeLevel(); - - bool hasMetaData(const std::string&) const; - bool findMetaData(const std::string&, std::string&) const; - std::list<std::string> getMetaData() const; - void setMetaData(const std::list<std::string>&); - void addMetaData(const std::string&); // TODO: remove this method once "cs:" and "vb:" are hard errors. - - static FormatType parseFormatMetaData(const std::list<std::string>&); - - enum ContainedType - { - ContainedTypeSequence, - ContainedTypeDictionary, - ContainedTypeEnum, - ContainedTypeEnumerator, - ContainedTypeModule, - ContainedTypeClass, - ContainedTypeException, - ContainedTypeStruct, - ContainedTypeOperation, - ContainedTypeParamDecl, - ContainedTypeDataMember, - ContainedTypeConstant - }; - virtual ContainedType containedType() const = 0; - - virtual bool uses(const ContainedPtr&) const = 0; - virtual std::string kindOf() const = 0; - - bool operator<(const Contained&) const; - bool operator==(const Contained&) const; - bool operator!=(const Contained&) const; - -protected: - - Contained(const ContainerPtr&, const std::string&); - friend class Container; - - ContainerPtr _container; - std::string _name; - std::string _scoped; - std::string _file; - std::string _line; - std::string _comment; - int _includeLevel; - std::list<std::string> _metaData; -}; - -// ---------------------------------------------------------------------- -// Container -// ---------------------------------------------------------------------- - -class Container : public virtual SyntaxTreeBase -{ -public: - - virtual void destroy(); - ModulePtr createModule(const std::string&); - ClassDefPtr createClassDef(const std::string&, int, bool, const ClassList&, bool); - ClassDeclPtr createClassDecl(const std::string&, bool, bool, bool = true); - ExceptionPtr createException(const std::string&, const ExceptionPtr&, bool, NodeType = Real); - StructPtr createStruct(const std::string&, bool, NodeType = Real); - SequencePtr createSequence(const std::string&, const TypePtr&, const StringList&, bool, NodeType = Real); - DictionaryPtr createDictionary(const std::string&, const TypePtr&, const StringList&, const TypePtr&, - const StringList&, bool, NodeType = Real); - EnumPtr createEnum(const std::string&, bool, NodeType = Real); - EnumeratorPtr createEnumerator(const std::string&); - EnumeratorPtr createEnumerator(const std::string&, int); - ConstPtr createConst(const std::string, const TypePtr&, const StringList&, const SyntaxTreeBasePtr&, - const std::string&, const std::string&, NodeType = Real); - TypeList lookupType(const std::string&, bool = true); - TypeList lookupTypeNoBuiltin(const std::string&, bool = true, bool = false); - ContainedList lookupContained(const std::string&, bool = true); - ExceptionPtr lookupException(const std::string&, bool = true); - UnitPtr unit() const; - ModuleList modules() const; - ClassList classes() const; - ExceptionList exceptions() const; - StructList structs() const; - SequenceList sequences() const; - DictionaryList dictionaries() const; - EnumList enums() const; - ConstList consts() const; - ContainedList contents() const; - bool hasNonLocalClassDecls() const; - bool hasNonLocalClassDefs() const; - bool hasLocalClassDefsWithAsync() const; - bool hasNonLocalSequences() const; - bool hasNonLocalExceptions() const; - bool hasDictionaries() const; - bool hasOnlyDictionaries(DictionaryList&) const; - bool hasClassDecls() const; - bool hasClassDefs() const; - bool hasLocalClassDefs() const; - bool hasNonLocalInterfaceDefs() const; - bool hasValueDefs() const; - bool hasOnlyClassDecls() const; - bool hasAbstractClassDefs() const; - bool hasNonLocalDataOnlyClasses() const; - bool hasOtherConstructedOrExceptions() const; // Exceptions or constructed types other than classes. - bool hasContentsWithMetaData(const std::string&) const; - bool hasAsyncOps() const; - bool hasNonLocalContained(Contained::ContainedType) const; - std::string thisScope() const; - void mergeModules(); - void sort(); - void sortContents(bool); - virtual void visit(ParserVisitor*, bool); - void containerRecDependencies(std::set<ConstructedPtr>&); // Internal operation, don't use directly. - - bool checkIntroduced(const std::string&, ContainedPtr = 0); - bool nameIsLegal(const std::string&, const char *); - bool checkForGlobalDef(const std::string&, const char *); - -protected: - - Container(const UnitPtr&); - - void checkIdentifier(const std::string&) const; - bool checkInterfaceAndLocal(const std::string&, bool, bool, bool, bool, bool); - bool checkGlobalMetaData(const StringList&, const StringList&); - bool validateConstant(const std::string&, const TypePtr&, const SyntaxTreeBasePtr&, const std::string&, bool); - EnumeratorPtr validateEnumerator(const std::string&); - - ContainedList _contents; - std::map<std::string, ContainedPtr, CICompare> _introducedMap; -}; - -// ---------------------------------------------------------------------- -// Module -// ---------------------------------------------------------------------- - -class Module : public virtual Container, public virtual Contained -{ -public: - - virtual ContainedType containedType() const; - virtual bool uses(const ContainedPtr&) const; - virtual std::string kindOf() const; - virtual void visit(ParserVisitor*, bool); - -protected: - - Module(const ContainerPtr&, const std::string&); - friend class Container; -}; - -// ---------------------------------------------------------------------- -// Constructed -// ---------------------------------------------------------------------- - -class Constructed : public virtual Type, public virtual Contained -{ -public: - - virtual bool isLocal() const; - virtual std::string typeId() const; - virtual bool isVariableLength() const = 0; - ConstructedList dependencies(); - virtual void recDependencies(std::set<ConstructedPtr>&) = 0; // Internal operation, don't use directly. - -protected: - - Constructed(const ContainerPtr&, const std::string&, bool); - - bool _local; -}; - -// ---------------------------------------------------------------------- -// ClassDecl -// ---------------------------------------------------------------------- - -class ClassDecl : public virtual Constructed -{ -public: - - virtual void destroy(); - ClassDefPtr definition() const; - bool isInterface() const; - virtual ContainedType containedType() const; - virtual bool uses(const ContainedPtr&) const; - virtual bool usesClasses() const; - virtual size_t minWireSize() const; - virtual bool isVariableLength() const; - virtual void visit(ParserVisitor*, bool); - virtual std::string kindOf() const; - virtual void recDependencies(std::set<ConstructedPtr>&); // Internal operation, don't use directly. - - static void checkBasesAreLegal(const std::string&, bool, bool, const ClassList&, const UnitPtr&); - -protected: - - ClassDecl(const ContainerPtr&, const std::string&, bool, bool); - friend class Container; - friend class ClassDef; - - ClassDefPtr _definition; - bool _interface; - -private: - - typedef std::list<ClassList> GraphPartitionList; - typedef std::list<StringList> StringPartitionList; - - static bool isInList(const GraphPartitionList&, const ClassDefPtr); - static void addPartition(GraphPartitionList&, GraphPartitionList::reverse_iterator, const ClassDefPtr); - static StringPartitionList toStringPartitionList(const GraphPartitionList&); - static void checkPairIntersections(const StringPartitionList&, const std::string&, const UnitPtr&); -}; - -// ---------------------------------------------------------------------- -// Operation -// ---------------------------------------------------------------------- - -class Operation : public virtual Contained, public virtual Container -{ -public: - - // - // Note: The order of definitions here *must* match the order of - // definitions of ::Ice::OperationMode in slice/Ice/Current.ice! - // - enum Mode - { - Normal, - Nonmutating, - Idempotent - }; - - TypePtr returnType() const; - bool returnIsOptional() const; - int returnTag() const; - Mode mode() const; - Mode sendMode() const; - ParamDeclPtr createParamDecl(const std::string&, const TypePtr&, bool, bool, int); - ParamDeclList parameters() const; - ExceptionList throws() const; - void setExceptionList(const ExceptionList&); - virtual ContainedType containedType() const; - virtual bool uses(const ContainedPtr&) const; - bool sendsClasses(bool) const; - bool returnsClasses(bool) const; - bool returnsData() const; - bool sendsOptionals() const; - int attributes() const; - FormatType format() const; - virtual std::string kindOf() const; - virtual void visit(ParserVisitor*, bool); - -protected: - - Operation(const ContainerPtr&, const std::string&, const TypePtr&, bool, int, Mode); - friend class ClassDef; - - TypePtr _returnType; - bool _returnIsOptional; - int _returnTag; - ExceptionList _throws; - Mode _mode; -}; - -// ---------------------------------------------------------------------- -// ClassDef -// ---------------------------------------------------------------------- - -// -// Note: For the purpose of this parser, a class definition is not -// considered to be a type, but a class declaration is. And each class -// definition has at least one class declaration (but not vice versa), -// so if you need the class as a "constructed type", use the -// declaration() operation to navigate to the class declaration. -// -class ClassDef : public virtual Container, public virtual Contained -{ -public: - - virtual void destroy(); - OperationPtr createOperation(const std::string&, const TypePtr&, bool, int, Operation::Mode = Operation::Normal); - DataMemberPtr createDataMember(const std::string&, const TypePtr&, bool, int, const SyntaxTreeBasePtr&, - const std::string&, const std::string&); - ClassDeclPtr declaration() const; - ClassList bases() const; - ClassList allBases() const; - OperationList operations() const; - OperationList allOperations() const; - DataMemberList dataMembers() const; - DataMemberList orderedOptionalDataMembers() const; - DataMemberList allDataMembers() const; - DataMemberList classDataMembers() const; - DataMemberList allClassDataMembers() const; - bool canBeCyclic() const; - bool isAbstract() const; - bool isInterface() const; - bool isA(const std::string&) const; - virtual bool isLocal() const; - bool hasDataMembers() const; - bool hasOperations() const; - bool hasDefaultValues() const; - bool inheritsMetaData(const std::string&) const; - virtual ContainedType containedType() const; - virtual bool uses(const ContainedPtr&) const; - virtual std::string kindOf() const; - virtual void visit(ParserVisitor*, bool); - int compactId() const; - bool isDelegate() const; - -protected: - - ClassDef(const ContainerPtr&, const std::string&, int, bool, const ClassList&, bool); - friend class Container; - - ClassDeclPtr _declaration; - bool _interface; - bool _hasDataMembers; - bool _hasOperations; - ClassList _bases; - bool _local; - int _compactId; -}; - -// ---------------------------------------------------------------------- -// Proxy -// ---------------------------------------------------------------------- - -class Proxy : public virtual Type -{ -public: - - virtual bool isLocal() const; - virtual std::string typeId() const; - virtual bool usesClasses() const; - virtual size_t minWireSize() const; - virtual bool isVariableLength() const; - - ClassDeclPtr _class() const; - - Proxy(const ClassDeclPtr&); - -protected: - - ClassDeclPtr __class; -}; - -// ---------------------------------------------------------------------- -// Exception -// ---------------------------------------------------------------------- - -// No inheritance from Constructed, as this is not a Type -class Exception : public virtual Container, public virtual Contained -{ -public: - - virtual void destroy(); - DataMemberPtr createDataMember(const std::string&, const TypePtr&, bool, int, const SyntaxTreeBasePtr&, - const std::string&, const std::string&); - DataMemberList dataMembers() const; - DataMemberList orderedOptionalDataMembers() const; - DataMemberList allDataMembers() const; - DataMemberList classDataMembers() const; - DataMemberList allClassDataMembers() const; - ExceptionPtr base() const; - ExceptionList allBases() const; - virtual bool isBaseOf(const ExceptionPtr&) const; - virtual bool isLocal() const; - virtual ContainedType containedType() const; - virtual bool uses(const ContainedPtr&) const; - bool usesClasses(bool) const; - bool hasDefaultValues() const; - bool inheritsMetaData(const std::string&) const; - virtual std::string kindOf() const; - virtual void visit(ParserVisitor*, bool); - -protected: - - Exception(const ContainerPtr&, const std::string&, const ExceptionPtr&, bool); - friend class Container; - - ExceptionPtr _base; - bool _local; -}; - -// ---------------------------------------------------------------------- -// Struct -// ---------------------------------------------------------------------- - -class Struct : public virtual Container, public virtual Constructed -{ -public: - - DataMemberPtr createDataMember(const std::string&, const TypePtr&, bool, int, const SyntaxTreeBasePtr&, - const std::string&, const std::string&); - DataMemberList dataMembers() const; - DataMemberList classDataMembers() const; - virtual ContainedType containedType() const; - virtual bool uses(const ContainedPtr&) const; - virtual bool usesClasses() const; - virtual size_t minWireSize() const; - virtual bool isVariableLength() const; - bool hasDefaultValues() const; - virtual std::string kindOf() const; - virtual void visit(ParserVisitor*, bool); - virtual void recDependencies(std::set<ConstructedPtr>&); // Internal operation, don't use directly. - -protected: - - Struct(const ContainerPtr&, const std::string&, bool); - friend class Container; -}; - -// ---------------------------------------------------------------------- -// Sequence -// ---------------------------------------------------------------------- - -class Sequence : public virtual Constructed -{ -public: - - TypePtr type() const; - StringList typeMetaData() const; - virtual ContainedType containedType() const; - virtual bool uses(const ContainedPtr&) const; - virtual bool usesClasses() const; - virtual size_t minWireSize() const; - virtual bool isVariableLength() const; - virtual std::string kindOf() const; - virtual void visit(ParserVisitor*, bool); - virtual void recDependencies(std::set<ConstructedPtr>&); // Internal operation, don't use directly. - -protected: - - Sequence(const ContainerPtr&, const std::string&, const TypePtr&, const StringList&, bool); - friend class Container; - - TypePtr _type; - StringList _typeMetaData; -}; - -// ---------------------------------------------------------------------- -// Dictionary -// ---------------------------------------------------------------------- - -class Dictionary : public virtual Constructed -{ -public: - - TypePtr keyType() const; - TypePtr valueType() const; - StringList keyMetaData() const; - StringList valueMetaData() const; - virtual ContainedType containedType() const; - virtual bool uses(const ContainedPtr&) const; - virtual bool usesClasses() const; - virtual size_t minWireSize() const; - virtual bool isVariableLength() const; - virtual std::string kindOf() const; - virtual void visit(ParserVisitor*, bool); - virtual void recDependencies(std::set<ConstructedPtr>&); // Internal operation, don't use directly. - - static bool legalKeyType(const TypePtr&, bool&); - -protected: - - Dictionary(const ContainerPtr&, const std::string&, const TypePtr&, const StringList&, const TypePtr&, - const StringList&, bool); - friend class Container; - - TypePtr _keyType; - TypePtr _valueType; - StringList _keyMetaData; - StringList _valueMetaData; -}; - -// ---------------------------------------------------------------------- -// Enum -// ---------------------------------------------------------------------- - -class Enum : public virtual Constructed -{ -public: - - virtual void destroy(); - EnumeratorList getEnumerators(); - void setEnumerators(const EnumeratorList&); - bool explicitValue() const; - int minValue() const; - int maxValue() const; - virtual ContainedType containedType() const; - virtual bool uses(const ContainedPtr&) const; - virtual bool usesClasses() const; - virtual size_t minWireSize() const; - virtual bool isVariableLength() const; - virtual std::string kindOf() const; - virtual void visit(ParserVisitor*, bool); - virtual void recDependencies(std::set<ConstructedPtr>&); // Internal operation, don't use directly. - -protected: - - Enum(const ContainerPtr&, const std::string&, bool); - friend class Container; - - EnumeratorList _enumerators; - bool _explicitValue; - IceUtil::Int64 _minValue; - IceUtil::Int64 _maxValue; -}; - -// ---------------------------------------------------------------------- -// Enumerator -// ---------------------------------------------------------------------- - -class Enumerator : public virtual Contained -{ -public: - - EnumPtr type() const; - virtual bool uses(const ContainedPtr&) const; - virtual ContainedType containedType() const; - virtual std::string kindOf() const; - - bool explicitValue() const; - int value() const; - -protected: - - Enumerator(const ContainerPtr&, const std::string&); - Enumerator(const ContainerPtr&, const std::string&, int); - friend class Container; - friend class Enum; - - EnumPtr _type; - bool _explicitValue; - int _value; -}; - -// ---------------------------------------------------------------------- -// Const -// ---------------------------------------------------------------------- - -class Const : public virtual Contained -{ -public: - - TypePtr type() const; - StringList typeMetaData() const; - SyntaxTreeBasePtr valueType() const; - std::string value() const; - std::string literal() const; - virtual bool uses(const ContainedPtr&) const; - virtual ContainedType containedType() const; - virtual std::string kindOf() const; - virtual void visit(ParserVisitor*, bool); - -protected: - - Const(const ContainerPtr&, const std::string&, const TypePtr&, const StringList&, const SyntaxTreeBasePtr&, - const std::string&, const std::string&); - friend class Container; - - TypePtr _type; - StringList _typeMetaData; - SyntaxTreeBasePtr _valueType; - std::string _value; - std::string _literal; -}; - -// ---------------------------------------------------------------------- -// ParamDecl -// ---------------------------------------------------------------------- - -class ParamDecl : public virtual Contained -{ -public: - - TypePtr type() const; - bool isOutParam() const; - bool optional() const; - int tag() const; - virtual ContainedType containedType() const; - virtual bool uses(const ContainedPtr&) const; - virtual std::string kindOf() const; - virtual void visit(ParserVisitor*, bool); - -protected: - - ParamDecl(const ContainerPtr&, const std::string&, const TypePtr&, bool, bool, int); - friend class Operation; - - TypePtr _type; - bool _isOutParam; - bool _optional; - int _tag; -}; - -// ---------------------------------------------------------------------- -// DataMember -// ---------------------------------------------------------------------- - -class DataMember : public virtual Contained -{ -public: - - TypePtr type() const; - bool optional() const; - int tag() const; - std::string defaultValue() const; - std::string defaultLiteral() const; - SyntaxTreeBasePtr defaultValueType() const; - virtual ContainedType containedType() const; - virtual bool uses(const ContainedPtr&) const; - virtual std::string kindOf() const; - virtual void visit(ParserVisitor*, bool); - - -protected: - - DataMember(const ContainerPtr&, const std::string&, const TypePtr&, bool, int, const SyntaxTreeBasePtr&, - const std::string&, const std::string&); - friend class ClassDef; - friend class Struct; - friend class Exception; - - TypePtr _type; - bool _optional; - int _tag; - SyntaxTreeBasePtr _defaultValueType; - std::string _defaultValue; - std::string _defaultLiteral; -}; - -// ---------------------------------------------------------------------- -// Unit -// ---------------------------------------------------------------------- - -class Unit : public virtual Container -{ -public: - - static UnitPtr createUnit(bool, bool, bool, bool, const StringList& = StringList()); - - bool ignRedefs() const; - bool allowIcePrefix() const; - bool allowUnderscore() const; - - void setComment(const std::string&); - std::string currentComment(); // Not const, as this function removes the current comment. - std::string currentFile() const; - std::string topLevelFile() const; - int currentLine() const; - - void nextLine(); - bool scanPosition(const char*); - int currentIncludeLevel() const; - - void addGlobalMetaData(const StringList&); - - void setSeenDefinition(); - - void error(const char*); // Not const, because error count is increased. - void error(const std::string&); // Ditto. - - void warning(const char*) const; - void warning(const std::string&) const; - - ContainerPtr currentContainer() const; - void pushContainer(const ContainerPtr&); - void popContainer(); - - DefinitionContextPtr currentDefinitionContext() const; - void pushDefinitionContext(); - void popDefinitionContext(); - DefinitionContextPtr findDefinitionContext(const std::string&) const; - - void addContent(const ContainedPtr&); - void removeContent(const ContainedPtr&); - ContainedList findContents(const std::string&) const; - ClassList findDerivedClasses(const ClassDefPtr&) const; - ExceptionList findDerivedExceptions(const ExceptionPtr&) const; - ContainedList findUsedBy(const ContainedPtr&) const; - - void addTypeId(int, const std::string&); - std::string getTypeId(int); - - bool usesNonLocals() const; - bool usesConsts() const; - - FeatureProfile profile() const; - - // - // Returns the path names of the files included directly by the top-level file. - // - StringList includeFiles() const; - - // - // Returns the path names of all files parsed by this unit. - // - StringList allFiles() const; - - int parse(const std::string&, FILE*, bool, FeatureProfile profile = Ice); - - virtual void destroy(); - virtual void visit(ParserVisitor*, bool); - - BuiltinPtr builtin(Builtin::Kind); // Not const, as builtins are created on the fly. (Lazy initialization.) - - void addTopLevelModule(const std::string&, const std::string&); - std::set<std::string> getTopLevelModules(const std::string&) const; - -private: - - Unit(bool, bool, bool, bool, const StringList&); - static void eraseWhiteSpace(::std::string&); - - bool _ignRedefs; - bool _all; - bool _allowIcePrefix; - bool _allowUnderscore; - StringList _defaultGlobalMetaData; - int _errors; - std::string _currentComment; - int _currentLine; - int _currentIncludeLevel; - std::string _currentFile; - std::string _topLevelFile; - std::stack<DefinitionContextPtr> _definitionContextStack; - StringList _includeFiles; - std::stack<ContainerPtr> _containerStack; - std::map<Builtin::Kind, BuiltinPtr> _builtins; - std::map<std::string, ContainedList> _contentMap; - FeatureProfile _featureProfile; - std::map<std::string, DefinitionContextPtr> _definitionContextMap; - std::map<int, std::string> _typeIds; - std::map< std::string, std::set<std::string> > _fileTopLevelModules; -}; - -extern Unit* unit; // The current parser for bison/flex - -} - -#endif diff --git a/cpp/include/Slice/Preprocessor.h b/cpp/include/Slice/Preprocessor.h deleted file mode 100644 index 80f8acf4d66..00000000000 --- a/cpp/include/Slice/Preprocessor.h +++ /dev/null @@ -1,60 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef PREPROCESSOR_H -#define PREPROCESSOR_H - -#include <IceUtil/Shared.h> -#include <IceUtil/Handle.h> -#include <vector> - -namespace Slice -{ - -class Preprocessor; -typedef IceUtil::Handle<Preprocessor> PreprocessorPtr; - -class Preprocessor : public IceUtil::SimpleShared -{ -public: - - static PreprocessorPtr create(const std::string&, const std::string&, const std::vector<std::string>&); - - ~Preprocessor(); - - FILE* preprocess(bool, const std::string& = ""); - bool close(); - - enum Language { CPlusPlus, Java, CSharp, Python, Ruby, PHP, JavaScript, JavaScriptJSON, ObjC, SliceXML }; - - bool printMakefileDependencies(std::ostream&, Language, const std::vector<std::string>&, const std::string& = "", - const std::string& = "cpp", const std::string& = ""); - - std::string getBaseName(); - - static std::string addQuotes(const std::string&); - static std::string normalizeIncludePath(const std::string&); - -private: - - Preprocessor(const std::string&, const std::string&, const std::vector<std::string>&); - - bool checkInputFile(); - - const std::string _path; - const std::string _fileName; - const std::string _shortFileName; - const std::vector<std::string> _args; - std::string _cppFile; - FILE* _cppHandle; -}; - -} - -#endif diff --git a/cpp/include/Slice/PythonUtil.h b/cpp/include/Slice/PythonUtil.h deleted file mode 100644 index 807fcfa1561..00000000000 --- a/cpp/include/Slice/PythonUtil.h +++ /dev/null @@ -1,64 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef SLICE_PYTHON_UTIL_H -#define SLICE_PYTHON_UTIL_H - -#include <Slice/Parser.h> -#include <IceUtil/OutputUtil.h> - -namespace Slice -{ -namespace Python -{ - -// -// Generate Python code for a translation unit. -// -void generate(const Slice::UnitPtr&, bool, bool, const std::vector<std::string>&, IceUtilInternal::Output&); - -// -// Convert a scoped name into a Python name. -// -std::string scopedToName(const std::string&); - -// -// Check the given identifier against Python's list of reserved words. If it matches -// a reserved word, then an escaped version is returned with a leading underscore. -// -std::string fixIdent(const std::string&); - -// -// Return the package specified in the global metadata for the given definition, -// or an empty string if no metadata was found. -// -std::string getPackageMetadata(const Slice::ContainedPtr&); - -// -// Get the fully-qualified name of the given definition, including any -// package defined via metadata. If a suffix is provided, it is -// prepended to the definition's unqualified name. If the nameSuffix -// is provided, it is appended to the containers name. -// -// COMPILERFIX: MSVC 6 seems to have a problem with const std::string -// = std::string(), const std::string = std::string(). -// -std::string getAbsolute(const Slice::ContainedPtr&, const std::string& = "", const std::string& = ""); - -// -// Emit a comment header. -// -void printHeader(IceUtilInternal::Output&); - -int compile(int, char*[]); - -} -} - -#endif diff --git a/cpp/include/Slice/RubyUtil.h b/cpp/include/Slice/RubyUtil.h deleted file mode 100644 index 3acae195d9c..00000000000 --- a/cpp/include/Slice/RubyUtil.h +++ /dev/null @@ -1,54 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef SLICE_RUBY_UTIL_H -#define SLICE_RUBY_UTIL_H - -#include <Slice/Parser.h> -#include <IceUtil/OutputUtil.h> - -namespace Slice -{ -namespace Ruby -{ - -// -// Generate Ruby code for a translation unit. -// -void generate(const Slice::UnitPtr&, bool, bool, const std::vector<std::string>&, IceUtilInternal::Output&); - -// -// Check the given identifier against Ruby's list of reserved words. If it matches -// a reserved word, then an escaped version is returned with a leading underscore. -// -enum IdentStyle -{ - IdentNormal, - IdentToUpper, // Mapped identifier must begin with an upper-case letter. - IdentToLower // Mapped identifier must begin with a lower-case letter. -}; -std::string fixIdent(const std::string&, IdentStyle); - -// -// Get the fully-qualified name of the given definition. If a prefix is provided, -// it is prepended to the definition's unqualified name. -// -std::string getAbsolute(const Slice::ContainedPtr&, IdentStyle, const std::string& = std::string()); - -// -// Emit a comment header. -// -void printHeader(IceUtilInternal::Output&); - -int compile(int, char*[]); - -} -} - -#endif diff --git a/cpp/include/Slice/Util.h b/cpp/include/Slice/Util.h deleted file mode 100644 index a2ec69a87a2..00000000000 --- a/cpp/include/Slice/Util.h +++ /dev/null @@ -1,51 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef SLICE_UTIL_H -#define SLICE_UTIL_H - -#include <Slice/Parser.h> -#include <IceUtil/OutputUtil.h> - -#include <ostream> -#include <fstream> - -namespace Slice -{ - -std::string fullPath(const std::string&); -std::string changeInclude(const std::string&, const std::vector<std::string>&); -void setErrorStream(std::ostream&); -std::ostream& getErrorStream(); -void emitError(const std::string&, int, const std::string&); -void emitWarning(const std::string&, int, const std::string&); -void emitError(const std::string&, const std::string&, const std::string&); -void emitWarning(const std::string&, const std::string&, const std::string&); -void emitRaw(const char*); -std::vector<std::string> filterMcppWarnings(const std::string&); -void printGeneratedHeader(IceUtilInternal::Output& out, const std::string&, const std::string& commentStyle = "//"); - -class DependOutputUtil : IceUtil::noncopyable -{ -public: - - DependOutputUtil(std::string& file); - ~DependOutputUtil(); - void cleanup(); - std::ostream& os(); - -private: - - const std::string _file; - std::ofstream _os; -}; - -} - -#endif |