* \note it is the caller's responsibility not to go out of bounds
* \note bounds is 0 <= pos < length(); caller must pay attention to signedness
*/
- explicit SBuf(const char *S, size_type n = npos);
+ explicit SBuf(const char *S, size_type n);
+ explicit SBuf(const char *S) : SBuf(S,strlen(S)) {}
/** Constructor: import SquidString, copying contents.
*
* \note to assign a std::string use the pattern:
* assign(stdstr.data(), stdstd.length())
*/
- SBuf& assign(const char *S, size_type n = npos);
+ SBuf& assign(const char *S, size_type n);
+ SBuf& assign(const char *S) {return assign(S,strlen(S));}
/** Assignment operator. Copy a NULL-terminated c-style string into a SBuf.
*
* \note to append a std::string use the pattern
* cstr_append(stdstr.data(), stdstd.length())
*/
- SBuf& append(const char * S, size_type Ssize = npos);
+ SBuf& append(const char * S, size_type Ssize);
+ SBuf& append(const char * S) { return append(S,strlen(S)); }
/** Assignment operation with printf(3)-style definition
* \note arguments may be evaluated more than once, be careful
* \retval <0 argument of the call is smaller than called SBuf
* \retval 0 argument of the call has the same contents of called SBuf
*/
- int compare(const SBuf &S, const SBufCaseSensitive isCaseSensitive, const size_type n = npos) const;
+ int compare(const SBuf &S, const SBufCaseSensitive isCaseSensitive, const size_type n) const;
+ int compare(const SBuf &S, const SBufCaseSensitive isCaseSensitive) const {
+ return compare(S, isCaseSensitive, S.length());
+ }
/// shorthand version for compare()
- inline int cmp(const SBuf &S, const size_type n = npos) const {
+ inline int cmp(const SBuf &S, const size_type n) const {
return compare(S,caseSensitive,n);
}
+ inline int cmp(const SBuf &S) const {
+ return compare(S,caseSensitive,S.length());
+ }
/// shorthand version for case-insensitive compare()
- inline int caseCmp(const SBuf &S, const size_type n = npos) const {
+ inline int caseCmp(const SBuf &S, const size_type n) const {
return compare(S,caseInsensitive,n);
}
+ inline int caseCmp(const SBuf &S) const {
+ return compare(S,caseInsensitive,S.length());
+ }
/// Comparison with a C-string.
- int compare(const char *s, const SBufCaseSensitive isCaseSensitive, const size_type n = npos) const;
+ int compare(const char *s, const SBufCaseSensitive isCaseSensitive, const size_type n) const;
+ int compare(const char *s, const SBufCaseSensitive isCaseSensitive) const {
+ return compare(s,isCaseSensitive,strlen(s));
+ }
/// Shorthand version for C-string compare().
- inline int cmp(const char *S, const size_type n = npos) const {
+ inline int cmp(const char *S, const size_type n) const {
return compare(S,caseSensitive,n);
}
+ inline int cmp(const char *S) const {
+ return compare(S,caseSensitive,strlen(S));
+ }
/// Shorthand version for case-insensitive C-string compare().
- inline int caseCmp(const char *S, const size_type n = npos) const {
+ inline int caseCmp(const char *S, const size_type n) const {
return compare(S,caseInsensitive,n);
}
+ inline int caseCmp(const char *S) const {
+ return compare(S,caseInsensitive,strlen(S));
+ }
/** check whether the entire supplied argument is a prefix of the SBuf.
* \param S the prefix to match against