Skip to content

Commit 8155ed3

Browse files
feat: finish multi lnaguage support
1 parent eed3835 commit 8155ed3

20 files changed

Lines changed: 202 additions & 2 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include <iostream>
2+
using namespace std;
3+
4+
// cc:main function
5+
int main()
6+
{
7+
cout << "Hello, World!";
8+
return 0;
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
public class HelloWorld {
2+
3+
// cc: main function
4+
public static void main(String[] args) {
5+
// Prints "Hello, World" to the terminal window.
6+
System.out.println("Hello, World");
7+
}
8+
9+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// cc:main function
2+
function greeting() {
3+
console.log('Hello world!');
4+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
// cc:main function
3+
echo "Hello World!";
4+
echo "PHP is so easy!";
5+
?>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import sys
2+
3+
# cc:main function
4+
def main(argv=None):
5+
if argv is None:
6+
argv = sys.argv
7+
8+
print "Hello, world"
9+
10+
return
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// cc:main function
2+
function greeting() {
3+
console.log('Hello world!');
4+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import React from 'react';
2+
import { BLUE_COLOR } from '../../constants';
3+
4+
export default ({ x, y, width, height }) => (
5+
<svg
6+
version="1.1"
7+
x={x}
8+
y={y}
9+
width={width}
10+
height={height}
11+
viewBox="0 0 550.801 550.801"
12+
shapeRendering={'geometricPrecision'}
13+
>
14+
<rect x="50" width="550" height="550" opacity="0.7" fill="white" />
15+
<g>
16+
<g>
17+
<path
18+
d="M386.406,415.441c-5.601,0-9.397,0.56-11.386,1.098v35.948c2.357,0.544,5.242,0.723,9.213,0.723 c14.654,0,23.683-7.394,23.683-19.881C407.911,422.129,400.138,415.441,386.406,415.441z"
19+
fill={BLUE_COLOR}
20+
/>
21+
<path
22+
d="M281.359,415.441c-5.601,0-9.4,0.56-11.386,1.098v35.948c2.365,0.544,5.247,0.723,9.224,0.723 c14.649,0,23.672-7.394,23.672-19.881C302.864,422.129,295.091,415.441,281.359,415.441z"
23+
fill={BLUE_COLOR}
24+
/>
25+
<path
26+
d="M475.095,132c-0.032-2.529-0.833-5.023-2.568-6.993L366.324,3.694c-0.021-0.031-0.053-0.042-0.084-0.076 c-0.633-0.707-1.36-1.29-2.141-1.804c-0.232-0.15-0.465-0.285-0.707-0.419c-0.686-0.369-1.393-0.67-2.131-0.892 c-0.2-0.061-0.379-0.14-0.58-0.195C359.87,0.119,359.047,0,358.203,0H97.2C85.292,0,75.6,9.693,75.6,21.601v507.6 c0,11.913,9.692,21.601,21.6,21.601H453.6c11.918,0,21.601-9.688,21.601-21.601V133.207 C475.2,132.804,475.137,132.398,475.095,132z M197.461,496.421c8.306,0,17.529-1.804,22.945-3.977l4.163,21.505 c-5.06,2.542-16.453,5.253-31.277,5.253c-42.098,0-63.795-26.209-63.795-60.903c0-41.581,29.647-64.71,66.517-64.71 c14.278,0,25.123,2.9,29.998,5.41l-5.601,21.874c-5.587-2.356-13.365-4.503-23.132-4.503c-21.877,0-38.86,13.173-38.86,40.294 C158.414,481.054,172.882,496.421,197.461,496.421z M318.959,461.542c-9.397,8.859-23.314,12.836-39.594,12.836 c-3.617,0-6.86-0.18-9.397-0.543v43.553h-27.288V397.195c8.501-1.444,20.43-2.536,37.233-2.536 c16.991,0,29.109,3.254,37.241,9.771c7.768,6.133,13.015,16.264,13.015,28.192C330.17,444.551,326.173,454.676,318.959,461.542z M424.006,461.542c-9.397,8.859-23.314,12.836-39.583,12.836c-3.617,0-6.866-0.18-9.402-0.543v43.553h-27.29V397.195 c8.495-1.444,20.419-2.536,37.235-2.536c16.986,0,29.104,3.254,37.226,9.771c7.778,6.133,13.025,16.264,13.025,28.192 C435.217,444.551,431.23,454.676,424.006,461.542z M97.2,366.758V21.605h250.203v110.519c0,5.961,4.831,10.8,10.8,10.8H453.6 l0.011,223.834H97.2z"
27+
fill={BLUE_COLOR}
28+
/>
29+
</g>
30+
<g>
31+
<path
32+
d="M255.878,295.165c-8.04,3.581-23.251,6.561-40.537,6.561c-47.115,0-77.219-28.625-77.219-74.535 c0-42.633,29.217-77.512,83.479-77.512c11.923,0,25.043,2.083,34.58,5.664l-7.153,33.684c-5.363-2.381-13.416-4.469-25.339-4.469 c-23.852,0-39.353,16.993-39.058,40.845c0,26.832,17.89,40.84,39.954,40.84c10.731,0,19.08-1.782,25.938-4.472L255.878,295.165z"
33+
fill={BLUE_COLOR}
34+
/>
35+
<path
36+
d="M311.576,192.302v27.372h26.24v11.81h-26.24v27.627h-12.309v-27.627h-26.243v-11.81h26.243v-27.372H311.576z"
37+
fill={BLUE_COLOR}
38+
/>
39+
<path
40+
d="M386.438,192.302v27.372h26.24v11.81h-26.24v27.627h-12.303v-27.627h-26.251v-11.81h26.251v-27.372H386.438z"
41+
fill={BLUE_COLOR}
42+
/>
43+
</g>
44+
</g>
45+
</svg>
46+
);

src/public/js/components/treeDiagram/component/Icons/language/File.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export default ({ x, y, width, height }) => (
1111
viewBox="0 0 512 512"
1212
shapeRendering={'geometricPrecision'}
1313
>
14+
<rect x="50" width="512" height="512" opacity="0.7" fill="white" />
1415
<g>
1516
<g>
1617
<path

src/public/js/components/treeDiagram/component/Icons/language/PythonFile.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export default ({ x, y, width, height }) => (
1111
viewBox="0 0 548.291 548.291"
1212
shapeRendering={'geometricPrecision'}
1313
>
14+
<rect x="50" width="550" height="550" opacity="0.7" fill="white" />
1415
<g>
1516
<g>
1617
<g>

src/public/js/components/treeDiagram/component/Node/File.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import classNames from 'classnames';
44
import { SYMBOL_WIDTH } from 'components/treeDiagram/component/constants';
55

66
import FileIcon from 'components/treeDiagram/component/Icons/language/File';
7+
import CppFileIcon from 'components/treeDiagram/component/Icons/language/CppFile';
78
import JavaScriptFileIcon from 'components/treeDiagram/component/Icons/language/JavaScriptFile';
89
import PythonFileIcon from 'components/treeDiagram/component/Icons/language/PythonFile';
910

@@ -12,6 +13,16 @@ import './index.scss';
1213

1314
const getFileIcon = ({ position, iconSize, language }) => {
1415
switch (language) {
16+
case 'cpp':
17+
return (
18+
<CppFileIcon
19+
x={position.x + 2}
20+
y={position.y - 10}
21+
height={iconSize + 1}
22+
width={iconSize + 1}
23+
/>
24+
);
25+
1526
case 'javascript':
1627
return (
1728
<JavaScriptFileIcon

0 commit comments

Comments
 (0)