[DEV] coding style in progress

This commit is contained in:
Edouard DUPIN 2013-10-03 23:56:01 +02:00
parent d9177e4565
commit 21441ab5aa
8 changed files with 184 additions and 9 deletions

120
bakaSed.sh Executable file
View File

@ -0,0 +1,120 @@
#!/bin/bash
replaceSed.sh "==" " == "
replaceSed.sh "==" " == "
replaceSed.sh "==" " == "
replaceSed.sh " == " " == "
replaceSed.sh " == " " == "
replaceSed.sh " == " " == "
replaceSed.sh " == " " == "
replaceSed.sh "\.PushBack(" ".pushBack("
replaceSed.sh "->PushBack(" "->pushBack("
replaceSed.sh " PushBack" " pushBack"
replaceSed.sh "\tPushBack" "\tpushBack"
replaceSed.sh "::PushBack" "::pushBack"
replaceSed.sh "\.PopBack(" ".popBack("
replaceSed.sh "->PopBack(" "->popBack("
replaceSed.sh " PopBack" " popBack"
replaceSed.sh "\tPopBack" "\tpopBack"
replaceSed.sh "::PopBack" "::popBack"
replaceSed.sh "\.Size" ".size"
replaceSed.sh "->Size" "->size"
replaceSed.sh " Size" " size"
replaceSed.sh "\tSize" "\tsize"
replaceSed.sh "::Size" "::size"
replaceSed.sh "\.Clear()" ".clear()"
replaceSed.sh "->Clear()" "->clear()"
replaceSed.sh " Clear" " clear"
replaceSed.sh "\tClear" "\tclear"
replaceSed.sh "::Clear" "::clear"
replaceSed.sh "\.To" ".to"
replaceSed.sh "->To" "->to"
replaceSed.sh " To" " to"
replaceSed.sh "\tTo" "\tto"
replaceSed.sh "::To" "::to"
replaceSed.sh "\.Is" ".is"
replaceSed.sh "->Is" "->is"
replaceSed.sh " Is" " is"
replaceSed.sh "\tIs" "\tis"
replaceSed.sh "::Is" "::is"
replaceSed.sh "\.Exist()" ".exist()"
replaceSed.sh "->Exist()" "->exist()"
replaceSed.sh " Exist" " exist"
replaceSed.sh "\tExist" "\texist"
replaceSed.sh "::Exist" "::exist"
replaceSed.sh "\.Add" ".add"
replaceSed.sh "->Add" "->add"
replaceSed.sh " Add" " add"
replaceSed.sh "\tAdd" "\tadd"
replaceSed.sh "::Add" "::add"
replaceSed.sh "\.Get" ".get"
replaceSed.sh "->Get" "->get"
replaceSed.sh " Get" " get"
replaceSed.sh "\tGet" "\tget"
replaceSed.sh "::Get" "::get"
replaceSed.sh "\.Set" ".set"
replaceSed.sh "->Set" "->set"
replaceSed.sh " Set" " set"
replaceSed.sh "\tSet" "\tset"
replaceSed.sh "::Set" "::set"
replaceSed.sh "\.Insert" ".insert"
replaceSed.sh "->Insert" "->insert"
replaceSed.sh " Insert" " insert"
replaceSed.sh "\tInsert" "\tinsert"
replaceSed.sh "::Insert" "::insert"
replaceSed.sh "\.Parse" ".parse"
replaceSed.sh "->Parse" "->parse"
replaceSed.sh " Parse" " parse"
replaceSed.sh "\tParse" "\tparse"
replaceSed.sh "::Parse" "::parse"
replaceSed.sh "\.Generate" ".generate"
replaceSed.sh "->Generate" "->generate"
replaceSed.sh " Generate" " generate"
replaceSed.sh "\tGenerate" "\tgenerate"
replaceSed.sh "::Generate" "::generate"
replaceSed.sh "\.Transfert" ".transfert"
replaceSed.sh "->Transfert" "->transfert"
replaceSed.sh " Transfert" " transfert"
replaceSed.sh "\tTransfert" "\ttransfert"
replaceSed.sh "::Transfert" "::transfert"
replaceSed.sh "\.Duplicate" ".duplicate"
replaceSed.sh "->Duplicate" "->duplicate"
replaceSed.sh " Duplicate" " duplicate"
replaceSed.sh "\tDuplicate" "\tduplicate"
replaceSed.sh "::Duplicate" "::duplicate"
replaceSed.sh "\.Draw" ".draw"
replaceSed.sh "->Draw" "->draw"
replaceSed.sh " Draw" " draw"
replaceSed.sh "\tDraw" "\tdraw"
replaceSed.sh "::Draw" "::draw"
replaceSed.sh "\.Check" ".check"
replaceSed.sh "->Check" "->check"
replaceSed.sh " Check" " check"
replaceSed.sh "\tCheck" "\tcheck"
replaceSed.sh "::Check" "::check"
replaceSed.sh "\.Count" ".count"
replaceSed.sh "->Count" "->count"
replaceSed.sh " Count" " count"
replaceSed.sh "\tCount" "\tcount"
replaceSed.sh "::Count" "::count"

