make FastAttributeList's unknown attribute value be passed as OString

Since that's how it's internally stored anyway, and I have a use case
where it's useful to limit the length by passing it to OString ctor.

Change-Id: I5903ea4f1b2cdb48c1bbceac6b8e21eb5882d377
This commit is contained in:
Luboš Luňák
2014-11-12 16:09:42 +01:00
parent 95cec52515
commit 8a75dafbe1
2 changed files with 12 additions and 13 deletions

View File

@@ -40,9 +40,8 @@ struct UnknownAttribute
OString maName; OString maName;
OString maValue; OString maValue;
UnknownAttribute( const OUString& rNamespaceURL, const OString& rName, const sal_Char* pValue ); UnknownAttribute( const OUString& rNamespaceURL, const OString& rName, const OString& value );
UnknownAttribute( const OString& rName, const OString& value );
UnknownAttribute( const OString& rName, const sal_Char* pValue );
void FillAttribute( ::com::sun::star::xml::Attribute* pAttrib ) const; void FillAttribute( ::com::sun::star::xml::Attribute* pAttrib ) const;
}; };
@@ -84,8 +83,8 @@ public:
void add( sal_Int32 nToken, const sal_Char* pValue, size_t nValueLength ); void add( sal_Int32 nToken, const sal_Char* pValue, size_t nValueLength );
void add( sal_Int32 nToken, const OString& rValue ); void add( sal_Int32 nToken, const OString& rValue );
void addNS( sal_Int32 nNamespaceToken, sal_Int32 nToken, const OString& rValue ); void addNS( sal_Int32 nNamespaceToken, sal_Int32 nToken, const OString& rValue );
void addUnknown( const OUString& rNamespaceURL, const OString& rName, const sal_Char* pValue ); void addUnknown( const OUString& rNamespaceURL, const OString& rName, const OString& value );
void addUnknown( const OString& rName, const sal_Char* pValue ); void addUnknown( const OString& rName, const OString& value );
const std::vector< sal_Int32 >& getFastAttributeTokens() const { return maAttributeTokens; } const std::vector< sal_Int32 >& getFastAttributeTokens() const { return maAttributeTokens; }
const char* getFastAttributeValue(size_t nIndex) const { return mpChunk + maAttributeValues[nIndex]; } const char* getFastAttributeValue(size_t nIndex) const { return mpChunk + maAttributeValues[nIndex]; }
sal_Int32 AttributeValueLength(size_t i) const { return maAttributeValues[i + 1] - maAttributeValues[i] - 1; } sal_Int32 AttributeValueLength(size_t i) const { return maAttributeValues[i + 1] - maAttributeValues[i] - 1; }

View File

@@ -32,13 +32,13 @@ FastTokenHandlerBase::~FastTokenHandlerBase()
{ {
} }
UnknownAttribute::UnknownAttribute( const OUString& rNamespaceURL, const OString& rName, const sal_Char* pValue ) UnknownAttribute::UnknownAttribute( const OUString& rNamespaceURL, const OString& rName, const OString& value )
: maNamespaceURL( rNamespaceURL ), maName( rName ), maValue( pValue ) : maNamespaceURL( rNamespaceURL ), maName( rName ), maValue( value )
{ {
} }
UnknownAttribute::UnknownAttribute( const OString& rName, const sal_Char* pValue ) UnknownAttribute::UnknownAttribute( const OString& rName, const OString& value )
: maName( rName ), maValue( pValue ) : maName( rName ), maValue( value )
{ {
} }
@@ -106,14 +106,14 @@ void FastAttributeList::addNS( sal_Int32 nNamespaceToken, sal_Int32 nToken, cons
add( nCombinedToken, rValue ); add( nCombinedToken, rValue );
} }
void FastAttributeList::addUnknown( const OUString& rNamespaceURL, const OString& rName, const sal_Char* pValue ) void FastAttributeList::addUnknown( const OUString& rNamespaceURL, const OString& rName, const OString& value )
{ {
maUnknownAttributes.push_back( UnknownAttribute( rNamespaceURL, rName, pValue ) ); maUnknownAttributes.push_back( UnknownAttribute( rNamespaceURL, rName, value ) );
} }
void FastAttributeList::addUnknown( const OString& rName, const sal_Char* pValue ) void FastAttributeList::addUnknown( const OString& rName, const OString& value )
{ {
maUnknownAttributes.push_back( UnknownAttribute( rName, pValue ) ); maUnknownAttributes.push_back( UnknownAttribute( rName, value ) );
} }
// XFastAttributeList // XFastAttributeList