Doxygen
Loading...
Searching...
No Matches
DocIncOperator Class Reference

Node representing a include/dontinclude operator block. More...

#include <src/docnode.h>

+ Inheritance diagram for DocIncOperator:
+ Collaboration diagram for DocIncOperator:

Public Types

enum  Type { Line , SkipLine , Skip , Until }
 

Public Member Functions

 DocIncOperator (DocParser *parser, DocNodeVariant *parent, Type t, const QCString &pat, const QCString &context, bool stripCodeComments, bool isExample, const QCString &exampleFile)
 
Type type () const
 
const char * typeAsString () const
 
int line () const
 
bool showLineNo () const
 
QCString text () const
 
QCString pattern () const
 
QCString context () const
 
bool isFirst () const
 
bool isLast () const
 
void markFirst (bool v=TRUE)
 
void markLast (bool v=TRUE)
 
bool stripCodeComments () const
 
bool isExample () const
 
QCString exampleFile () const
 
QCString includeFileName () const
 
void parse ()
 
- Public Member Functions inherited from DocNode
 DocNode (DocParser *parser, DocNodeVariant *parent)
 
 ~DocNode ()=default
 
DocNodeVariantparent ()
 
const DocNodeVariantparent () const
 
DocNodeVariantthisVariant ()
 
const DocNodeVariantthisVariant () const
 
void setThisVariant (DocNodeVariant *thisVariant)
 
DocParserparser ()
 
const DocParserparser () const
 
void setParent (DocNodeVariant *parent)
 
bool isPreformatted () const
 

Private Attributes

Type m_type = Line
 
int m_line = 0
 
bool m_showLineNo = false
 
QCString m_text
 
QCString m_pattern
 
QCString m_context
 
bool m_isFirst = false
 
bool m_isLast = false
 
bool m_stripCodeComments = true
 
bool m_isExample = false
 
QCString m_exampleFile
 
QCString m_includeFileName
 

Additional Inherited Members

- Protected Types inherited from DocNode
enum  RefType { Unknown , Anchor , Section , Table }
 
- Protected Member Functions inherited from DocNode
void setInsidePreformatted (bool p)
 

Detailed Description

Node representing a include/dontinclude operator block.

Definition at line 471 of file docnode.h.

Member Enumeration Documentation

◆ Type

Enumerator
Line 
SkipLine 
Skip 
Until 

Definition at line 474 of file docnode.h.

Constructor & Destructor Documentation

◆ DocIncOperator()

DocIncOperator::DocIncOperator ( DocParser * parser,
DocNodeVariant * parent,
Type t,
const QCString & pat,
const QCString & context,
bool stripCodeComments,
bool isExample,
const QCString & exampleFile )
inline

Definition at line 475 of file docnode.h.

bool m_stripCodeComments
Definition docnode.h:516
bool stripCodeComments() const
Definition docnode.h:501
QCString m_exampleFile
Definition docnode.h:518
QCString m_context
Definition docnode.h:513
QCString context() const
Definition docnode.h:496
QCString exampleFile() const
Definition docnode.h:503
bool m_isExample
Definition docnode.h:517
QCString m_pattern
Definition docnode.h:512
bool isExample() const
Definition docnode.h:502
DocNode(DocParser *parser, DocNodeVariant *parent)
Definition docnode.h:84
DocParser * parser()
Definition docnode.h:97
DocNodeVariant * parent()
Definition docnode.h:89
#define FALSE
Definition qcstring.h:34

References context(), DocNode::DocNode(), exampleFile(), FALSE, isExample(), m_context, m_exampleFile, m_isExample, m_isFirst, m_isLast, m_pattern, m_stripCodeComments, m_type, DocNode::parent(), DocNode::parser(), and stripCodeComments().

Member Function Documentation

◆ context()

◆ exampleFile()

◆ includeFileName()

◆ isExample()

◆ isFirst()

bool DocIncOperator::isFirst ( ) const
inline

◆ isLast()

bool DocIncOperator::isLast ( ) const
inline

◆ line()

int DocIncOperator::line ( ) const
inline

◆ markFirst()

void DocIncOperator::markFirst ( bool v = TRUE)
inline

Definition at line 499 of file docnode.h.

499{ m_isFirst = v; }

References m_isFirst, and TRUE.

◆ markLast()

void DocIncOperator::markLast ( bool v = TRUE)
inline

Definition at line 500 of file docnode.h.

