Песочница
Материал из Wiki.crossplatform.ru
(Различия между версиями)
(→Пример: исходник Boost) |
(→Geshi test) |
||
Строка 226: | Строка 226: | ||
j++; /* this line has no lasting effect */ | j++; /* this line has no lasting effect */ | ||
}</geshi> | }</geshi> | ||
+ | |||
+ | == Забавный глюк == | ||
+ | код обернут в тэг '''nowiki''' и помещен в шаблон {{tl|code}} | ||
+ | |||
+ | {{code | ||
+ | |boost | ||
+ | |code=<nowiki>#include <iostream> | ||
+ | #include <boost/tokenizer.hpp> | ||
+ | #include <string> | ||
+ | |||
+ | int main() | ||
+ | { | ||
+ | std::string str = ";;Hello|world||-foo--bar;yow;baz|"; | ||
+ | typedef boost::tokenizer<boost::char_separator<char> > | ||
+ | tokenizer; | ||
+ | boost::char_separator<char> sep("-;|"); | ||
+ | tokenizer tokens(str, sep); | ||
+ | for (tokenizer::iterator tok_iter = tokens.begin(); | ||
+ | tok_iter != tokens.end(); ++tok_iter) | ||
+ | std::cout << "<" << *tok_iter << "> "; | ||
+ | std::cout << "\n"; | ||
+ | return EXIT_SUCCESS; | ||
+ | }</nowiki> | ||
+ | }} | ||
+ | |||
+ | код обернут в тэг '''nowiki'''без шаблона | ||
+ | |||
+ | <nowiki>#include <iostream> | ||
+ | #include <boost/tokenizer.hpp> | ||
+ | #include <string> | ||
+ | |||
+ | int main() | ||
+ | { | ||
+ | std::string str = ";;Hello|world||-foo--bar;yow;baz|"; | ||
+ | typedef boost::tokenizer<boost::char_separator<char> > | ||
+ | tokenizer; | ||
+ | boost::char_separator<char> sep("-;|"); | ||
+ | tokenizer tokens(str, sep); | ||
+ | for (tokenizer::iterator tok_iter = tokens.begin(); | ||
+ | tok_iter != tokens.end(); ++tok_iter) | ||
+ | std::cout << "<" << *tok_iter << "> "; | ||
+ | std::cout << "\n"; | ||
+ | return EXIT_SUCCESS; | ||
+ | }</nowiki> |
Версия 22:33, 11 января 2009
Содержание |
Пример списка
1
- one
- two
// Строка 1 Строка 2 Строка 3 Строка 1 Строка 2 Строка 3
- three
- three point
2
- one
Строка 1
Строка 2 Строка 3
Строка 1 Строка 2 Строка 3##three point two
3
- one
- two
Строка 1 Строка 2 Строка 3
Строка 1 Строка 2 Строка 3
- three
-
- three point one
- three point two
4
- one
- two
//----- QLabel lbl1; QString str; Строка 3 Строка 1 Строка 2 Строка 3
//----- QLabel lbl1; QString str; Строка 3 Строка 1 Строка 2 Строка 3
- three
-
- three point one
- three point two
Пример: исходник C/C++
#include <stdio.h> void f(void); int main(void) { int i; for(i=0; i<10; i++) f(); return 0; } void f(void) { int j = 10; printf("%d ", j); j++; /* this line has no lasting effect */ }
Пример: исходник ACE
#include <stdio.h> void f(void); int main(void) { int i; for(i=0; i<10; i++) f(); return 0; } void f(void) { int j = 10; printf("%d ", j); j++; /* this line has no lasting effect */ }
Пример: исходник Boost
#include <iostream> #include <boost/tokenizer.hpp> #include <string> int main() { std::string str = ";;Hello|world||-foo--bar;yow;baz|"; typedef boost::tokenizer<boost::char_separator<char> > tokenizer; boost::char_separator<char> sep("-;|"); tokenizer tokens(str, sep); for (tokenizer::iterator tok_iter = tokens.begin(); tok_iter != tokens.end(); ++tok_iter) std::cout << "<" << *tok_iter << "> "; std::cout << "\n"; return EXIT_SUCCESS; }
Пример: исходник GTK+
#include <stdio.h> void f(void); int main(void) { int i; for(i=0; i<10; i++) f(); return 0; } void f(void) { int j = 10; printf("%d ", j); j++; /* this line has no lasting effect */ }
Пример: исходник Qt
// QString locale = QLocale::system().name(); // запрос языка (например: "ru") QTranslator* translator = new QTranslator; translator->load(QString("qt_") + locale); // загрузка файла qt_*.qm app.installTranslator(translator); // устанока переводчика
Пример: исходник WxWidgets
#include <stdio.h> void f(void); int main(void) { int i; for(i=0; i<10; i++) f(); return 0; } void f(void) { int j = 10; printf("%d ", j); j++; /* this line has no lasting effect */ }
Geshi test
<geshi lang=cpp lines=0 source=SOURCE>#include <stdio.h>
void f(void);
int main(void) {
int i; for(i=0; i<10; i++) f(); return 0;
}
void f(void) {
int j = 10; printf("%d ", j); j++; /* this line has no lasting effect */
}</geshi>
Забавный глюк
код обернут в тэг nowiki и помещен в шаблон {{code}}
UNIQ79ac93ee19ec8e5a-nowiki-0000000C-QINU
код обернут в тэг nowikiбез шаблона
#include <iostream> #include <boost/tokenizer.hpp> #include <string> int main() { std::string str = ";;Hello|world||-foo--bar;yow;baz|"; typedef boost::tokenizer<boost::char_separator<char> > tokenizer; boost::char_separator<char> sep("-;|"); tokenizer tokens(str, sep); for (tokenizer::iterator tok_iter = tokens.begin(); tok_iter != tokens.end(); ++tok_iter) std::cout << "<" << *tok_iter << "> "; std::cout << "\n"; return EXIT_SUCCESS; }