sync with master
[platform/framework/native/appfw.git] / src / base / utility / FBaseUtil_ScannerImpl.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file        FBaseUtil_ScannerImpl.h
20  * @brief       This is the header file for the _ScannerImpl class.
21  *
22  * This header file contains declarations and definitions of the _ScannerImpl class. 
23  *
24  */
25
26 #ifndef _FBASE_UTIL_SCANNER_IMPL_H_
27 #define _FBASE_UTIL_SCANNER_IMPL_H_
28
29 #include <FBaseString.h>
30 #include <FBaseUtilRegularExpression.h>
31
32 namespace Tizen { namespace Base { namespace Utility
33 {
34
35 class _OSP_EXPORT_ _ScannerImpl
36         : public Tizen::Base::Object
37 {
38 public:
39         _ScannerImpl(void);
40         _ScannerImpl(const _ScannerImpl& scanner);
41         _ScannerImpl& operator =(const _ScannerImpl& scanner);
42         virtual ~_ScannerImpl(void);
43 //      virtual int GetHashCode(void);
44
45         result Construct(const String& str);
46         result Construct(const String& filePath, const String& encodingScheme);
47
48         result FindInLine(const String& str, String& MatchedStr); 
49         result FindInLine(const RegularExpression& pattern, String& MatchedStr); 
50         
51         result GetNextSignedChar(signed char& nextSignedChar);
52         result GetNextSignedChar(signed char& nextSignedChar, int radix);
53         result GetNextInt(int& nextInt);
54         result GetNextInt(int& nextInt, int radix);
55         result GetNextShort(short& nextShort);
56         result GetNextShort(short& nextShort, int radix);
57         result GetNextLongLong(long long& nextLongLong);
58         result GetNextFloat(float& nextFloat);
59         result GetNextDouble(double& nextDouble);
60         result GetNextBool(bool& nextBool);
61         result GetNextLine(String& nextLine);
62         result GetNextToken(String& nextStr);
63         result GetNextToken(const String& pattern, String& nextStr);
64         result GetNextToken(const RegularExpression& pattern, String& nextStr);
65
66         int GetRadix(void);
67         String GetDelimiter(void);
68
69         bool HasNextToken(void);
70         bool HasNextToken(const String& pattern);
71         bool HasNextToken(const RegularExpression& pattern);
72         bool IsNextTokenConvertibleToSignedChar(void); 
73         bool IsNextTokenConvertibleToSignedChar(int radix);
74         bool IsNextTokenConvertibleToInt(void);
75         bool IsNextTokenConvertibleToInt(int radix);
76         bool IsNextTokenConvertibleToShort(void);
77         bool IsNextTokenConvertibleToShort(int radix);
78         bool IsNextTokenConvertibleToLongLong(void);
79         bool IsNextTokenConvertibleToFloat(void);
80         bool IsNextTokenConvertibleToDouble(void);
81         bool IsNextTokenConvertibleToBool(void);
82         bool HasNextLine(void);
83
84         void SetRadix(int radix);
85         void SetDelimiter(const String& delimiter);
86         void SetDelimiter(const RegularExpression& pattern);
87
88         void Skip(const String& str);
89         void Skip(const RegularExpression& pattern);
90         result GetNextToken(const String& pattern, String& ret, int& matTokenLen);
91         result GetNextMatchingString(const String& pattern, String& ret, int& length);
92
93 public:
94         int __radix;
95         String __delimiter;
96         const wchar_t* __pParseStr;
97         bool __isAllocatedOnHeap;
98         int __position;
99
100         friend class Scanner;
101 }; // _ScannerImpl
102
103 }}}   // Osp::Base::Utility
104
105 #endif // _FBASE_UTIL_SCANNER_IMPL_H_