⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 settings.h

📁 图像处理的压缩算法
💻 H
📖 第 1 页 / 共 2 页
字号:
/*------------------------------------------------------------------------------*
 * File Name: Settigns.h														*
 * Creation: YuI 12/20/2002														*
 * Purpose: Origin C OriginSettings Class Header								*
 * Copyright (c) OriginLab Corp.2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007	*
 * All Rights Reserved															*
 * 																				*
 * Modification Log:															*
 *------------------------------------------------------------------------------*/
#ifndef _SETTINGS_H
#define _SETTINGS_H

/** >Internal Origin Objects
 		The OriginSettings class provides methods and properties to access different 
 		customizable settings of Origin.
	Example:
		// get types of file that can be imported into the active page
		// and bring up "Open File" dialog box
		void test()
		{
			StringArray saTypes;
			PageBase pg = Project.Pages();
			Project.Settings.GetUserTypes(saTypes, pg.GetType());
			string strPath = GetOpenBox(saTypes);
			printf("File name is \"%s\"", strPath);
		}
		
*/
class	OriginSettings
{
public:
	OriginSettings();
	
public:
	void	GetUserTypes(StringArray& saTypes, int nGroup);
};


/** >System
		The INIFile class provides methods to access data stored in initialization file
*/
class INIFile
{
public:
	/**
		Constructor to determine what INI file to use
	Parameters:
		lpcszFilename - File name (can specify full path and file name)
		bUseIniPath - Set to TRUE for INI path, false for program path
	Returns:
	Example:
		// This function will output an ini file's section and key names.
		void output_ini(LPCSTR lpcszIniFile)
		{
			INIFile ini1("Origin.ini", FALSE);
			INIFile ini2("Origin.ini");
			int nNumLevels1 = ini1.ReadInt("Config", "NumLevels", 0);
			int nNumLevels2 = ini2.ReadInt("Config", "NumLevels", 0);
			printf("NumLevels in Program folder ini = %d", nNumLevels1);
			printf("NumLevels in ini folder ini = %d", nNumLevels2);
		}			
		
	*/

	INIFile(LPCSTR lpcszFilename = NULL, BOOL bUseIniPath = TRUE);

public:
	/**
		Get all the section names into a string array.
		Parameters:
			saSections - string array to receive the section names
		Returns:
			number of section names in the array
		Example:
			// This function will output an ini file's section and key names.
			void output_ini(LPCSTR lpcszIniFile)
			{
				string str;
				INIFile ini(lpcszIniFile);
				StringArray saSections, saKeys;
				ini.GetSectionNames(saSections);
				for( int iSection = 0; iSection < saSections.GetSize(); iSection++ )
				{
					printf("%s\n", saSections[iSection]);
					ini.GetKeyNames(saKeys, saSections[iSection]);
					for( int iKey = 0; iKey < saKeys.GetSize(); iKey++ )
					{
						str = ini.ReadString(saSections[iSection], saKeys[iKey]);
						printf("    %s = %s\n", saKeys[iKey], str);
					}
				}
			}			
	*/
	int GetSectionNames(StringArray &saSections);
	
	/**
		Get all the key names in a section into a string array.
		Parameters:
			saKeys - string array to receive the key names
			lpcszSection - pointer to the section name to get the key names from
		Returns:
			number of key names in the array
		Example:
			// This function will output an ini file's section and key names.
			void output_ini(LPCSTR lpcszIniFile)
			{
				string str;
				INIFile ini(lpcszIniFile);
				StringArray saSections, saKeys;
				ini.GetSectionNames(saSections);
				for( int iSection = 0; iSection < saSections.GetSize(); iSection++ )
				{
					printf("%s\n", saSections[iSection]);
					ini.GetKeyNames(saKeys, saSections[iSection]);
					for( int iKey = 0; iKey < saKeys.GetSize(); iKey++ )
					{
						str = ini.ReadString(saSections[iSection], saKeys[iKey]);
						printf("    %s = %s\n", saKeys[iKey], str);
					}
				}
			}			
	*/
	int GetKeyNames(StringArray &saKeys, LPCSTR lpcszSection);