500{ m_isLast = v; }

References m_isLast, and TRUE.

Referenced by DocPara::handleIncludeOperator().

◆ parse()

void DocIncOperator::parse ( )

Definition at line 318 of file docnode.cpp.

319{
320 if (parser()->context.includeFileName.isEmpty())
321 {
322 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),
323 "No previous '\\include' or '\\dontinclude' command for '\\%s' present",
324 typeAsString());
325 }
326 bool found = false;
327
329 const char *p = parser()->context.includeFileText.data();
330 size_t l = parser()->context.includeFileLength;
331 size_t o = parser()->context.includeFileOffset;
332 int il = parser()->context.includeFileLine;
333 AUTO_TRACE("text={} off={} len={}",Trace::trunc(p),o,l);
334 size_t so = o, bo = 0;
335 bool nonEmpty = FALSE;
336 switch(type())
337 {
338 case Line:
339 while (o<l)
340 {
341 char c = p[o];
342 if (c=='\n')
343 {
345 if (nonEmpty) break; // we have a pattern to match
346 so=o+1; // no pattern, skip empty line
347 }
348 else if (!isspace(static_cast<uint8_t>(c))) // no white space char
349 {
350 nonEmpty=TRUE;
351 }
352 o++;
353 }
354 if (parser()->context.includeFileText.mid(so,o-so).find(m_pattern)!=-1)
355 {
356 m_line = il;
358 found = true;
359 AUTO_TRACE_ADD("\\line {}",Trace::trunc(m_text));
360 }
361 parser()->context.includeFileOffset = std::min(l,o+1); // set pointer to start of new line
364 break;
365 case SkipLine:
366 while (o<l)
367 {
368 so=o;
369 while (o<l)
370 {
371 char c = p[o];
372 if (c=='\n')
373 {
375 if (nonEmpty) break; // we have a pattern to match
376 so=o+1; // no pattern, skip empty line
377 }
378 else if (!isspace(static_cast<uint8_t>(c))) // no white space char
379 {
380 nonEmpty=TRUE;
381 }
382 o++;
383 }
384 if (parser()->context.includeFileText.mid(so,o-so).find(m_pattern)!=-1)
385 {
386 m_line = il;
388 found = true;
389 AUTO_TRACE_ADD("\\skipline {}",Trace::trunc(m_text));
390 break;
391 }
392 o++; // skip new line
393 }
394 parser()->context.includeFileOffset = std::min(l,o+1); // set pointer to start of new line
397 break;
398 case Skip:
399 while (o<l)
400 {
401 so=o;
402 while (o<l)
403 {
404 char c = p[o];
405 if (c=='\n')
406 {
408 if (nonEmpty) break; // we have a pattern to match
409 so=o+1; // no pattern, skip empty line
410 }
411 else if (!isspace(static_cast<uint8_t>(c))) // no white space char
412 {
413 nonEmpty=TRUE;
414 }
415 o++;
416 }
417 if (parser()->context.includeFileText.mid(so,o-so).find(m_pattern)!=-1)
418 {
419 found = true;
420 break;
421 }
422 o++; // skip new line
423 }
424 parser()->context.includeFileOffset = so; // set pointer to start of new line
427 break;
428 case Until:
429 bo=o;
430 while (o<l)
431 {
432 so=o;
433 while (o<l)
434 {
435 char c = p[o];
436 if (c=='\n')
437 {
439 if (nonEmpty) break; // we have a pattern to match
440 so=o+1; // no pattern, skip empty line
441 }
442 else if (!isspace(static_cast<uint8_t>(c))) // no white space char
443 {
444 nonEmpty=TRUE;
445 }
446 o++;
447 }
448 if (parser()->context.includeFileText.mid(so,o-so).find(m_pattern)!=-1)
449 {
450 m_line = il;
452 found = true;
453 AUTO_TRACE_ADD("\\until {}",Trace::trunc(m_text));
454 break;
455 }
456 o++; // skip new line
457 }
458 parser()->context.includeFileOffset = std::min(l,o+1); // set pointer to start of new line
461 break;
462 }
463 if (!found)
464 {
465 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),
466 "referenced pattern '%s' for command '\\%s' not found",qPrint(m_pattern),typeAsString());
467 }
468}
const char * typeAsString() const
Definition docnode.h:481
Type type() const
Definition docnode.h:480
QCString m_text
Definition docnode.h:511
bool m_showLineNo
Definition docnode.h:510
DocParserContext context
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
Definition qcstring.h:226
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Definition qcstring.h:159
#define AUTO_TRACE_ADD(...)
Definition docnode.cpp:47
#define AUTO_TRACE(...)
Definition docnode.cpp:46
#define warn_doc_error(file, line, fmt,...)
Definition message.h:74
QCString trunc(const QCString &s, size_t numChars=15)
Definition trace.h:56
const char * qPrint(const char *s)
Definition qcstring.h:672
#define TRUE
Definition qcstring.h:37
bool includeFileShowLineNo
Definition docparser_p.h:89
size_t includeFileLength
Definition docparser_p.h:87
QCString includeFileText
Definition docparser_p.h:85
QCString includeFileName
Definition docparser_p.h:84
size_t includeFileOffset
Definition docparser_p.h:86
bool found
Definition util.cpp:984

