Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * Version: MPL 1.1 / GPLv3+ / LGPLv3+
4 : *
5 : * The contents of this file are subject to the Mozilla Public License Version
6 : * 1.1 (the "License"); you may not use this file except in compliance with
7 : * the License or as specified alternatively below. You may obtain a copy of
8 : * the License at http://www.mozilla.org/MPL/
9 : *
10 : * Software distributed under the License is distributed on an "AS IS" basis,
11 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : * for the specific language governing rights and limitations under the
13 : * License.
14 : *
15 : * Major Contributor(s):
16 : * Copyright (C) 2012 Kohei Yoshida <kohei.yoshida@suse.com>
17 : *
18 : * All Rights Reserved.
19 : *
20 : * For minor contributions see the git repository.
21 : *
22 : * Alternatively, the contents of this file may be used under the terms of
23 : * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
24 : * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
25 : * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
26 : * instead of those above.
27 : */
28 :
29 : #ifndef __SC_TYPEDSTRDATA_HXX__
30 : #define __SC_TYPEDSTRDATA_HXX__
31 :
32 : #include "rtl/ustring.hxx"
33 : #include "scdllapi.h"
34 :
35 : #include <set>
36 :
37 0 : class ScTypedStrData
38 : {
39 : public:
40 : enum StringType {
41 : Value = 0,
42 : Standard = 1,
43 : Name = 2,
44 : DbName = 3,
45 : Header = 4
46 : };
47 :
48 : ScTypedStrData( const rtl::OUString& rStr, double nVal = 0.0,
49 : StringType eType = Standard );
50 :
51 : ScTypedStrData( const ScTypedStrData& rCpy );
52 :
53 : bool IsStrData() const;
54 : SC_DLLPUBLIC const rtl::OUString& GetString() const;
55 : StringType GetStringType() const;
56 :
57 : struct LessCaseSensitive : std::binary_function<ScTypedStrData, ScTypedStrData, bool>
58 : {
59 : bool operator() (const ScTypedStrData& left, const ScTypedStrData& right) const;
60 : };
61 :
62 : struct LessCaseInsensitive : std::binary_function<ScTypedStrData, ScTypedStrData, bool>
63 : {
64 : bool operator() (const ScTypedStrData& left, const ScTypedStrData& right) const;
65 : };
66 :
67 : struct EqualCaseSensitive : std::binary_function<ScTypedStrData, ScTypedStrData, bool>
68 : {
69 : bool operator() (const ScTypedStrData& left, const ScTypedStrData& right) const;
70 : };
71 :
72 : struct EqualCaseInsensitive : std::binary_function<ScTypedStrData, ScTypedStrData, bool>
73 : {
74 : bool operator() (const ScTypedStrData& left, const ScTypedStrData& right) const;
75 : };
76 :
77 : bool operator== (const ScTypedStrData& r) const;
78 : bool operator< (const ScTypedStrData& r) const;
79 :
80 : private:
81 : rtl::OUString maStrValue;
82 : double mfValue;
83 : StringType meStrType;
84 : };
85 :
86 0 : class FindTypedStrData : std::unary_function<ScTypedStrData, bool>
87 : {
88 : ScTypedStrData maVal;
89 : bool mbCaseSens;
90 : public:
91 : FindTypedStrData(const ScTypedStrData& rVal, bool bCaseSens);
92 : bool operator() (const ScTypedStrData& r) const;
93 : };
94 :
95 : typedef std::set<ScTypedStrData, ScTypedStrData::LessCaseSensitive> ScTypedCaseStrSet;
96 :
97 : #endif
98 :
99 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|