merged tag ooo/OOO330_m14
[LibreOffice.git] / cosv / inc / cosv / str_types.hxx
blob1eb9d5ad9729d90b5cb0489571d16274bdd41b89
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef COSV_STR_TYPES_HXX
29 #define COSV_STR_TYPES_HXX
32 namespace csv
35 /** Provides some generally used constants.
37 struct str
39 public:
40 typedef ::size_t position;
41 typedef ::size_t size;
43 enum constants
45 npos = position(-1),
46 maxsize = size(-1)
49 enum insert_mode
51 overwrite = 0,
52 insert = 1
57 /** Is used for string comparisons.
59 @collab String
60 @collab various csv::compare(...) functions
62 class CharOrder_Table
64 public:
65 /** @precond
66 Parameter i_pCharWeightsArray
67 must have size of 256.
69 CharOrder_Table(
70 const int * i_pCharWeightsArray );
72 /** @return the weight of the char i_c.
73 @precond
74 Even with unusual implementations, where char has more than 8 bit,
75 there must be true: 0 <= i_c < 256.
77 int operator()(
78 char i_c ) const;
79 private:
80 int cWeights[256];
84 // IMPLEMENTATION
86 inline int
87 CharOrder_Table::operator()( char i_c ) const
88 { return cWeights[ UINT8(i_c) ]; }
92 } // namespace csv
94 #endif