Open karolherbst opened 10 years ago
I could think about something like this:
in the store config a new properity: parser.categories
which may contain "game" or "game, music"
and later in the file [game] and [music] sections and a parser would automaticall parse all properties of these sections and put everything into a map<string,string>, which can be easily turn into a c++ object in a seperated step
Thinking about this, does this tie in to the idea of storing properties using a map instead of a model?
in the first step, yes. Then we could have converter classes for Class <=> map<string,string> which we could use for databases as well, because they usually work on a string base anyway.
also this would uncouple property <=> object translation from parsing information we get from stores or our database.
I don#t find a good way how to declerate stuff if this is implemented, weird things like enums will make the layout of the store config files less intuitiv if we don't find a good layout.
I think we should prefer using a yaml or json file format for store config files.
yaml:
store:
format: xml
homepage: http://www.desura.com/
name: desura
auth:
http_post:
loginurl: https://secure.desura.com/3/memberlogin
logouturl: https://secure.desura.com/1/memberlogout
fields: [username]
secrets: [password]
token:
type: cookie
keys: [freeman, masterchief]
models:
game:
url: https://secure.desura.com/1/memberdata
path: /memberdata/games//game
fields:
id: "@siteareaid"
name: name/text()
description: summary/text()
homepage: homepage/text()
platforms: /memberdata/platforms/platform/games/game[@siteareaid=$game.id]/../..
platform:
value: "@id"
mapping: {win32: 100, mac32: 130, lin32: 110, lin64: 120}
url: https://secure.desura.com/1/memberdata
path: /memberdata/platforms//platform
json:
{
"models": {
"platform": {
"url": "https://secure.desura.com/1/memberdata",
"path": "/memberdata/platforms//platform",
"mapping": {
"win32": 100,
"mac32": 130,
"lin64": 120,
"lin32": 110
},
"value": "@id"
},
"game": {
"url": "https://secure.desura.com/1/memberdata",
"path": "/memberdata/games//game",
"fields": {
"platforms": "/memberdata/platforms/platform/games/game[@siteareaid=$game.id]/../..",
"homepage": "homepage/text()",
"description": "summary/text()",
"name": "name/text()",
"id": "@siteareaid"
}
}
},
"store": {
"homepage": "http://www.desura.com/",
"name": "desura",
"format": "xml"
},
"auth": {
"http_post": {
"secrets": [
"password"
],
"fields": [
"username"
],
"loginurl": "https://secure.desura.com/3/memberlogin",
"logouturl": "https://secure.desura.com/1/memberlogout",
"token": {
"keys": [
"freeman",
"masterchief"
],
"type": "cookie"
}
}
}
}
currently the store parsers depend on our game models, so that it will be harder to parse new stuff later. There should be a more generic interface