Hello and thank you for your time. I am new to C++ and QT. I need to parse an ASCII model file which contains multiple sub-circuits and multiple models within the sub-circuits. The sub-circuits are denoted by lines beginning with ".subckt", followed by sub-circuit parameters, followed by the models inside them, numbered sequentially and beginning with ".model some_name.1". I need to leave the entire sub-circuit as is. After the end of the sub-circuit, I need to append everything in the sub-circuit until the first model, then append the first model and remove the remaining models, and repeat this process for all of the models within the sub-circuit. For example, if I have a sub-circuit with two models in it, the end result would be three total sub-circuits, the original containing both models, and two new sub-circuits each containing one of the models.
I have been trying to solve this using QRegExp, cap() and reading the files line by line, but one of the problems I have encountered is that because the ".subckt" and ".model" are on separate lines, it does not capture everything after ".subckt" until ".model", it captures everything on the same line as ".subckt". Also the number of models within each sub-circuit is not constant, so I need a way to create as many new sub-circuits as there are models in a given sub-circuit.
Is QRegExp and cap() the way to go with this? Also, I need help with creating the loop or function that can count the number of models in a sub-circuit and create that number of new sub-circuits. Any help and suggestions are greatly appreciated. Thank you for you time and help.
Bookmarks