summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/StringUtil.h
blob: 207d9612f9de907ba52782531a08598b426c4319 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// **********************************************************************
//
// Copyright (c) 2003
// ZeroC, Inc.
// Billerica, MA, USA
//
// All Rights Reserved.
//
// Ice is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License version 2 as published by
// the Free Software Foundation.
//
// **********************************************************************

#ifndef ICE_STRING_UTIL_H
#define ICE_STRING_UTIL_H

namespace IceInternal
{

//  
// Encodes a string into UTF8, escaping all characters outside the range [32-126]
// as well as any special characters determined by the caller.
//
std::string encodeString(const std::string&, const std::string&);

//
// Decodes a UTF8 string. Decoding starts at the given start position
// (inclusive) and stops at the given end position (exclusive). If the end
// position is zero, then the remainder of the string is used. Upon success,
// the result parameter holds the decoded string and true is returned.
// A return value of false indicates an error was detected in the encoding.
//
bool decodeString(const std::string&, std::string::size_type, std::string::size_type, std::string&);

//
// If a single or double quotation mark is found at the start position,
// then the position of the matching closing quote is returned. If no
// quotation mark is found at the start position, then 0 is returned.
// If no matching closing quote is found, then std::string::npos is
// returned.
//
std::string::size_type checkQuote(const std::string&, std::string::size_type = 0);

}

#endif