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 320 of file docnode.cpp.

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