Summary of the invention
In view of the foregoing deficiencies of prior art, the purpose of the present invention is to provide a kind of configuration file loading method and
Device, mobile terminal need to issue different editions configuration parameter according to different clients for solving common apparatus in the prior art
Version, code revision amount is big, the high problem of maintenance cost.
In order to achieve the above objects and other related objects, the present invention provides a kind of configuration file loading method, the configuration
File includes common profiles and customized configuration file;The configuration file loading method is the following steps are included: load institute
Common profiles are stated, the common profiles include common configuration parameter;The customized configuration file is parsed, and is determined
It whether there is common configuration parameter in the customized file;If it exists, then common configuration in the common profiles is joined
Several values is revised as the value of customized configuration parameter.
In one embodiment of the present invention, there are common configuration parameters in the customized file, will be described public
When the value of common configuration parameter is revised as the value of customized configuration parameter in configuration file, comprising the following steps: described public
Parameter is added in common configuration parameter in configuration file and replaces attribute, and the value of the parameter replacement attribute is customized configuration ginseng
The value of common configuration parameter in the common profiles, is revised as the value of customized configuration parameter by several values.
In one embodiment of the present invention, the value of common configuration parameter in the common profiles is being revised as visitor
Include: after the value of inhibition and generation configuration parameter, when exporting the configuration file obtain and export respectively the common profiles and
Customized configuration file;
Wherein, it is described customized to match when common configuration parameter includes parameter replacement attribute in the common profiles
The value for setting parameter is the value of parameter replacement attribute.
In one embodiment of the present invention, if common configuration parameter, the public affairs are not present in the customized file
The value of common configuration parameter is constant in configuration file altogether.
Correspondingly, the configuration file loading device includes: to deposit the present invention also provides a kind of configuration file loading device
Storage unit is used for storage configuration file, and the configuration file includes common profiles and customized configuration file, described public
Configuration file includes common configuration parameter;Loading unit is connect with the storage unit, for loading the common configuration text
Part;Searching unit is connect with the storage unit and loading unit, for loading the common configuration text in the loading unit
After part, the customized configuration file is parsed, and determine and whether there is common configuration parameter in the customized file;Modification
Unit is connect with the storage unit, loading unit and searching unit, for there are common configurations in the customized file
When parameter, the value of common configuration parameter in common profiles that the loading unit is loaded is revised as customized configuration and is joined
Several values.
In one embodiment of the present invention, the modification unit includes: attribute adding unit, with the storage unit and
Searching unit connection, in the customized file there are when common configuration parameter, in the common profiles
Parameter is added in common configuration parameter and replaces attribute, and the value of the parameter replacement attribute is the value of customized configuration parameter, addition
Common configuration parameter after parameter replacement attribute is stored in the storage unit in common profiles;Parameter modifying unit,
It is connect with the storage unit, loading unit and attribute adding unit, it, will be described for being triggered according to the attribute adding unit
The value of common configuration parameter is revised as the value of customized configuration parameter in the common profiles that loading unit is loaded.
In one embodiment of the present invention, the configuration file loading device further include: lead-out unit, with the storage
Unit connection, for obtaining respectively and exporting the common profiles and customized configuration file;The lead-out unit is being led
It is described if common configuration parameter includes parameter replacement attribute in the common profiles out when the customized configuration file
The value of customized configuration parameter is the value that the parameter replaces attribute.
It is described to add when common configuration parameter being not present in the customized file in one embodiment of the present invention
The value for carrying common configuration parameter in the common profiles that module is loaded is constant.
Correspondingly, the present invention also provides a kind of communication equipments including any above-mentioned configuration file loading device.
In one embodiment of the present invention, the communication equipment is mobile phone, tablet computer or interchanger.
As described above, configuration file loading method of the invention and device, mobile terminal, have the advantages that
For common apparatus, common profiles and customized configuration file two parts are set by configuration file, for
Different clients, common profiles are constant, in configuration file loading procedure, if in common profiles including customized match
Parameter is set, then the value of common configuration parameter in the common profiles is revised as to the value of customized configuration parameter, thus full
The individual cultivation of each client of foot needs.Since different clients only need provide different customized configuration files, make jointly
With common profiles, the modification amount of code is effectively reduced, maintenance cost is reduced, improves maintenance efficiency.
Further, there are common configuration parameters in the customized file, will be public in the common profiles
When the value of configuration parameter is revised as the value of customized configuration parameter, pass through the common configuration parameter in the common profiles
Middle addition parameter replaces attribute, and the value of the parameter replacement attribute is the value of customized configuration parameter, by the common configuration
The value of common configuration parameter is revised as the value of customized configuration parameter in file.In subsequent export configuration file, can utilize
Parameter replaces attribute, the common configuration parameter and customized configuration parameter in the customized configuration file of acquisition rapidly and efficiently
Corresponding relationship effectively, accurately obtains customized configuration file.
Specific embodiment
Illustrate embodiments of the present invention below by way of specific specific example, those skilled in the art can be by this specification
Other advantages and efficacy of the present invention can be easily understood for disclosed content.The present invention can also pass through in addition different specific realities
The mode of applying is embodied or practiced, the various details in this specification can also based on different viewpoints and application, without departing from
Various modifications or alterations are carried out under spirit of the invention.It should be noted that in the absence of conflict, following embodiment and implementation
Feature in example can be combined with each other.
It should be noted that illustrating the basic structure that only the invention is illustrated in a schematic way provided in following embodiment
Think, only shown in schema then with related component in the present invention rather than component count, shape and size when according to actual implementation
Draw, when actual implementation kenel, quantity and the ratio of each component can arbitrarily change for one kind, and its assembly layout kenel
It is likely more complexity.
Referring to Fig. 1, providing a kind of flow diagram of configuration file loading method for the present invention.The configuration file packet
Include common profiles and customized configuration file;The configuration file loading method the following steps are included:
Step S11, loads the common profiles, and the common profiles include common configuration parameter;
Step S12 parses the customized configuration file, and determines and whether there is common configuration in the customized file
Parameter;
If in the customized file, there are common configuration parameters, then follow the steps S13, will be in the common profiles
The value of common configuration parameter is revised as the value of customized configuration parameter.
If common configuration parameter is not present in the customized file, common configuration parameter in the common profiles
Value it is constant, configuration parameter load complete.
In the present embodiment, for common apparatus, common profiles and customized configuration file are set by configuration file
Two parts, for different clients, common profiles are constant, in configuration file loading procedure, if in common profiles
Including customized configuration parameter, then the value of common configuration parameter in the common profiles is revised as customized configuration parameter
Value, to meet the individual cultivation needs of each client.Since different clients only need provide different customized configurations
File is used in conjunction with common profiles, effectively reduces the modification amount of code, reduces maintenance cost, improves maintenance effect
Rate.
In another embodiment, when executing step S13, i.e., there are common configuration parameter in the customized file,
When the value of common configuration parameter in the common profiles is revised as the value of customized configuration parameter, it may include following step
It is rapid:
Parameter is added in the common configuration parameter in the common profiles and replaces attribute, and the parameter replaces attribute
Value be customized configuration parameter value, the value of common configuration parameter in the common profiles is revised as customized match
Set the value of parameter.
At this point, the value that the value of common configuration parameter in the common profiles is revised as to customized configuration parameter it
Afterwards, include: when exporting the configuration file
It obtains respectively and exports the common profiles and customized configuration file;
Wherein, it is described customized to match when common configuration parameter includes parameter replacement attribute in the common profiles
The value for setting parameter is the value of parameter replacement attribute.
In above-described embodiment, there are common configuration parameters in the customized file, will be in the common profiles
When the value of common configuration parameter is revised as the value of customized configuration parameter, due to the common configuration in the common profiles
Parameter is added in parameter and replaces attribute, and the value of the parameter replacement attribute is the value of customized configuration parameter, will be described public
The value of common configuration parameter is revised as the value of customized configuration parameter in configuration file.It, can in subsequent export configuration file
Using parameter replacement attribute, the common configuration parameter in the customized configuration file of acquisition rapidly and efficiently is joined with customized configuration
Several corresponding relationships effectively, accurately obtains customized configuration file.
Referring to Fig. 2, being the structural schematic diagram of configuration file loading device one embodiment of the present invention.Match described in Fig. 2
Setting file loading device 1 includes:
Storage unit 11 is used for storage configuration file, and the configuration file includes common profiles and customized configuration text
Part, the common profiles include common configuration parameter;
Loading unit 12 is connect with the storage unit 11, for loading the common profiles;
Searching unit 13 is connect with the storage unit 11 and loading unit 12, for loading institute in the loading unit 12
After stating common profiles, the customized configuration file is parsed, and is determined in the customized file with the presence or absence of public
Configuration parameter;
Modification unit 14 is connect with the storage unit 11, loading unit 12 and searching unit 13, for described customized
There are common configuration parameters in the common profiles that when common configuration parameter, the loading unit 12 is loaded in change file
Value be revised as the value of customized configuration parameter.
In the present embodiment, configuration file setting includes common profiles and customized configuration file two in storage unit 11
Part, for different clients, common profiles are constant, in configuration file loading procedure, if searching unit 13 knows public affairs
Altogether include customized configuration parameter in configuration file, then triggers modification unit 14 and join common configuration in the common profiles
Several values is revised as the value of customized configuration parameter, to meet the individual cultivation needs of each client.Due to different clients
Different customized configuration files is only needed provide, common profiles are used in conjunction with, effectively reduces the modification amount of code, is dropped
Low maintenance cost, improves maintenance efficiency.
Referring to Fig. 3, being the structural schematic diagram of another embodiment of configuration file loading device of the present invention.The present embodiment
In, the configuration file loading device 2 includes:
Storage unit 21 is used for storage configuration file, and the configuration file includes common profiles and customized configuration text
Part, the common profiles include common configuration parameter;
Loading unit 22 is connect with the storage unit 21, for loading the common profiles;
Searching unit 23 is connect with the storage unit 21 and loading unit 22, for loading institute in the loading unit 22
After stating common profiles, the customized configuration file is parsed, and is determined in the customized file with the presence or absence of public
Configuration parameter;
Modification unit 24 is connect with the storage unit 21, loading unit 22 and searching unit 23, for described customized
There are common configuration parameters in the common profiles that when common configuration parameter, the loading unit 22 is loaded in change file
Value be revised as the value of customized configuration parameter.
Wherein, the modification unit 24 further comprises:
Attribute adding unit 241 is connect with the storage unit 21 and searching unit 23, in the customized file
In there are when common configuration parameter, add parameter in the common configuration parameter in the common profiles and replace attribute, institute
The value for stating parameter replacement attribute is the value of customized configuration parameter, and the common configuration parameter after addition parameter replacement attribute is stored in
In the storage unit in common profiles;
Parameter modifying unit 242 is connect with the storage unit 21, loading unit 22 and attribute adding unit 241, is used for
It is triggered according to the attribute adding unit, the value of common configuration parameter in the common profiles that the loading unit is loaded
It is revised as the value of customized configuration parameter.
In the present embodiment, the configuration file loading device 2 further include:
Lead-out unit (not shown) is connect with the storage unit 21, for obtaining and exporting the common configuration text respectively
Part and customized configuration file;The lead-out unit is when exporting the customized configuration file, if the common profiles
Middle common configuration parameter includes parameter replacement attribute, and the value of the customized configuration parameter is the value that the parameter replaces attribute.
In the present embodiment, there are common configuration parameters in the customized file, will be public in the common profiles
When the value of configuration parameter is revised as the value of customized configuration parameter altogether, since attribute adding unit 241 is in the common configuration text
Parameter is added in common configuration parameter in part replaces attribute, when exporting configuration file subsequently through lead-out unit, Neng Gouli
With parameter replacement attribute, the common configuration parameter and customized configuration parameter that obtain in customized configuration file rapidly and efficiently
Corresponding relationship, effectively, accurately obtain customized configuration file.
Correspondingly, the present invention also provides a kind of communication equipments including any above-mentioned configuration file loading device.Specifically
, the communication equipment is mobile phone, tablet computer or interchanger.
In conclusion configuration file loading method of the present invention sets common profiles for configuration file and customized matches
File two parts are set, for different clients, common profiles are constant, in configuration file loading procedure, if common configuration
Include customized configuration parameter in file, then the value of common configuration parameter in the common profiles is revised as customized match
The value of parameter is set, to meet the individual cultivation needs of each client.Due to different clients only need provide it is different customized
Change configuration file, is used in conjunction with common profiles, effectively reduces the modification amount of code, reduce maintenance cost, improve
Maintenance efficiency.In addition, there are common configuration parameters in the customized file, by common configuration in the common profiles
When the value of parameter is revised as the value of customized configuration parameter, ginseng is added in the common configuration parameter in the common profiles
Number replacement attribute, thus in subsequent export configuration file, it can be using parameter replacement attribute, acquisition rapidly and efficiently is customized
The corresponding relationship for changing the common configuration parameter and customized configuration parameter in configuration file, effectively, accurately obtains customized match
Set file.So the present invention effectively overcomes various shortcoming in the prior art and has high industrial utilization value.
The above-described embodiments merely illustrate the principles and effects of the present invention, and is not intended to limit the present invention.It is any ripe
The personage for knowing this technology all without departing from the spirit and scope of the present invention, carries out modifications and changes to above-described embodiment.Cause
This, institute is complete without departing from the spirit and technical ideas disclosed in the present invention by those of ordinary skill in the art such as
At all equivalent modifications or change, should be covered by the claims of the present invention.