29 #include <config_lgpl.h>
40 struct LockEntrySequenceParseContext
42 std::unique_ptr<ucb::LockEntry> pEntry;
46 LockEntrySequenceParseContext()
47 : hasScope( false ), hasType( false ) {}
54 #define STATE_LOCKENTRY (STATE_TOP)
55 #define STATE_LOCKSCOPE (STATE_TOP + 1)
56 #define STATE_EXCLUSIVE (STATE_TOP + 2)
57 #define STATE_SHARED (STATE_TOP + 3)
58 #define STATE_LOCKTYPE (STATE_TOP + 4)
59 #define STATE_WRITE (STATE_TOP + 5)
71 if ( name !=
nullptr )
75 case NE_XML_STATEROOT:
76 if ( strcmp( name,
"lockentry" ) == 0 )
81 if ( strcmp( name,
"lockscope" ) == 0 )
83 else if ( strcmp( name,
"locktype" ) == 0 )
86 #define IIS_BUGS_WORKAROUND
88 #ifdef IIS_BUGS_WORKAROUND
103 else if ( strcmp( name,
"exclusive" ) == 0 )
105 else if ( strcmp( name,
"shared" ) == 0 )
107 else if ( strcmp( name,
"write" ) == 0 )
113 if ( strcmp( name,
"exclusive" ) == 0 )
115 else if ( strcmp( name,
"shared" ) == 0 )
120 if ( strcmp( name,
"write" ) == 0 )
125 return NE_XML_DECLINE;
145 LockEntrySequenceParseContext * pCtx
146 =
static_cast< LockEntrySequenceParseContext *
>( userdata );
148 pCtx->pEntry.reset(
new ucb::LockEntry );
153 pCtx->pEntry->Scope = ucb::LockScope_EXCLUSIVE;
154 pCtx->hasScope =
true;
158 pCtx->pEntry->Scope = ucb::LockScope_SHARED;
159 pCtx->hasScope =
true;
163 pCtx->pEntry->Type = ucb::LockType_WRITE;
164 pCtx->hasType =
true;
168 if ( !pCtx->hasScope )
173 if ( !pCtx->hasType )
178 if ( !pCtx->hasType || !pCtx->hasScope )
193 ucb::LockEntry > & rOutData )
195 const sal_Int32 TOKEN_LENGTH = 12;
200 sal_Int32 nStart = 0;
201 sal_Int32 nEnd = rInData.indexOf(
"</lockentry>" );
204 ne_xml_parser *
parser = ne_xml_create();
211 LockEntrySequenceParseContext aCtx;
212 ne_xml_push_handler( parser,
218 ne_xml_parse( parser,
219 rInData.getStr() + nStart,
220 nEnd - nStart + TOKEN_LENGTH );
222 success = !ne_xml_failed( parser );
224 ne_xml_destroy( parser );
232 if ( nCount > rOutData.getLength() )
233 rOutData.realloc( rOutData.getLength() + 2 );
235 rOutData[ nCount - 1 ] = *aCtx.pEntry;
238 nStart = nEnd + TOKEN_LENGTH;
239 nEnd = rInData.indexOf(
"</lockentry>", nStart );
242 rOutData.realloc( nCount );
static int LockEntrySequence_endelement_callback(void *userdata, int state, const char *, const char *)
static int LockEntrySequence_startelement_callback(void *, int parent, const char *, const char *name, const char **)
static bool createFromXML(const OString &rInData, css::uno::Sequence< css::ucb::LockEntry > &rOutData)
static int LockEntrySequence_chardata_callback(void *, int, const char *, size_t)