coan  6.0.1
A C/C++ Configuration Analyzer
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
explained_expansion.h
Go to the documentation of this file.
1 #ifndef EXPLAINED_EXPANSION_H
2 #define EXPLAINED_EXPANSION_H
3 #pragma once
4 /***************************************************************************
5  * Copyright (C) 2007-2013 Mike Kinghan, imk@burroingroingjoing.com *
6  * All rights reserved. *
7  * *
8  * Contributed originally by Mike Kinghan, imk@burroingroingjoing.com *
9  * *
10  * Redistribution and use in source and binary forms, with or without *
11  * modification, are permitted provided that the following conditions *
12  * are met: *
13  * *
14  * Redistributions of source code must retain the above copyright *
15  * notice, this list of conditions and the following disclaimer. *
16  * *
17  * Redistributions in binary form must reproduce the above copyright *
18  * notice, this list of conditions and the following disclaimer in the *
19  * documentation and/or other materials provided with the distribution. *
20  * *
21  * Neither the name of Mike Kinghan nor the names of its contributors *
22  * may be used to endorse or promote products derived from this software *
23  * without specific prior written permission. *
24  * *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
26  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
27  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS *
28  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE *
29  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, *
30  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, *
31  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS *
32  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED *
33  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,*
34  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF *
35  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
36  * DAMAGE. *
37  * *
38  **************************************************************************/
39 #include "expansion_base.h"
40 
49 {
56  reference const & ref,
57  explained_expansion * parent = nullptr)
58  : expansion_base(ref),_parent(parent){}
59 
63  unsigned expand() override;
64 
66  void throw_self() const override {
67  throw *this;
68  }
69 
70 protected:
71 
73  unsigned expand(std::string & str) override;
74 
96  unsigned bubble_edit(
97  explained_expansion const & e,
98  bool do_self = true);
99 
102 
107 
109  unsigned _step = 0;
110 
111 };
112 
113 #endif // EOF
explained_expansion * _parent
Pointer to the explained_expansion, if any, of which this one is a sub-expansion. ...
struct explained_expansion encapsulates macro-expansion of a reference when the --explain option is o...
void throw_self() const override
Throw *this.
explained_expansion(reference const &ref, explained_expansion *parent=nullptr)
Explicitly construct from a reference and optional parent.
unsigned expand() override
Perform the explained expansion of the reference, returning the numbe of edits applied.
struct expansion_base is an abstract base for classes that encapsulate a mode of macro-expansion of a...
unsigned _step
Sequential number of the explained expansion step.
void report_intermediate_value()
Report the latest value of the expansion.
unsigned bubble_edit(explained_expansion const &e, bool do_self=true)
Recursively replace remaining occurrences of a reference in the parents of this explained_expansion a...