您的位置:首页 > 编程语言 > Java开发

linphone-LpConfig.java文件分析

2016-07-23 15:14 471 查看

介绍:

主要是设置配置文件的工具类

UML类图



LpConfigImpl.java

/*
LPConfigImpl.java
Copyright (C) 2013  Belledonne Communications, Grenoble, France

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/
package org.linphone.core;

class LpConfigImpl implements LpConfig {

private final long nativePtr;
boolean ownPtr = false;

public LpConfigImpl(long ptr) {
nativePtr = ptr;
}

private native long newLpConfigImpl(String file);
private native void delete(long ptr);

public LpConfigImpl(String file) {
nativePtr = newLpConfigImpl(file);
ownPtr = true;
}

protected void finalize() throws Throwable {
if(ownPtr) {
delete(nativePtr);
}
}

private native void sync(long ptr);
@Override
public void sync() {
sync(nativePtr);
}

private native void setInt(long ptr, String section, String key, int value);
@Override
public void setInt(String section, String key, int value) {
setInt(nativePtr, section, key, value);
}

private native void setFloat(long ptr, String section, String key, float value);
@Override
public void setFloat(String section, String key, float value) {
setFloat(nativePtr, section, key, value);
}

private native void setBool(long ptr, String section, String key, boolean value);
@Override
public void setBool(String section, String key, boolean value) {
setBool(nativePtr, section, key, value);
}

private native void setString(long ptr, String section, String key, String value);
@Override
public void setString(String section, String key, String value) {
setString(nativePtr, section, key, value);
}

private native void setIntRange(long ptr, String section, String key, int min, int max);
@Override
public void setIntRange(String section, String key, int min, int max) {
setIntRange(nativePtr, section, key, min, max);
}

private native int getInt(long ptr, String section, String key, int defaultValue);
@Override
public int getInt(String section, String key, int defaultValue) {
return getInt(nativePtr, section, key, defaultValue);
}

private native float getFloat(long ptr, String section, String key, float defaultValue);
@Override
public float getFloat(String section, String key, float defaultValue) {
return getFloat(nativePtr, section, key, defaultValue);
}

private native boolean getBool(long ptr, String section, String key, boolean defaultValue);
@Override
public boolean getBool(String section, String key, boolean defaultValue) {
return getBool(nativePtr, section, key, defaultValue);
}

private native String getString(long ptr, String section, String key, String defaultValue);
@Override
public String getString(String section, String key, String defaultValue) {
return getString(nativePtr, section, key, defaultValue);
}

private native int[] getIntRange(long ptr, String section, String key, int defaultMin, int defaultMax);
@Override
public int[] getIntRange(String section, String key, int defaultMin, int defaultMax) {
return getIntRange(nativePtr, section, key, defaultMin, defaultMax);
}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  linphone LpConfig