1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: luxenum.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef UDM_LUXENUM_HXX
32 #define UDM_LUXENUM_HXX
47 typedef std::map
< intt
, String
> EnumValueMap
;
51 class Enum
// : public Template_Base
55 typedef Enum
< DIFF
> self
;
60 const char * i_sText
)
61 : nValue(i_nValue
) { Values_()[nValue
] = i_sText
;
62 // Sequence_().insert(
63 // std::lower_bound( Sequence_().begin(), Sequence_().end(), i_nValue ),
68 : nValue(i_nValue
) { ; }
71 : nValue(i_nValue
) { if ( NOT
CheckIntt(i_nValue
) ) { csv_assert(false); } }
73 const self
& i_rEnum
)
74 : nValue(i_rEnum
.nValue
) {;}
78 { nValue
= i_nValue
; return *this; }
81 { if ( CheckIntt(i_nValue
) ) {nValue
= DIFF(i_nValue
);}
82 else {csv_assert(false);} return *this; }
84 const self
& i_rEnum
)
85 { nValue
= i_rEnum
.nValue
; return *this; }
86 operator DIFF() const { return DIFF(nValue
); }
88 DIFF
operator()() const { return nValue
; }
89 const String
& Text() const { return Values_()[nValue
]; }
96 { return Values_().find(i_nNumber
) != Values_().end(); }