Changeset 73908 in vbox for trunk/include/iprt/cpp
- Timestamp:
- Aug 27, 2018 10:15:30 AM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 124627
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/cpp/ministring.h
r73907 r73908 586 586 587 587 /** 588 * Appends the output of the string format operation (RTStrPrintf). 589 * 590 * @param pszFormat Pointer to the format string, 591 * @see pg_rt_str_format. 592 * @param ... Ellipsis containing the arguments specified by 593 * the format string. 594 * 595 * @throws std::bad_alloc On allocation error. The object is left unchanged. 596 * 597 * @returns Reference to the object. 598 */ 599 RTCString &appendPrintf(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2); 600 601 /** 602 * Appends the output of the string format operation (RTStrPrintf). 603 * 604 * @param pszFormat Pointer to the format string, 605 * @see pg_rt_str_format. 606 * @param ... Ellipsis containing the arguments specified by 607 * the format string. 608 * 609 * @returns VINF_SUCCESS or VERR_NO_STRING_MEMORY. 610 */ 611 int appendPrintfNoThrow(const char *pszFormat, ...) RT_NOEXCEPT RT_IPRT_FORMAT_ATTR(1, 2); 612 613 /** 614 * Appends the output of the string format operation (RTStrPrintfV). 615 * 616 * @param pszFormat Pointer to the format string, 617 * @see pg_rt_str_format. 618 * @param va Argument vector containing the arguments 619 * specified by the format string. 620 * 621 * @throws std::bad_alloc On allocation error. The object is left unchanged. 622 * 623 * @returns Reference to the object. 624 */ 625 RTCString &appendPrintfV(const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(1, 0); 626 627 /** 628 * Assigns the output of the string format operation (RTStrPrintfV). 629 * 630 * @param pszFormat Pointer to the format string, 631 * @see pg_rt_str_format. 632 * @param va Argument vector containing the arguments 633 * specified by the format string. 634 * 635 * @returns VINF_SUCCESS or VERR_NO_STRING_MEMORY. 636 */ 637 int appendPrintfVNoThrow(const char *pszFormat, va_list va) RT_NOEXCEPT RT_IPRT_FORMAT_ATTR(1, 0); 638 639 /** 588 640 * Shortcut to append(), RTCString variant. 589 641 * … … 624 676 * @returns Reference to the object. 625 677 */ 626 RTCString &toUpper() 678 RTCString &toUpper() RT_NOEXCEPT 627 679 { 628 680 if (length()) … … 643 695 * @returns Reference to the object. 644 696 */ 645 RTCString &toLower() 697 RTCString &toLower() RT_NOEXCEPT 646 698 { 647 699 if (length()) … … 664 716 * @param cchLength How much following @a offStart to erase. 665 717 */ 666 RTCString &erase(size_t offStart = 0, size_t cchLength = npos) ;718 RTCString &erase(size_t offStart = 0, size_t cchLength = npos) RT_NOEXCEPT; 667 719 668 720 /** … … 800 852 * @returns char at the index or null. 801 853 */ 802 inline char operator[](size_t i) const 854 inline char operator[](size_t i) const RT_NOEXCEPT 803 855 { 804 856 if (i < length()) … … 815 867 * @returns const pointer to C-style string. 816 868 */ 817 inline const char *c_str() const 869 inline const char *c_str() const RT_NOEXCEPT 818 870 { 819 871 return (m_psz) ? m_psz : ""; … … 832 884 * may go nowhere. Better not use mutableRaw() at all. 833 885 */ 834 char *mutableRaw() 886 char *mutableRaw() RT_NOEXCEPT 835 887 { 836 888 return m_psz; … … 845 897 * nowhere. 846 898 */ 847 void jolt() 899 void jolt() RT_NOEXCEPT 848 900 { 849 901 if (m_psz) … … 869 921 * @returns @c true if empty, @c false if not. 870 922 */ 871 bool isEmpty() const 923 bool isEmpty() const RT_NOEXCEPT 872 924 { 873 925 return length() == 0; … … 884 936 * @returns @c false if empty, @c true if not. 885 937 */ 886 bool isNotEmpty() const 938 bool isNotEmpty() const RT_NOEXCEPT 887 939 { 888 940 return length() != 0; … … 904 956 * if larger. 905 957 */ 906 int compare(const char *pcszThat, CaseSensitivity cs = CaseSensitive) const 958 int compare(const char *pcszThat, CaseSensitivity cs = CaseSensitive) const RT_NOEXCEPT 907 959 { 908 960 /* This klugde is for m_cch=0 and m_psz=NULL. pcsz=NULL and psz="" … … 924 976 * if larger. 925 977 */ 926 int compare(const RTCString &rThat, CaseSensitivity cs = CaseSensitive) const 978 int compare(const RTCString &rThat, CaseSensitivity cs = CaseSensitive) const RT_NOEXCEPT 927 979 { 928 980 if (cs == CaseSensitive) … … 937 989 * @param rThat The string to compare with. 938 990 */ 939 bool equals(const RTCString &rThat) const 991 bool equals(const RTCString &rThat) const RT_NOEXCEPT 940 992 { 941 993 return rThat.length() == length() … … 950 1002 * @param pszThat The string to compare with. 951 1003 */ 952 bool equals(const char *pszThat) const 1004 bool equals(const char *pszThat) const RT_NOEXCEPT 953 1005 { 954 1006 /* This klugde is for m_cch=0 and m_psz=NULL. pcsz=NULL and psz="" … … 965 1017 * @param that The string to compare with. 966 1018 */ 967 bool equalsIgnoreCase(const RTCString &that) const 1019 bool equalsIgnoreCase(const RTCString &that) const RT_NOEXCEPT 968 1020 { 969 1021 /* Unfolded upper and lower case characters may require different … … 978 1030 * @param pszThat The string to compare with. 979 1031 */ 980 bool equalsIgnoreCase(const char *pszThat) const 1032 bool equalsIgnoreCase(const char *pszThat) const RT_NOEXCEPT 981 1033 { 982 1034 /* This klugde is for m_cch=0 and m_psz=NULL. pcsz=NULL and psz="" … … 1020 1072 * @returns 0 based position of pszNeedle. npos if not found. 1021 1073 */ 1022 size_t find(const char *pszNeedle, size_t offStart = 0) const ;1074 size_t find(const char *pszNeedle, size_t offStart = 0) const RT_NOEXCEPT; 1023 1075 1024 1076 /** … … 1036 1088 * NULL or an empty string. 1037 1089 */ 1038 size_t find(const RTCString *pStrNeedle, size_t offStart = 0) const ;1090 size_t find(const RTCString *pStrNeedle, size_t offStart = 0) const RT_NOEXCEPT; 1039 1091 1040 1092 /** … … 1046 1098 * @param chReplace Character to replace cFind with. Must be ASCII < 128. 1047 1099 */ 1048 void findReplace(char chFind, char chReplace) ;1100 void findReplace(char chFind, char chReplace) RT_NOEXCEPT; 1049 1101 1050 1102 /** … … 1054 1106 * @remarks QString::count 1055 1107 */ 1056 size_t count(char ch) const ;1108 size_t count(char ch) const RT_NOEXCEPT; 1057 1109 1058 1110 /** … … 1063 1115 * @remarks QString::count 1064 1116 */ 1065 size_t count(const char *psz, CaseSensitivity cs = CaseSensitive) const ;1117 size_t count(const char *psz, CaseSensitivity cs = CaseSensitive) const RT_NOEXCEPT; 1066 1118 1067 1119 /** … … 1072 1124 * @remarks QString::count 1073 1125 */ 1074 size_t count(const RTCString *pStr, CaseSensitivity cs = CaseSensitive) const ;1126 size_t count(const RTCString *pStr, CaseSensitivity cs = CaseSensitive) const RT_NOEXCEPT; 1075 1127 1076 1128 /** … … 1079 1131 * @returns this 1080 1132 */ 1081 RTCString &strip() ;1133 RTCString &strip() RT_NOEXCEPT; 1082 1134 1083 1135 /** … … 1086 1138 * @returns this 1087 1139 */ 1088 RTCString &stripLeft() ;1140 RTCString &stripLeft() RT_NOEXCEPT; 1089 1141 1090 1142 /** … … 1093 1145 * @returns this 1094 1146 */ 1095 RTCString &stripRight() ;1147 RTCString &stripRight() RT_NOEXCEPT; 1096 1148 1097 1149 /** … … 1135 1187 * @returns true if match, false if mismatch. 1136 1188 */ 1137 bool endsWith(const RTCString &that, CaseSensitivity cs = CaseSensitive) const ;1189 bool endsWith(const RTCString &that, CaseSensitivity cs = CaseSensitive) const RT_NOEXCEPT; 1138 1190 1139 1191 /** … … 1143 1195 * @returns true if match, false if mismatch. 1144 1196 */ 1145 bool startsWith(const RTCString &that, CaseSensitivity cs = CaseSensitive) const ;1197 bool startsWith(const RTCString &that, CaseSensitivity cs = CaseSensitive) const RT_NOEXCEPT; 1146 1198 1147 1199 /** … … 1152 1204 * @returns true if match, false if mismatch. 1153 1205 */ 1154 bool startsWithWord(const char *pszWord, CaseSensitivity enmCase = CaseSensitive) const ;1206 bool startsWithWord(const char *pszWord, CaseSensitivity enmCase = CaseSensitive) const RT_NOEXCEPT; 1155 1207 1156 1208 /** … … 1161 1213 * @returns true if match, false if mismatch. 1162 1214 */ 1163 bool startsWithWord(const RTCString &rThat, CaseSensitivity enmCase = CaseSensitive) const ;1215 bool startsWithWord(const RTCString &rThat, CaseSensitivity enmCase = CaseSensitive) const RT_NOEXCEPT; 1164 1216 1165 1217 /** … … 1170 1222 * @returns true if found, false if not found. 1171 1223 */ 1172 bool contains(const RTCString &that, CaseSensitivity cs = CaseSensitive) const ;1224 bool contains(const RTCString &that, CaseSensitivity cs = CaseSensitive) const RT_NOEXCEPT; 1173 1225 1174 1226 /** … … 1179 1231 * @returns true if found, false if not found. 1180 1232 */ 1181 bool contains(const char *pszNeedle, CaseSensitivity cs = CaseSensitive) const ;1233 bool contains(const char *pszNeedle, CaseSensitivity cs = CaseSensitive) const RT_NOEXCEPT; 1182 1234 1183 1235 /** … … 1187 1239 * @returns 0 on failure. 1188 1240 */ 1189 int32_t toInt32() const 1241 int32_t toInt32() const RT_NOEXCEPT 1190 1242 { 1191 1243 return RTStrToInt32(c_str()); … … 1198 1250 * @returns 0 on failure. 1199 1251 */ 1200 uint32_t toUInt32() const 1252 uint32_t toUInt32() const RT_NOEXCEPT 1201 1253 { 1202 1254 return RTStrToUInt32(c_str()); … … 1209 1261 * @returns 0 on failure. 1210 1262 */ 1211 int64_t toInt64() const 1263 int64_t toInt64() const RT_NOEXCEPT 1212 1264 { 1213 1265 return RTStrToInt64(c_str()); … … 1220 1272 * @returns 0 on failure. 1221 1273 */ 1222 uint64_t toUInt64() const 1274 uint64_t toUInt64() const RT_NOEXCEPT 1223 1275 { 1224 1276 return RTStrToUInt64(c_str()); … … 1231 1283 * @returns IPRT error code, see RTStrToInt64. 1232 1284 */ 1233 int toInt(uint64_t &i) const ;1285 int toInt(uint64_t &i) const RT_NOEXCEPT; 1234 1286 1235 1287 /** … … 1239 1291 * @returns IPRT error code, see RTStrToInt32. 1240 1292 */ 1241 int toInt(uint32_t &i) const ;1293 int toInt(uint32_t &i) const RT_NOEXCEPT; 1242 1294 1243 1295 /** Splitting behavior regarding empty sections in the string. */ … … 1254 1306 * @param a_enmMode How should empty parts be handled. 1255 1307 * @returns separated strings as string list. 1308 * @throws std::bad_alloc On allocation error. 1256 1309 */ 1257 1310 RTCList<RTCString, RTCString *> split(const RTCString &a_rstrSep, … … 1266 1319 * @param a_rstrSep The separator used for joining. 1267 1320 * @returns joined string. 1321 * @throws std::bad_alloc On allocation error. 1268 1322 */ 1269 1323 static RTCString joinEx(const RTCList<RTCString, RTCString *> &a_rList, … … 1277 1331 * @param a_rstrSep The separator used for joining. 1278 1332 * @returns joined string. 1333 * @throws std::bad_alloc On allocation error. 1279 1334 */ 1280 1335 static RTCString join(const RTCList<RTCString, RTCString *> &a_rList, … … 1288 1343 * @param a_rThat The string to swap with. 1289 1344 */ 1290 inline void swap(RTCString &a_rThat) throw()1345 inline void swap(RTCString &a_rThat) RT_NOEXCEPT 1291 1346 { 1292 1347 char *pszTmp = m_psz; … … 1314 1369 * assigning a new string. 1315 1370 */ 1316 void cleanup() 1371 void cleanup() RT_NOEXCEPT 1317 1372 { 1318 1373 if (m_psz)
Note:
See TracChangeset
for help on using the changeset viewer.