Backstory (You can jump)
I work almost exclusively with Qt and with the design philosophy of
Expand everything as API
The particular practice of this question is the tracking of the members of the group, emitting signals whenever their value changes.
For example, here is a general way to treat class members with the philosophy of the API, namely that for each member, there are at least four components:
QUrl url (); // return a copy of m_Url
void setUrl (URL QUrl); // A designated URL creator
void urlChanged (); // emit a signal whenever setUrl () is used
QUrl m_Url; // the object itself, with its protected state
This has worked very well for me so far, since as soon as I have to add features that depend on
m_Url, I only have to do this:
connect (this, & MyClass :: urlChanged, & foo, & MyOtherClass :: doBar);
And this is reliable because, basically,
Now, I must say that HTML and web development were not my original strengths in programming, and as such, I did not understand why these signals would exist:
But, there was no signal for
htmlChanged. Instead, all you have is:
Which is a function that will capture the current state. I had to manually call him on a timer whenever I wanted to check for a change of state.
So that's what I did, and then I discovered that even the HTML code of a static web page, or at least the one I was working with, was constantly changing, in which the changes had not changed. no meaning, and that's why none of this signal has been included by Qt's developers.
The heart of the problem
So I know what you are saying, "
significant is a subjective and situational term ", so let me define what I mean by
It's an excerpt of HTML code, say about 10,000 lines, the change I noticed on a webpage:
change in this
and returns to a constant loop. The fact that it comes back to the original state in a constant loop is what makes this change
no Sensand for that matter, it's not something I know how to follow intelligently. My initial strategy of detecting each change in the html string and analyzing it over an interval seems to me to be a very bad approach.
The fundamental questions
How I intelligently discover and follow significant changes in HTML? For example, suppose that a single value changes in an HTML document of 100,000 lines; Do I repair the entire document, compare it and find the change, or is there a way to avoid all that and correct the difference?
What API design philosophies, or existing APIs, should I use when interfacing with HTML, which will give me the correct signals for code injection or the right time for it? data extraction?
The answer should ideally take into account that the backend is Qt / C ++ oriented so that I can easily interface with the other libraries I depend on. I can do things like inject JQuery into the web page, or follow printfs and others. If that counts, the current engine I'm using is based on Chromium, https://wiki.qt.io/QtWebEngine.