Skip to main content

The DocIncOperator Class Reference

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

Declaration

class DocIncOperator { ... }

Included Headers

#include <src/docnode.h>

Base class

classDocNode

Abstract node interface with type information. More...

Enumerations Index

enumType { ... }

Public Constructors Index

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

Public Member Functions Index

Typetype () const
const char *typeAsString () const
intline () const
boolshowLineNo () const
QCStringtext () const
QCStringpattern () const
QCStringcontext () const
boolisFirst () const
boolisLast () const
voidmarkFirst (bool v=TRUE)
voidmarkLast (bool v=TRUE)
boolstripCodeComments () const
boolisExample () const
QCStringexampleFile () const
QCStringincludeFileName () const
voidparse ()

Private Member Attributes Index

Typem_type = Line
intm_line = 0
boolm_showLineNo = false
QCStringm_text
QCStringm_pattern
QCStringm_context
boolm_isFirst = false
boolm_isLast = false
boolm_stripCodeComments = true
boolm_isExample = false
QCStringm_exampleFile
QCStringm_includeFileName

Description

Node representing a include/dontinclude operator block.

Definition at line 476 of file docnode.h.

Enumerations

Type

enum DocIncOperator::Type
Enumeration values
Line
SkipLine
Skip
Until

Definition at line 479 of file docnode.h.

Public Constructors

DocIncOperator()

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

Public Member Functions

context()

exampleFile()

includeFileName()

isExample()

bool DocIncOperator::isExample ()
inline

isFirst()

bool DocIncOperator::isFirst ()
inline

isLast()

bool DocIncOperator::isLast ()
inline

line()

int DocIncOperator::line ()
inline

markFirst()

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

Definition at line 504 of file docnode.h.

504 void markFirst(bool v=TRUE) { 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 void markLast(bool v=TRUE) { m_isLast = v; }

References m_isLast and TRUE.

Referenced by DocPara::handleIncludeOperator.

parse()

void DocIncOperator::parse ()

Declaration at line 510 of file docnode.h, 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;
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}

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 ()
inline

Definition at line 500 of file docnode.h.

500 QCString pattern() const { return m_pattern; }

Reference m_pattern.

Referenced by PrintDocVisitor::operator().

showLineNo()

bool DocIncOperator::showLineNo ()
inline

stripCodeComments()

text()

QCString DocIncOperator::text ()
inline

type()

typeAsString()

const char * DocIncOperator::typeAsString ()
inline

Definition at line 486 of file docnode.h.

486 const char *typeAsString() const
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.

Private Member Attributes

m_context

QCString DocIncOperator::m_context

Definition at line 518 of file docnode.h.

Referenced by context and DocIncOperator.

m_exampleFile

QCString DocIncOperator::m_exampleFile

Definition at line 523 of file docnode.h.

Referenced by DocIncOperator and exampleFile.

m_includeFileName

QCString DocIncOperator::m_includeFileName

Definition at line 524 of file docnode.h.

Referenced by includeFileName and parse.

m_isExample

bool DocIncOperator::m_isExample = false

Definition at line 522 of file docnode.h.

522 bool m_isExample = false;

Referenced by DocIncOperator and isExample.

m_isFirst

bool DocIncOperator::m_isFirst = false

Definition at line 519 of file docnode.h.

519 bool m_isFirst = false;

Referenced by DocIncOperator, isFirst and markFirst.

m_isLast

bool DocIncOperator::m_isLast = false

Definition at line 520 of file docnode.h.

520 bool m_isLast = false;

Referenced by DocIncOperator, isLast and markLast.

m_line

int DocIncOperator::m_line = 0

Definition at line 514 of file docnode.h.

514 int m_line = 0;

Referenced by line and parse.

m_pattern

QCString DocIncOperator::m_pattern

Definition at line 517 of file docnode.h.

Referenced by DocIncOperator, parse and pattern.

m_showLineNo

bool DocIncOperator::m_showLineNo = false

Definition at line 515 of file docnode.h.

515 bool m_showLineNo = false;

Referenced by parse and showLineNo.

m_stripCodeComments

bool DocIncOperator::m_stripCodeComments = true

Definition at line 521 of file docnode.h.

Referenced by DocIncOperator, parse and stripCodeComments.

m_text

QCString DocIncOperator::m_text

Definition at line 516 of file docnode.h.

Referenced by parse and text.

m_type

Type DocIncOperator::m_type = Line

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:


Generated via doxygen2docusaurus by Doxygen 1.14.0.