MCPcopy Create free account
hub / github.com/apache/thrift / getTypeIDForTypeName

Function getTypeIDForTypeName

lib/cpp/src/thrift/protocol/TJSONProtocol.cpp:104–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104static TType getTypeIDForTypeName(const std::string& name) {
105 TType result = T_STOP; // Sentinel value
106 if (name.length() > 1) {
107 switch (name[0]) {
108 case 'd':
109 result = T_DOUBLE;
110 break;
111 case 'i':
112 switch (name[1]) {
113 case '8':
114 result = T_BYTE;
115 break;
116 case '1':
117 result = T_I16;
118 break;
119 case '3':
120 result = T_I32;
121 break;
122 case '6':
123 result = T_I64;
124 break;
125 }
126 break;
127 case 'l':
128 result = T_LIST;
129 break;
130 case 'm':
131 result = T_MAP;
132 break;
133 case 'r':
134 result = T_STRUCT;
135 break;
136 case 's':
137 if (name[1] == 't') {
138 result = T_STRING;
139 } else if (name[1] == 'e') {
140 result = T_SET;
141 }
142 break;
143 case 't':
144 result = T_BOOL;
145 break;
146 case 'u':
147 result = T_UUID;
148 break;
149 }
150 }
151 if (result == T_STOP) {
152 throw TProtocolException(TProtocolException::NOT_IMPLEMENTED, "Unrecognized type");
153 }
154 return result;
155}
156
157// This table describes the handling for the first 0x30 characters
158// 0 : escape using "\u00xx" notation

Callers 4

readFieldBeginMethod · 0.85
readMapBeginMethod · 0.85
readListBeginMethod · 0.85
readSetBeginMethod · 0.85

Calls 2

TProtocolExceptionClass · 0.70
lengthMethod · 0.65

Tested by

no test coverage detected