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"
11#include "ALib.Files.TextFile.H"
12
13
14using namespace alib;
15using namespace std;
16
17namespace dxl {
18
19void ExclamationFile::Read(const alib::CString& filePath) {
20 Lox_SetDomain( "DLAPP/EXCL" , Scope::Filename )
21
23 TextFileLineReader reader(filePath);
24 if ( reader.Status != std::errc(0) ) {
25 // todo: lox error
26 return;
27 }
28
29 // loop over all lines
30 Substring line;
31 int lineNo= 0;
32 while ( (line= reader.NextLine()).IsNotNull() ) {
33 ++lineNo;
34 // skip comment line
35 line.Trim();
36 if ( line.IsEmpty()
37 || line.CharAtStart() == '#'
38 || line.CharAtStart() == '!'
39 || line.StartsWith("//") )
40 continue;
41
42 // parse filename
43 String file= Substring(line.ConsumeToken(':')).Trim();
44 line.Trim();
45 if (file.IsEmpty() ) {
46 Lox_Error("Error in exclamation file: Expected file name @ {}:{}:{} ",
47 filePath, lineNo+1, reader.Line.Length() - line.Length() )
48 continue;
49 }
50
51 int exclLine;
52 int exclCol;
53 if (!line.ConsumeDec(exclLine) ) {
54 Lox_Error("Error in exclamation file: Expected line number @ {}:{}:{} ",
55 filePath, lineNo+1, reader.Line.Length() - line.Length() )
56 continue;
57 }
58 line.Trim();
59 line.ConsumeChar(':');
60
61 if (!line.ConsumeDec(exclCol) ) {
62 Lox_Error("Error in exclamation file: Expected column number @ {}:{}:{} ",
63 filePath, reader.Line.Length() - line.Length(), lineNo+1 )
64 continue;
65 }
66
67 List.emplace_back( Entry{file, exclLine, exclCol, lineNo} );
68 }
69
70 Lox_Info( "Exclamation file {}:1 imported, {} rules read", filePath, List.size() )
71}
72
74 for ( Entry& entry : List ) {
75 if ( filePath.IndexOf(entry.FilePath) >= 0 )
76 result.push_back(&entry);
77 }
78}
79
80} //namespace [dxl]
81
#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
strings::TString< PathCharType > PathString
strings::TCString< character > CString
files::TextFileLineReader< TLocalBufferSize > TextFileLineReader
strings::TString< character > String
strings::TSubstring< character > Substring
std::vector< T, StdMA< T > > StdVectorMA
todox
Definition doxyfile.cpp:20
NLocalString< TLocalBufferSize > Line
void Read(const alib::CString &filePath)
void Get(const alib::system::PathString &filePath, alib::StdVectorMA< Entry * > &result)
alib::ListMA< Entry > List
A simple linear list of entries.