	/**
		Retrieves an integer value from the specified section in an initialization file
		Parameters:
			lpcszSection - section name
			lpcszKey - key name
			nDefault - return value if section or key is not found in initialization file
		Returns:
			integer value specified by section and key from initialization file
		
		Example:
			//gets current value for Initial Origin window state from Origin.ini file
			//see "Config" section og Origin.ini for more details
			void test()
			{
				string strFileName = GetAppPath(1)+ "Origin.ini";
				INIFile ini(strFileName);
				printf("Initial Origin window state is %d", ini.ReadInt("Config", "ShowState", -1));
			}
	*/
	int		ReadInt(LPCSTR lpcszSection, LPCSTR lpcszKey, int nDefault);
	
	/**
		Writes integer value into the specified section of an initialization file
		Parameters:
			lpcszSection - section name
			lpcszKey - key name
			nValue - value to be written
		Example:
			This example writes integer value into the Config section of MyOrigin.ini.
			For this example to run, a file with the name MyOrigin.ini should exist under C:\ folder.
			In addition, MyOrigin.ini should contain a section named Config and a key named ShowState.

			void test_INIFile_WriteInt()
			{
					int iState = 3;
					INIFile iniMyF("C:\\MyOrigin.ini");
					
					iniMyF.WriteInt("Config", "ShowState", iState);
					printf("Set initial Origin window state to %d\n", iState);
					
					if (iState == iniMyF.ReadInt("Config", "ShowState", -1))
						printf("Success!\ninitial Origin window state is %d\n",iState);
					else 
						out_str("Error!");
			}
	*/
	void	WriteInt(LPCSTR lpcszSection, LPCSTR lpcszKey, int nValue);
		
	/**
			Reads the value of a key in a given section into a string.
			Parameters:
				lpcszSection = section name
				lpcszKey = key name
				lpcszDefault = NULL 
			Returns:
				the value of a key in a given section in the form of a string
			Example:
				    // reads and prints all the key values in all sections
					string str;
					INIFile ini("filename.ini");
					StringArray saSections, saKeys;
					ini.GetSectionNames(saSections);
					for( int iSection = 0; iSection < saSections.GetSize(); iSection++ )
					{
						printf("%s\n", saSections[iSection]);
						ini.GetKeyNames(saKeys, saSections[iSection]);
						for( int iKey = 0; iKey < saKeys.GetSize(); iKey++ )
						{
							str = ini.ReadString(saSections[iSection], saKeys[iKey]);
							printf("    %s = %s\n", saKeys[iKey], str);
						}
					}
					
	*/
	string	ReadString(LPCSTR lpcszSection, LPCSTR lpcszKey, LPCSTR lpcszDefault = NULL);
	
	
	/**
				Writes a string value for a given keyname in a given section
			Parameters:
				lpcszSection = section name
				lpcszKey = key name
				lpcszValue = the string that needs to be written  
			Returns:
			Example:
					// writes "***" into all the key values in all sections
					string str = "***";
					INIFile ini("EBGIF2.ini");
					StringArray saSections, saKeys;
					ini.GetSectionNames(saSections);
					for( int iSection = 0; iSection < saSections.GetSize(); iSection++ )
					{
						printf("%s\n", saSections[iSection]);
						ini.GetKeyNames(saKeys, saSections[iSection]);
						for( int iKey = 0; iKey < saKeys.GetSize(); iKey++ )
						{
							ini.WriteString(saSections[iSection], saKeys[iKey], str);
							string str1 = ini.ReadString(saSections[iSection], saKeys[iKey], str);
							printf("    %s = %s\n", saKeys[iKey], str1);
						}
					}
					
	*/
	void	WriteString(LPCSTR lpcszSection, LPCSTR lpcszKey, LPCSTR lpcszValue);
	
	/**
				Sets the file name to the given string.
			Parameters:
				lpcszSection = new file name
				
			Returns:
			Example:
				
					INIFile ini("Origin.ini");

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -