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 ,
  Requirement
}
Protected Member Functions inherited from DocNode
void setInsidePreformatted (bool p)

Detailed Description

Node representing a include/dontinclude operator block.

Definition at line 476 of file docnode.h.

Member Enumeration Documentation

◆ Type

Enumerator
Line 
SkipLine 
Skip 
Until 

Definition at line 479 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 480 of file docnode.h.

bool m_stripCodeComments
Definition docnode.h:521
bool stripCodeComments() const
Definition docnode.h:506
QCString m_exampleFile
Definition docnode.h:523
QCString m_context
Definition docnode.h:518
QCString context() const
Definition docnode.h:501
QCString exampleFile() const
Definition docnode.h:508
bool m_isExample
Definition docnode.h:522
QCString m_pattern
Definition docnode.h:517
bool isExample() const
Definition docnode.h:507
DocNode(DocParser *parser, DocNodeVariant *parent)
Definition docnode.h:85
DocParser * parser()
Definition docnode.h:98
DocNodeVariant * parent()
Definition docnode.h:90
#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 504 of file docnode.h.

504{ m_isFirst = v; }

References m_isFirst, and TRUE.

◆ markLast()

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

Definition at line 505 of file docnode.h.

505{ m_isLast = v; }

References m_isLast, and TRUE.

Referenced by DocPara::handleIncludeOperator().

◆ parse()

void DocIncOperator::parse ( )

Definition at line 321 of file docnode.cpp.

322{
323 if (parser()->context.includeFileName.isEmpty())
324 {
325 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),
326 "No previous '\\include' or '\\dontinclude' command for '\\{}' present",
327 typeAsString());
328 }
329 bool found = false;
330
332 const char *p = parser()->context.includeFileText.data();
333 size_t l = parser()->context.includeFileLength;
334 size_t o = parser()->context.includeFileOffset;
335 int il = parser()->context.includeFileLine;
336 AUTO_TRACE("text={} off={} len={}",Trace::trunc(p),o,l);
337 size_t so = o, bo = 0;
338 bool nonEmpty = FALSE;
339 switch(type())
340 {
341 case Line:
342 while (o<l)
343 {
344 char c = p[o];
345 if (c=='\n')
346 {
348 if (nonEmpty) break; // we have a pattern to match
349 so=o+1; // no pattern, skip empty line
350 }
351 else if (!isspace(static_cast<uint8_t>(c))) // no white space char
352 {
353 nonEmpty=TRUE;
354 }
355 o++;
356 }
357 if (parser()->context.includeFileText.mid(so,o-so).find(m_pattern)!=-1)
358 {
359 m_line = il;
361 found = true;
362 AUTO_TRACE_ADD("\\line {}",Trace::trunc(m_text));
363 }
364 parser()->context.includeFileOffset = std::min(l,o+1); // set pointer to start of new line
367 break;
368 case SkipLine:
369 while (o<l)
370 {
371 so=o;
372 while (o<l)
373 {
374 char c = p[o];
375 if (c=='\n')
376 {
378 if (nonEmpty) break; // we have a pattern to match
379 so=o+1; // no pattern, skip empty line
380 }
381 else if (!isspace(static_cast<uint8_t>(c))) // no white space char
382 {
383 nonEmpty=TRUE;
384 }
385 o++;
386 }
387 if (parser()->context.includeFileText.mid(so,o-so).find(m_pattern)!=-1)
388 {
389 m_line = il;
391 found = true;
392 AUTO_TRACE_ADD("\\skipline {}",Trace::trunc(m_text));
393 break;
394 }
395 o++; // skip new line
396 }
397 parser()->context.includeFileOffset = std::min(l,o+1); // set pointer to start of new line
400 break;
401 case Skip:
402 while (o<l)
403 {
404 so=o;
405 while (o<l)
406 {
407 char c = p[o];
408 if (c=='\n')
409 {
411 if (nonEmpty) break; // we have a pattern to match
412 so=o+1; // no pattern, skip empty line
413 }
414 else if (!isspace(static_cast<uint8_t>(c))) // no white space char
415 {
416 nonEmpty=TRUE;
417 }
418 o++;
419 }
420 if (parser()->context.includeFileText.mid(so,o-so).find(m_pattern)!=-1)
421 {
422 found = true;
423 break;
424 }
425 o++; // skip new line
426 }
427 parser()->context.includeFileOffset = so; // set pointer to start of new line
430 break;
431 case Until:
432 bo=o;
433 while (o<l)
434 {
435 so=o;
436 while (o<l)
437 {
438 char c = p[o];
439 if (c=='\n')
440 {
442 if (nonEmpty) break; // we have a pattern to match
443 so=o+1; // no pattern, skip empty line
444 }
445 else if (!isspace(static_cast<uint8_t>(c))) // no white space char
446 {
447 nonEmpty=TRUE;
448 }
449 o++;
450 }
451 if (parser()->context.includeFileText.mid(so,o-so).find(m_pattern)!=-1)
452 {
453 m_line = il;
455 found = true;
456 AUTO_TRACE_ADD("\\until {}",Trace::trunc(m_text));
457 break;
458 }
459 o++; // skip new line
460 }
461 parser()->context.includeFileOffset = std::min(l,o+1); // set pointer to start of new line
464 break;
465 }
466 if (!found)
467 {
468 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),
469 "referenced pattern '{}' for command '\\{}' not found",m_pattern,typeAsString());
470 }
471}
const char * typeAsString() const
Definition docnode.h:486
Type type() const
Definition docnode.h:485
QCString m_text
Definition docnode.h:516
bool m_showLineNo
Definition docnode.h:515
DocParserContext context
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
Definition qcstring.h:241
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:172
#define AUTO_TRACE_ADD(...)
Definition docnode.cpp:49
#define AUTO_TRACE(...)
Definition docnode.cpp:48
#define warn_doc_error(file, line, fmt,...)
Definition message.h:112
QCString trunc(const QCString &s, size_t numChars=15)
Definition trace.h:56
#define TRUE
Definition qcstring.h:37
bool includeFileShowLineNo
Definition docparser_p.h:92
size_t includeFileLength
Definition docparser_p.h:90
QCString includeFileText
Definition docparser_p.h:88
QCString includeFileName
Definition docparser_p.h:87
size_t includeFileOffset
Definition docparser_p.h:89

