source: vendor/synergy/current/lib/base/CStringUtil.h

Last change on this file was 2749, checked in by bird, 19 years ago

synergy v1.3.1 sources (zip).

File size: 2.2 KB
Line 
1/*
2 * synergy -- mouse and keyboard sharing utility
3 * Copyright (C) 2002 Chris Schoeneman
4 *
5 * This package is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * found in the file COPYING that should have accompanied this file.
8 *
9 * This package is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef CSTRINGUTIL_H
16#define CSTRINGUTIL_H
17
18#include "CString.h"
19#include <stdarg.h>
20
21//! String utilities
22/*!
23This class provides various functions for string manipulation.
24*/
25class CStringUtil {
26public:
27 //! Format positional arguments
28 /*!
29 Format a string using positional arguments. fmt has literal
30 characters and conversion specifications introduced by `\%':
31 - \c\%\% -- literal `\%'
32 - \c\%{n} -- positional element n, n a positive integer, {} are literal
33
34 All arguments in the variable list are const char*. Positional
35 elements are indexed from 1.
36 */
37 static CString format(const char* fmt, ...);
38
39 //! Format positional arguments
40 /*!
41 Same as format() except takes va_list.
42 */
43 static CString vformat(const char* fmt, va_list);
44
45 //! Print a string using printf-style formatting
46 /*!
47 Equivalent to printf() except the result is returned as a CString.
48 */
49 static CString print(const char* fmt, ...);
50
51 //! Case-insensitive comparisons
52 /*!
53 This class provides case-insensitve comparison functions.
54 */
55 class CaselessCmp {
56 public:
57 //! Same as less()
58 bool operator()(const CString& a, const CString& b) const;
59
60 //! Returns true iff \c a is lexicographically less than \c b
61 static bool less(const CString& a, const CString& b);
62
63 //! Returns true iff \c a is lexicographically equal to \c b
64 static bool equal(const CString& a, const CString& b);
65
66 //! Returns true iff \c a is lexicographically less than \c b
67 static bool cmpLess(const CString::value_type& a,
68 const CString::value_type& b);
69
70 //! Returns true iff \c a is lexicographically equal to \c b
71 static bool cmpEqual(const CString::value_type& a,
72 const CString::value_type& b);
73 };
74};
75
76#endif
77
Note: See TracBrowser for help on using the repository browser.