Dan
Yo!
Mat
Yo!
Hey!
Spirit
wondering how to override callback function in Qt's QOAuthHttpServerReplyHandler()
Spirit
for anyone interest in helping this is where you can find the sourcecode online
Spirit
https://code.woboq.org/qt5/qtnetworkauth/src/oauth/
Spirit
im not sure how to properly subclass QOAuthHttpServerReplyHandler which is derived from QOAuthOobReplyHandler() which is derived from QAbstractOAuthReplyHandler() In QAbstractOAuthReplyHandler() callback() is declared as a public function`virtual QString callback() const = 0;` In QOAuthOobReplyHandler() callback() is declared as a public function`QString callback() const override;` In QOAuthHttpServerReplyHandler() callback() is declared as a public function QString callbackPath() const;
Spirit
from qoauthhttpserverreplyhandler.cpp: QString QOAuthHttpServerReplyHandler::callback() const { Q_D(const QOAuthHttpServerReplyHandler); Q_ASSERT(d->httpServer.isListening()); const QUrl url(QString::fromLatin1("http://127.0.0.1:%1/%2") .arg(d->httpServer.serverPort()).arg(d->path)); return url.toString(QUrl::EncodeDelimiters); }
Spirit
alot of functions use an object d which is expanded from the macro #define Q_D(Class) Class##Private * const d = d_func() as in Q_D(const QOAuthHttpServerReplyHandler); expands to: QOAuthHttpServerReplyHandlerPrivate * const d = d_func();
Spirit
and in QOAuthHttpServerReplyHandlerPrivate: there are these cast and friend statements that i think might complicated it? Q_DECLARE_PUBLIC(QOAuthHttpServerReplyHandler) which expand to: inline QOAuthHttpServerReplyHandler* q_func() { return static_cast<QOAuthHttpServerReplyHandler *>(q_ptr); } inline const QOAuthHttpServerReplyHandler* q_func() const { return static_cast<const QOAuthHttpServerReplyHandler *>(q_ptr); } friend class QOAuthHttpServerReplyHandler;
Spirit
ive been reading this https://wiki.qt.io/D-Pointer but i still dont get it
Rushi
Cin.ignore() remove first char in string but I required these. What should I do
Rushi
For taking next line string input in function
Rushi
Please help
Pavel
For taking next line string input in function
To read a line std::string response; std::getline(std::cin, response);
Anonymous
Thanks ☺
Nouhou
morning everyone
Sachin
bool compare(int a,int b) { if(minHeap) return a<b; else a>b; Given>minHeap=true; How this function is working if I call this. While(1st condition &&compare(x,y)) { }
Sachin
#help please
Anonymous
Your function returns nothing when minHeah == false
Anonymous
And that's undefined behaviour
01000001011011010100000101101110
01000001011011010100000101101110
guys i am getting error when trying to sort std::map by its value
01000001011011010100000101101110
can someone help me?
Anonymous
There's no need to sort a map
01000001011011010100000101101110
and what is 'operator-'
Anonymous
1) std::sort accepts only RandomAccessIterator`s, for example `std::vector provides such iterators 2) std::map contains its elements in a ascending order by default, unless you specified other order (you didn't)
Anonymous
and what is 'operator-'
operator- is operator -
01000001011011010100000101101110
but i think the order is made by the keys..and not from the values?
Anonymous
Insted of #define ll long long use int64_t
01000001011011010100000101101110
because it uses hashing and maintains a balanced tree structure..which gives O(n)
01000001011011010100000101101110
Insted of #define ll long long use int64_t
alright..ill study about int64_t.. thank you
Anonymous
Searching and inserting key-value pairs are O(logn) for std::map
01000001011011010100000101101110
yeah sorry..O(log(n))
01000001011011010100000101101110
so how can i sort map from values instead of the key?
Anonymous
01000001011011010100000101101110
https://stackoverflow.com/questions/5056645/sorting-stdmap-using-value
01000001011011010100000101101110
https://thispointer.com/how-to-sort-a-map-by-value-in-c/
01000001011011010100000101101110
ive tried them
01000001011011010100000101101110
but they dont work for me
Anonymous
If you need such a feature, I assume there's something wrong with you desing, and your code tells me the same thing
01000001011011010100000101101110
yeah coding style in the code is worse..i know but am not developing any software..i am just doing CP..here time and correctness gets more points
01000001011011010100000101101110
to save time in typing and focusing on the solution approach is what we focus on in competitions.
01000001011011010100000101101110
sorry for poor code
Anonymous
You are not at a competition right now You can focus on writing good code
01000001011011010100000101101110
https://stackoverflow.com/questions/5056645/sorting-stdmap-using-value
but i am not the only one who has faced this problem.. there are many question on stack overflow, g4g, and other sites..as well
Anonymous
Not even good Just not bad one
01000001011011010100000101101110
01000001011011010100000101101110
Anonymous
Just use more expressive variables name
Anonymous
And i think you need to reconsider your way of solving the problem
Anonymous
Good luck
01000001011011010100000101101110
yeah, thank you :)
01000001011011010100000101101110
operator- is operator -
but how does it comes in sort()? in my lambda..ive used '>' operator.
Artöm
but how does it comes in sort()? in my lambda..ive used '>' operator.
Iterator distance, since RAIters can be substracted from eqch other
Anonymous
but how does it comes in sort()? in my lambda..ive used '>' operator.
I don't know std::sort function is desinged for sequences with random access This means that only array-based containers are suitable, such as std::vector, std::array
01000001011011010100000101101110
dont you think that sort in map is also important?
01000001011011010100000101101110
okay
Anonymous
You don't know what map is, if you ask such questions
01000001011011010100000101101110
thanks again
01000001011011010100000101101110
You don't know what map is, if you ask such questions
i think i know what a map is....but as you suggest ill study it one more time..
Anonymous
That's is the point of std::map
01000001011011010100000101101110
Anonymous
Alright
I think your problem has different solution, but it is offtopic
01000001011011010100000101101110
Yes..now I'm trying different approach
01000001011011010100000101101110
Thank you
Nouhou
hello
Anonymous
hello
nohello.com
Nouhou
can i put my problem on the javascript?
Nouhou
ok thanks
Rushi
To read a line std::string response; std::getline(std::cin, response);
I know about these but when I want to read multiple line and store in the same string variable .the first character is get ignore so I required these first char....