{"id":28298989,"url":"https://github.com/leojimenezg/file-value-counter","last_synced_at":"2025-06-15T07:30:52.640Z","repository":{"id":286515217,"uuid":"961634259","full_name":"LeoJimenezG/file-value-counter","owner":"LeoJimenezG","description":"A lightweight C++ program that reads .txt files, scans for time values following a custom key symbol, and calculates the total sum of the values based on a defined pattern.","archived":false,"fork":false,"pushed_at":"2025-05-17T02:50:44.000Z","size":39,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-30T06:20:07.733Z","etag":null,"topics":["cpp","files","search"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LeoJimenezG.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-06T22:54:12.000Z","updated_at":"2025-05-17T02:50:47.000Z","dependencies_parsed_at":"2025-05-17T03:39:27.489Z","dependency_job_id":null,"html_url":"https://github.com/LeoJimenezG/file-value-counter","commit_stats":null,"previous_names":["leojimenezg/file_hour_counter","leojimenezg/file-hour-counter-cpp","leojimenezg/file-value-counter"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/LeoJimenezG/file-value-counter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeoJimenezG%2Ffile-value-counter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeoJimenezG%2Ffile-value-counter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeoJimenezG%2Ffile-value-counter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeoJimenezG%2Ffile-value-counter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LeoJimenezG","download_url":"https://codeload.github.com/LeoJimenezG/file-value-counter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeoJimenezG%2Ffile-value-counter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259940447,"owners_count":22935283,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","files","search"],"created_at":"2025-05-23T06:15:42.360Z","updated_at":"2025-06-15T07:30:52.632Z","avatar_url":"https://github.com/LeoJimenezG.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# File Value Counter\n\nA lightweight C++ program that reads `.txt` files, scans for time values following a custom key symbol, and calculates the total sum of the values based on a defined pattern.\n\n---\n\n## Installation\n\nTo get this project up and runnig on your local machine, follow the next instructions.\n\n### Prerequisites\nBefore anything else, make sure you have installed **C++20** (or newer) and a compatible compiler like **GCC** or **Clang** in your system. \n\n### Steps\n1. **Clone the repository:**\nOpen your prefered terminal and clone the project to your local machine.\n    ```bash\n    git clone https://github.com/LeoJimenezG/file-value-counter.git\n    ```\n2. **Navigate into the project directory:**\n    ```bash\n    cd file-value-counter\n    ```\n3. **Build the project**\nChoose the compilation method that applies to your setup.\n    * If you compile using GCC:\n        ```bash\n        g++ -std=c++20 main.cpp -o main\n        ```\n    * If you compile using Clang:\n        ```bash\n        clang++ -std=c++20 main.cpp -o main\n        ```\n4. **Run the application**\nFinally, execute the generated object file to launch the File Hour Counter Program.\n    ```bash\n    ./main\n    ```\n\n---\n\n## How Does It Work?\n\nThis project stands out from others I’ve built because it was created to solve a specific personal need. As a result, the code is tightly tailored to my context. However, it's flexible enough to be adapted with minimal effort.\n\nAt its core, the program reads a `.txt` file line by line, searching for values (like hours) that follow a user-defined key symbol and match a given pattern. The goal is to extract and sum these values accurately.\n\nTo make the scan meaningful, you must configure certain global variables, especially the key symbols and format patterns. If these aren't set correctly, the results will be unreliable, since all filtering and comparison happens during the line-by-line parsing.\n\n### `initialize_variables()` \nInitializes the global variables used throughout the program. Technically, this could be avoided, but centralizing the initialization helps keep the logic clear and easy to understand. It's a stylistic choice to improve readability and control.\n\n### `search_file_content()`\nThis is the heart of the program. It reads the file line by line, storing each one in the `line` variable. For every line, it checks whether the predefined key symbols and pattern are present. If so, it extracts the value and adds it to the running total.\n\n### `show_total_hours()`\nA simple utility function that prints the final result stored in `total_hours`, using a personalized but easy-to-read format.\n\n---\n\n## Notes\n\n* Initially, I aimed to design a general purpose solution that could adapt to various scenarios. However, I quickly realized that such flexibility added unnecessary complexity and more importantly, it didn't solve my specific need. That’s why this project takes a focused, tailored approach.\n* I haven’t tested the program with other file types or formats, so its behavior outside the intended use case is unknown. Consider it a prototype rather than a production-ready tool.\n* This is the first meaningful and functional project I've completed in C++. I'm still learning the language, and while the code may not follow all best practices, it's a reflection of what I know and don't know.\n\n---\n\n## Useful Resources\n\n* **[C++ Reference](https://en.cppreference.com/w/)** - An extensive and reliable reference for modern C++ standards, syntax, and standard libraries.\n* **[C++ Standard String](https://cplusplus.com/reference/string/string/)** - Detailed documentation on string operations and methods.\n* **[C++ File Handling](https://www.w3schools.com/CPP/cpp_files.asp)** - A beginner-friendly overview of reading from and writing to files in C++.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleojimenezg%2Ffile-value-counter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleojimenezg%2Ffile-value-counter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleojimenezg%2Ffile-value-counter/lists"}