1// RUN: rm -rf %t && mkdir -p %t/docs %t/build 2// RUN: sed 's|$test_dir|%/S|g' %S/Inputs/basic-project/database_template.json > %t/build/compile_commands.json 3// RUN: clang-doc --format=html --output=%t/docs --executor=all-TUs %t/build/compile_commands.json 4// RUN: FileCheck %s -input-file=%t/docs/index_json.js -check-prefix=JSON-INDEX 5// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/Shape.html -check-prefix=HTML-SHAPE 6// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/Calculator.html -check-prefix=HTML-CALC 7// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/Rectangle.html -check-prefix=HTML-RECTANGLE 8// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/Circle.html -check-prefix=HTML-CIRCLE 9 10// JSON-INDEX: async function LoadIndex() { 11// JSON-INDEX-NEXT: return{ 12// JSON-INDEX-NEXT: "USR": "{{([0-9A-F]{40})}}", 13// JSON-INDEX-NEXT: "Name": "", 14// JSON-INDEX-NEXT: "RefType": "default", 15// JSON-INDEX-NEXT: "Path": "", 16// JSON-INDEX-NEXT: "Children": [ 17// JSON-INDEX-NEXT: { 18// JSON-INDEX-NEXT: "USR": "{{([0-9A-F]{40})}}", 19// JSON-INDEX-NEXT: "Name": "GlobalNamespace", 20// JSON-INDEX-NEXT: "RefType": "namespace", 21// JSON-INDEX-NEXT: "Path": "GlobalNamespace", 22// JSON-INDEX-NEXT: "Children": [ 23// JSON-INDEX-NEXT: { 24// JSON-INDEX-NEXT: "USR": "{{([0-9A-F]{40})}}", 25// JSON-INDEX-NEXT: "Name": "Calculator", 26// JSON-INDEX-NEXT: "RefType": "record", 27// JSON-INDEX-NEXT: "Path": "GlobalNamespace", 28// JSON-INDEX-NEXT: "Children": [] 29// JSON-INDEX-NEXT: }, 30// JSON-INDEX-NEXT: { 31// JSON-INDEX-NEXT: "USR": "{{([0-9A-F]{40})}}", 32// JSON-INDEX-NEXT: "Name": "Circle", 33// JSON-INDEX-NEXT: "RefType": "record", 34// JSON-INDEX-NEXT: "Path": "GlobalNamespace", 35// JSON-INDEX-NEXT: "Children": [] 36// JSON-INDEX-NEXT: }, 37// JSON-INDEX-NEXT: { 38// JSON-INDEX-NEXT: "USR": "{{([0-9A-F]{40})}}", 39// JSON-INDEX-NEXT: "Name": "Rectangle", 40// JSON-INDEX-NEXT: "RefType": "record", 41// JSON-INDEX-NEXT: "Path": "GlobalNamespace", 42// JSON-INDEX-NEXT: "Children": [] 43// JSON-INDEX-NEXT: }, 44// JSON-INDEX-NEXT: { 45// JSON-INDEX-NEXT: "USR": "{{([0-9A-F]{40})}}", 46// JSON-INDEX-NEXT: "Name": "Shape", 47// JSON-INDEX-NEXT: "RefType": "record", 48// JSON-INDEX-NEXT: "Path": "GlobalNamespace", 49// JSON-INDEX-NEXT: "Children": [] 50// JSON-INDEX-NEXT: } 51// JSON-INDEX-NEXT: ] 52// JSON-INDEX-NEXT: } 53// JSON-INDEX-NEXT: ] 54// JSON-INDEX-NEXT: }; 55// JSON-INDEX-NEXT: } 56 57// HTML-SHAPE: <h1>class Shape</h1> 58// HTML-SHAPE: <p>Defined at line 8 of file {{.*}}Shape.h</p> 59// HTML-SHAPE: <div>brief</div> 60// HTML-SHAPE: <p> Abstract base class for shapes.</p> 61// HTML-SHAPE: <p> Provides a common interface for different types of shapes.</p> 62// HTML-SHAPE: <h2 id="Functions">Functions</h2> 63// HTML-SHAPE: <h3 id="{{([0-9A-F]{40})}}">area</h3> 64// HTML-SHAPE: <p>public double area()</p> 65// HTML-SHAPE: <div>brief</div> 66// HTML-SHAPE: <p> Calculates the area of the shape.</p> 67// HTML-SHAPE: <h3 id="{{([0-9A-F]{40})}}">perimeter</h3> 68// HTML-SHAPE: <p>public double perimeter()</p> 69// HTML-SHAPE: <div>brief</div> 70// HTML-SHAPE: <p> Calculates the perimeter of the shape.</p> 71// HTML-SHAPE: <div>return</div> 72// HTML-SHAPE: <p> double The perimeter of the shape.</p> 73// HTML-SHAPE: <h3 id="{{([0-9A-F]{40})}}">~Shape</h3> 74// HTML-SHAPE: <p>public void ~Shape()</p> 75// HTML-SHAPE: <p>Defined at line 13 of file {{.*}}Shape.h</p> 76// HTML-SHAPE: <div>brief</div> 77// HTML-SHAPE: <p> Virtual destructor.</p> 78 79// HTML-CALC: <h1>class Calculator</h1> 80// HTML-CALC: <p>Defined at line 8 of file {{.*}}Calculator.h</p> 81// HTML-CALC: <div>brief</div> 82// HTML-CALC: <p> A simple calculator class.</p> 83// HTML-CALC: <p> Provides basic arithmetic operations.</p> 84// HTML-CALC: <h2 id="Functions">Functions</h2> 85// HTML-CALC: <h3 id="{{([0-9A-F]{40})}}">add</h3> 86// HTML-CALC: <p>public int add(int a, int b)</p> 87// HTML-CALC: <p>Defined at line 3 of file {{.*}}Calculator.cpp</p> 88// HTML-CALC: <div>brief</div> 89// HTML-CALC: <p> Adds two integers.</p> 90// HTML-CALC: <div>return</div> 91// HTML-CALC: <p> int The sum of a and b.</p> 92// HTML-CALC: <h3 id="{{([0-9A-F]{40})}}">subtract</h3> 93// HTML-CALC: <p>public int subtract(int a, int b)</p> 94// HTML-CALC: <p>Defined at line 7 of file {{.*}}Calculator.cpp</p> 95// HTML-CALC: <div>brief</div> 96// HTML-CALC: <p> Subtracts the second integer from the first.</p> 97// HTML-CALC: <div>return</div> 98// HTML-CALC: <p> int The result of a - b.</p> 99// HTML-CALC: <h3 id="{{([0-9A-F]{40})}}">multiply</h3> 100// HTML-CALC: <p>public int multiply(int a, int b)</p> 101// HTML-CALC: <p>Defined at line 11 of file {{.*}}Calculator.cpp</p> 102// HTML-CALC: <div>brief</div> 103// HTML-CALC: <p> Multiplies two integers.</p> 104// HTML-CALC: <div>return</div> 105// HTML-CALC: <p> int The product of a and b.</p> 106// HTML-CALC: <h3 id="{{([0-9A-F]{40})}}">divide</h3> 107// HTML-CALC: <p>public double divide(int a, int b)</p> 108// HTML-CALC: <p>Defined at line 15 of file {{.*}}Calculator.cpp</p> 109// HTML-CALC: <div>brief</div> 110// HTML-CALC: <p> Divides the first integer by the second.</p> 111// HTML-CALC: <div>return</div> 112// HTML-CALC: <p> double The result of a / b.</p> 113// HTML-CALC: <div>throw</div> 114// HTML-CALC: <p>if b is zero.</p> 115 116// HTML-RECTANGLE: <h1>class Rectangle</h1> 117// HTML-RECTANGLE: <p>Defined at line 10 of file {{.*}}Rectangle.h</p> 118// HTML-RECTANGLE: <p> Represents a rectangle with a given width and height.</p 119// HTML-RECTANGLE: <p> 120// HTML-RECTANGLE: Inherits from 121// HTML-RECTANGLE: <a href="Shape.html">Shape</a> 122// HTML-RECTANGLE: </p> 123// HTML-RECTANGLE: <h2 id="Members">Members</h2> 124// HTML-RECTANGLE: <p> Width of the rectangle.</p> 125// HTML-RECTANGLE: <div>private double width_</div> 126// HTML-RECTANGLE: <p> Height of the rectangle.</p> 127// HTML-RECTANGLE: <div>private double height_</div> 128// HTML-RECTANGLE: <h2 id="Functions">Functions</h2> 129// HTML-RECTANGLE: <h3 id="{{([0-9A-F]{40})}}">Rectangle</h3> 130// HTML-RECTANGLE: <p>public void Rectangle(double width, double height)</p> 131// HTML-RECTANGLE: <p>Defined at line 3 of file {{.*}}Rectangle.cpp</p> 132// HTML-RECTANGLE: <div>brief</div> 133// HTML-RECTANGLE: <p> Constructs a new Rectangle object.</p> 134// HTML-RECTANGLE: <h3 id="{{([0-9A-F]{40})}}">area</h3> 135// HTML-RECTANGLE: <p>public double area()</p> 136// HTML-RECTANGLE: <p>Defined at line 6 of file {{.*}}Rectangle.cpp</p> 137// HTML-RECTANGLE: <div>brief</div> 138// HTML-RECTANGLE: <p> Calculates the area of the rectangle.</p> 139// HTML-RECTANGLE: <div>return</div> 140// HTML-RECTANGLE: <p> double The area of the rectangle.</p> 141// HTML-RECTANGLE: <h3 id="{{([0-9A-F]{40})}}">perimeter</h3> 142// HTML-RECTANGLE: <p>public double perimeter()</p> 143// HTML-RECTANGLE: <p>Defined at line 10 of file {{.*}}Rectangle.cpp</p> 144// HTML-RECTANGLE: <div>brief</div> 145// HTML-RECTANGLE: <p> Calculates the perimeter of the rectangle.</p> 146// HTML-RECTANGLE: <div>return</div> 147// HTML-RECTANGLE: <p> double The perimeter of the rectangle.</p> 148 149// HTML-CIRCLE: <h1>class Circle</h1> 150// HTML-CIRCLE: <p>Defined at line 10 of file {{.*}}Circle.h</p> 151// HTML-CIRCLE: <div>brief</div> 152// HTML-CIRCLE: <p> Circle class derived from Shape.</p> 153// HTML-CIRCLE: <p> Represents a circle with a given radius.</p> 154// HTML-CIRCLE: <p> 155// HTML-CIRCLE: Inherits from 156// HTML-CIRCLE: <a href="Shape.html">Shape</a> 157// HTML-CIRCLE: </p> 158// HTML-CIRCLE: <h2 id="Members">Members</h2> 159// HTML-CIRCLE: <p> Radius of the circle.</p> 160// HTML-CIRCLE: <div>private double radius_</div> 161// HTML-CIRCLE: <h2 id="Functions">Functions</h2> 162// HTML-CIRCLE: <h3 id="{{([0-9A-F]{40})}}">Circle</h3> 163// HTML-CIRCLE: <p>public void Circle(double radius)</p> 164// HTML-CIRCLE: <p>Defined at line 3 of file {{.*}}Circle.cpp</p> 165// HTML-CIRCLE: <div>brief</div> 166// HTML-CIRCLE: <p> Constructs a new Circle object.</p> 167// HTML-CIRCLE: <h3 id="{{([0-9A-F]{40})}}">area</h3> 168// HTML-CIRCLE: <p>public double area()</p> 169// HTML-CIRCLE: <p>Defined at line 5 of file {{.*}}Circle.cpp</p> 170// HTML-CIRCLE: <div>brief</div> 171// HTML-CIRCLE: <p> Calculates the area of the circle.</p> 172// HTML-CIRCLE: <div>return</div> 173// HTML-CIRCLE: <p> double The area of the circle.</p> 174// HTML-CIRCLE: <h3 id="{{([0-9A-F]{40})}}">perimeter</h3> 175// HTML-CIRCLE: <p>public double perimeter()</p> 176// HTML-CIRCLE: <p>Defined at line 9 of file {{.*}}Circle.cpp</p> 177// HTML-CIRCLE: <div>brief</div> 178// HTML-CIRCLE: <p> Calculates the perimeter of the circle.</p> 179// HTML-CIRCLE: <div>return</div> 180// HTML-CIRCLE: <p> double The perimeter of the circle.</p> 181 182// MD-CALC: # class Calculator 183// MD-CALC: *Defined at .{{[\/]}}include{{[\/]}}Calculator.h#8* 184// MD-CALC: **brief** A simple calculator class. 185// MD-CALC: Provides basic arithmetic operations. 186// MD-CALC: ## Functions 187// MD-CALC: ### add 188// MD-CALC: *public int add(int a, int b)* 189// MD-CALC: *Defined at .{{[\/]}}src{{[\/]}}Calculator.cpp#3* 190// MD-CALC: **brief** Adds two integers. 191// MD-CALC: **a** First integer. 192// MD-CALC: **b** Second integer. 193// MD-CALC: **return** int The sum of a and b. 194// MD-CALC: ### subtract 195// MD-CALC: *public int subtract(int a, int b)* 196// MD-CALC: *Defined at .{{[\/]}}src{{[\/]}}Calculator.cpp#7* 197// MD-CALC: **brief** Subtracts the second integer from the first. 198// MD-CALC: **a** First integer. 199// MD-CALC: **b** Second integer. 200// MD-CALC: **return** int The result of a - b. 201// MD-CALC: ### multiply 202// MD-CALC: *public int multiply(int a, int b)* 203// MD-CALC: *Defined at .{{[\/]}}src{{[\/]}}Calculator.cpp#11* 204// MD-CALC: **brief** Multiplies two integers. 205// MD-CALC: **a** First integer. 206// MD-CALC: **b** Second integer. 207// MD-CALC: **return** int The product of a and b. 208// MD-CALC: ### divide 209// MD-CALC: *public double divide(int a, int b)* 210// MD-CALC: *Defined at .{{[\/]}}src{{[\/]}}Calculator.cpp#15* 211// MD-CALC: **brief** Divides the first integer by the second. 212// MD-CALC: **a** First integer. 213// MD-CALC: **b** Second integer. 214// MD-CALC: **return** double The result of a / b. 215// MD-CALC: **throw**if b is zero. 216 217// MD-CIRCLE: # class Circle 218// MD-CIRCLE: *Defined at .{{[\/]}}include{{[\/]}}Circle.h#10* 219// MD-CIRCLE: **brief** Circle class derived from Shape. 220// MD-CIRCLE: Represents a circle with a given radius. 221// MD-CIRCLE: Inherits from Shape 222// MD-CIRCLE: ## Members 223// MD-CIRCLE: private double radius_ 224// MD-CIRCLE: ## Functions 225// MD-CIRCLE: ### Circle 226// MD-CIRCLE: *public void Circle(double radius)* 227// MD-CIRCLE: *Defined at .{{[\/]}}src{{[\/]}}Circle.cpp#3* 228// MD-CIRCLE: **brief** Constructs a new Circle object. 229// MD-CIRCLE: **radius** Radius of the circle. 230// MD-CIRCLE: ### area 231// MD-CIRCLE: *public double area()* 232// MD-CIRCLE: *Defined at .{{[\/]}}src{{[\/]}}Circle.cpp#5* 233// MD-CIRCLE: **brief** Calculates the area of the circle. 234// MD-CIRCLE: **return** double The area of the circle. 235// MD-CIRCLE: ### perimeter 236// MD-CIRCLE: *public double perimeter()* 237// MD-CIRCLE: *Defined at .{{[\/]}}src{{[\/]}}Circle.cpp#9* 238// MD-CIRCLE: **brief** Calculates the perimeter of the circle. 239// MD-CIRCLE: **return** double The perimeter of the circle. 240 241// MD-RECTANGLE: # class Rectangle 242// MD-RECTANGLE: *Defined at .{{[\/]}}include{{[\/]}}Rectangle.h#10* 243// MD-RECTANGLE: **brief** Rectangle class derived from Shape. 244// MD-RECTANGLE: Represents a rectangle with a given width and height. 245// MD-RECTANGLE: Inherits from Shape 246// MD-RECTANGLE: ## Members 247// MD-RECTANGLE: private double width_ 248// MD-RECTANGLE: private double height_ 249// MD-RECTANGLE: ## Functions 250// MD-RECTANGLE: ### Rectangle 251// MD-RECTANGLE: *public void Rectangle(double width, double height)* 252// MD-RECTANGLE: *Defined at .{{[\/]}}src{{[\/]}}Rectangle.cpp#3* 253// MD-RECTANGLE: **brief** Constructs a new Rectangle object. 254// MD-RECTANGLE: **width** Width of the rectangle. 255// MD-RECTANGLE: **height** Height of the rectangle. 256// MD-RECTANGLE: ### area 257// MD-RECTANGLE: *public double area()* 258// MD-RECTANGLE: *Defined at .{{[\/]}}src{{[\/]}}Rectangle.cpp#6* 259// MD-RECTANGLE: **brief** Calculates the area of the rectangle. 260// MD-RECTANGLE: **return** double The area of the rectangle. 261// MD-RECTANGLE: ### perimeter 262// MD-RECTANGLE: *public double perimeter()* 263// MD-RECTANGLE: *Defined at .{{[\/]}}src{{[\/]}}Rectangle.cpp#10* 264// MD-RECTANGLE: **brief** Calculates the perimeter of the rectangle. 265// MD-RECTANGLE: **return** double The perimeter of the rectangle. 266 267// MD-SHAPE: # class Shape 268// MD-SHAPE: *Defined at .{{[\/]}}include{{[\/]}}Shape.h#8* 269// MD-SHAPE: **brief** Abstract base class for shapes. 270// MD-SHAPE: Provides a common interface for different types of shapes. 271// MD-SHAPE: ## Functions 272// MD-SHAPE: ### ~Shape 273// MD-SHAPE: *public void ~Shape()* 274// MD-SHAPE: *Defined at .{{[\/]}}include{{[\/]}}Shape.h#13* 275// MD-SHAPE: **brief** Virtual destructor. 276// MD-SHAPE: ### area 277// MD-SHAPE: *public double area()* 278// MD-SHAPE: **brief** Calculates the area of the shape. 279// MD-SHAPE: **return** double The area of the shape. 280// MD-SHAPE: ### perimeter 281// MD-SHAPE: *public double perimeter()* 282// MD-SHAPE: **brief** Calculates the perimeter of the shape. 283// MD-SHAPE: **return** double The perimeter of the shape. 284 285// MD-ALL-FILES: # All Files 286// MD-ALL-FILES: ## [GlobalNamespace](GlobalNamespace{{[\/]}}index.md) 287 288// MD-INDEX: # C/C++ Reference 289// MD-INDEX: * Namespace: [GlobalNamespace](GlobalNamespace)