Native Library provides low-level optimization and productivity for C/C++ application.
Beside standard library, we would like to have a greater customization with important goals:
- Blazing fast performance with small footprint and low-level access with GAS & C
- Powerful structured programming in C++ for scalability
- Awesome syntactically enhancement with C++ customization
- Java standard packages for productivity & maintainability
- Reduce memory leak via automatic storage and object oriented instead of pointer
- Support third-party services for business features
This project is also useful for new developers in practical programming.
- This library is originally developed in C/C++ so we can make classes go faster by optimizing in GAS for Linux amd64
- C version of every function should be delivered first
- Example for GNU Assembly x64
- GNU Coding Style for C
- GNU Coding Style for C++
- Oracle Java 8 API Documentation
- CMake ~ 2.8
- GCC ~ 4.8.1
- Python ~ 2.7
- OpenSSL
- Zlib
OS X & Linux
$ git clone https://github.com/foodtiny/native.git
$ cmake . && make
$ sudo make installInstall & run mock server for third-party services
$ sudo apt-get install python-pip
$ sudo pip install -r misc/requirements.txt
$ make serverOpen another terminal & debug with unit test
$ cmake . && make unit-test -j8public class Main {
public static void main(String[] args) {
String text = "Native Library: ";
byte[] bytes = { 72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100 };
for (byte number : bytes) {
text += (char) number;
}
System.out.println(text);
}
}#include <native/library.hpp>
int main() {
String text = "Native Library: ";
Array<byte> bytes = { 72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100 };
for (byte number : bytes) {
text += (char) number;
}
System::out::println(text);
return 0;
}$ g++ -c -o test.o ./test.cpp
$ gcc -static -o native test.o -L/usr/local/lib libnative_static.a -lstdc++
$ ./nativeTo test third parties we need to setup a server to mock http request from them.
By running make server, it will serve in http://localhost:9999. You will see Hi guys! in there.
Please keep this terminal running during your development.
$ make serverValgrind helps us in checking memory leak, you've just need to run
$ cmake . && make native_test && make leak
It will tell you issues relate to memory.
#define CTEST_MAIN
#define CTEST_SEGFAULT
#include <native/unit_test.h>
int main(int argc, const char *argv[]) {
int result = ctest_main(argc, argv);
return result;
}
TEST(YourTestSuite, YourTestCase) {
ASSERT_STR("me", "you");
}- This library must be followed Oracle Java 8 Documentation for standardization
- Make sure that your commits must be passed before you create pull request
- At least one contributor in this project reviews your commits (except you) before merging
- Best practices guidelines in CONTRIBUTION.md
Copyright © 2014-2016 Food Tiny. All rights reserved, except as follows. Code is released under the Apache 2.0 license. You may obtain a duplicate copy of the same license, titled CC-BY-SA-4.0, at http://creativecommons.org/licenses/by/4.0/. Terms and conditions set forth in the file LICENSE.docs.
This library provides Java classes in C++ so its syntax is friendly for both programming languges but we still have some issues :
- Namespace - Package
// Java
System.out.println("Java");// C++
System::out::println("C++");- Array
// Java
byte[] byes = {};// C++
Array<byte> bytes = {};- Interface
Comming soon
- Runtime
Comming soon
- Garbage Collection
Comming soon
All data types are implemented and ready to use in C++ Application
- char - Java.Lang.Character
- byte - Java.Lang.Byte (equivalent with
unsigned char) - string - Java.Lang.String (equivalent with
char*, Java does not have data typestring) - short - Java.Lang.Short
- int - Java.Lang.Integer
- long - Java.Lang.Long
- float - Java.Lang.Float
- double - Java.Lang.Double
- boolean - Java.Lang.Boolean (equivalent with
bool) - enum - Java.Lang.Enum
All Java packages are in transformation so we can have a general look about road map
- Java.Lang.Appendable
- Java.Lang.Autocloseable
- Java.Lang.Boolean
- Java.Lang.Byte
- Java.Lang.Character
- Java.Lang.CharSequence
- Java.Lang.Cloneable
- Java.Lang.Comparable
- Java.Lang.Double
- Java.Lang.Enum
- Java.Lang.Error
- Java.Lang.Exception
- Java.Lang.Float
- Java.Lang.Integer
- Java.Lang.Iterable
- Java.Lang.Long
- Java.Lang.Math
- Java.Lang.Number
- Java.Lang.Object
- Java.Lang.Process
- Java.Lang.Readable
- Java.Lang.Runnable
- Java.Lang.Runtime
- Java.Lang.Short
- Java.Lang.String
- Java.Lang.System
- Java.Lang.Throwable
- Java.Lang.Thread
- Java.Lang.BufferedReader
- Java.Lang.BufferedWriter
- Java.Lang.CharArrayWriter
- Java.Lang.Console
- Java.Lang.FileDescriptor
- Java.Lang.FileFilter
- Java.Lang.FileWriter
- Java.Lang.Flushable
- Java.Lang.InputStream
- Java.Lang.IOError
- Java.Lang.IOException
- Java.Lang.ObjectInput
- Java.Lang.ObjectOutput
- Java.Lang.OutputStream
- Java.Lang.OutputStreamWriter
- Java.Lang.PipedWriter
- Java.Lang.PrintWriter
- Java.Lang.Reader
- Java.Lang.Serializable
- Java.Lang.StreamTokenizer
- Java.Lang.Writer
- Java.Util.AbstractCollection
- Java.Util.AbstractList
- Java.Util.AbstractMap
- Java.Util.AbstractSet
- Java.Util.ArrayList
- Java.Util.Arrays
- Java.Util.BitSet
- Java.Util.Base64
- Java.Util.Calendar
- Java.Util.Collection
- Java.Util.Collections
- Java.Util.Currency
- Java.Util.Date
- Java.Util.EnumMap
- Java.Util.EnumSet
- Java.Util.HashMap
- Java.Util.HashSet
- Java.Util.Iterator
- Java.Util.LinkedListHashSet
- Java.Util.LinkedList
- Java.Util.List
- Java.Util.Map
- Java.Util.Observable
- Java.Util.PriorityQueue
- Java.Util.Queue
- Java.Util.Random
- Java.Util.Scanner
- Java.Util.Set
- Java.Util.SimpleTimeZone
- Java.Util.Stack
- Java.Util.Timer
- Java.Util.TimerTask
- Java.Util.TimeZone
- Java.Util.TreeSet
- Java.Util.UUID
- Java.Util.Vector
- Java.Security.Certificate
- Java.Security.KeyFactory
- Java.Security.KeyStore
- Java.Security.MessageDigest
- Java.Net.HttpURLConnection
- Java.Net.URL
- Java.Net.URLEncoder
- Java.Net.URLDecoder
- Java.Lang.Array
- Java.Vendor.AbstractVendor
- Java.Vendor.ElasticSearch
- Java.Vendor.Etcd
- Java.Vendor.Firebase
- Java.Vendor.SendGrid
- Java.Vendor.Twilio