Doxygen XLinks
by
V: 2511R0
Website: doxygen
Loading...
Searching...
No Matches
exclamations.cpp
1//==================================================================================================
2// This implementation-file is part of DoxygenXLinks - A doxygen post-processor that allows to
3// define smarter <b>Doxygen</b>-links.
4//
5// \emoji :copyright: 2025-2026 A-Worx GmbH, Germany.
6// Published under \ref mainpage_license "Boost Software License".
7//==================================================================================================
8
9#include "exclamations.hpp"
10#include "dxlapp.hpp"
12
13using namespace alib;
14using namespace std;
15
16namespace dxl {
17
18void ExclamationFile::Read(const alib::CString& filePath) {
19 Lox_SetDomain( "DLAPP/EXCL" , Scope::Filename )
20
22 TextFileLineReader reader(filePath);
23 if ( reader.Status != std::errc(0) ) {
24 // todo: lox error
25 return;
26 }
27
28 // loop over all lines
29 Substring line;
30 int lineNo= 0;
31 while ( (line= reader.NextLine()).IsNotNull() ) {
32 ++lineNo;
33 // skip comment line
34 line.Trim();
35 if ( line.IsEmpty()
36 || line.CharAtStart() == '#'
37 || line.CharAtStart() == '!'
38 || line.StartsWith("//") )
39 continue;
40
41 // parse filename
42 String file= Substring(line.ConsumeToken(':')).Trim();
43 line.Trim();
44 if (file.IsEmpty() ) {
45 Lox_Error("Error in exclamation file: Expected file name @ {}:{}:{} ",
46 filePath, lineNo+1, reader.Line.Length() - line.Length() )
47 continue;
48 }
49
50 int exclLine;
51 int exclCol;
52 if (!line.ConsumeDec(exclLine) ) {
53 Lox_Error("Error in exclamation file: Expected line number @ {}:{}:{} ",
54 filePath, lineNo+1, reader.Line.Length() - line.Length() )
55 continue;
56 }
57 line.Trim();
58 line.ConsumeChar(':');
59
60 if (!line.ConsumeDec(exclCol) ) {
61 Lox_Error("Error in exclamation file: Expected column number @ {}:{}:{} ",
62 filePath, reader.Line.Length() - line.Length(), lineNo+1 )
63 continue;
64 }
65
66 List.emplace_back( Entry{file, exclLine, exclCol, lineNo} );
67 }
68
69 Lox_Info( "Exclamation file {}:1 imported, {} rules read", filePath, List.size() )
70}
71
72void ExclamationFile::Get(const PathString& filePath, StdVectorMA<Entry*>& result) {
73 for ( Entry& entry : List ) {
74 if ( filePath.IndexOf(entry.FilePath) >= 0 )
75 result.push_back(&entry);
76} }
77
78} //namespace [dxl]
#define ALIB_LOCK_RECURSIVE_WITH(lock)
#define Lox_Info(...)
#define Lox_Error(...)
#define Lox_SetDomain(...)
constexpr integer Length() const
constexpr bool IsEmpty() const
TChar CharAtStart() const
integer IndexOf(const TString &needle, integer startIdx=0, integer endIdx=strings::MAX_LEN) const
bool StartsWith(const TString &needle) const
bool ConsumeDec(std::integral auto &result, TNumberFormat< TChar > *numberFormat=nullptr)
TSubstring & Trim(const TCString< TChar > &whiteSpaces=CStringConstantsTraits< TChar >::DefaultWhitespaces())
TString< TChar > ConsumeToken(TChar separator=',', lang::Inclusion includeSeparator=lang::Inclusion::Include)
An entry of the exclamation file.
RecursiveLock GLOBAL_ALLOCATOR_LOCK
system::TextFileLineReader< TLocalBufferSize > TextFileLineReader
strings::TCString< character > CString
strings::TString< character > String
strings::TSubstring< character > Substring
strings::TString< PathCharType > PathString
std::vector< T, StdMA< T > > StdVectorMA
todox
Definition doxyfile.cpp:20
NLocalString< TLocalBufferSize > Line
void Get(const alib::PathString &filePath, alib::StdVectorMA< Entry * > &result)
void Read(const alib::CString &filePath)
alib::ListMA< Entry > List
A simple linear list of entries.