| XMP Toolkit SDK 6.0.0

IUTF8String.h
Go to the documentation of this file.
1 #ifndef __IUTF8String_h__
2 #define __IUTF8String_h__ 1
3
4 // =================================================================================================
5 // Copyright 2014 Adobe
6 // All Rights Reserved.
7 //
8 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms
9 // of the Adobe license agreement accompanying it. If you have received this file from a source other
10 // than Adobe, then your use, modification, or distribution of it requires the prior written permission
11 // of Adobe.
12 // =================================================================================================
13
14 #include "XMPCommon/Interfaces/BaseInterfaces/ISharedObject.h"
15 #include "XMPCommon/Interfaces/BaseInterfaces/IVersionable.h"
16
17 namespace AdobeXMPCommon {
18 using AdobeXMPCommon::npos;
19
25 class XMP_PUBLIC IUTF8String_v1
26 : public virtual ISharedObject
27 , public virtual IVersionable
28 {
29 public:
38 virtual spIUTF8String APICALL append( const char * buf, sizet count ) = 0;
39
53 virtual spIUTF8String APICALL append( const spcIUTF8String & src, sizet srcPos = 0, sizet count = npos ) = 0;
54
63 virtual spIUTF8String APICALL assign( const char * buf, sizet count ) = 0;
64
78 virtual spIUTF8String APICALL assign( const spcIUTF8String & src, sizet srcPos = 0, sizet count = npos ) = 0;
79
91 virtual spIUTF8String APICALL insert( sizet pos, const char * buf, sizet count ) = 0;
92
109 virtual spIUTF8String APICALL insert( sizet pos, const spcIUTF8String & src, sizet srcPos = 0, sizet count = npos ) = 0;
110
121 virtual spIUTF8String APICALL erase( sizet pos = 0, sizet count = npos ) = 0;
122
134 virtual void APICALL resize( sizet n ) = 0 ;
135
149 virtual spIUTF8String APICALL replace( sizet pos, sizet count, const char * buf, sizet srcCount ) = 0;
150
166 virtual spIUTF8String APICALL replace( sizet pos, sizet count, const spcIUTF8String & src, sizet srcPos = 0, sizet srcCount = npos ) = 0;
167
182 virtual sizet APICALL copy( char * buf, sizet len, sizet pos = 0 ) const = 0;
183
196 sizet find( const char * buf, sizet pos = 0 ) const {
197 return find( buf, pos, npos );
198 }
199
213 virtual sizet APICALL find( const char * buf, sizet pos, sizet count ) const = 0;
214
215
216 //
229 virtual sizet APICALL find( const spcIUTF8String & src, sizet pos = 0, sizet count = npos ) const = 0;
230
232 // @{
245 sizet rfind( const char * buf, sizet pos = npos ) const {
246 return rfind( buf, pos, npos );
247 }
248 virtual sizet APICALL rfind( const char * buf, sizet pos, sizet count ) const = 0;
250
266 virtual sizet APICALL rfind( const spcIUTF8String & src, sizet pos = npos, sizet count = npos ) const = 0;
267
285 int32 compare( const char * buf ) const {
286 return compare( 0, size(), buf, npos );
287 }
307 int32 compare( sizet pos, sizet len, const char * buf ) const {
308 return compare( pos, len, buf, npos );
309 }
330 virtual int32 APICALL compare( sizet pos, sizet len, const char * buf, sizet count ) const = 0;
331
332
349 int32 compare( const spcIUTF8String & str ) const {
350 return compare( 0, size(), str, 0, str->size() );
351 }
374 virtual int32 APICALL compare( sizet pos, sizet len, const spcIUTF8String & str, sizet strPos = 0, sizet strLen = npos ) const = 0;
375
387 virtual spIUTF8String APICALL substr( sizet pos = 0, sizet count = npos ) const = 0;
388
393 virtual bool APICALL empty() const = 0;
394
399 virtual const char * APICALL c_str() const __NOTHROW__ = 0;
400
404 virtual void APICALL clear() __NOTHROW__ = 0;
405
410 virtual sizet APICALL size() const __NOTHROW__ = 0;
411
418 virtual pIUTF8String APICALL GetActualIUTF8String() __NOTHROW__ = 0;
419 XMP_PRIVATE pcIUTF8String GetActualIUTF8String() const __NOTHROW__ {
420 return const_cast< IUTF8String_v1 * >( this )->GetActualIUTF8String();
421 }
424
431 XMP_PRIVATE static spIUTF8String MakeShared( pIUTF8String_base ptr );
432 XMP_PRIVATE static spcIUTF8String MakeShared( pcIUTF8String_base ptr ) {
433 return MakeShared( const_cast< pIUTF8String_base >( ptr ) );
434 }
437
442 XMP_PRIVATE static uint64 GetInterfaceID() { return kIUTF8StringID; }
443
448 XMP_PRIVATE static uint32 GetInterfaceVersion() { return 1; }
450
451 // static factory functions
452
458 XMP_PRIVATE static spIUTF8String CreateUTF8String( pIObjectFactory objFactory );
459
469 XMP_PRIVATE static spIUTF8String CreateUTF8String( pIObjectFactory objFactory, const char * buf, sizet count );
470
471 protected:
475 virtual ~IUTF8String_v1() __NOTHROW__ {}
476
478 virtual pIUTF8String_base APICALL assign( const char * buffer, sizet count, pcIError_base & error ) __NOTHROW__ = 0;
479 virtual pIUTF8String_base APICALL assign( pcIUTF8String_base str, sizet srcPos, sizet count, pcIError_base & error ) __NOTHROW__ = 0;
480 virtual pIUTF8String_base APICALL append( const char * buffer, sizet count, pcIError_base & error ) __NOTHROW__ = 0;
481 virtual pIUTF8String_base APICALL append( pcIUTF8String_base str, sizet srcPos, sizet count, pcIError_base & error ) __NOTHROW__ = 0;
482 virtual pIUTF8String_base APICALL insert( sizet pos, const char * buf, sizet count, pcIError_base & error ) __NOTHROW__ = 0;
483 virtual pIUTF8String_base APICALL insert( sizet pos, pcIUTF8String_base src, sizet srcPos, sizet count, pcIError_base & error ) __NOTHROW__ = 0;
484 virtual pIUTF8String_base APICALL erase( sizet pos, sizet count, pcIError_base & error ) __NOTHROW__ = 0;
485 virtual void APICALL resize( sizet n, pcIError_base & error ) __NOTHROW__ = 0;
486 virtual pIUTF8String_base APICALL replace( sizet pos, sizet count, const char * buf, sizet srcCount, pcIError_base & error ) __NOTHROW__ = 0;
487 virtual pIUTF8String_base APICALL replace( sizet pos, sizet count, pcIUTF8String_base src, sizet srcPos, sizet srcCount, pcIError_base & error ) __NOTHROW__ = 0;
488 virtual sizet APICALL copy( char * buf, sizet len, sizet pos, pcIError_base & error ) const __NOTHROW__ = 0;
489 virtual sizet APICALL find( const char * buf, sizet pos, sizet count, pcIError_base & error ) const __NOTHROW__ = 0;
490 virtual sizet APICALL find( pcIUTF8String_base src, sizet pos, sizet count, pcIError_base & error ) const __NOTHROW__ = 0;
491 virtual sizet APICALL rfind( const char * buf, sizet pos, sizet count, pcIError_base & error ) const __NOTHROW__ = 0;
492 virtual sizet APICALL rfind( pcIUTF8String_base src, sizet pos, sizet count, pcIError_base & error ) const __NOTHROW__ = 0;
493 virtual int32 APICALL compare( sizet pos, sizet len, const char * buf, sizet count, pcIError_base & error ) const __NOTHROW__ = 0;
494 virtual int32 APICALL compare( sizet pos, sizet len, pcIUTF8String_base str, sizet strPos, sizet strLen, pcIError_base & error ) const __NOTHROW__ = 0;
495 virtual pIUTF8String_base APICALL substr( sizet pos, sizet count, pcIError_base & error ) const __NOTHROW__ = 0;
496 virtual uint32 APICALL empty( pcIError_base & error ) const __NOTHROW__ = 0;
497
498 #ifdef FRIEND_CLASS_DECLARATION
499 FRIEND_CLASS_DECLARATION();
500 #endif
501 REQ_FRIEND_CLASS_DECLARATION();
503 };
504 }
505
506 #endif // __IUTF8String_h__
XMP_PRIVATE
#define XMP_PRIVATE
Definition: XMP_Environment.h:222
__NOTHROW__
#define __NOTHROW__
Definition: XMPCommonDefines.h:147
XMP_PUBLIC
#define XMP_PUBLIC
Definition: XMP_Environment.h:221
AdobeXMPCommon::pcIUTF8String_base
const typedef IUTF8String_v1 * pcIUTF8String_base
Definition: XMPCommonFwdDeclarations.h:75
AdobeXMPCommon::pIUTF8String
IUTF8String * pIUTF8String
Definition: XMPCommonFwdDeclarations.h:77
AdobeXMPCommon::pIObjectFactory
IObjectFactory * pIObjectFactory
Definition: XMPCommonFwdDeclarations.h:57
ISharedObject.h
AdobeXMPCommon
Definition: IConfigurable.h:21
AdobeXMPCommon::spcIUTF8String
shared_ptr< const IUTF8String > spcIUTF8String
Definition: XMPCommonFwdDeclarations.h:80
AdobeXMPCommon::npos
const sizet npos(kMaxSize)
AdobeXMPCommon::spIUTF8String
shared_ptr< IUTF8String > spIUTF8String
Definition: XMPCommonFwdDeclarations.h:79
AdobeXMPCommon::uint32
XMP_Uns32 uint32
Definition: XMPCommonDefines.h:174
AdobeXMPCommon::kIUTF8StringID
static const uint64 kIUTF8StringID(0x6e55544638537472)
AdobeXMPCommon::sizet
uint32 sizet
Definition: XMPCommonDefines.h:176
AdobeXMPCommon::IUTF8String_v1::compare
int32 compare(const char *buf) const
Compare strings.
Definition: IUTF8String.h:285
AdobeXMPCommon::IVersionable
Interface that serves as the base interface for all the externally exposed interfaces which needs to ...
Definition: IVersionable.h:30
AdobeXMPCommon::IUTF8String_v1::compare
int32 compare(const spcIUTF8String &str) const
Compare strings.
Definition: IUTF8String.h:349
AdobeXMPCommon::int32
XMP_Int32 int32
Definition: XMPCommonDefines.h:173
REQ_FRIEND_CLASS_DECLARATION
#define REQ_FRIEND_CLASS_DECLARATION()
Definition: XMPCommonDefines.h:137
AdobeXMPCommon::pcIUTF8String
const typedef IUTF8String * pcIUTF8String
Definition: XMPCommonFwdDeclarations.h:78
AdobeXMPCommon::pIUTF8String_base
IUTF8String_v1 * pIUTF8String_base
Definition: XMPCommonFwdDeclarations.h:74
AdobeXMPCommon::IUTF8String_v1::rfind
sizet rfind(const char *buf, sizet pos=npos) const
Find last occurrence of content in string.
Definition: IUTF8String.h:245
IVersionable.h
AdobeXMPCommon::IUTF8String_v1
Version1 of the interface that represents an UTF8String.
Definition: IUTF8String.h:25
AdobeXMPCommon::IUTF8String_v1::~IUTF8String_v1
virtual ~IUTF8String_v1() __NOTHROW__
Definition: IUTF8String.h:475
AdobeXMPCommon::IUTF8String_v1::find
sizet find(const char *buf, sizet pos=0) const
Find content in string.
Definition: IUTF8String.h:196
AdobeXMPCommon::IUTF8String_v1::compare
int32 compare(sizet pos, sizet len, const char *buf) const
Compare strings.
Definition: IUTF8String.h:307
AdobeXMPCommon::pcIError_base
const typedef IError_v1 * pcIError_base
Definition: XMPCommonFwdDeclarations.h:64
AdobeXMPCommon::uint64
XMP_Uns64 uint64
Definition: XMPCommonDefines.h:172
AdobeXMPCommon::ISharedObject
Interface that serves as the base interface of all the externally exposed interfaces.
Definition: ISharedObject.h:29