<patterns>
  <class pattern="\.(c|cc|C|cpp|c\+\+|cxx|h|hh|hpp|H|css|js|php)((\.cmake)|(\.in))?$" icon="text-x-c++src.png" name="c++" >

<!--Options-->
  <Option>
   <Name>wrap</Name>
   <Value>0</Value>
   <flags>2</flags>
  </Option>
  <Option>
   <Name>emulate_tabs</Name>
   <Value>1</Value>
   <flags>2</flags>
  </Option>
  <Option>
   <Name>tab_size</Name>
   <Value>4</Value>
   <flags>2</flags>
  </Option>
  <Option>
   <Name>default</Name>
   <Value>0</Value>
   <flags>2</flags>
  </Option>
  <Option>
   <Name>base_indentation</Name>
   <Value>0</Value>
   <flags>2</flags>
  </Option>

<!--Highlight styles-->
  <style format="2" name="Comment" color="#ff8c00" />
  <style format="0" name="Cvs In" color="#ff0000" />
  <style format="0" name="Cvs Out" color="#0000ff" />
  <style format="0" name="End Of Line" color="#aa0000" />
  <style format="0" name="Keyword" color="#0000ff" />
  <style format="2" name="Math" color="#a020f0" />
  <style format="0" name="Numeric Constants" color="#808000" />
  <style format="0" name="Preprocessor" color="#ff00ff" />
  <style format="0" name="Preprocessor2" color="#aa00aa" />
  <style format="0" name="Scope" color="#008000" />
  <style format="0" name="Storage Type" color="#a020f0" />
  <style format="0" name="String" color="#00cd00" />
  <style format="0" name="String2" color="#2e8b2e" />
  <style format="0" name="Word" color="#ff0000" />

