mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Add C++ sample
This commit is contained in:
@@ -257,8 +257,8 @@
|
|||||||
".gemrc"
|
".gemrc"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"tokens_total": 269224,
|
"tokens_total": 269398,
|
||||||
"languages_total": 273,
|
"languages_total": 274,
|
||||||
"tokens": {
|
"tokens": {
|
||||||
"Apex": {
|
"Apex": {
|
||||||
"global": 70,
|
"global": 70,
|
||||||
@@ -5573,19 +5573,19 @@
|
|||||||
"yajl_free_error": 1
|
"yajl_free_error": 1
|
||||||
},
|
},
|
||||||
"C++": {
|
"C++": {
|
||||||
"class": 31,
|
"class": 32,
|
||||||
"Bar": 2,
|
"Bar": 2,
|
||||||
"{": 294,
|
"{": 298,
|
||||||
"protected": 4,
|
"protected": 4,
|
||||||
"char": 34,
|
"char": 34,
|
||||||
"*name": 2,
|
"*name": 2,
|
||||||
";": 831,
|
";": 848,
|
||||||
"public": 23,
|
"public": 24,
|
||||||
"void": 65,
|
"void": 65,
|
||||||
"hello": 2,
|
"hello": 2,
|
||||||
"(": 888,
|
"(": 894,
|
||||||
")": 891,
|
")": 896,
|
||||||
"}": 296,
|
"}": 300,
|
||||||
"foo": 2,
|
"foo": 2,
|
||||||
"cudaArray*": 1,
|
"cudaArray*": 1,
|
||||||
"cu_array": 4,
|
"cu_array": 4,
|
||||||
@@ -5599,7 +5599,7 @@
|
|||||||
"cudaCreateChannelDesc": 1,
|
"cudaCreateChannelDesc": 1,
|
||||||
"<float>": 1,
|
"<float>": 1,
|
||||||
"cudaMallocArray": 1,
|
"cudaMallocArray": 1,
|
||||||
"&": 84,
|
"&": 87,
|
||||||
"width": 5,
|
"width": 5,
|
||||||
"height": 5,
|
"height": 5,
|
||||||
"cudaMemcpyToArray": 1,
|
"cudaMemcpyToArray": 1,
|
||||||
@@ -5615,7 +5615,7 @@
|
|||||||
"cudaFilterModePoint": 1,
|
"cudaFilterModePoint": 1,
|
||||||
"tex.normalized": 1,
|
"tex.normalized": 1,
|
||||||
"false": 40,
|
"false": 40,
|
||||||
"//": 227,
|
"//": 230,
|
||||||
"do": 2,
|
"do": 2,
|
||||||
"not": 2,
|
"not": 2,
|
||||||
"normalize": 1,
|
"normalize": 1,
|
||||||
@@ -5630,7 +5630,7 @@
|
|||||||
"/": 9,
|
"/": 9,
|
||||||
"blockDim.y": 2,
|
"blockDim.y": 2,
|
||||||
"kernel": 2,
|
"kernel": 2,
|
||||||
"<<": 5,
|
"<<": 16,
|
||||||
"<": 27,
|
"<": 27,
|
||||||
"d_data": 1,
|
"d_data": 1,
|
||||||
"cudaUnbindTexture": 1,
|
"cudaUnbindTexture": 1,
|
||||||
@@ -5646,12 +5646,12 @@
|
|||||||
"y": 4,
|
"y": 4,
|
||||||
"blockIdx.y*blockDim.y": 1,
|
"blockIdx.y*blockDim.y": 1,
|
||||||
"threadIdx.y": 1,
|
"threadIdx.y": 1,
|
||||||
"if": 137,
|
"if": 138,
|
||||||
"&&": 13,
|
"&&": 13,
|
||||||
"c": 52,
|
"c": 52,
|
||||||
"tex2D": 1,
|
"tex2D": 1,
|
||||||
"y*width": 1,
|
"y*width": 1,
|
||||||
"#include": 77,
|
"#include": 79,
|
||||||
"<QCoreApplication>": 1,
|
"<QCoreApplication>": 1,
|
||||||
"<QString>": 1,
|
"<QString>": 1,
|
||||||
"<QVariantMap>": 2,
|
"<QVariantMap>": 2,
|
||||||
@@ -5664,7 +5664,7 @@
|
|||||||
"instance": 4,
|
"instance": 4,
|
||||||
"env_instance": 3,
|
"env_instance": 3,
|
||||||
"new": 2,
|
"new": 2,
|
||||||
"return": 112,
|
"return": 114,
|
||||||
"QObject": 2,
|
"QObject": 2,
|
||||||
"QCoreApplication": 1,
|
"QCoreApplication": 1,
|
||||||
"parse": 3,
|
"parse": 3,
|
||||||
@@ -5672,7 +5672,7 @@
|
|||||||
"**envp": 1,
|
"**envp": 1,
|
||||||
"**env": 1,
|
"**env": 1,
|
||||||
"**": 2,
|
"**": 2,
|
||||||
"QString": 19,
|
"QString": 20,
|
||||||
"envvar": 2,
|
"envvar": 2,
|
||||||
"name": 3,
|
"name": 3,
|
||||||
"value": 5,
|
"value": 5,
|
||||||
@@ -5689,14 +5689,89 @@
|
|||||||
"QVariantMap": 3,
|
"QVariantMap": 3,
|
||||||
"asVariantMap": 2,
|
"asVariantMap": 2,
|
||||||
"m_map": 2,
|
"m_map": 2,
|
||||||
"#ifndef": 7,
|
"#ifndef": 8,
|
||||||
"ENV_H": 3,
|
"ENV_H": 3,
|
||||||
"#define": 7,
|
"#define": 9,
|
||||||
"<QObject>": 1,
|
"<QObject>": 1,
|
||||||
"Q_OBJECT": 1,
|
"Q_OBJECT": 1,
|
||||||
"*instance": 1,
|
"*instance": 1,
|
||||||
"private": 10,
|
"private": 10,
|
||||||
"#endif": 18,
|
"#endif": 19,
|
||||||
|
"GDSDBREADER_H": 3,
|
||||||
|
"<QDir>": 1,
|
||||||
|
"GDS_DIR": 1,
|
||||||
|
"enum": 6,
|
||||||
|
"level": 1,
|
||||||
|
"LEVEL_ONE": 1,
|
||||||
|
"LEVEL_TWO": 1,
|
||||||
|
"LEVEL_THREE": 1,
|
||||||
|
"dbDataStructure": 2,
|
||||||
|
"label": 1,
|
||||||
|
"quint32": 3,
|
||||||
|
"depth": 1,
|
||||||
|
"userIndex": 1,
|
||||||
|
"QByteArray": 1,
|
||||||
|
"data": 2,
|
||||||
|
"This": 4,
|
||||||
|
"is": 33,
|
||||||
|
"COMPRESSED": 1,
|
||||||
|
"optimize": 1,
|
||||||
|
"ram": 1,
|
||||||
|
"and": 14,
|
||||||
|
"disk": 1,
|
||||||
|
"space": 2,
|
||||||
|
"decompressed": 1,
|
||||||
|
"quint64": 1,
|
||||||
|
"uniqueID": 1,
|
||||||
|
"QVector": 2,
|
||||||
|
"<dbDataStructure*>": 1,
|
||||||
|
"nextItems": 1,
|
||||||
|
"<quint32>": 1,
|
||||||
|
"nextItemsIndices": 1,
|
||||||
|
"dbDataStructure*": 1,
|
||||||
|
"father": 1,
|
||||||
|
"fatherIndex": 1,
|
||||||
|
"bool": 92,
|
||||||
|
"noFatherRoot": 1,
|
||||||
|
"Used": 1,
|
||||||
|
"to": 74,
|
||||||
|
"tell": 1,
|
||||||
|
"this": 4,
|
||||||
|
"node": 1,
|
||||||
|
"the": 178,
|
||||||
|
"root": 1,
|
||||||
|
"so": 1,
|
||||||
|
"hasn": 1,
|
||||||
|
"t": 8,
|
||||||
|
"in": 9,
|
||||||
|
"argument": 1,
|
||||||
|
"list": 2,
|
||||||
|
"of": 44,
|
||||||
|
"an": 2,
|
||||||
|
"operator": 9,
|
||||||
|
"overload.": 1,
|
||||||
|
"A": 1,
|
||||||
|
"friend": 7,
|
||||||
|
"stream": 4,
|
||||||
|
"myclass.label": 2,
|
||||||
|
"myclass.depth": 2,
|
||||||
|
"myclass.userIndex": 2,
|
||||||
|
"qCompress": 2,
|
||||||
|
"myclass.data": 4,
|
||||||
|
"myclass.uniqueID": 2,
|
||||||
|
"myclass.nextItemsIndices": 2,
|
||||||
|
"myclass.fatherIndex": 2,
|
||||||
|
"myclass.noFatherRoot": 2,
|
||||||
|
"myclass.fileName": 2,
|
||||||
|
"myclass.firstLineData": 4,
|
||||||
|
"myclass.linesNumbers": 2,
|
||||||
|
"QDataStream": 2,
|
||||||
|
"myclass": 1,
|
||||||
|
"//Don": 1,
|
||||||
|
"read": 1,
|
||||||
|
"it": 2,
|
||||||
|
"either": 1,
|
||||||
|
"qUncompress": 2,
|
||||||
"<iostream>": 1,
|
"<iostream>": 1,
|
||||||
"using": 1,
|
"using": 1,
|
||||||
"namespace": 14,
|
"namespace": 14,
|
||||||
@@ -5806,7 +5881,6 @@
|
|||||||
"EC_KEY_dup": 1,
|
"EC_KEY_dup": 1,
|
||||||
"b.pkey": 2,
|
"b.pkey": 2,
|
||||||
"b.fSet": 2,
|
"b.fSet": 2,
|
||||||
"operator": 7,
|
|
||||||
"EC_KEY_copy": 1,
|
"EC_KEY_copy": 1,
|
||||||
"hash": 20,
|
"hash": 20,
|
||||||
"sizeof": 6,
|
"sizeof": 6,
|
||||||
@@ -5815,11 +5889,9 @@
|
|||||||
"vchSig.clear": 2,
|
"vchSig.clear": 2,
|
||||||
"vchSig.resize": 2,
|
"vchSig.resize": 2,
|
||||||
"Shrink": 1,
|
"Shrink": 1,
|
||||||
"to": 73,
|
|
||||||
"fit": 1,
|
"fit": 1,
|
||||||
"actual": 1,
|
"actual": 1,
|
||||||
"size": 1,
|
"size": 1,
|
||||||
"bool": 91,
|
|
||||||
"SignCompact": 2,
|
"SignCompact": 2,
|
||||||
"uint256": 10,
|
"uint256": 10,
|
||||||
"vector": 14,
|
"vector": 14,
|
||||||
@@ -5837,7 +5909,6 @@
|
|||||||
"keyRec": 5,
|
"keyRec": 5,
|
||||||
"1": 2,
|
"1": 2,
|
||||||
"GetPubKey": 5,
|
"GetPubKey": 5,
|
||||||
"this": 3,
|
|
||||||
"break": 30,
|
"break": 30,
|
||||||
"BN_bn2bin": 2,
|
"BN_bn2bin": 2,
|
||||||
"/8": 2,
|
"/8": 2,
|
||||||
@@ -5873,11 +5944,9 @@
|
|||||||
"str": 2,
|
"str": 2,
|
||||||
"CKeyID": 5,
|
"CKeyID": 5,
|
||||||
"uint160": 8,
|
"uint160": 8,
|
||||||
"in": 8,
|
|
||||||
"CScriptID": 3,
|
"CScriptID": 3,
|
||||||
"CPubKey": 11,
|
"CPubKey": 11,
|
||||||
"vchPubKey": 6,
|
"vchPubKey": 6,
|
||||||
"friend": 5,
|
|
||||||
"vchPubKeyIn": 2,
|
"vchPubKeyIn": 2,
|
||||||
"a": 34,
|
"a": 34,
|
||||||
"a.vchPubKey": 3,
|
"a.vchPubKey": 3,
|
||||||
@@ -5916,15 +5985,12 @@
|
|||||||
"QT_VERSION_CHECK": 1,
|
"QT_VERSION_CHECK": 1,
|
||||||
"#error": 2,
|
"#error": 2,
|
||||||
"Something": 1,
|
"Something": 1,
|
||||||
"is": 30,
|
|
||||||
"wrong": 1,
|
"wrong": 1,
|
||||||
"with": 3,
|
"with": 3,
|
||||||
"the": 176,
|
|
||||||
"setup.": 1,
|
"setup.": 1,
|
||||||
"Please": 1,
|
"Please": 1,
|
||||||
"report": 2,
|
"report": 2,
|
||||||
"mailing": 1,
|
"mailing": 1,
|
||||||
"list": 1,
|
|
||||||
"argc": 2,
|
"argc": 2,
|
||||||
"char**": 2,
|
"char**": 2,
|
||||||
"argv": 2,
|
"argv": 2,
|
||||||
@@ -5964,7 +6030,6 @@
|
|||||||
"The": 8,
|
"The": 8,
|
||||||
"QsciCommand": 7,
|
"QsciCommand": 7,
|
||||||
"represents": 1,
|
"represents": 1,
|
||||||
"an": 1,
|
|
||||||
"internal": 10,
|
"internal": 10,
|
||||||
"editor": 1,
|
"editor": 1,
|
||||||
"command": 9,
|
"command": 9,
|
||||||
@@ -5981,20 +6046,16 @@
|
|||||||
"are": 3,
|
"are": 3,
|
||||||
"provided": 1,
|
"provided": 1,
|
||||||
"change": 1,
|
"change": 1,
|
||||||
"and": 13,
|
|
||||||
"remove": 1,
|
"remove": 1,
|
||||||
"binding.": 1,
|
"binding.": 1,
|
||||||
"Each": 1,
|
"Each": 1,
|
||||||
"has": 2,
|
"has": 2,
|
||||||
"user": 2,
|
"user": 2,
|
||||||
"friendly": 2,
|
"friendly": 2,
|
||||||
"of": 43,
|
|
||||||
"use": 1,
|
"use": 1,
|
||||||
"mapping": 1,
|
"mapping": 1,
|
||||||
"dialogs.": 1,
|
"dialogs.": 1,
|
||||||
"QSCINTILLA_EXPORT": 2,
|
"QSCINTILLA_EXPORT": 2,
|
||||||
"This": 3,
|
|
||||||
"enum": 5,
|
|
||||||
"defines": 1,
|
"defines": 1,
|
||||||
"different": 1,
|
"different": 1,
|
||||||
"commands": 1,
|
"commands": 1,
|
||||||
@@ -6392,10 +6453,8 @@
|
|||||||
"draw": 1,
|
"draw": 1,
|
||||||
"text.": 3,
|
"text.": 3,
|
||||||
"should": 1,
|
"should": 1,
|
||||||
"it": 1,
|
|
||||||
"necessary": 1,
|
"necessary": 1,
|
||||||
"reserve": 1,
|
"reserve": 1,
|
||||||
"space": 1,
|
|
||||||
"By": 1,
|
"By": 1,
|
||||||
"default": 3,
|
"default": 3,
|
||||||
"relative": 1,
|
"relative": 1,
|
||||||
@@ -6572,7 +6631,6 @@
|
|||||||
"IsLineFeed": 2,
|
"IsLineFeed": 2,
|
||||||
"fall": 2,
|
"fall": 2,
|
||||||
"through": 2,
|
"through": 2,
|
||||||
"t": 6,
|
|
||||||
"u": 6,
|
"u": 6,
|
||||||
"v": 3,
|
"v": 3,
|
||||||
"xx": 1,
|
"xx": 1,
|
||||||
@@ -27345,7 +27403,7 @@
|
|||||||
"Arduino": 20,
|
"Arduino": 20,
|
||||||
"AutoHotkey": 3,
|
"AutoHotkey": 3,
|
||||||
"C": 49038,
|
"C": 49038,
|
||||||
"C++": 9539,
|
"C++": 9713,
|
||||||
"Ceylon": 50,
|
"Ceylon": 50,
|
||||||
"CoffeeScript": 2955,
|
"CoffeeScript": 2955,
|
||||||
"Coq": 18259,
|
"Coq": 18259,
|
||||||
@@ -27415,7 +27473,7 @@
|
|||||||
"Arduino": 1,
|
"Arduino": 1,
|
||||||
"AutoHotkey": 1,
|
"AutoHotkey": 1,
|
||||||
"C": 23,
|
"C": 23,
|
||||||
"C++": 16,
|
"C++": 17,
|
||||||
"Ceylon": 1,
|
"Ceylon": 1,
|
||||||
"CoffeeScript": 9,
|
"CoffeeScript": 9,
|
||||||
"Coq": 12,
|
"Coq": 12,
|
||||||
@@ -27479,5 +27537,5 @@
|
|||||||
"XSLT": 1,
|
"XSLT": 1,
|
||||||
"YAML": 1
|
"YAML": 1
|
||||||
},
|
},
|
||||||
"md5": "0dd037f8ae8057afc1213dc441839d99"
|
"md5": "ca1d189ca79aa9c52370da78f2c2b4dd"
|
||||||
}
|
}
|
||||||
69
samples/C++/gdsdbreader.h
Normal file
69
samples/C++/gdsdbreader.h
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
#ifndef GDSDBREADER_H
|
||||||
|
#define GDSDBREADER_H
|
||||||
|
|
||||||
|
// This file contains core structures, classes and types for the entire gds app
|
||||||
|
// WARNING: DO NOT MODIFY UNTIL IT'S STRICTLY NECESSARY
|
||||||
|
|
||||||
|
#include <QDir>
|
||||||
|
#include "diagramwidget/qgldiagramwidget.h"
|
||||||
|
|
||||||
|
#define GDS_DIR "gdsdata"
|
||||||
|
|
||||||
|
enum level {LEVEL_ONE, LEVEL_TWO, LEVEL_THREE};
|
||||||
|
|
||||||
|
// The internal structure of the db to store information about each node (each level)
|
||||||
|
// this will be serialized before being written to file
|
||||||
|
class dbDataStructure
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
QString label;
|
||||||
|
quint32 depth;
|
||||||
|
quint32 userIndex;
|
||||||
|
QByteArray data; // This is COMPRESSED data, optimize ram and disk space, is decompressed
|
||||||
|
// just when needed (to display the comments)
|
||||||
|
|
||||||
|
// The following ID is used to create second-third level files
|
||||||
|
quint64 uniqueID;
|
||||||
|
// All the next items linked to this one
|
||||||
|
QVector<dbDataStructure*> nextItems;
|
||||||
|
// Corresponding indices vector (used to store data)
|
||||||
|
QVector<quint32> nextItemsIndices;
|
||||||
|
// The father element (or NULL if it's root)
|
||||||
|
dbDataStructure* father;
|
||||||
|
// Corresponding indices vector (used to store data)
|
||||||
|
quint32 fatherIndex;
|
||||||
|
bool noFatherRoot; // Used to tell if this node is the root (so hasn't a father)
|
||||||
|
|
||||||
|
// These fields will be useful for levels 2 and 3
|
||||||
|
QString fileName; // Relative filename for the associated code file
|
||||||
|
QByteArray firstLineData; // Compressed first line data, this will be used with the line number to retrieve info
|
||||||
|
QVector<quint32> linesNumbers; // First and next lines (next are relative to the first) numbers
|
||||||
|
|
||||||
|
// -- Generic system data not to be stored on disk
|
||||||
|
void *glPointer; // GL pointer
|
||||||
|
|
||||||
|
// These operator overrides prevent the glPointer and other non-disk-necessary data serialization
|
||||||
|
friend QDataStream& operator<<(QDataStream& stream, const dbDataStructure& myclass)
|
||||||
|
// Notice: this function has to be "friend" because it cannot be a member function, member functions
|
||||||
|
// have an additional parameter "this" which isn't in the argument list of an operator overload. A friend
|
||||||
|
// function has full access to private data of the class without having the "this" argument
|
||||||
|
{
|
||||||
|
// Don't write glPointer and every pointer-dependent structure
|
||||||
|
return stream << myclass.label << myclass.depth << myclass.userIndex << qCompress(myclass.data)
|
||||||
|
<< myclass.uniqueID << myclass.nextItemsIndices << myclass.fatherIndex << myclass.noFatherRoot
|
||||||
|
<< myclass.fileName << qCompress(myclass.firstLineData) << myclass.linesNumbers;
|
||||||
|
}
|
||||||
|
friend QDataStream& operator>>(QDataStream& stream, dbDataStructure& myclass)
|
||||||
|
{
|
||||||
|
//Don't read it, either
|
||||||
|
stream >> myclass.label >> myclass.depth >> myclass.userIndex >> myclass.data
|
||||||
|
>> myclass.uniqueID >> myclass.nextItemsIndices >> myclass.fatherIndex >> myclass.noFatherRoot
|
||||||
|
>> myclass.fileName >> myclass.firstLineData >> myclass.linesNumbers;
|
||||||
|
myclass.data = qUncompress(myclass.data);
|
||||||
|
myclass.firstLineData = qUncompress(myclass.firstLineData);
|
||||||
|
return stream;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // GDSDBREADER_H
|
||||||
Reference in New Issue
Block a user