References AUTO_TRACE, AUTO_TRACE_ADD, context(), DocParser::context, QCString::data(), FALSE, 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(), Skip, SkipLine, DocParserContext::stripCodeComments, TRUE, Trace::trunc(), type(), typeAsString(), Until, and warn_doc_error.

◆ pattern()

QCString DocIncOperator::pattern ( ) const
inline

Definition at line 500 of file docnode.h.

500{ 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 486 of file docnode.h.

487 {
488 switch(m_type)
489 {
490 case Line: return "line";
491 case SkipLine: return "skipline";
492 case Skip: return "skip";
493 case Until: return "until";
494 }
495 return "";
496 }

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

Referenced by parse().

Member Data Documentation

◆ m_context

QCString DocIncOperator::m_context
private

Definition at line 518 of file docnode.h.

Referenced by context(), and DocIncOperator().

◆ m_exampleFile

QCString DocIncOperator::m_exampleFile
private

Definition at line 523 of file docnode.h.

Referenced by DocIncOperator(), and exampleFile().

◆ m_includeFileName

QCString DocIncOperator::m_includeFileName
private

Definition at line 524 of file docnode.h.

Referenced by includeFileName(), and parse().

◆ m_isExample

bool DocIncOperator::m_isExample = false
private

Definition at line 522 of file docnode.h.

Referenced by DocIncOperator(), and isExample().

◆ m_isFirst

bool DocIncOperator::m_isFirst = false
private

Definition at line 519 of file docnode.h.

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

◆ m_isLast

bool DocIncOperator::m_isLast = false
private

Definition at line 520 of file docnode.h.

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

◆ m_line

int DocIncOperator::m_line = 0
private

Definition at line 514 of file docnode.h.

Referenced by line(), and parse().

◆ m_pattern

QCString DocIncOperator::m_pattern
private

Definition at line 517 of file docnode.h.

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

◆ m_showLineNo

bool DocIncOperator::m_showLineNo = false
private

Definition at line 515 of file docnode.h.

Referenced by parse(), and showLineNo().

◆ m_stripCodeComments

bool DocIncOperator::m_stripCodeComments = true
private

Definition at line 521 of file docnode.h.

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

◆ m_text

QCString DocIncOperator::m_text
private

Definition at line 516 of file docnode.h.

Referenced by parse(), and text().

◆ m_type

Type DocIncOperator::m_type = Line
private

Definition at line 513 of file docnode.h.

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


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