GithubHelp home page GithubHelp logo

macmade / objective-cpp Goto Github PK

View Code? Open in Web Editor NEW
49.0 6.0 11.0 430 KB

C++ compatibility library for Objective-C - Objective-CPP is a library intended to ease software development using Objective-C++. It declares categories on Objective-C classes, to work with the STL C++ types, such as std::string, std::vector, etc.

License: MIT License

Objective-C++ 75.46% Shell 0.32% C++ 24.22%
objective-c objective-c-plus-plus c-plus-plus interoperability library framework foundation std stdlib

objective-cpp's Introduction

Objective-CPP

Build Status Issues Status License
Contact Sponsor

About

C++ compatibility library for Objective-C
Objective-CPP is a library intended to ease software development using Objective-C++.

It declares categories on Objective-C classes, to work with the STL C++ types, such as std::string, std::vector, etc.

For instance, with Objective-CPP, you can call every method of the NSString class passing std::string objects, instead of NSString objects. The same applies for the return types, as you can get seamlessly std::string objects out of NSString objects.

Example:

Here's a little example with NSString:

{
    NSString * objcString = @"hello, world";
    std::string cppString = [ objcString cppStringUsingEncoding: NSUTF8StringEncoding ];
    
    std::cout << cppString << std::endl;
}

And the same in the other way:

{
    std::string cppString = "hello, world";
    NSString * objcString = [ NSString stringWithCPPString: cppString encoding: NSUTF8StringEncoding ];
    
    NSLog( @"%@", objcString );
}

Strings:

Objective-CPP expands the NSString class with a category, adding support for C++ strings (std::string).
All methods from NSString can then return a std::string instead of a NSString *, or take std::string arguments instead of NSString * arguments.

By default, Objective-CPP uses UTF-8 as default encoding for strings, for converting NSString objects into C++ string objects, and reverse.
You can set another encoding using the new 'setDefaultCPPStringEncoding' class method of NSString:

[ NSString setDefaultCPPStringEncoding: NSASCIIStringEncoding ];

License

Objective-CPP is released under the terms of the MIT License.

Repository Infos

Owner:			Jean-David Gadina - XS-Labs
Web:			www.xs-labs.com
Blog:			www.noxeos.com
Twitter:		@macmade
GitHub:			github.com/macmade
LinkedIn:		ch.linkedin.com/in/macmade/
StackOverflow:	stackoverflow.com/users/182676/macmade

objective-cpp's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

objective-cpp's Issues

Compiler issue with Xcode 15.3 & C++20

Hi,
I'm trying to use your library in our project using a c++20 compiler (the IDE is Xcode) and we are having a compilation error(Please see attachments).

Could you please let me know how we can fix it effectively without braking your code.

Untitled

image

Thank you,
Stay safe

Bad Ass

Just wanted to say that this is bad ass, thanks guys!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.