<!--Highlight patterns-->
  <range_pattern options="span " style="Cvs In" parent="" name="Cvs In" >
   <comments>cvs conflict</comments>
   <begin>^\s*&lt;{7}</begin>
   <end>^\s*\={3}</end>
  </range_pattern>
  <range_pattern options="span " style="Cvs Out" parent="" name="Cvs Out" >
   <comments>cvs conflict</comments>
   <begin>\={3}\s*$</begin>
   <end>^\s*&gt;{7}</end>
  </range_pattern>
  <keyword_pattern style="End Of Line" parent="" name="End Of Line" >
   <comments>end of line</comments>
   <keyword>;\s*$</keyword>
  </keyword_pattern>
  <range_pattern options="no_indent " style="Preprocessor" parent="" name="Preprocessor" >
   <comments>preprocessor comment</comments>
   <begin>^\s*#\s*(include|define|if(n?def)?|line|error|el(se|if)|endif|undef|pragma)\b</begin>
   <end>$</end>
  </range_pattern>
  <range_pattern options="no_indent comments" style="Comment" parent="" name="Comment" >
   <comments>begin of line C style comments</comments>
   <begin>^\s*//</begin>
   <end>$</end>
  </range_pattern>
  
  <range_pattern options="comments" style="Comment" parent="" name="Comment1" >
   <comments>middle of line C style comments</comments>
   <begin>//</begin>
   <end>$</end>
  </range_pattern>
  
  <range_pattern options="span no_indent comments" style="Comment" parent="" name="Comment2" >
   <comments>begin of line C++ style comments</comments>
   <begin>^\s*/\*</begin>
   <end>\*/</end>
  </range_pattern>
  
  <range_pattern options="span comments" style="Comment" parent="" name="Comment2" >
   <comments>middle of line C++ style comments</comments>
   <begin>/\*</begin>
   <end>\*/</end>
  </range_pattern>
  
  <range_pattern options="no_indent " style="Scope" parent="" name="Scope" >
   <comments></comments>
   <begin>\b(public|private|protected|signals|slots|Q_SIGNALS|Q_SLOTS)\b</begin>
   <end>(:\s*$)|([^,\s*].$)</end>
  </range_pattern>
  
  <range_pattern style="Keyword" parent="" name="Class Name" >
   <comments>class name</comments>
   <begin>\bclass\b</begin>
   <end>(.(?=(;|\{|:))|$)</end>
  </range_pattern>
  
  <range_pattern style="Keyword" parent="" name="Namespace" >
   <comments>namespace</comments>
   <begin>\b(using\s+)?namespace\b</begin>
   <end>(.(?=(;|\{))|$)</end>
  </range_pattern>
  
  <range_pattern style="Keyword" parent="" name="Typedef" >
   <comments>typedef (c++11)</comments>
   <begin>\b(using\s+)\b</begin>
   <end>(.(?=(;|\{))|$)</end>
  </range_pattern>
  
  <keyword_pattern style="Keyword" parent="" name="Keyword" >
   <comments>keywords</comments>
   <keyword>\b(break|case|catch|continue|default|delete|do|(dynamic|static|const|reinterpret)_cast|else|emit|fabs|false|for(each|ever)?|goto|if|new|return|sizeof|switch|this|throw|true|try|while)\b</keyword>
  </keyword_pattern>
  
  <keyword_pattern style="Keyword" parent="" name="Root Keyword" >
   <comments>root keywords</comments>
   <keyword>\b(kTRUE|kFALSE)\b</keyword>
  </keyword_pattern>
  
  <keyword_pattern style="Storage Type" parent="" name="Root Storage Type" >
   <comments>storage type</comments>
   <keyword>\b(Bool_t|(U?Short_t)|(U?Int_t)|Double_t|Float_t|(U?Long(64)?_t)|Char_t|TString|(T(H|F)\d(F|I)?)|TString|(TGraph(Errors)?))\b</keyword>
  </keyword_pattern>
  
  <keyword_pattern style="Storage Type" parent="" name="Stl Storage Type" >
   <comments>storage type (STL)</comments>
  <keyword>\bstd::((string(::npos)?)|set|map|pair|(initializer_)?list|((i|i?o)(f|string)?stream)|vector|\w*iterator|\w*inserter)\b</keyword>
  </keyword_pattern>

  <keyword_pattern style="Keyword" parent="" name="Stl Keyword" >
   <comments>keywords</comments>
   <keyword>\bstd::(\w+)\b</keyword>
  </keyword_pattern>
  
  <keyword_pattern style="Keyword" parent="" name="Braces" >
   <comments>parenthesis</comments>
   <keyword>((\{|\[|\]|\})*(\{|\[|\]|\})(\{|\[|\]|\})*)</keyword>
  </keyword_pattern>

  <keyword_pattern style="Storage Type" parent="" name="Storage Type" >
   <comments>storage type</comments>
   <keyword>\b(nullptr|auto|(u?char)|wchar_t|bool|double|enum|float|(u?int)|(u?long)|operator|register|(u?short)|((un)?signed)|struct|union|void)\b</keyword>
  </keyword_pattern>
  
  <keyword_pattern style="Storage Type" parent="" name="Storage Attributes" >
   <comments>storage type</comments>
   <keyword>\b(explicit|export|extern|const|friend|inline|mutable|static|template|typedef|typeid|typename|virtual|volatile|final|override|constexpr)\b</keyword>
  </keyword_pattern>
  
  <keyword_pattern style="Storage Type" parent="" name="t Storage Type" >
   <comments>storage type (STL)</comments>
   <keyword>(\b(u)?(int)(8|16|32|64)_t\b)</keyword>
  </keyword_pattern>
  
  <keyword_pattern style="Keyword" parent="" name="Math" >
   <comments>storage type (STL)</comments>
   <keyword>(\b(std::)((a?(cos|sin|tan))|log|exp|sqrt|pow|(f?abs)|min|max)\b)</keyword>
  </keyword_pattern>
  
  <keyword_pattern style="Numeric Constants" parent="" name="Numeric Constants" >
   <comments>numeric constants</comments>
   <keyword>\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f)?\b</keyword>
  </keyword_pattern>
  
  <range_pattern style="String" parent="" name="String" >
   <comments>strings</comments>
   <begin>&quot;</begin>
   <end>([^\\]&quot;|$)</end>
  </range_pattern>
  
  <keyword_pattern style="String2" parent="" name="String single character" >
   <comments>single character strings</comments>
   <keyword>'(.|\\(.|\n))'</keyword>
  </keyword_pattern>
  
  <keyword_pattern style="String2" parent="String" name="String Escape Character" >
   <comments>single escape characters</comments>
   <keyword>\\(.|\n)</keyword>
  </keyword_pattern>

<!--Indentation patterns-->
  <indent_pattern type="0" name="0" >
   <rule par="0" >
    <regexp>^\s*\}</regexp>
   </rule>
   <rule par="-1" >
    <regexp>(\{\s*)($|//)</regexp>
   </rule>
   <comments>keep unchanged when opening curly bracket at end of previous line but if this line starts with a closing bracket</comments>
  </indent_pattern>

  <indent_pattern type="1" name="1" >
   <rule par="-1" >
    <regexp>(\{\s*)($|//)</regexp>
   </rule>
   <comments>increment pattern when opening curly bracket at end of previous line and if	this line is not a closing bracket</comments>
  </indent_pattern>
  
  <indent_pattern scale="2" type="2" name="2" >
   <rule par="-1" >
    <regexp>(;\s*($|//))</regexp>
   </rule>
   <rule par="-2" >
    <regexp>[^;|\{|\}|(^\s*default\s*:)|(^\s*case)\s*]\s*($|//)</regexp>
   </rule>
   <rule par="0" >
    <regexp>^\s*\}</regexp>
   </rule>
   <comments>decrement pattern twice when closing curly bracket at beginning of current line, previous line is terminated, but the one before is not and is not openning/closing bracket</comments>
  </indent_pattern>
  
  <indent_pattern type="2" name="3" >
   <rule par="0" >
    <regexp>^\s*\}</regexp>
   </rule>
   <comments>decrement pattern when closing curly bracket at beginning of current line</comments>
  </indent_pattern>
  
  <indent_pattern type="2" name="4" >
   <rule par="0" >
    <regexp>^\s*\{</regexp>
   </rule>
   <rule par="-1" >
    <regexp>[^;\s*]\s*($|//)</regexp>
   </rule>
   <rule par="-2" >
    <regexp>[^;|\}|\{|:\s*]\s*($|//)</regexp>
   </rule>
   <comments>decrement when previous line is not terminated,
the one before is not terminated either,
and this one is an opening bracket</comments>
  </indent_pattern>

  <indent_pattern type="0" name="5" >
   <rule par="0" >
    <regexp>^\s*\{</regexp>
   </rule>
   <rule par="-1" >
    <regexp>[^;\s*]\s*($|//)</regexp>
   </rule>
   <rule par="-2" >
    <regexp>(;|\{|\})\s*($|//)</regexp>
   </rule>
   <comments>keep unchanged when previous line is not terminated but this one is an opening bracket</comments>
  </indent_pattern>

  <indent_pattern type="0" name="6" >
   <rule par="-1" >
    <regexp>((\}|(\}\s*;))\s*($|//))</regexp>
   </rule>
   <comments>keep unchanged when previous line is not terminated but is a closing bracket</comments>
  </indent_pattern>
  
  <indent_pattern type="0" name="6.1" >
   <rule par="-1" >
    <regexp>(;\s*//)</regexp>
   </rule>
   <comments>keep unchanged if previous line is terminated + comment but above is
 	- terminated
	- a bracket</comments>
  </indent_pattern>

  <indent_pattern type="0" name="6.2" >
   <rule par="-1" >
    <regexp>^\s*(case|(default\s*:))</regexp>
   </rule>
   <comments>keep unchanged if  previous line is not terminated but start with case</comments>
  </indent_pattern>

  <indent_pattern type="0" name="6.3" >
   <rule par="-1" >
    <regexp>([^;\s*]\s*$)</regexp>
   </rule>
   <rule par="-2" >
    <regexp>^\s*(enum)</regexp>
   </rule>
   <comments>keep unchanged if  previous line is not terminated but start with enum</comments>
  </indent_pattern>


  <indent_pattern type="0" name="6.4" >
   <rule par="-1" >
    <regexp>([^;\s*]\s*$)</regexp>
   </rule>
   <rule par="-2" >
    <regexp>(\{\s*($|//))</regexp>
   </rule>
   <rule par="-3" >
    <regexp>(=\s*($|//))</regexp>
   </rule>   
  <comments>keep unchanged if previous line is not terminated but above is
 	- terminated
	- a bracket
  and the one before ends with '='</comments>
  </indent_pattern>

  <indent_pattern type="1" name="7" >
   <rule par="-1" >
    <regexp>([^;\s*]\s*$)</regexp>
   </rule>
   <rule par="-2" >
    <regexp>((;|\{|\})\s*($|//))</regexp>
   </rule>
   <comments>increment if previous line is not terminated but above is
 	- terminated
	- a bracket</comments>
  </indent_pattern>

  <indent_pattern type="0" name="8" >
   <rule par="-1" >
    <regexp>(;\s*($|//))</regexp>
   </rule>
   <rule par="-2" >
    <regexp>((\{|\})\s*($|//))|(;\s*($|//))</regexp>
   </rule>
   <comments>keep unchanged if previous line is terminated and previous is
 	- terminated
	- a bracket</comments>
  </indent_pattern>
  <indent_pattern type="0" name="8.1" >
   <rule par="-1" >
    <regexp>(;\s*($|//))</regexp>
   </rule>
   <rule par="-2" >
    <regexp>^\s*(case|(default\s*:))</regexp>
   </rule>
   <comments>keep unchanged if previous line terminated and previous one start with case</comments>
  </indent_pattern>
  <indent_pattern type="2" name="9" >
   <rule par="-1" >
    <regexp>(;\s*($|//))</regexp>
   </rule>
   <rule par="-2" >
    <regexp>[^;\s*]\s*($|//)</regexp>
   </rule>
   <comments>decrement when previous line is terminated but above was not</comments>
  </indent_pattern>

<!--Parenthesis-->
  <parenthesis begin="(" end=")" regexp="\(|\)" />
  <parenthesis begin="[" end="]" regexp="\[|\]" />
  <parenthesis begin="{" end="}" regexp="\{|\}" />
  <parenthesis begin="/*" end="*/" regexp="(/\*)|(\*/)" />

<!--Block delimiters-->
  <block_delimiter begin="{" end="}" regexp="\{|\}" />
  <block_delimiter begin="/*" end="*/" regexp="(^\s*/\*)|(\s+/\*)|(\*/)" />

<!--Text macros-->
  <macro accelerator="Alt+T" name="Add One Tab Indentation" >
   <rule>
    <regexp>^</regexp>
    <replacement>XML_TAB</replacement>
   </rule>
  </macro>
  <macro accelerator="Shift+Alt+T" name="Remove One Tab Indentation" >
   <rule>
    <regexp>^\t</regexp>
    <replacement></replacement>
   </rule>
  </macro>
  <macro accelerator="Shift+Ctrl+I" name="Remove All Tab Indentations" >
   <rule>
    <regexp>^\s+</regexp>
    <replacement></replacement>
   </rule>
  </macro>
  <macro name="Clean End Of Line" options="automatic" >
   <rule>
    <regexp>\s+$</regexp>
    <replacement></replacement>
   </rule>
  </macro>
  <macro options="separator" name="generic" />
  <macro accelerator="Alt+C" name="Add C++ Comments" >
   <rule>
    <regexp>^</regexp>
    <replacement>// </replacement>
   </rule>
  </macro>
  <macro accelerator="Shift+Alt+C" name="Remove C++ Comments" >
   <rule>
    <regexp>^//(\s|$)</regexp>
    <replacement></replacement>
   </rule>
  </macro>
  <macro options="separator" name="generic" />
  <macro name="Add C Line Comments" >
   <rule>
    <regexp>^</regexp>
    <replacement>/*</replacement>
   </rule>
   <rule>
    <regexp>$</regexp>
    <replacement>*/</replacement>
   </rule>
  </macro>
  <macro name="Remove C Line Comments" >
   <rule>
    <regexp>^\s*/\*</regexp>
    <replacement></replacement>
   </rule>
   <rule>
    <regexp>\*/\s*$</regexp>
    <replacement></replacement>
   </rule>
  </macro>
  <macro name="Add C Bar Comments" >
   <rule>
    <regexp>^</regexp>
    <replacement>XML_TAB</replacement>
   </rule>
   <rule options="no_split" >
    <regexp>^</regexp>
    <replacement>/*XML_ENDL</replacement>
   </rule>
   <rule options="no_split" >
    <regexp>$</regexp>
    <replacement>XML_ENDL*/</replacement>
   </rule>
  </macro>
  <macro name="Remove C Bar Comments" >
   <rule options="no_split" >
    <regexp>^/\*\n?</regexp>
    <replacement></replacement>
   </rule>
   <rule options="no_split" >
    <regexp>\n?\*/$</regexp>
    <replacement></replacement>
   </rule>
   <rule>
    <regexp>^\t</regexp>
    <replacement></replacement>
   </rule>
  </macro>
 </class>
</patterns>
