本文整理汇总了C++中Hello类的典型用法代码示例。如果您正苦于以下问题:C++ Hello类的具体用法?C++ Hello怎么用?C++ Hello使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Hello类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: client
static void client()
{
log4cxx::NDC ndc("client");
ORWELL_LOG_INFO("client ...");
zmq::context_t aContext(1);
usleep(1 * 1000);
ORWELL_LOG_INFO("create pusher");
Sender aPusher("tcp://127.0.0.1:9000", ZMQ_PUSH, orwell::com::ConnectionMode::CONNECT, aContext);
ORWELL_LOG_INFO("create subscriber");
Receiver aSubscriber("tcp://127.0.0.1:9001", ZMQ_SUB, orwell::com::ConnectionMode::CONNECT, aContext);
usleep(1 * 1000);
ExpectGameState(false, aSubscriber);
Hello aHelloMessage;
aHelloMessage.set_name("playername");
RawMessage aMessage("randomid", "Hello", aHelloMessage.SerializeAsString());
aPusher.send(aMessage);
ExpectGameState(true, aSubscriber);
aPusher.send(aMessage);
ORWELL_LOG_INFO("quit client");
}
示例2: Hello
QWidget * HelloWorldPlugin::createWidgetPlugin(QWidget *parent, const char *name)
{
Hello *hello = new Hello(pluginWindow()->caption(), parent, name);
hello->setFont(QFont("times",14,QFont::Bold) );
hello->setBackgroundColor(Qt::black);
return hello;
}
示例3: main
int main(int argc, char *argv[])
{
Test *test = new Test;
SOM_Test(!strcmp(test->somGetClassName(),"Test"));
SOM_Test(test->somRespondsTo(somIdFromString("hello_")) == 1);
SOM_Test(!strcmp(test->hello_(),"Hello World"));
SOM_Test(test->somRespondsTo(somIdFromString("mello_")) == 1);
SOM_Test(!strcmp(test->mello_(),"Mello World"));
SOM_Test(test->somGetClass()->somRespondsTo(somIdFromString("HelloCreate")) == 1);
Hello *a = ((M_Hello*) (test->somGetClass()))->HelloCreate("Hello from A");
SOM_Test(!strcmp(a->hello_(),"Hello from A"));
SOM_Test(test->somGetClass()->somRespondsTo(somIdFromString("MelloCreate")) == 1);
Mello *b = ((M_Mello*) (test->somGetClass()))->MelloCreate("Mello from B");
SOM_Test(!strcmp(b->mello_(),"Mello from B"));
Hello *c = (Hello*) (test->somGetClass()->somNew());
Mello *d = (Mello*) (test->somGetClass()->somNew());
SOM_Test(!strcmp(c->hello_(),"Hello World"));
SOM_Test(!strcmp(d->mello_(),"Mello World"));
printf("Derived Metaclass Test Successfully Completed.\n");
return 0;
}
示例4: TEST
TEST( HelloWorld_test, Say ) {
MockMsg msg;
EXPECT_CALL( msg, get_msg() )
.WillOnce(Return("Hola!"));
Hello saludador;
saludador.say(&msg);
}
示例5: main
int main()
{
Hello *h = new Hello();
h->setFormal(true);
h->greeting();
delete h;
return 0;
}
示例6: main
int
main ()
{
Hello h;
h.PrintHello ();
return 0;
}
示例7: OnClickedRegistCancel
void Regist::OnClickedRegistCancel()
{
Hello dlg;
fatherflag = 1;
ShowWindow(SW_HIDE);
dlg.DoModal();
ShowWindow(SW_SHOW);
// TODO: 在此添加控件通知处理程序代码
}
示例8: main
int main(){
std::cout << "Hello World!" << std::endl;
std::cout << "C++ Data Structures!" << std::endl;
Hello hello;
hello.printHello();
return 0;
}
示例9: OnClickedManagerLogout
void Manager::OnClickedManagerLogout()
{
Hello dlg;
CurrentUser = "";
fatherflag = 1;
ShowWindow(SW_HIDE);
dlg.DoModal();
ShowWindow(SW_SHOW);
// TODO: 在此添加控件通知处理程序代码
}
示例10: main
int main()
{
setlocale(0, "");
Hello h;
h.World();
h.Everybody();
return 0;
}
示例11: Hello_stringFromJNI
static jstring Hello_stringFromJNI(JNIEnv* env,jobject thiz)
{
Hello* he = (Hello*)env->GetIntField(thiz,helloFieldID);
if(he == NULL)
return NULL;
char* jni_str = (char*)he->stringFromJNI();
size_t size = strlen(jni_str);
jchar* data = UTF8toUTF16((char*)jni_str,&size);
jstring str = env->NewString(data,size);
free(data);
return str;
}
示例12: Hello_calculate
static jint Hello_calculate(JNIEnv* env,jobject thiz,jstring calculate,jint math,jint math2)
{
Hello* he = (Hello*)env->GetIntField(thiz,helloFieldID);
if(he == NULL)
return -1;
const jchar* cal = env->GetStringChars(calculate,NULL);
jsize cal_size = env->GetStringLength(calculate);
char* cal2 = UTF16toUTF8((jchar*)cal,(size_t*)&cal_size);
int result = he->calculate(cal2,math,math2);
env->ReleaseStringChars(calculate,cal);
free(cal2);
return (jint)result;
}
示例13: main
int main(int argc, const char * argv[])
{
Hello *h = new Hello();
h->sayHello("ZhangSan");
// std::string name = "ZhangSan";
// h->sayHello((char*)name.c_str());
// insert code here...
std::cout << "Hello, World!\n";
return 0;
}
示例14: main
int main(int argc, const char * argv[])
{
Hello *h = new Hello();
// C写法
// h->sayHello("Lance");
// std::string name = "Lance";
// 转成C类型的字符串,这样就不会警告了。
// h->sayHello((char *)name.c_str());
// C++写法
h->sayHello("Lance");
return 0;
}
示例15: main
int main() {
Talker t;
t.SaySomething();
Hello h;
h.SaySomething();
World w;
w.SaySomething();
//Now lets have some polymorphism !!!
cout << "Polymorphic Hello World" << endl;
vector<Talker *> talkers(2);
talkers.at(0) = new Hello();
talkers.at(1) = new World();
for (int i = 0; i < talkers.size(); i++) {
talkers.at(i)->SaySomething();
}
}