├── java2cpp
├── __init__.py
└── Java2Cpp.py
├── README.md
├── setup.py
├── test.java
├── test.py
├── test.cpp
├── .gitignore
└── LICENSE
/java2cpp/__init__.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | # author: Ethosa
3 |
4 | from .Java2Cpp import Java2Cpp
5 |
6 | __copyright__ = "2019"
7 | __authors__ = ["Ethosa"]
8 | __version__ = "0.0.3"
9 |
10 | if __name__ == '__main__':
11 | print(Java2Cpp)
12 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
java2cpp
2 |
3 | Translator java code to C++ code
4 |
5 | [](https://www.codefactor.io/repository/github/ethosa/java2cpp)
6 | [](https://www.codacy.com/manual/Ethosa/java2cpp?utm_source=github.com&utm_medium=referral&utm_content=Ethosa/java2cpp&utm_campaign=Badge_Grade)
7 | [](https://badge.fury.io/py/java2cpp)
8 | [](https://github.com/Ethosa/java2cpp/blob/master/LICENSE)
9 |
10 | ## Getting started
11 |
12 | Installing:
13 | `pip install java2cpp`
14 | or
15 | `pip install git+https://github.com/Ethosa/java2cpp.git`
16 |
--------------------------------------------------------------------------------
/setup.py:
--------------------------------------------------------------------------------
1 | import setuptools
2 |
3 | with open("README.md", "r") as fh:
4 | long_description = fh.read()
5 |
6 | setuptools.setup(
7 | name="java2cpp",
8 | version="0.0.3",
9 | author="Ethosa",
10 | author_email="social.ethosa@gmail.com",
11 | description="Java to C++ language translator",
12 | long_description=long_description,
13 | long_description_content_type="text/markdown",
14 | url="https://github.com/Ethosa/java2cpp",
15 | packages=setuptools.find_packages(),
16 | license="LGPLv3",
17 | keywords="java to c++ language translator ethosa",
18 | classifiers=[
19 | "Development Status :: 3 - Alpha",
20 | "Programming Language :: Python :: 3",
21 | "Programming Language :: Python :: 3.4",
22 | "Programming Language :: Python :: 3.5",
23 | "Programming Language :: Python :: 3.6",
24 | "Programming Language :: Python :: 3.7",
25 | "License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
26 | "Operating System :: OS Independent",
27 | ],
28 | project_urls={
29 | "Github": "https://github.com/Ethosa/java2cpp",
30 | "Documentation": "https://github.com/Ethosa/java2cpp",
31 | },
32 | python_requires=">=3",
33 | install_requires=["retranslator"]
34 | )
35 |
--------------------------------------------------------------------------------
/test.java:
--------------------------------------------------------------------------------
1 | package sosalesosa;
2 |
3 | import java.util.*;
4 |
5 | // Hello world program
6 |
7 | class Main {
8 | public static void main(String[] args){
9 | System.out.println("Hello world");
10 | System.out.print("ban");
11 | var a = 1;
12 |
13 | for (int i = 0; i < 100; ++i){
14 | System.out.println(test());
15 | }
16 |
17 | HashMap m = new HashMap<>();
18 | m.put("hello world", 5);
19 | m.put("a", 1777);
20 | System.out.println(m.get("hello world"));
21 | System.out.println(m.get("a"));
22 |
23 | if (m.containsKey("b"))
24 | System.out.println("contains!");
25 | else
26 | System.out.println("not contains :(");
27 |
28 | HashSet b = new HashSet();
29 | b.add("lol");
30 | System.out.println(b);
31 | if (b.contains("lol")) System.out.println("lol contains :|");
32 |
33 | ArrayList c = new ArrayList();
34 | c.add("Hello world");
35 | System.out.println(c);
36 | var index = c.indexOf("Hello world");
37 | System.out.println(c.get(0));
38 | }
39 | public static int test(){
40 | var r = new Random();
41 | int b = 5 + r.nextInt(64 - 5 + 1);
42 | return b;
43 | }
44 | public String test(String a){
45 | long i = 100L;
46 | long j = 100_000L;
47 | String timed = "timed";
48 | return timed + a;
49 | }
50 | }
--------------------------------------------------------------------------------
/test.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | # author: Ethosa
3 |
4 | from java2cpp import Java2Cpp
5 |
6 | j = Java2Cpp()
7 |
8 | text = """package sosalesosa;
9 |
10 | import java.util.*;
11 |
12 | // Hello world program
13 |
14 | class Main {
15 | public static void main(String[] args){
16 | System.out.println("Hello world");
17 | System.out.print("ban");
18 | var a = 1;
19 |
20 | for (int i = 0; i < 100; ++i){
21 | System.out.println(test());
22 | }
23 |
24 | HashMap m = new HashMap<>();
25 | m.put("hello world", 5);
26 | m.put("a", 1777);
27 | System.out.println(m.get("hello world"));
28 | System.out.println(m.get("a"));
29 |
30 | if (m.containsKey("b"))
31 | System.out.println("contains!");
32 | else
33 | System.out.println("not contains :(");
34 |
35 | HashSet b = new HashSet();
36 | b.add("lol");
37 | System.out.println(b);
38 | if (b.contains("lol")) System.out.println("lol contains :|");
39 |
40 | ArrayList c = new ArrayList();
41 | c.add("Hello world");
42 | System.out.println(c);
43 | var index = c.indexOf("Hello world");
44 | System.out.println(c.get(0));
45 | }
46 | public static int test(){
47 | var r = new Random();
48 | int b = 5 + r.nextInt(64 - 5 + 1);
49 | return b;
50 | }
51 | public String test(String a){
52 | long i = 100L;
53 | long j = 100_000L;
54 | String timed = "timed";
55 | return timed + a;
56 | }
57 | }"""
58 |
59 | print(j.translate(text))
60 |
--------------------------------------------------------------------------------
/test.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include