Programmer Application Note

2015년 7월 27일 월요일

함수포인터

오후 5:04 Posted by PAN.SPOT , No comments
  • 함수 정의
void cStyleFunction(int param){...}

class Aclass {
 void classFunction(int param){...}
 static void classStaticFunction(int param){...}
};

namespace NameSpace{
 void namespaceFunction(int param){...}
}
  • 함수포인터 선언
void (*FunctionPointer) (int param);
typedef void (*TypedefFunctionPointer) (int param);
void (Aclass::*ClassFunctionPointer) (int param);
  • 함수포인터 사용
void (*FunctionPointer) (int param);
void main(){
 void (*FunctionPointer) (int param);
 FunctionPointer = cStyleFunction; //ok
 FunctionPointer = Aclass::classStaticFunction; //ok
 FunctionPointer = NameSpace::namespaceFunction; //ok 
 FunctionPointer = Aclass::classFunction; //error
 FunctionPointer(param);
}
typedef void (*TypedefFunctionPointer) (int param);
typedef void (*TypedefFunctionPointer) (int param);
void main(){
 TypedefFunctionPointer tfp;
 tfp = cStyleFunction; //ok
 tfp = Aclass::classStaticFunction; //ok
 tfp = NameSpace::namespaceFunction; //ok
 tfp = Aclass::classFunction; //error
 tfp(param);
}
typedef void (Aclass::*ClassFunctionPointer) (int param);
void main(){
 Aclass *a = new Aclass();
 void (Aclass::*ClassFunctionPointer) (int param);
 ClassFunctionPointer = &Aclass::classFunction; //ok
 (a->*ClassFunctionPointer)(param);
}

2015년 7월 23일 목요일

디폴트 생성자 , 소멸자, 복사 생성자 , 대입연산자

오후 5:22 Posted by PAN.SPOT , No comments

컴파일러가 자동으로 생성하는 것들

Empty() {...}; //기본 생성자
~Empty() {...};//기본 소멸자
Empty(const Empty& rhs) {...}; //복사 생성자
Empty& operator=(const Empty& rhs) {...}; //복사 대입 연산자
Empty e1; //기본 생성자,기본 소멸자 Empty e2(e1); // 복사 생성자 e2 = e1; //복사 대입 연산자

만약 하나밖에 없는 자원이라 복사생성자나 대입 연산자가 필요 없다면

pirvate:
    HomeForSale(const HomeForSale&);
    HomeForSale& operator=(const HomeForSale&);

임베디드 webkit browser 한글 폰트 설정

오후 4:20 Posted by PAN.SPOT , No comments
임베디드에서 webkit browser 한글이 깨져 나올때가 있다. 이때 fonts.conf 파일을 찾아서 
아래와 같이 변경 해준다. 

파일을 열어보면 다음과 같이 match 태그들을 볼 수 있다. 기본 폰트인 monospace,sans-serif 등을 볼 수 있는데 아래와 같이 기본폰트를 강제로 한글 표현이 가능한 폰트로 변경 한다. 

아래는 sans serif를 NanumGothic으로 변경한 예이다. 

<match target="pattern">
  <test qual="any" name="family">
          <string>sans serif</string>
  </test>
  <edit name="family" mode="assign" binding="strong">
          <string>NanumGothic</string>
  </edit>
</match>

위와 같은 방법으로 브라우저의 한글 폰트 설정을 강제로 변경 할 수 있다.

2015년 7월 21일 화요일

git 계통관계

오후 11:46 Posted by PAN.SPOT , , No comments
^ : 해당 커밋의 부모
^2 : 두번쨰 부모 (즉 부모가 두가지로 나눠져 있을 떄)
~: 해당 커밋의 부모
~2 : 해당 커밋의 부모의 부모

HEAD^^ = HEAD~2


2015년 7월 1일 수요일

If no other git process is currently running, this probably means a git process crashed in this repository earlier. Make sure no other git process is running and remove the file manually to continue.

오후 10:55 Posted by PAN.SPOT , No comments

git 사용중 아래와 같은 에러발생 시 

If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.
$rm /PROJECTDIR/.git/index.lock
$git reset