References AUTO_TRACE, AUTO_TRACE_ADD, context(), DocParser::context, QCString::data(), FALSE, found, DocParserContext::includeFileLength, DocParserContext::includeFileLine, DocParserContext::includeFileName, DocParserContext::includeFileOffset, DocParserContext::includeFileShowLineNo, DocParserContext::includeFileText, Line, m_includeFileName, m_line, m_pattern, m_showLineNo, m_stripCodeComments, m_text, QCString::mid(), DocNode::parser(), qPrint(), Skip, SkipLine, DocParserContext::stripCodeComments, TRUE, Trace::trunc(), type(), typeAsString(), Until, and warn_doc_error.

◆ pattern()

QCString DocIncOperator::pattern ( ) const
inline

Definition at line 495 of file docnode.h.

495{ return m_pattern; }

References m_pattern.

Referenced by PrintDocVisitor::operator()().

◆ showLineNo()

bool DocIncOperator::showLineNo ( ) const
inline

◆ stripCodeComments()

◆ text()

◆ type()

◆ typeAsString()

const char * DocIncOperator::typeAsString ( ) const
inline

Definition at line 481 of file docnode.h.

482 {
483 switch(m_type)
484 {
485 case Line: return "line";
486 case SkipLine: return "skipline";
487 case Skip: return "skip";
488 case Until: return "until";
489 }
490 return "";
491 }

References Line, m_type, Skip, SkipLine, and Until.

Referenced by parse().

Member Data Documentation

◆ m_context

QCString DocIncOperator::m_context
private

Definition at line 513 of file docnode.h.

Referenced by context(), and DocIncOperator().

◆ m_exampleFile

QCString DocIncOperator::m_exampleFile
private

Definition at line 518 of file docnode.h.

Referenced by DocIncOperator(), and exampleFile().

◆ m_includeFileName

QCString DocIncOperator::m_includeFileName
private

Definition at line 519 of file docnode.h.

Referenced by includeFileName(), and parse().

◆ m_isExample

bool DocIncOperator::m_isExample = false
private

Definition at line 517 of file docnode.h.

Referenced by DocIncOperator(), and isExample().

◆ m_isFirst

bool DocIncOperator::m_isFirst = false
private

Definition at line 514 of file docnode.h.

Referenced by DocIncOperator(), isFirst(), and markFirst().

◆ m_isLast

bool DocIncOperator::m_isLast = false
private

Definition at line 515 of file docnode.h.

Referenced by DocIncOperator(), isLast(), and markLast().

◆ m_line

int DocIncOperator::m_line = 0
private

Definition at line 509 of file docnode.h.

Referenced by line(), and parse().

◆ m_pattern

QCString DocIncOperator::m_pattern
private

Definition at line 512 of file docnode.h.

Referenced by DocIncOperator(), parse(), and pattern().

◆ m_showLineNo

bool DocIncOperator::m_showLineNo = false
private

Definition at line 510 of file docnode.h.

Referenced by parse(), and showLineNo().

◆ m_stripCodeComments

bool DocIncOperator::m_stripCodeComments = true
private

Definition at line 516 of file docnode.h.

Referenced by DocIncOperator(), parse(), and stripCodeComments().

◆ m_text

QCString DocIncOperator::m_text
private

Definition at line 511 of file docnode.h.

Referenced by parse(), and text().

◆ m_type

Type DocIncOperator::m_type = Line
private

Definition at line 508 of file docnode.h.

Referenced by DocIncOperator(), type(), and typeAsString().


The documentation for this class was generated from the following files: