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

Function ReadStringVersion

IO/XML/vtkXMLReader.cxx:86–124  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

84
85//------------------------------------------------------------------------------
86static void ReadStringVersion(const char* version, int& major, int& minor)
87{
88 if (!version)
89 {
90 major = -1;
91 minor = -1;
92 return;
93 }
94 // Extract the major and minor version numbers.
95 size_t length = strlen(version);
96 const char* begin = version;
97 const char* end = version + length;
98 const char* s;
99
100 for (s = begin; (s != end) && (*s != '.'); ++s)
101 {
102 }
103
104 if (s > begin)
105 {
106 std::stringstream str;
107 str.write(begin, s - begin);
108 str >> major;
109 if (!str)
110 {
111 major = 0;
112 }
113 }
114 if (++s < end)
115 {
116 std::stringstream str;
117 str.write(s, end - s);
118 str >> minor;
119 if (!str)
120 {
121 minor = 0;
122 }
123 }
124}
125
126vtkCxxSetObjectMacro(vtkXMLReader, InputArray, vtkCharArray);
127

Callers 2

ReadVTKFileMethod · 0.85

Calls 1

writeMethod · 0.45

Tested by

no test coverage detected