MCPcopy Create free account
hub / github.com/Kitware/VTK / DecodeString

Method DecodeString

IO/Legacy/vtkDataReader.cxx:3821–3859  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

3819
3820//------------------------------------------------------------------------------
3821int vtkDataReader::DecodeString(char* resname, const char* name)
3822{
3823 if (!resname || !name)
3824 {
3825 return 0;
3826 }
3827 std::ostringstream str;
3828 size_t cc = 0;
3829 unsigned int ch;
3830 size_t len = strlen(name);
3831 size_t reslen = 0;
3832 char buffer[10] = "0x";
3833 while (name[cc])
3834 {
3835 if (name[cc] == '%')
3836 {
3837 if (cc <= (len - 3))
3838 {
3839 buffer[2] = name[cc + 1];
3840 buffer[3] = name[cc + 2];
3841 buffer[4] = 0;
3842 auto result = vtk::scan<unsigned int>(std::string_view(buffer), "{:x}");
3843 ch = result->value();
3844 str << static_cast<char>(ch);
3845 cc += 2;
3846 reslen++;
3847 }
3848 }
3849 else
3850 {
3851 str << name[cc];
3852 reslen++;
3853 }
3854 cc++;
3855 }
3856 strncpy(resname, str.str().c_str(), reslen + 1);
3857 resname[reslen] = 0;
3858 return static_cast<int>(reslen);
3859}
3860
3861static int my_getline(istream& in, std::string& out, char delimiter)
3862{

Callers 12

ReadArrayMethod · 0.95
ReadScalarDataMethod · 0.95
ReadVectorDataMethod · 0.95
ReadNormalDataMethod · 0.95
ReadTensorDataMethod · 0.95
ReadCoScalarDataMethod · 0.95
ReadTCoordsDataMethod · 0.95
ReadGlobalIdsMethod · 0.95
ReadPedigreeIdsMethod · 0.95
ReadEdgeFlagsMethod · 0.95
ReadInformationMethod · 0.95
ReadFieldDataMethod · 0.95

Calls 3

valueMethod · 0.45
c_strMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected