Mercurial > hg > orthanc-stone
diff Framework/Orthanc/Core/Toolbox.h @ 15:da2cf3ace87a
sync
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 09 Nov 2016 17:20:44 +0100 |
parents | 0b9034112fde |
children |
line wrap: on
line diff
--- a/Framework/Orthanc/Core/Toolbox.h Wed Nov 09 15:29:53 2016 +0100 +++ b/Framework/Orthanc/Core/Toolbox.h Wed Nov 09 17:20:44 2016 +0100 @@ -56,9 +56,17 @@ # error The macro BOOST_HAS_REGEX must be defined #endif -#if !defined(ORTHANC_SANDBOXED) -# define ORTHANC_SANDBOXED 0 -#endif + +/** + * NOTE: GUID vs. UUID + * The simple answer is: no difference, they are the same thing. Treat + * them as a 16 byte (128 bits) value that is used as a unique + * value. In Microsoft-speak they are called GUIDs, but call them + * UUIDs when not using Microsoft-speak. + * http://stackoverflow.com/questions/246930/is-there-any-difference-between-a-guid-and-a-uuid + **/ + + namespace Orthanc { @@ -72,12 +80,6 @@ { void USleep(uint64_t microSeconds); -#if ORTHANC_SANDBOXED == 0 - ServerBarrierEvent ServerBarrier(const bool& stopFlag); - - ServerBarrierEvent ServerBarrier(); -#endif - void ToUpperCase(std::string& s); // Inplace version void ToLowerCase(std::string& s); // Inplace version @@ -88,24 +90,6 @@ void ToLowerCase(std::string& result, const std::string& source); -#if ORTHANC_SANDBOXED == 0 - void ReadFile(std::string& content, - const std::string& path); - - bool ReadHeader(std::string& header, - const std::string& path, - size_t headerSize); - - void WriteFile(const std::string& content, - const std::string& path); - - void WriteFile(const void* content, - size_t size, - const std::string& path); - - void RemoveFile(const std::string& path); -#endif - void SplitUriComponents(UriComponents& components, const std::string& uri); @@ -121,10 +105,6 @@ std::string FlattenUri(const UriComponents& components, size_t fromLevel = 0); -#if ORTHANC_SANDBOXED == 0 - uint64_t GetFileSize(const std::string& path); -#endif - #if ORTHANC_ENABLE_MD5 == 1 void ComputeMD5(std::string& result, const std::string& data); @@ -164,12 +144,6 @@ const std::string& content); #endif -#if ORTHANC_SANDBOXED == 0 - std::string GetPathToExecutable(); - - std::string GetDirectoryOfExecutable(); -#endif - std::string ConvertToUtf8(const std::string& source, Encoding sourceEncoding); @@ -183,13 +157,6 @@ std::string StripSpaces(const std::string& source); -#if BOOST_HAS_DATE_TIME == 1 - std::string GetNowIsoString(); - - void GetNowDicom(std::string& date, - std::string& time); -#endif - // In-place percent-decoding for URL void UrlDecode(std::string& s); @@ -203,12 +170,6 @@ const std::string& source, char separator); -#if ORTHANC_SANDBOXED == 0 - void MakeDirectory(const std::string& path); - - bool IsExistingFile(const std::string& path); -#endif - #if ORTHANC_ENABLE_PUGIXML == 1 void JsonToXml(std::string& target, const Json::Value& source, @@ -216,11 +177,6 @@ const std::string& arrayElement = "item"); #endif -#if ORTHANC_SANDBOXED == 0 - void ExecuteSystemCommand(const std::string& command, - const std::vector<std::string>& arguments); -#endif - bool IsInteger(const std::string& str); void CopyJsonWithoutComments(Json::Value& target, @@ -229,15 +185,6 @@ bool StartsWith(const std::string& str, const std::string& prefix); -#if ORTHANC_SANDBOXED == 0 - int GetProcessId(); - - bool IsRegularFile(const std::string& path); -#endif - - FILE* OpenFile(const std::string& path, - FileMode mode); - void UriEncode(std::string& target, const std::string& source); @@ -256,5 +203,11 @@ unsigned int GetJsonUnsignedIntegerField(const ::Json::Value& json, const std::string& key, unsigned int defaultValue); + + std::string GenerateUuid(); + + bool IsUuid(const std::string& str); + + bool StartsWithUuid(const std::string& str); } }