1 /*************************************************************************
3 * OpenOffice.org - a multi-platform office productivity suite
6 * Fridrich Strba <fridrich.strba@bluewin.ch>
7 * Thorsten Behrens <tbehrens@novell.com>
9 * Copyright (C) 2008, Novell Inc.
10 * Parts copyright 2005 by Sun Microsystems, Inc.
12 * The Contents of this file are made available subject to
13 * the terms of GNU Lesser General Public License Version 2.1.
15 ************************************************************************/
17 // MARKER(update_precomp.py): autogen include statement, do not remove
18 #include "precompiled_filter.hxx"
20 #include "tokenmap.hxx"
28 sal_Int32
getTokenId( const char* sIdent
, sal_Int32 nLen
)
30 const struct xmltoken
* t
= Perfect_Hash::in_word_set( sIdent
, nLen
);
34 return XML_TOKEN_INVALID
;
37 sal_Int32
getTokenId( const rtl::OUString
& sIdent
)
39 rtl::OString
aUTF8( sIdent
.getStr(),
41 RTL_TEXTENCODING_UTF8
);
42 return getTokenId( aUTF8
.getStr(), aUTF8
.getLength() );
45 const char* getTokenName( sal_Int32 nTokenId
)
47 if( nTokenId
>= XML_TOKEN_COUNT
)
50 const xmltoken
* pCurr
=wordlist
;
51 const xmltoken
* pEnd
=wordlist
+sizeof(wordlist
)/sizeof(*wordlist
);
52 while( pCurr
!= pEnd
)
54 if(pCurr
->nToken
== nTokenId
)