]> cygwin.com Git - cygwin-apps/setup.git/blame - String++.h
Suppress bogus free-nonheap-object warning in iniparse.cc
[cygwin-apps/setup.git] / String++.h
CommitLineData
3c054baf 1/*
5f9ac473 2 * Copyright 2003-2006, Various Contributors.
3c054baf
RC
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * A copy of the GNU General Public License can be found at
10 * http://www.gnu.org/
3c054baf
RC
11 */
12
c93bc6d0
MB
13#ifndef SETUP_STRING___H
14#define SETUP_STRING___H
3c054baf 15
b401ef47 16#include <string>
3f7be627 17#include "win32.h"
3c054baf 18
cb026227 19char *new_cstr_char_array (const std::string& s);
3a8630fd 20
346627e7
IP
21#define __TOSTRING__(X) #X
22/* Note the layer of indirection here is needed to allow
23 stringification of the expansion of macros, i.e. "#define foo
24 bar", "TOSTRING(foo)", to yield "bar". */
25#define TOSTRING(X) __TOSTRING__(X)
26
cb026227 27std::string format_1000s (int num, char sep = ',');
0ac305ec 28
5f9ac473 29std::string stringify (int num);
8300be9c 30
afa76033
MB
31int casecompare (const std::string& a, const std::string& b, size_t limit = 0);
32
2b791966 33std::string replace(const std::string& haystack, const std::string& needle,
5f9ac473 34 const std::string& replacement);
2b791966 35
cb026227
MB
36class casecompare_lt_op
37{
5f9ac473
MB
38 public:
39 bool operator() (const std::string& a, const std::string& b) const
40 { return casecompare(a, b) < 0; }
cb026227
MB
41};
42
43inline std::string operator+ (const char *a, const std::string& b)
44{ return std::string(a) + b; }
45
e32e0a4a 46std::wstring string_to_wstring(const std::string &s);
3f7be627 47std::string wstring_to_string(const std::wstring &w, unsigned int encoding = CP_UTF8);
dd0631fa
JT
48
49// produce a std::string using formatting like sprintf
50std::wstring vformat(const std::wstring &fmt, va_list ap);
b08f9c71 51std::wstring format(const std::wstring &fmt, ...);
e32e0a4a 52
c93bc6d0 53#endif /* SETUP_STRING___H */
This page took 0.121965 seconds and 5 git commands to generate.