Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[建议]不要用struct来处理config.json #14

Closed
ghost opened this issue Jul 4, 2019 · 7 comments
Closed

[建议]不要用struct来处理config.json #14

ghost opened this issue Jul 4, 2019 · 7 comments
Labels
wontfix This will not be worked on
Milestone

Comments

@ghost
Copy link

ghost commented Jul 4, 2019

v2ray-core的config.json是动态变化的,而struct数据格式是固定的,并不适合用来处理配置项会不断增删的情况。然后就会出现很多很难看的"access": null,"error": null, ... 。所以建议用json库来处理config,但是我不会C语言不知道哪个库好。

@ghost ghost added question labels Jul 4, 2019
@ghost
Copy link
Author

ghost commented Jul 4, 2019

这个问题我之前有仔细想过,前几天加的那些 struct 真的是让人头晕眼花……
Qt有自带的JSON库,这个不是问题,我个人比较喜欢使用强类型的struct + template,你说的 "access": null 确实也很不好看
这个修改提议待定
ADDED: 可能会加到TODO里面

@ghost

This comment has been minimized.

@ghost
Copy link
Author

ghost commented Jul 4, 2019

另外,削减掉目前没有实现的 RootObject::TransportSettings 后,整个JSON只有 不到 150 行,不存在很难看的 null 现象

v2ray-core的config.json是动态变化的

  • AFAIK,大多数JSON是一次性配置,不会更改很多次

@ghost
Copy link
Author

ghost commented Jul 4, 2019

Added: 相比于 ‘struct template’ json 确实会方便一些
@ZLplLQc

@ghost ghost added this to the Beta b0.0.1 milestone Jul 4, 2019
@ghost ghost added enhancement and removed question labels Jul 4, 2019
@ghost
Copy link
Author

ghost commented Jul 4, 2019

只是个建议。

@ghost ghost closed this as completed Jul 4, 2019
@ghost ghost reopened this Jul 6, 2019
@ghost
Copy link
Author

ghost commented Jul 6, 2019

现已决定使用 JSON 库实现配置文件读写
谢谢

@ghost ghost removed the DiscussionNeeded label Jul 6, 2019
@ghost
Copy link
Author

ghost commented Jul 9, 2019

#18 部分对于类型要求很高的仍然使用了 struct,但主体使用的是 QJsonObject

@ghost ghost closed this as completed Jul 9, 2019
@rubyKC rubyKC mentioned this issue Aug 24, 2019
@ghost ghost added the wontfix This will not be worked on label Sep 5, 2019
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Development

No branches or pull requests

0 participants