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 472 of file docnode.h.

Member Enumeration Documentation

◆ Type

Enumerator
Line 
SkipLine 
Skip 
Until 

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

bool m_stripCodeComments
Definition docnode.h:517
bool stripCodeComments() const
Definition docnode.h:502
QCString m_exampleFile
Definition docnode.h:519
QCString m_context
Definition docnode.h:514
QCString context() const
Definition docnode.h:497
QCString exampleFile() const
Definition docnode.h:504
bool m_isExample
Definition docnode.h:518
QCString m_pattern
Definition docnode.h:513
bool isExample() const
Definition docnode.h:503
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 500 of file docnode.h.

500{ m_isFirst = v; }

References m_isFirst, and TRUE.

◆ markLast()

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

Definition at line 501 of file docnode.h.

501{ m_isLast = v; }

References m_isLast, and TRUE.

Referenced by DocPara::handleIncludeOperator().

◆ parse()

void DocIncOperator::parse ( )

Definition at line 319 of file docnode.cpp.

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

◆ pattern()

QCString DocIncOperator::pattern ( ) const
inline

Definition at line 496 of file docnode.h.

496{ 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 482 of file docnode.h.

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

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

Referenced by parse().

Member Data Documentation

◆ m_context

QCString DocIncOperator::m_context
private

Definition at line 514 of file docnode.h.

Referenced by context(), and DocIncOperator().

◆ m_exampleFile

QCString DocIncOperator::m_exampleFile
private

Definition at line 519 of file docnode.h.

Referenced by DocIncOperator(), and exampleFile().

◆ m_includeFileName

QCString DocIncOperator::m_includeFileName
private

Definition at line 520 of file docnode.h.

Referenced by includeFileName(), and parse().

◆ m_isExample

bool DocIncOperator::m_isExample = false
private

Definition at line 518 of file docnode.h.

Referenced by DocIncOperator(), and isExample().

◆ m_isFirst

bool DocIncOperator::m_isFirst = false
private

Definition at line 515 of file docnode.h.

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

◆ m_isLast

bool DocIncOperator::m_isLast = false
private

Definition at line 516 of file docnode.h.

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

◆ m_line

int DocIncOperator::m_line = 0
private

Definition at line 510 of file docnode.h.

Referenced by line(), and parse().

◆ m_pattern

QCString DocIncOperator::m_pattern
private

Definition at line 513 of file docnode.h.

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

◆ m_showLineNo

bool DocIncOperator::m_showLineNo = false
private

Definition at line 511 of file docnode.h.

Referenced by parse(), and showLineNo().

◆ m_stripCodeComments

bool DocIncOperator::m_stripCodeComments = true
private

Definition at line 517 of file docnode.h.

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

◆ m_text

QCString DocIncOperator::m_text
private

Definition at line 512 of file docnode.h.

Referenced by parse(), and text().

◆ m_type

Type DocIncOperator::m_type = Line
private

Definition at line 509 of file docnode.h.

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


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