Author: Mason Wright
Email:
[email protected]
Date: Wed, 18 Jun 2025 16:42:10 -0600
main.cc
09c195df02536b6a796bd648fce9669397b96109
Moved things around and made .h files
Clone
A
include/element.h
A
include/parser.h
-
index.html
M
main
M
main.cc
A
make.sh
-
src/adapter.cc
A
src/element.cc
-
src/events.cc
A
src/parser.cc
Commits
b966b2a517365074e5c381dbdea05b3221dc0198
e840f1eeb0ae26af69e1ae146ea9938e28e9f1af
e4e05418a640eaed08cd1ec7cd8644eb1dbcca50
4e01ba8ad2c3361fa4be3d896288020948b58b5e
aae562ac1350480e4889aabb35899f776c5b59e9
6c3ae0e31eb0893f20e3872117f92cc6b9a942af
350e7d88bb2feb9db00c6e032cc6623f215b7adf
95e6c70d23e99ffcf70e5bbe12503496e5d8f232
e188783659b9bc3b9993a647e93ed110e7f41db6
5e4c38ff3c212cdd9881427ef3f8c2706539a190
e50ea9e1356a74af18fdd171337ef9dc931e1f4e
8f2e83556d12aaebe8e8597ea6923804b0eb7a43
1627c585128af263181053ab2cf1a4cdcd14ee21
def3513f75b325464ad88a33c741c4ca80572b77
a21501590980a905fa9b902897d700a42a08b7f0
56074a6bfe4498d092f3a227297c8c20e2bb962c
d9cf1485b7ae0614130494f0e73237921323b9a1
80f04b134ae32ad8a9d526007b33dd02f6600f05
23d6c65f9368d3c622a55a3068a6b2f1efa0c8d4
09c195df02536b6a796bd648fce9669397b96109
f2b5c8202fbc904e2ed78260e3fdbd55164799d2
4bfba076120f389994fc46a98e8b7a2622314400
e36ac5417e10ee9b9f94f340e1ccf28afc5705ea
d00dc89a86dd7e2fcfd4618bc3a1c8cfba9e3c3d
d9eef16adaf292f3748db5fb5aa98463de10d712
18ff2ec1bfc1cf9fcd17c1acb05c3b41f8f0ed83
9e7fd2980d723437ea621b78d395fa72ca3f4922
Diff
diff --git a/main.cc b/main.cc index 135fb3a..4a6554a 100755 --- a/main.cc +++ b/main.cc @@ -1,5 +1,3 @@ -#include
-#include
-#include
-#include "element.h" -#include "parser.h" +#include
// For print and std::println +#include
+using namespace std; @@ -8,21 +6,27 @@ int main() { - // Option 1: Parse from a file - std::ifstream inputFile("./index.html"); - if (!inputFile.is_open()) { - std::cerr << "Error: Could not open index.html" << std::endl; - return 1; - } - - std::unique_ptr
document = parseStream(inputFile); - inputFile.close(); // Close the file after parsing - - // Option 2: Parse from a string (for testing) - // std::string html_content = "
Hello
world
!
Another paragraph.
"; - // std::stringstream ss(html_content); - // std::unique_ptr
document = parseStream(ss); - - // Print the parsed document tree - if (document) { - document->print(); - } else { - std::cout << "Document parsing failed or resulted in an empty document." << std::endl; - } + int age = 30; + string name = "Alice"; + double pi = 3.1415926535; + bool is_cpp_fun = true; + + // 1. Basic usage - similar to cout without endl + print("Hello, world!"); + print("This is awesome.\n"); // Manually add newline for print + + // 2. Basic usage with arguments - placeholder {} + println("Name: {}, Age: {}", name, age); + + // 3. Positional arguments (optional, but useful for reordering) + println("Age: {1}, Name: {0}", name, age); + + // 4. Formatting numbers (precision, width, scientific notation) + println("Pi (default): {}", pi); + println("Pi (2 decimal places): {:.2f}", pi); + println("Pi (scientific): {:e}", pi); + println("Number with width and fill: {:*^10}", 42); // Center 42 in 10 chars, fill with * + + // 5. Formatting boolean values + println("Is C++ fun? {}", is_cpp_fun); // Prints 1 or 0 by default + println("Is C++ fun? {:L}", is_cpp_fun); // Prints true or false (locale-dependent) + + // 6. Printing multiple values with spaces in between + println("{} {} {} {}", "One", 2, 3.0, true);
#include
#include
#include
#include "element.h" #include "parser.h" int main() { // Option 1: Parse from a file std::ifstream inputFile("./index.html"); if (!inputFile.is_open()) { std::cerr << "Error: Could not open index.html" << std::endl; return 1; } std::unique_ptr
document = parseStream(inputFile); inputFile.close(); // Close the file after parsing // Option 2: Parse from a string (for testing) // std::string html_content = "
Hello
world
!
Another paragraph.
"; // std::stringstream ss(html_content); // std::unique_ptr
document = parseStream(ss); // Print the parsed document tree if (document) { document->print(); } else { std::cout << "Document parsing failed or resulted in an empty document." << std::endl; } return 0; }