Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

Блог пользователя OnlyPain

Автор OnlyPain, история, 3 года назад, По-английски

Can someone tell me how to add(parse) contest information in my code editor before submitting to any OJ as it is done in Cp Editor?

For Eg.

Thanks in advance.

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
3 года назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

Luckily CpEditor is open source... So we can take a look to see how it actually happens!

  1. First clue: settings.json:533. Seems to be the string resource format for the lines maybe? I didn't look too much into this.
  2. Second clue: CompanionServer.cpp:131. Appears to populate a struct for info for CpEditor... I'm assuming it's coming from Competitive Companion.
  3. Third clue: appwindow.cpp:1130. This function is called via CompanionServer's emit of onRequestArrived (you can see them being linked together in AppWindow::setConnections())
  4. Finally: mainwindow.cpp:507. finalComments is the final string outputted to the editor as content (you can trace to see where it adds comment prefixes per language for each line, and even calls editor.setText() here on line 555)

Hope this helps!