C++ objective-c包装器,用于命名空间c++;图书馆(gloox)

C++ objective-c包装器,用于命名空间c++;图书馆(gloox),c++,objective-c,namespaces,wrapper,C++,Objective C,Namespaces,Wrapper,我试图用objective-c包装gloox库。我已经阅读了这篇文章,这篇文章相当直截了当,但是它没有涵盖命名空间中的类。关于如何仅在名称空间中使用本文中的技术,您有什么想法吗? 谢谢你的帮助 [编辑] 我想我明白了 加 我认为当编译为objective C++时,显而易见的方法应该有效: #if defined __cplusplus namespace Foo { class MyCPPClass; } // forward class declaration #else /*not s

我试图用objective-c包装gloox库。我已经阅读了这篇文章,这篇文章相当直截了当,但是它没有涵盖命名空间中的类。关于如何仅在名称空间中使用本文中的技术,您有什么想法吗? 谢谢你的帮助

[编辑] 我想我明白了 加


我认为当编译为objective C++时,显而易见的方法应该有效:

#if defined __cplusplus
namespace Foo { class MyCPPClass; }   // forward class declaration
#else
/*not sure here*/ /*namespace Foo { typedef struct MyCPPClass MyCPPClass;  }*/ // forward struct declaration
#endif

@interface MyOCClass : NSObject
{
@private
    Foo::MyCPPClass* cppObject;
} 

// methods and properties

@end

项目中有很多用于混合C++和Objul-C.< /P>的方法。我还发现了另一种方法,在这里,你也可以将实例声明包在
#if defined __cplusplus
namespace Foo { class MyCPPClass; }   // forward class declaration
#else
/*not sure here*/ /*namespace Foo { typedef struct MyCPPClass MyCPPClass;  }*/ // forward struct declaration
#endif

@interface MyOCClass : NSObject
{
@private
    Foo::MyCPPClass* cppObject;
} 

// methods and properties

@end