Panini 1.4.0
Header-only library for generating C++, written in C++17
panini::Include Class Reference

Command for outputting an include statement for C++. More...

#include <Include.hpp>

Inheritance diagram for panini::Include:
panini::Command

Public Member Functions

 Include (const IncludeEntry &entry)
 
 Include (IncludeEntry &&entry) noexcept
 
 Include (const std::filesystem::path &path, IncludeStyle style=IncludeStyle::Inherit)
 
 Include (std::filesystem::path &&path, IncludeStyle style=IncludeStyle::Inherit) noexcept
 
void Visit (Writer &writer) override
 
- Public Member Functions inherited from panini::Command
virtual ~Command ()=default
 

Detailed Description

Command for outputting an include statement for C++.

Include statements can be output by hand with relative ease, but this command will help you standardize how they are written.

Includes use double quotes by default, and can use single quotes or angular brackets as well.

Note
Include statements with single quotes are not valid C++.

Example:

writer << Include("stdio.h", IncludeStyle::AngularBrackets);
writer << Include("game/systems/Audio.h") << NextLine();
writer << Include("game/systems/Particles.h") << NextLine();
writer << Include("game/Physics.h") << NextLine();
Include(const IncludeEntry &entry)
Definition: Include.hpp:72
@ AngularBrackets
Output angular brackets <>

Output:

#include <stdio.h>
#include "game/systems/Audio.h"
#include "game/systems/Particles.h"
#include "game/Physics.h"

Constructor & Destructor Documentation

◆ Include() [1/4]

panini::Include::Include ( const IncludeEntry entry)
inlineexplicit

Construct an Include command from an IncludeEntry that is copied to the instance.

◆ Include() [2/4]

panini::Include::Include ( IncludeEntry &&  entry)
inlineexplicitnoexcept

Construct an Include command from an IncludeEntry that is moved into the instance.

◆ Include() [3/4]

panini::Include::Include ( const std::filesystem::path &  path,
IncludeStyle  style = IncludeStyle::Inherit 
)
inlineexplicit

Create an Include command with a path and an IncludeStyle.

Setting the style parameter to IncludeStyle::Inherit copies the include style from the writer, otherwise it will be overridden for this command only.

◆ Include() [4/4]

panini::Include::Include ( std::filesystem::path &&  path,
IncludeStyle  style = IncludeStyle::Inherit 
)
inlineexplicitnoexcept

Create an Include command with a path and an IncludeStyle.

Setting the style parameter to IncludeStyle::Inherit copies the include style from the writer, otherwise it will be overridden for this command only.

Member Function Documentation

◆ Visit()

void panini::Include::Visit ( Writer writer)
inlineoverridevirtual

Accepts a Writer to write chunks to the output.

Implements panini::Command.


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