View File

@ -22,7 +22,7 @@ We need to use the same coding style in c and c++ to simplify inter-reading code
* @param[in,out] _xxxx Comment on the variable
* @return my return explanation
*/
- enumeration comment:
- one line documlentation:
xxxxx, //!< my comment
---------------------------
@ -40,7 +40,6 @@ We need to use the same coding style in c and c++ to simplify inter-reading code
he will be able to do it.
When you set a brace '{' you need to add a brace, and when you set a
stop brace '}' you need to remove a tab
To be simple : (tab stop at the 'if' start)
if:
if ( xxx == yyy
@ -80,6 +79,17 @@ We need to use the same coding style in c and c++ to simplify inter-reading code
namespace appl {
void get(void);
};
For special element like : you might add a tabulation too
case xxx:
actions...
public:
definition ...
An exception for the inline function inside c++ header:
class Plop {
private:
int32_t m_value; //!< my value of money gain
public:
int32_t getValue(void) const { return m_value; };
----------------
-- 4: types --
@ -131,12 +141,41 @@ We need to use the same coding style in c and c++ to simplify inter-reading code
- enum:
Camel case with first letter in lower case.
enum myEnum {
myEnumDef1,
myEnumDef2,
myEnumDef3,
};
- structure (C only)
use naming like Classes (and for mamber too)
- minimum size : Do not use variable with size <3, the for a iterator
for a 'for' :
for (int32_t iii=0; iii<xxx; ++iii) {
actions ...
}
----------------
-- 8: types --
----------------
Une stanndard Type :
bool
int8_t / uint8_t
int16_t / uint16_t
int32_t / uint32_t
int64_t / uint64_t
size_t
int (some case needed)
float / double
float_t to automatic match whith the compilation choice between float or double
-----------------------
-- 9: return value --
-----------------------
use the best simple way to check the return value :
use 'int' type and return 0 whenall is ok, or -errno if an error
occured, note thet the >0 value, you can set what you want.
--------------------------
-- 8: C++ specificity --
-- 9: C++ specificity --
--------------------------
- STL
You can use the Stl, but the porting and the result can be

2
external/agg vendored

@ -1 +1 @@
Subproject commit 64280cda086d931f7af6ac4ce29e181ceee8f45b
Subproject commit ed0661317bb59183336d11b13f76025bdf08bb34

2
external/ejson vendored

@ -1 +1 @@
Subproject commit 299ca3e6b2edf15cc8156b97d9e59b3d3c3a4fa7
Subproject commit a788a3c450585c42dd59cf8e3813bd1a4a241c5e

2
external/esvg vendored

@ -1 +1 @@
Subproject commit 32c4469c127fed6ff4f3c9a7031eb7e76f72c43b
Subproject commit b80dbfd29830143bb2db0f6057e9d7bd0d530fb0

2
external/etk vendored

@ -1 +1 @@
Subproject commit dfcb78c081c6d975cf88dcb2e4cd1b0ada289c67
Subproject commit 006233a2fdb26276294771d7780492215b115363

2
external/exml vendored

@ -1 +1 @@
Subproject commit 75ef4d184ade2791d1db3b3d0f40b8ae46aa7f45
Subproject commit 33d1e95085e090eec9860213ba97a1616442d159

16
replaceSed.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
listFiles=" `find . -name "*.cpp"` "
listFiles+=" `find . -name "*.c"` "
listFiles+=" `find . -name "*.h"` "
#listFiles+=" `find . -name "*.mk"` "
echo "Replace : \"$1\" ==> \"$2\""
for iii in $listFiles
do
echo "* File : "$iii
sed -i "s|$1|$2|" $iii
done