comparison Core/Toolbox.cpp @ 2129:0c09d1af22f3

"/tools/invalidate-tags" to invalidate the JSON summary of all the DICOM files
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 07 Nov 2016 17:44:10 +0100
parents e9e6ffbf0fd5
children dd609a99d39a
comparison
equal deleted inserted replaced
2128:9329ba17a069 2129:0c09d1af22f3
842 return ConvertToAscii(source); 842 return ConvertToAscii(source);
843 } 843 }
844 } 844 }
845 845
846 846
847 bool Toolbox::IsAsciiString(const void* data,
848 size_t size)
849 {
850 const uint8_t* p = reinterpret_cast<const uint8_t*>(data);
851
852 for (size_t i = 0; i < size; i++, p++)
853 {
854 if (*p > 127 || (*p != 0 && iscntrl(*p)))
855 {
856 return false;
857 }
858 }
859
860 return true;
861 }
862
863
847 std::string Toolbox::ConvertToAscii(const std::string& source) 864 std::string Toolbox::ConvertToAscii(const std::string& source)
848 { 865 {
849 std::string result; 866 std::string result;
850 867
851 result.reserve(source.size() + 1); 868 result.reserve(source.size() + 1);