8 changed files with 415 additions and 198 deletions
@ -1,192 +1,193 @@ |
|||||||
{ |
{ |
||||||
"colors": { |
"colors": { |
||||||
"text_color": ["black", "standard text color"], |
"text_color": "black", |
||||||
"string": ["green", "string text color"] |
"string" : "green" |
||||||
}, |
}, |
||||||
"syntax": { |
"syntax": { |
||||||
"1": ["text_color","CXCursor_UnexposedDecl"], |
"1": "text_color", |
||||||
"2": ["text_color","CXCursor_StructDecl"], |
"2": "text_color", |
||||||
"3": ["text_color","CXCursor_UnionDecl"], |
"2": "text_color", |
||||||
"4": ["text_color","CXCursor_ClassDecl"], |
"3": "text_color", |
||||||
"5": ["text_color","CXCursor_EnumDecl"], |
"4": "text_color", |
||||||
"6": ["text_color","CXCursor_FieldDecl"], |
"5": "text_color", |
||||||
"7": ["text_color","CXCursor_EnumConstantDecl"], |
"6": "text_color", |
||||||
"8": ["text_color","CXCursor_FunctionDecl"], |
"7": "text_color", |
||||||
"9": ["text_color","CXCursor_VarDecl"], |
"8": "text_color", |
||||||
"10": ["text_color","CXCursor_ParmDecl"], |
"9": "text_color", |
||||||
"11": ["text_color","CXCursor_ObjCInterfaceDecl"], |
"10": "text_color", |
||||||
"12": ["text_color","CXCursor_ObjCCategoryDecl"], |
"11": "text_color", |
||||||
"13": ["text_color","CXCursor_ObjCProtocolDecl"], |
"12": "text_color", |
||||||
"14": ["text_color","CXCursor_ObjCPropertyDecl"], |
"13": "text_color", |
||||||
"15": ["text_color","CXCursor_ObjCIvarDecl"], |
"14": "text_color", |
||||||
"16": ["text_color","CXCursor_ObjCInstanceMethodDecl"], |
"15": "text_color", |
||||||
"17": ["text_color","CXCursor_ObjCClassMethodDecl"], |
"16": "text_color", |
||||||
"18": ["text_color","CXCursor_ObjCImplementationDecl"], |
"17": "text_color", |
||||||
"19": ["text_color","CXCursor_ObjCCategoryImplDecl"], |
"18": "text_color", |
||||||
"20": ["text_color","CXCursor_TypedefDecl"], |
"19": "text_color", |
||||||
"21": ["text_color","CXCursor_CXXMethod"], |
"20": "text_color", |
||||||
"22": ["text_color","CXCursor_Namespace"], |
"21": "text_color", |
||||||
"23": ["text_color","CXCursor_LinkageSpec"], |
"22": "text_color", |
||||||
"24": ["text_color","CXCursor_Constructor"], |
"23": "text_color", |
||||||
"25": ["text_color","CXCursor_Destructor"], |
"24": "text_color", |
||||||
"26": ["text_color","CXCursor_ConversionFunction"], |
"25": "text_color", |
||||||
"27": ["text_color","CXCursor_TemplateTypeParameter"], |
"26": "text_color", |
||||||
"28": ["text_color","CXCursor_NonTypeTemplateParameter"], |
"27": "text_color", |
||||||
"29": ["text_color","CXCursor_TemplateTemplateParameter"], |
"28": "text_color", |
||||||
"30": ["text_color","CXCursor_FunctionTemplate"], |
"29": "text_color", |
||||||
"31": ["text_color","CXCursor_ClassTemplate"], |
"30": "text_color", |
||||||
"32": ["text_color","CXCursor_ClassTemplatePartialSpecialization"], |
"31": "text_color", |
||||||
"33": ["text_color","CXCursor_NamespaceAlias"], |
"32": "text_color", |
||||||
"34": ["text_color","CXCursor_UsingDirective"], |
"33": "text_color", |
||||||
"35": ["text_color","CXCursor_UsingDeclaration"], |
"34": "text_color", |
||||||
"36": ["text_color","CXCursor_TypeAliasDecl"], |
"35": "text_color", |
||||||
"37": ["text_color","CXCursor_ObjCSynthesizeDecl"], |
"36": "text_color", |
||||||
"38": ["text_color","CXCursor_ObjCDynamicDecl"], |
"37": "text_color", |
||||||
"39": ["text_color","CXCursor_CXXAccessSpecifier"], |
"38": "text_color", |
||||||
"40": ["text_color","CXCursor_FirstRef"], |
"39": "text_color", |
||||||
"41": ["text_color","CXCursor_ObjCSuperClassRef"], |
"40": "text_color", |
||||||
"42": ["text_color","CXCursor_ObjCProtocolRef"], |
"41": "text_color", |
||||||
"43": ["text_color","CXCursor_ObjCClassRef"], |
"42": "text_color", |
||||||
"44": ["text_color","CXCursor_TypeRef"], |
"43": "text_color", |
||||||
"45": ["text_color","CXCursor_CXXBaseSpecifier"], |
"44": "text_color", |
||||||
"46": ["text_color","CXCursor_TemplateRef"], |
"45": "text_color", |
||||||
"47": ["text_color","CXCursor_NamespaceRef"], |
"46": "text_color", |
||||||
"48": ["text_color","CXCursor_MemberRef"], |
"47": "text_color", |
||||||
"49": ["text_color","CXCursor_LabelRef"], |
"48": "text_color", |
||||||
"50": ["text_color","CXCursor_OverloadedDeclRef"], |
"49": "text_color", |
||||||
"51": ["text_color","CXCursor_VariableRef"], |
"50": "text_color", |
||||||
"70": ["text_color","CXCursor_FirstInvalid"], |
"51": "text_color", |
||||||
"70": ["text_color","CXCursor_InvalidFile"], |
"70": "text_color", |
||||||
"71": ["text_color","CXCursor_NoDeclFound"], |
"70": "text_color", |
||||||
"72": ["text_color","CXCursor_NotImplemented"], |
"71": "text_color", |
||||||
"73": ["text_color","CXCursor_InvalidCode"], |
"72": "text_color", |
||||||
"100": ["text_color","CXCursor_FirstExpr"], |
"73": "text_color", |
||||||
"100": ["text_color","CXCursor_UnexposedExpr"], |
"100": "text_color", |
||||||
"101": ["text_color","CXCursor_DeclRefExpr"], |
"100": "text_color", |
||||||
"102": ["text_color","CXCursor_MemberRefExpr"], |
"101": "text_color", |
||||||
"103": ["text_color","CXCursor_CallExpr"], |
"102": "text_color", |
||||||
"104": ["text_color","CXCursor_ObjCMessageExpr"], |
"103": "text_color", |
||||||
"105": ["text_color","CXCursor_BlockExpr"], |
"104": "text_color", |
||||||
"106": ["text_color","CXCursor_IntegerLiteral"], |
"105": "text_color", |
||||||
"107": ["text_color","CXCursor_FloatingLiteral"], |
"106": "text_color", |
||||||
"108": ["text_color","CXCursor_ImaginaryLiteral"], |
"107": "text_color", |
||||||
"109": ["string","CXCursor_StringLiteral"], |
"108": "text_color", |
||||||
"110": ["text_color","CXCursor_CharacterLiteral"], |
"109": "string", |
||||||
"111": ["text_color","CXCursor_ParenExpr"], |
"110": "text_color", |
||||||
"112": ["text_color","CXCursor_UnaryOperator"], |
"111": "text_color", |
||||||
"113": ["text_color","CXCursor_ArraySubscriptExpr"], |
"112": "text_color", |
||||||
"114": ["text_color","CXCursor_BinaryOperator"], |
"113": "text_color", |
||||||
"115": ["text_color","CXCursor_CompoundAssignOperator"], |
"114": "text_color", |
||||||
"116": ["text_color","CXCursor_ConditionalOperator"], |
"115": "text_color", |
||||||
"117": ["text_color","CXCursor_CStyleCastExpr"], |
"116": "text_color", |
||||||
"118": ["text_color","CXCursor_CompoundLiteralExpr"], |
"117": "text_color", |
||||||
"119": ["text_color","CXCursor_InitListExpr"], |
"118": "text_color", |
||||||
"120": ["text_color","CXCursor_AddrLabelExpr"], |
"119": "text_color", |
||||||
"121": ["text_color","CXCursor_StmtExpr"], |
"120": "text_color", |
||||||
"122": ["text_color","CXCursor_GenericSelectionExpr"], |
"121": "text_color", |
||||||
"123": ["text_color","CXCursor_GNUNullExpr"], |
"122": "text_color", |
||||||
"124": ["text_color","CXCursor_CXXStaticCastExpr"], |
"123": "text_color", |
||||||
"125": ["text_color","CXCursor_CXXDynamicCastExpr"], |
"124": "text_color", |
||||||
"126": ["text_color","CXCursor_CXXReinterpretCastExpr"], |
"125": "text_color", |
||||||
"127": ["text_color","CXCursor_CXXConstCastExpr"], |
"126": "text_color", |
||||||
"128": ["text_color","CXCursor_CXXFunctionalCastExpr"], |
"127": "text_color", |
||||||
"129": ["text_color","CXCursor_CXXTypeidExpr"], |
"128": "text_color", |
||||||
"130": ["text_color","CXCursor_CXXBoolLiteralExpr"], |
"129": "text_color", |
||||||
"131": ["text_color","CXCursor_CXXNullPtrLiteralExpr"], |
"130": "text_color", |
||||||
"132": ["text_color","CXCursor_CXXThisExpr"], |
"131": "text_color", |
||||||
"133": ["text_color","CXCursor_CXXThrowExpr"], |
"132": "text_color", |
||||||
"134": ["text_color","CXCursor_CXXNewExpr"], |
"133": "text_color", |
||||||
"135": ["text_color","CXCursor_CXXDeleteExpr"], |
"134": "text_color", |
||||||
"136": ["text_color","CXCursor_UnaryExpr"], |
"135": "text_color", |
||||||
"137": ["text_color","CXCursor_ObjCStringLiteral"], |
"136": "text_color", |
||||||
"138": ["text_color","CXCursor_ObjCEncodeExpr"], |
"137": "text_color", |
||||||
"139": ["text_color","CXCursor_ObjCSelectorExpr"], |
"138": "text_color", |
||||||
"140": ["text_color","CXCursor_ObjCProtocolExpr"], |
"139": "text_color", |
||||||
"141": ["text_color","CXCursor_ObjCBridgedCastExpr"], |
"140": "text_color", |
||||||
"142": ["text_color","CXCursor_PackExpansionExpr"], |
"141": "text_color", |
||||||
"143": ["text_color","CXCursor_SizeOfPackExpr"], |
"142": "text_color", |
||||||
"144": ["text_color","CXCursor_LambdaExpr"], |
"143": "text_color", |
||||||
"145": ["text_color","CXCursor_ObjCBoolLiteralExpr"], |
"144": "text_color", |
||||||
"146": ["text_color","CXCursor_ObjCSelfExpr"], |
"145": "text_color", |
||||||
"200": ["text_color","CXCursor_FirstStmt"], |
"146": "text_color", |
||||||
"200": ["text_color","CXCursor_UnexposedStmt"], |
"200": "text_color", |
||||||
"201": ["text_color","CXCursor_LabelStmt"], |
"200": "text_color", |
||||||
"202": ["text_color","CXCursor_CompoundStmt"], |
"201": "text_color", |
||||||
"203": ["text_color","CXCursor_CaseStmt"], |
"202": "text_color", |
||||||
"204": ["text_color","CXCursor_DefaultStmt"], |
"203": "text_color", |
||||||
"205": ["text_color","CXCursor_IfStmt"], |
"204": "text_color", |
||||||
"206": ["text_color","CXCursor_SwitchStmt"], |
"205": "text_color", |
||||||
"207": ["text_color","CXCursor_WhileStmt"], |
"206": "text_color", |
||||||
"208": ["text_color","CXCursor_DoStmt"], |
"207": "text_color", |
||||||
"209": ["text_color","CXCursor_ForStmt"], |
"208": "text_color", |
||||||
"210": ["text_color","CXCursor_GotoStmt"], |
"209": "text_color", |
||||||
"211": ["text_color","CXCursor_IndirectGotoStmt"], |
"210": "text_color", |
||||||
"212": ["text_color","CXCursor_ContinueStmt"], |
"211": "text_color", |
||||||
"213": ["text_color","CXCursor_BreakStmt"], |
"212": "text_color", |
||||||
"214": ["text_color","CXCursor_ReturnStmt"], |
"213": "text_color", |
||||||
"215": ["text_color","CXCursor_GCCAsmStmt"], |
"214": "text_color", |
||||||
"216": ["text_color","CXCursor_ObjCAtTryStmt"], |
"215": "text_color", |
||||||
"217": ["text_color","CXCursor_ObjCAtCatchStmt"], |
"216": "text_color", |
||||||
"218": ["text_color","CXCursor_ObjCAtFinallyStmt"], |
"217": "text_color", |
||||||
"219": ["text_color","CXCursor_ObjCAtThrowStmt"], |
"218": "text_color", |
||||||
"220": ["text_color","CXCursor_ObjCAtSynchronizedStmt"], |
"219": "text_color", |
||||||
"221": ["text_color","CXCursor_ObjCAutoreleasePoolStmt"], |
"220": "text_color", |
||||||
"222": ["text_color","CXCursor_ObjCForCollectionStmt"], |
"221": "text_color", |
||||||
"223": ["text_color","CXCursor_CXXCatchStmt"], |
"222": "text_color", |
||||||
"224": ["text_color","CXCursor_CXXTryStmt"], |
"223": "text_color", |
||||||
"225": ["text_color","CXCursor_CXXForRangeStmt"], |
"224": "text_color", |
||||||
"226": ["text_color","CXCursor_SEHTryStmt"], |
"225": "text_color", |
||||||
"227": ["text_color","CXCursor_SEHExceptStmt"], |
"226": "text_color", |
||||||
"228": ["text_color","CXCursor_SEHFinallyStmt"], |
"227": "text_color", |
||||||
"229": ["text_color","CXCursor_MSAsmStmt"], |
"228": "text_color", |
||||||
"230": ["text_color","CXCursor_NullStmt"], |
"229": "text_color", |
||||||
"231": ["text_color","CXCursor_DeclStmt"], |
"230": "text_color", |
||||||
"232": ["text_color","CXCursor_OMPParallelDirective"], |
"231": "text_color", |
||||||
"233": ["text_color","CXCursor_OMPSimdDirective"], |
"232": "text_color", |
||||||
"234": ["text_color","CXCursor_OMPForDirective"], |
"233": "text_color", |
||||||
"235": ["text_color","CXCursor_OMPSectionsDirective"], |
"234": "text_color", |
||||||
"236": ["text_color","CXCursor_OMPSectionDirective"], |
"235": "text_color", |
||||||
"237": ["text_color","CXCursor_OMPSingleDirective"], |
"236": "text_color", |
||||||
"238": ["text_color","CXCursor_OMPParallelForDirective"], |
"237": "text_color", |
||||||
"239": ["text_color","CXCursor_OMPParallelSectionsDirective"], |
"238": "text_color", |
||||||
"240": ["text_color","CXCursor_OMPTaskDirective"], |
"239": "text_color", |
||||||
"241": ["text_color","CXCursor_OMPMasterDirective"], |
"240": "text_color", |
||||||
"242": ["text_color","CXCursor_OMPCriticalDirective"], |
"241": "text_color", |
||||||
"243": ["text_color","CXCursor_OMPTaskyieldDirective"], |
"242": "text_color", |
||||||
"244": ["text_color","CXCursor_OMPBarrierDirective"], |
"243": "text_color", |
||||||
"245": ["text_color","CXCursor_OMPTaskwaitDirective"], |
"244": "text_color", |
||||||
"246": ["text_color","CXCursor_OMPFlushDirective"], |
"245": "text_color", |
||||||
"247": ["text_color","CXCursor_SEHLeaveStmt"], |
"246": "text_color", |
||||||
"248": ["text_color","CXCursor_OMPOrderedDirective"], |
"247": "text_color", |
||||||
"249": ["text_color","CXCursor_OMPAtomicDirective"], |
"248": "text_color", |
||||||
"250": ["text_color","CXCursor_OMPForSimdDirective"], |
"249": "text_color", |
||||||
"251": ["text_color","CXCursor_OMPParallelForSimdDirective"], |
"250": "text_color", |
||||||
"252": ["text_color","CXCursor_OMPTargetDirective"], |
"251": "text_color", |
||||||
"253": ["text_color","CXCursor_OMPTeamsDirective"], |
"252": "text_color", |
||||||
"300": ["text_color","CXCursor_TranslationUnit"], |
"253": "text_color", |
||||||
"400": ["text_color","CXCursor_FirstAttr"], |
"300": "text_color", |
||||||
"400": ["text_color","CXCursor_UnexposedAttr"], |
"400": "text_color", |
||||||
"401": ["text_color","CXCursor_IBActionAttr"], |
"400": "text_color", |
||||||
"402": ["text_color","CXCursor_IBOutletAttr"], |
"401": "text_color", |
||||||
"403": ["text_color","CXCursor_IBOutletCollectionAttr"], |
"402": "text_color", |
||||||
"404": ["text_color","CXCursor_CXXFinalAttr"], |
"403": "text_color", |
||||||
"405": ["text_color","CXCursor_CXXOverrideAttr"], |
"404": "text_color", |
||||||
"406": ["text_color","CXCursor_AnnotateAttr"], |
"405": "text_color", |
||||||
"407": ["text_color","CXCursor_AsmLabelAttr"], |
"406": "text_color", |
||||||
"408": ["text_color","CXCursor_PackedAttr"], |
"407": "text_color", |
||||||
"409": ["text_color","CXCursor_PureAttr"], |
"408": "text_color", |
||||||
"410": ["text_color","CXCursor_ConstAttr"], |
"409": "text_color", |
||||||
"411": ["text_color","CXCursor_NoDuplicateAttr"], |
"410": "text_color", |
||||||
"412": ["text_color","CXCursor_CUDAConstantAttr"], |
"411": "text_color", |
||||||
"413": ["text_color","CXCursor_CUDADeviceAttr"], |
"412": "text_color", |
||||||
"414": ["text_color","CXCursor_CUDAGlobalAttr"], |
"413": "text_color", |
||||||
"415": ["text_color","CXCursor_CUDAHostAttr"], |
"414": "text_color", |
||||||
"416": ["text_color","CXCursor_CUDASharedAttr"], |
"415": "text_color", |
||||||
"500": ["text_color","CXCursor_PreprocessingDirective"], |
"416": "text_color", |
||||||
"501": ["text_color","CXCursor_MacroDefinition"], |
"500": "text_color", |
||||||
"502": ["text_color","CXCursor_MacroExpansion"], |
"501": "text_color", |
||||||
"503": ["text_color","CXCursor_InclusionDirective"], |
"502": "text_color", |
||||||
"600": ["text_color","CXCursor_ModuleImportDecl"], |
"503": "text_color", |
||||||
"700": ["text_color","CXCursor_OverloadCandidate"] |
"600": "text_color", |
||||||
} |
"700": "text_color" |
||||||
|
} |
||||||
} |
} |
||||||
|
|||||||
@ -0,0 +1,92 @@ |
|||||||
|
#include "sourcefile.h" |
||||||
|
#include <giomm.h> |
||||||
|
#include <string> |
||||||
|
#include <iostream> |
||||||
|
#include <vector> |
||||||
|
|
||||||
|
using namespace std; |
||||||
|
|
||||||
|
sourcefile::sourcefile(const string &input_filename) |
||||||
|
: lines(), filename(input_filename) { |
||||||
|
open(input_filename); |
||||||
|
} |
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/ |
||||||
|
void sourcefile::open(const string &filename) { |
||||||
|
Gio::init(); |
||||||
|
|
||||||
|
// Creates/Opens a file specified by the input string.
|
||||||
|
Glib::RefPtr<Gio::File> file = Gio::File::create_for_path(filename); |
||||||
|
|
||||||
|
if (!file) // Gio::File has overloaded operator
|
||||||
|
cerr << "Was not able to open file: " << filename << endl; |
||||||
|
|
||||||
|
// Creates pointer for filestream
|
||||||
|
|
||||||
|
if (!file->query_exists()) { |
||||||
|
file->create_file()->close(); |
||||||
|
} |
||||||
|
|
||||||
|
Glib::RefPtr<Gio::FileInputStream> stream = file->read(); |
||||||
|
|
||||||
|
if (!stream) // error message on stream failure
|
||||||
|
cerr << filename << " returned an empty stream" << endl; |
||||||
|
|
||||||
|
Glib::RefPtr<Gio::DataInputStream> |
||||||
|
datainput = Gio::DataInputStream::create(stream); |
||||||
|
|
||||||
|
string line; |
||||||
|
while (datainput->read_line(line)) { |
||||||
|
lines.push_back(line); |
||||||
|
} |
||||||
|
|
||||||
|
datainput->close(); |
||||||
|
stream->close(); |
||||||
|
} |
||||||
|
|
||||||
|
vector<string> sourcefile::get_lines() { |
||||||
|
return lines; |
||||||
|
} |
||||||
|
|
||||||
|
string sourcefile::get_line(int line_number) { |
||||||
|
return lines[line_number]; |
||||||
|
} |
||||||
|
|
||||||
|
int sourcefile::save(const string &text) { |
||||||
|
Gio::init(); |
||||||
|
|
||||||
|
// Creates/Opens a file specified by the input string.
|
||||||
|
Glib::RefPtr<Gio::File> file = Gio::File::create_for_path(filename); |
||||||
|
|
||||||
|
if (!file) // Gio::File has overloaded operator
|
||||||
|
cerr << "Was not able to open file: " << filename << endl; |
||||||
|
|
||||||
|
// Creates
|
||||||
|
Glib::RefPtr<Gio::FileOutputStream> stream = |
||||||
|
file->query_exists() ? file->replace() : file->create_file(); |
||||||
|
|
||||||
|
if (!stream) // error message on stream failure
|
||||||
|
cerr << filename << " returned an empty stream" << endl; |
||||||
|
|
||||||
|
Glib::RefPtr<Gio::DataOutputStream> |
||||||
|
output = Gio::DataOutputStream::create(stream); |
||||||
|
|
||||||
|
output->put_string(text); |
||||||
|
|
||||||
|
output->close(); |
||||||
|
stream->close(); |
||||||
|
|
||||||
|
|
||||||
|
return 0; |
||||||
|
} |
||||||
|
|
||||||
|
string sourcefile::get_content() { |
||||||
|
string res; |
||||||
|
for (auto line : lines) { |
||||||
|
res.append(line).append("\n"); |
||||||
|
} |
||||||
|
return res; |
||||||
|
} |
||||||
|
|
||||||
@ -0,0 +1,23 @@ |
|||||||
|
#ifndef JUCI_SOURCEFILE_H_ |
||||||
|
#define JUCI_SOURCEFILE_H_ |
||||||
|
|
||||||
|
#include <string> |
||||||
|
#include <vector> |
||||||
|
|
||||||
|
using namespace std; |
||||||
|
|
||||||
|
class sourcefile { |
||||||
|
public: |
||||||
|
explicit sourcefile(const string &filename); |
||||||
|
vector<string> get_lines(); |
||||||
|
string get_content(); |
||||||
|
string get_line(int line_number); |
||||||
|
int save(const string &text); |
||||||
|
|
||||||
|
private: |
||||||
|
void open(const string &filename); |
||||||
|
vector<string> lines; |
||||||
|
string filename; |
||||||
|
}; |
||||||
|
|
||||||
|
#endif // JUCI_SOURCEFILE_H_
|
||||||
Loading…
Reference in new issue