code
stringlengths
3
1.01M
repo_name
stringlengths
5
116
path
stringlengths
3
311
language
stringclasses
30 values
license
stringclasses
15 values
size
int64
3
1.01M
<?php phpinfo();
u8lvavhel/lemp-base-docker
www/index.php
PHP
mit
18
## ember-cli [![Build Status](https://travis-ci.org/stefanpenner/ember-cli.png?branch=master)](https://travis-ci.org/stefanpenner/ember-cli) [![Dependency Status](https://david-dm.org/stefanpenner/ember-cli.svg)](https://david-dm.org/stefanpenner/ember-cli) An ember command line utility. Supports node 0.10.5 and npm 1.4.6. ## Community * irc: #ember-cli on freenode * issues: [ember-cli/issues](https://github.com/stefanpenner/ember-cli/issues) * website: [iamstef.net/ember-cli](http://iamstef.net/ember-cli) [![ScreenShot](http://static.iamstef.net/ember-conf-2014-video.jpg)](https://www.youtube.com/watch?v=4D8z3972h64) ## Warning Although potentially exciting, this is still really a WIP, use at your own risk. ## Project Elements Additional components of this project which are used runtime in your application: * [ember-jj-abrams-resolver](https://github.com/stefanpenner/ember-jj-abrams-resolver) * [loader](https://github.com/stefanpenner/loader.js) * [ember-cli-shims](https://github.com/stefanpenner/ember-cli-shims) * [ember-load-initializers](https://github.com/stefanpenner/ember-load-initializers) ## Development Hints ### Working with master ``` sh git clone https://github.com/stefanpenner/ember-cli.git cd ember-cli npm link ``` `npm link` is very similar to `npm install -g` except that instead of downloading the package from the repo the just cloned `ember-cli/` folder becomes the global package. Any changes to the files in the `ember-cli/` folder will immediately affect the global ember-cli package. Now you can use `ember-cli` via the command line: ``` sh ember new foo cd foo npm link ember-cli ember server ``` `npm link ember-cli` is needed because by default the globally installed `ember-cli` just loads the local `ember-cli` from the project. `npm link ember-cli` symlinks the global `ember-cli` package to the local `ember-cli` package. Now the `ember-cli` you cloned before is in three places: The folder you cloned it into, npm's folder where it stores global packages and the `ember-cli` project you just created. If you upgrade an app running against Ember CLI master you will need to re-link to your checkout of Ember CLI by running `npm link ember-cli` in your project again. Please read the official [npm-link documentation](https://www.npmjs.org/doc/cli/npm-link.html) and the [npm-link cheatsheet](https://blog.nodejitsu.com/npm-cheatsheet/#Linking_any_npm_package_locally) for more information. ### Working with the tests Use `npm run-script autotest` to run the tests after every file change (Runs only fast tests). Use `npm test` to run them once. For a full test run which includes some very slow acceptance tests, please run: `npm run-script test-all`. Please note, this is what travis runs. To exclude a test or test suite append a `.skip` to `it()` or `describe()` respectively (e.g. `it.skip(...)`). To focus on a certain test or test suite append `.only`. Please read the official [mocha documentation](http://visionmedia.github.io/mocha) for more information. ## Contribution [See `CONTRIBUTING.md`](https://github.com/stefanpenner/ember-cli/blob/master/CONTRIBUTING.md) ## Donating All donations will support this project and treats for contributors. [![Support via Gittip](https://rawgithub.com/twolfson/gittip-badge/0.2.0/dist/gittip.png)](https://www.gittip.com/stefanpenner/) ## License ember-cli is [MIT Licensed](https://github.com/stefanpenner/ember-cli/blob/master/LICENSE.md).
hinsenchan/gearbox_web_app
node_modules/ember-cli/README.md
Markdown
mit
3,472
module('lively.ide.DirectoryWatcher').requires('lively.Network').toRun(function() { // depends on the DirectoryWatcherServer Object.extend(lively.ide.DirectoryWatcher, { watchServerURL: new URL(Config.nodeJSURL+'/DirectoryWatchServer/'), dirs: {}, reset: function() { // lively.ide.DirectoryWatcher.reset() this.dirs = {}; this.watchServerURL.withFilename('reset').asWebResource().post(); }, request: function(url, thenDo) { return url.asWebResource().beAsync().withJSONWhenDone(function(json, status) { thenDo(!json || json.error, json); }).get(); }, getFiles: function(dir, thenDo) { this.request(this.watchServerURL.withFilename('files').withQuery({dir: dir}), thenDo); }, getChanges: function(dir, since, startWatchTime, thenDo) { this.request(this.watchServerURL.withFilename('changes').withQuery({ startWatchTime: startWatchTime, since: since, dir: dir}), thenDo); }, withFilesOfDir: function(dir, doFunc) { // Retrieves efficiently the files of dir. Uses a server side watcher that // sends infos about file changes, deletions, creations. // This methods synchs those with the cached state held in this object // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- // dir = lively.shell.exec('pwd', {sync:true}).resultString() // lively.ide.DirectoryWatcher.dirs // lively.ide.DirectoryWatcher.withFilesOfDir(dir, function(files) { show(Object.keys(files).length); }) // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- var watchState = this.dirs[dir] || (this.dirs[dir] = {updateInProgress: false, callbacks: []}); doFunc && watchState.callbacks.push(doFunc); if (watchState.updateInProgress) { return; } watchState.updateInProgress = true; // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- if (!watchState.files) { // first time called this.getFiles(dir, function(err, result) { if (err) show("dir watch error: %s", err); result.files && Properties.forEachOwn(result.files, function(path, stat) { extend(stat); }) Object.extend(watchState, { files: result.files, lastUpdated: result.startTime, startTime: result.startTime }); whenDone(); }); return; } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- var timeSinceLastUpdate = Date.now() - (watchState.lastUpdated || 0); if (timeSinceLastUpdate < 10 * 1000) { whenDone(); } // recently updated // get updates this.getChanges(dir, watchState.lastUpdated, watchState.startTime, function(err, result) { if (!result.changes || result.changes.length === 0) { whenDone(); return; } watchState.lastUpdated = result.changes[0].time; console.log('%s files changed in %s: %s', result.changes.length, dir, result.changes.pluck('path').join('\n')); result.changes.forEach(function(change) { switch (change.type) { case 'removal': delete watchState.files[change.path]; break; case 'creation': case 'change': watchState.files[change.path] = extend(change.stat); break; } }); whenDone(); }); // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- function whenDone() { watchState.updateInProgress = false; var cb; while ((cb = watchState.callbacks.shift())) cb(watchState.files); } function extend(statObj) { // convert date string into a date object if (!statObj) statObj = {}; statObj.isDirectory = !!(statObj.mode & 0x4000); ['atime', 'mtime', 'ctime'].forEach(function(field) { if (statObj[field]) statObj[field] = new Date(statObj[field]); }); return statObj; } } }); }) // end of module
pascience/LivelyKernel
core/lively/ide/DirectoryWatcher.js
JavaScript
mit
4,138
<html> <head> <title>Popcorn processing unit Tests</title> <link rel="stylesheet" href="../../test/qunit/qunit.css" type="text/css" media="screen"> <script src="../../test/qunit/qunit.js"></script> <script src="../../popcorn.js"></script> <script src="popcorn.processing.js"></script> <script src="popcorn.processing.unit.js"></script> </head> <body> <h1 id="qunit-header">Popcorn processing Plug-in Demo</h1> <h2 id="qunit-banner"></h2> <div id="qunit-testrunner-toolbar"></div> <h2 id="qunit-userAgent"></h2> <ol id="qunit-tests"></ol> <div id="qunit-fixture"> </div> <div> <video id="video" controls preload="none" width="250px" poster="../../test/poster.png"> <source id="mp4" src="../../test/trailer.mp4" type='video/mp4; codecs="avc1, mp4a"'> <source id="ogv" src="../../test/trailer.ogv" type='video/ogg; codecs="theora, vorbis"'> <source id='webm' src="../../test/trailer.webm" type='video/webm; codecs="vp8, vorbis"'> <p>Your user agent does not support the HTML5 Video element.</p> </video> </div> <div id="processing-div-1" width="50%" height="50%"></div> <div id="processing-div-2" width="50%" height="50%"></div> <div id="processing-div-3" width="50%" height="50%"></div> <div id="processing-div-4" width="50%" height="50%"></div> </html>
ScottDowne/popcorn-js
plugins/processing/popcorn.processing.unit.html
HTML
mit
1,398
/* ======================================================================== * TABLE OF CONTENTS * ======================================================================== * ======================================================================== * LAYOUT * ======================================================================== 01. HEADER 02. SIDEBAR LEFT & RIGHT 03. PAGE CONTENT * ======================================================================== * ======================================================================== * PAGES * ======================================================================== 01. SIGN 02. ERROR 03. INVOICE * ======================================================================== * ======================================================================== * COMPONENT * ======================================================================== 01. RESET 02. PANEL 03. MEDIA MANAGER 04. PAGINATION 05. RATING STAR 06. DROPDOWN 07. LIST GROUP 08. FORM 09. TABLE 10. BUTTON 11. MISC * ======================================================================== * ======================================================================== * PLUGINS * ======================================================================== 01. CHOSEN 02. DROPZONE 03. JPRELOADER 04. DATEPICKER 05. ION SLIDER * ======================================================================== */ /* ======================================================================== * HEADER * ======================================================================== */ body.page-sidebar-minimize #header .navbar-minimize > a { background-color: #8d8d6e; color: #ffffff; } body.page-sidebar-minimize #header .navbar-minimize:hover > a { background-color: #7f7f63; } #header .navbar-header { background-color: #8d8d6e; } /* ======================================================================== * SIDEBAR LEFT & RIGHT * ======================================================================== */ .sidebar-content img { border: 2px solid #8d8d6e; } #sidebar-left.sidebar-box .sidebar-menu > li.active > a > .icon i, #sidebar-left.sidebar-rounded .sidebar-menu > li.active > a > .icon i, #sidebar-left.sidebar-circle .sidebar-menu > li.active > a > .icon i { background-color: #8d8d6e; } #sidebar-left.sidebar-box .sidebar-menu > li > ul > li:hover:after, #sidebar-left.sidebar-rounded .sidebar-menu > li > ul > li:hover:after, #sidebar-left.sidebar-circle .sidebar-menu > li > ul > li:hover:after { -webkit-box-shadow: 0 0 0 5px #707058; -moz-box-shadow: 0 0 0 5px #707058; box-shadow: 0 0 0 5px #707058; } #sidebar-left .sidebar-menu ul li:hover:after { background-color: #8d8d6e; } #sidebar-left .sidebar-menu ul li:hover a:before { color: #8d8d6e; } #sidebar-left .sidebar-menu ul li.active:after { background-color: #8d8d6e; } #sidebar-left .sidebar-menu ul li.active > ul > li.active a:before { color: #8d8d6e; } /* ======================================================================== * PAGE CONTENT * ======================================================================== */ body.page-sidebar-minimize .navbar-minimize, body.page-sidebar-minimize-auto .navbar-minimize { border-right: 1px solid #8d8d6e !important; } body.page-sidebar-minimize .navbar-minimize a, body.page-sidebar-minimize-auto .navbar-minimize a { background-color: #8d8d6e; border-bottom: 1px solid #8d8d6e; } body.page-sidebar-minimize .navbar-minimize a:hover, body.page-sidebar-minimize-auto .navbar-minimize a:hover { background-color: #7f7f63; border-bottom: 1px solid #7f7f63; } body.page-sidebar-minimize .navbar-minimize a i, body.page-sidebar-minimize-auto .navbar-minimize a i { color: #ffffff; } .navbar-minimize-mobile { background-color: #8d8d6e; } .navbar-minimize-mobile:hover { background-color: #7f7f63; } @media (max-width: 768px) { body.page-sidebar-left-show .navbar-minimize-mobile, body.page-sidebar-right-show .navbar-minimize-mobile { background-color: #707058; } body.page-sidebar-left-show .navbar-minimize-mobile:hover, body.page-sidebar-right-show .navbar-minimize-mobile:hover { background-color: #7f7f63; } } .navbar-toolbar .navbar-form input:focus { border: 1px solid #8d8d6e; } .navbar-toolbar .navbar-form .btn-focus { background-color: #8d8d6e; box-shadow: none; border: none; color: #ffffff; } .navbar-toolbar .navbar-right .dropdown > a:focus > i { color: #8d8d6e; } /* ======================================================================== * SIGN * ======================================================================== */ .sign-wrapper a { color: #8d8d6e; } .sign-wrapper a:hover, .sign-wrapper a:focus, .sign-wrapper a:active { color: #8a8a6c; } .sign-text:before { background-color: #a4a48a; } .sign-header { background-color: #8d8d6e; border-bottom: 10px solid #79795e; } .sign-text span { background-color: #8d8d6e; } .sign-text img { border: 7px solid #8d8d6e; } /* ======================================================================== * ERROR * ======================================================================== */ .error-wrapper h1 { color: #8d8d6e; } /* ======================================================================== * INVOICE * ======================================================================== */ .product-num { background-color: #8d8d6e; } /* ======================================================================== * RESET * ======================================================================== */ a { color: #8d8d6e; } a:hover, a:active, a:focus { color: #707058; } input.no-border-left:focus, textarea.no-border-left:focus { border-top: 1px solid #8d8d6e !important; border-right: 1px solid #8d8d6e !important; border-bottom: 1px solid #8d8d6e !important; border-left: none !important; } input.no-border-right:focus, textarea.no-border-right:focus { border-top: 1px solid #8d8d6e !important; border-none: 1px solid #8d8d6e !important; border-bottom: 1px solid #8d8d6e !important; border-right: none !important; } input:focus, textarea:focus { border: 1px solid #8d8d6e !important; } /* ======================================================================== * PANEL * ======================================================================== */ .panel-tab .panel-heading ul li.active a i { color: #8d8d6e; } .panel-tab .panel-heading ul li a:hover i { color: #8d8d6e; } /* ======================================================================== * MEDIA MANAGER * ======================================================================== */ .media-manager .media-manager-options .filter-type a.active { color: #8d8d6e; } /* ======================================================================== * PAGINATION * ======================================================================== */ .pagination > li > a { color: #707058; } .pagination > .active > a, .pagination > .active > span { background-color: #707058; border: 1px solid #707058; } .pagination > .active > a:hover, .pagination > .active > span:hover, .pagination > .active > a:focus, .pagination > .active > span:focus { background-color: #8d8d6e; border: 1px solid #8d8d6e; } .pager > li > a { color: #707058; } /* ======================================================================== * RATING STAR * ======================================================================== */ .rating .star:hover:before { color: #8d8d6e; } .rating .star.active:before { color: #8d8d6e; } .rating .star.active ~ .star:before { color: #8d8d6e; } /* ======================================================================== * DROPDOWN * ======================================================================== */ .dropdown-menu li { position: relative; } .dropdown-menu li.active a { background-color: #8d8d6e; } .dropdown-menu li.active:hover a, .dropdown-menu li.active:focus a, .dropdown-menu li.active:active a { background-color: #8d8d6e; cursor: default; } .dropdown-menu li > a:hover:before { display: block; content: ""; position: absolute; left: 0px; top: 0px; bottom: 0px; border-left: 3px solid #7f7f63; } /* ======================================================================== * LIST GROUP * ======================================================================== */ a.list-group-item.active { background-color: #8d8d6e; border-color: #8d8d6e; } a.list-group-item.active:hover, a.list-group-item.active:focus { background-color: #8d8d6e; border-color: #8d8d6e; } /* ======================================================================== * FORM * ======================================================================== */ .ckbox-theme input[type=checkbox]:checked + label::after { border-color: #8d8d6e; background-color: #8d8d6e; } .ckbox-theme input[type=checkbox][disabled]:checked + label::after { border-color: #8d8d6e; opacity: .5; } .rdio-theme input[type=radio]:checked + label::after { border-color: #8d8d6e; background-color: #8d8d6e; } .rdio-theme input[type=radio][disabled]:checked + label::after { border-color: #8d8d6e; opacity: .5; } .form-control:focus { border: 1px solid #8d8d6e; -webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none; } .form-focus { border: 1px solid #8d8d6e; -webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none; } /* ======================================================================== * TABLE * ======================================================================== */ .table-theme thead tr th { background-color: #8d8d6e !important; border-color: #99997c #99997c #79795e !important; color: #fff; } .table-theme tbody tr td.sorting_1 { background: #abab93 !important; color: white; border-bottom: 1px solid #babaa7 !important; } .table-theme tfoot tr th { background-color: #8d8d6e !important; border-color: #79795e #99997c #99997c !important; color: #fff; } .table-theme.table-bordered { border: 1px solid #8d8d6e; } .table-theme.table-bordered thead tr th:first-child, .table-theme.table-bordered tfoot tr th:first-child, .table-theme.table-bordered thead tr th:last-child, .table-theme.table-bordered tfoot tr th:last-child { -webkit-border-radius: 0px !important; -moz-border-radius: 0px !important; border-radius: 0px !important; } .table-theme.table-bordered tbody tr td.sorting_1 { border-right: 1px solid #babaa7 !important; } .table-theme table.has-columns-hidden > tbody > tr > td > span.responsiveExpander:before { color: white; } .table-theme table.has-columns-hidden > tbody > tr.detail-show > td span.responsiveExpander:before { color: white; } /* ======================================================================== * BUTTON * ======================================================================== */ .btn-theme { background-color: #8d8d6e; border-color: #8d8d6e; color: white; } .btn-theme:hover, .btn-theme:focus, .btn-theme:active, .btn-theme.active, .btn-theme[disabled], .btn-theme.disabled { background-color: #7f7f63; border-color: transparent; color: white; } .btn-theme.dropdown-toggle.btn-theme { background-color: #8d8d6e; border-color: #7f7f63; color: white; } .btn-theme.btn-alt { background-color: #7f7f63; border: 1px solid #8d8d6e; } .btn-theme.btn-alt:hover { background-color: #707058; } .btn-theme.btn-stroke { border: 1px double #8d8d6e; background-color: transparent; color: #999; } .btn-theme.btn-stroke:hover { background-color: #7f7f63; border-color: transparent; color: white; } .btn-theme.btn-solid { border: 1px solid #8d8d6e; } .btn-theme.btn-dashed { border: 1px dashed #8d8d6e; } .btn-theme.btn-dotted { border: 1px dotted #8d8d6e; } .btn-theme.btn-double { border: 4px double #8d8d6e; } .btn-theme.btn-inset { border: 4px inset #8d8d6e; } .btn-theme.btn-circle { padding-left: 0; padding-right: 0; width: 34px; -webkit-border-radius: 50% 50% 50% 50%; -moz-border-radius: 50% 50% 50% 50%; border-radius: 50% 50% 50% 50%; } .btn-theme.btn-slidedown:after { width: 100%; height: 0; top: 0; left: 0; background-color: #707058; z-index: -1; } .btn-theme.btn-slidedown:hover, .btn-theme.btn-slidedown:active { color: white; } .btn-theme.btn-slidedown:hover:after, .btn-theme.btn-slidedown:active:after { height: 100%; } .btn-theme.btn-slideright:after { width: 0%; height: 100%; top: 0; left: 0; background-color: #707058; z-index: -1; } .btn-theme.btn-slideright:hover, .btn-theme.btn-slideright:active { color: white; } .btn-theme.btn-slideright:hover:after, .btn-theme.btn-slideright:active:after { width: 100%; } .btn-theme.btn-expand:after { width: 0; height: 103%; top: 50%; left: 50%; background-color: #707058; opacity: 0; -webkit-transform: translateX(-50%) translateY(-50%); -moz-transform: translateX(-50%) translateY(-50%); -ms-transform: translateX(-50%) translateY(-50%); -o-transform: translateX(-50%) translateY(-50%); transform: translateX(-50%) translateY(-50%); } .btn-theme.btn-expand:hover:after { width: 90%; opacity: 1; } .btn-theme.btn-expand:active:after { width: 101%; opacity: 1; } .btn-theme.btn-rotate { overflow: hidden; } .btn-theme.btn-rotate:after { width: 100%; height: 0; top: 50%; left: 50%; background-color: #707058; opacity: 0; -webkit-transform: translateX(-50%) translateY(-50%) rotate(45deg); -moz-transform: translateX(-50%) translateY(-50%) rotate(45deg); -ms-transform: translateX(-50%) translateY(-50%) rotate(45deg); -o-transform: translateX(-50%) translateY(-50%) rotate(45deg); transform: translateX(-50%) translateY(-50%) rotate(45deg); } .btn-theme.btn-rotate:hover:after { height: 260%; opacity: 1; } .btn-theme.btn-rotate:active:after { height: 400%; opacity: 1; } .btn-theme.btn-open { overflow: hidden; } .btn-theme.btn-open:after { width: 101%; height: 0; top: 50%; left: 50%; background-color: #707058; opacity: 0; -webkit-transform: translateX(-50%) translateY(-50%); -moz-transform: translateX(-50%) translateY(-50%); -ms-transform: translateX(-50%) translateY(-50%); -o-transform: translateX(-50%) translateY(-50%); transform: translateX(-50%) translateY(-50%); } .btn-theme.btn-open:hover:after { height: 75%; opacity: 1; } .btn-theme.btn-open:active:after { height: 130%; opacity: 1; } .btn-theme.btn-push { background: #8d8d6e; box-shadow: 0 6px #707058; -webkit-transition: none; -moz-transition: none; transition: none; } .btn-theme.btn-push:hover { box-shadow: 0 4px #707058; top: 2px; } .btn-theme.btn-push:active { box-shadow: 0 0 #707058; top: 6px; } .btn-theme.btn-pushright { background: #8d8d6e; box-shadow: 6px 0 #707058; -webkit-transition: none; -moz-transition: none; transition: none; } .btn-theme.btn-pushright:hover { box-shadow: 4px 0 #707058; left: 2px; } .btn-theme.btn-pushright:active { box-shadow: 0 0 #707058; left: 6px; } /* ======================================================================== * PANEL * ======================================================================== */ .panel-theme .panel-heading { background-color: #8d8d6e; border: 1px solid #8a8a6c; color: white; } .panel-theme .panel-heading .option .btn:hover { background-color: #7f7f63; color: white; } .panel-theme .panel-heading .option .btn i { color: white; } .panel-bg-theme .panel-body { background-color: #8d8d6e; color: white; } .panel-bg-theme .panel-body .text-muted { color: #f2f2f2; } /* ======================================================================== * MISC * ======================================================================== */ .img-bordered-theme { border: 2px solid #8d8d6e; } .progress-bar-theme { background-color: #8d8d6e; } .fg-theme { color: #8d8d6e !important; } .nicescroll-rails div { background-color: #8d8d6e !important; } .sidebar .nicescroll-rails div { background-color: #323232 !important; } .cal-month-box { border-top: 7px solid #79795e !important; -webkit-border-radius: 0px; -moz-border-radius: 0px; border-radius: 0px; } .cal-row-head [class*="cal-cell1"], .cal-row-head [class*="cal-cell"] { background-color: #8d8d6e; color: #ffffff; border-width: 0px 1px 0px !important; border-style: solid; border-color: #99997c #99997c #79795e !important; border-left: none !important; } .cal-row-head [class*="cal-cell1"]:hover, .cal-row-head [class*="cal-cell"]:hover { background-color: #8d8d6e !important; } .cal-row-head [class*="cal-cell1"]:first-child, .cal-row-head [class*="cal-cell"]:first-child { border-width: 0px 1px 0px !important; border-style: solid; border-color: #99997c #99997c #79795e !important; } .cal-row-head [class*="cal-cell1"]:last-child, .cal-row-head [class*="cal-cell"]:last-child { border-right: none !important; } #cal-day-panel { border-top: 7px solid #79795e !important; background-color: rgba(255, 255, 255, 0.28); } .cal-day-today { background-color: #8d8d6e !important; } .cal-row-head + .cal-day-hour { background-color: #79795e !important; color: #ffffff; } .bg-theme { background-color: #8d8d6e !important; border: 1px solid #8d8d6e; color: white; } .bg-theme a, .bg-theme i, .bg-theme span, .bg-theme small, .bg-theme p { color: white; } .bg-theme .flot-tick-label.tickLabel { color: rgba(255, 255, 255, 0.5) !important; } .bg-theme .morris-hover-row-label { background-color: #707058; } #back-top:hover { background: #8d8d6e; box-shadow: 0 0 0 6px #ffffff; } .jqvmap-zoomin, .jqvmap-zoomout { background: #8d8d6e !important; } .jqvmap-zoomin:hover, .jqvmap-zoomout:hover { background: #707058 !important; } /* ======================================================================== * CHOSEN * ======================================================================== */ .chosen-container .chosen-results li.highlighted { background-color: #8d8d6e !important; background-image: none !important; } /* ======================================================================== * DROPZONE * ======================================================================== */ .dz-file-preview .dz-details:before { color: #8d8d6e; } /* ======================================================================== * JPRELOADER * ======================================================================== */ #jpreBar { background-color: #8d8d6e; } /* ======================================================================== * DATEPICKER * ======================================================================== */ .datepicker table thead tr:first-child { background-color: #8d8d6e; } .datepicker table thead tr:last-child { background-color: #707058; } .datepicker table thead tr th { background-color: #8d8d6e; border-color: #7f7f63 #7f7f63 #79795e; } .datepicker table thead tr .prev:hover, .datepicker table thead tr .switch:hover, .datepicker table thead tr .next:hover { background-color: #7f7f63 !important; } .datepicker table tbody tr td.active, .datepicker table tbody tr td.active:hover, .datepicker table tbody tr td.active:disabled, .datepicker table tbody tr td.active.disabled:hover { background-color: #8d8d6e; } .datepicker table tbody tr td.active.active { background-color: #8d8d6e; border-top: 1px solid #8d8d6e; border-bottom: 1px solid #8d8d6e; } .datepicker table tbody tr td.active.active:hover { background-color: #707058; } .datepicker .icon-arrow-left:before { font-family: "FontAwesome"; content: "\f104"; } .datepicker .icon-arrow-right:before { font-family: "FontAwesome"; content: "\f105"; } .datepicker-dropdown:after { border-bottom: 6px solid #8d8d6e; } /* ======================================================================== * ION SLIDER * ======================================================================== */ .slider-theme .irs-diapason { background-color: #99997c !important; } .slider-theme .irs-slider { background-color: #8d8d6e !important; } .slider-theme #irs-active-slider, .slider-theme .irs-slider:hover { background-color: #8d8d6e !important; } .slider-theme .irs-from, .slider-theme .irs-to, .slider-theme .irs-single { background-color: #8d8d6e !important; } .slider-theme .irs-from:after, .slider-theme .irs-to:after, .slider-theme .irs-single:after { border-top-color: #8d8d6e !important; } .slider-theme.circle .irs-slider { top: 21px; width: 20px; height: 20px; -webkit-border-radius: 50%; -moz-border-radius: 50%; border-radius: 50%; } .slider-theme.donut .irs-slider { background: #e1e4e9 !important; top: 21px; width: 20px; height: 20px; -webkit-border-radius: 50%; -moz-border-radius: 50%; border-radius: 50%; border: 4px solid #8d8d6e; margin-left: -3px; }
ktarou/sso-poc
sso-server/src/main/webapp/assets/admin/css/themes/antique-bronze.theme.css
CSS
mit
20,940
// Generated by CoffeeScript 1.3.1
trela/qikify
qikify/views/resources/scripts/js/statistics.js
JavaScript
mit
37
package com.jvm_bloggers.core.data_fetching.blog_posts; import akka.actor.ActorRef; import akka.actor.ActorSystem; import akka.routing.RoundRobinPool; import com.jvm_bloggers.core.data_fetching.blogs.PreventConcurrentExecutionSafeguard; import com.jvm_bloggers.core.rss.SyndFeedProducer; import com.jvm_bloggers.entities.blog.Blog; import com.jvm_bloggers.entities.blog.BlogRepository; import com.jvm_bloggers.entities.metadata.Metadata; import com.jvm_bloggers.entities.metadata.MetadataKeys; import com.jvm_bloggers.entities.metadata.MetadataRepository; import com.jvm_bloggers.utils.NowProvider; import lombok.NoArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Component; @Component @NoArgsConstructor public class BlogPostsFetcher { private BlogRepository blogRepository; private ActorRef rssCheckingActor; private MetadataRepository metadataRepository; private NowProvider nowProvider; private PreventConcurrentExecutionSafeguard concurrentExecutionSafeguard = new PreventConcurrentExecutionSafeguard(); @Autowired public BlogPostsFetcher(ActorSystem actorSystem, BlogRepository blogRepository, BlogPostService blogPostService, SyndFeedProducer syndFeedFactory, MetadataRepository metadataRepository, NowProvider nowProvider) { this.blogRepository = blogRepository; final ActorRef blogPostStoringActor = actorSystem .actorOf(NewBlogPostStoringActor.props(blogPostService)); rssCheckingActor = actorSystem.actorOf(new RoundRobinPool(10) .props(RssCheckingActor.props(blogPostStoringActor, syndFeedFactory)), "rss-checkers"); this.metadataRepository = metadataRepository; this.nowProvider = nowProvider; } void refreshPosts() { concurrentExecutionSafeguard.preventConcurrentExecution(this::startFetchingProcess); } @Async("singleThreadExecutor") public void refreshPostsAsynchronously() { refreshPosts(); } private Void startFetchingProcess() { blogRepository.findAllActiveBlogs() .filter(Blog::isActive) .forEach(person -> rssCheckingActor.tell(new RssLink(person), ActorRef.noSender())); final Metadata dateOfLastFetch = metadataRepository .findByName(MetadataKeys.DATE_OF_LAST_FETCHING_BLOG_POSTS); dateOfLastFetch.setValue(nowProvider.now().toString()); metadataRepository.save(dateOfLastFetch); return null; } public boolean isFetchingProcessInProgress() { return concurrentExecutionSafeguard.isExecuting(); } }
jvm-bloggers/jvm-bloggers
src/main/java/com/jvm_bloggers/core/data_fetching/blog_posts/BlogPostsFetcher.java
Java
mit
2,766
--- summary: In our first month of operation, we hired our first two developers, and accomplished a record amount of work on both Bundler and RubyGems.org. --- <% title "April 2015 Monthly Update" %> Hello, everyone! This is the Ruby Together monthly update for April, 2015. This was our first month in operation, and we were able to make a huge amount of progress this month. ## New hires This month, Ruby Together hired André Arko (that's me!) to work on Bundler, which led to the release of several significant new features, detailed in the "New releases" section below. We also hired David Radcliffe, starting to pay him for his work on the RubyGems.org servers and infrastructure. David has worked tirelessly for years to ensure that RubyGems.org stays up to serve gems to the world. As a volunteer, David has spent countless nights and weekends donating his time and expertise to the Ruby community, and he richly deserves to be paid a fair rate for his work that benefits every person and company using Ruby. ## New projects As planned, Ruby Together hired André Arko to continue ongoing maintenance and feature work on Bundler. Next, shortly after our public launch, we were able to form [The RubyGems Partnership](https://rubytogether.org/rubygems) together with [Ruby Central](http://rubycentral.org). As part of that partnership, we have hired [David Radcliffe](http://github.com/dwradcliffe) to support his ongoing maintenance and development work on RubyGems.org. In addition to Bundler and RubyGems, we were able to start supporting the RubyBench.org project by funding the dedicated server that the benchmark suite runs on. Since RubyBench is a benchmarking project, it is vital that the test suite run on its own hardware, and that the hardware always be exactly the same. In the future, we plan to support active development of RubyBench as a valuable community resource. ## Bundler work log The last month included a record number of Bundler releases: we released versions 1.7.14, 1.8.6, 1.8.7, 1.9.0, 1.9.1, 1.9.2, 1.9.3, and 1.9.4. The 1.7.14 fix addressed a couple of small bugs and one regression, and we have since wound down ongoing support work for the 1.7.x release branch. The 1.8.6 and 1.8.7 releases fixed edge cases when installing multiple compiled gems in parallel, updating only the requested gem when multiple gems came from a specific gem server, and fixed a regression that could suppress errors that occurred while Bundler required a gem. The big news, though, was the 1.9 release! Bundler 1.9 is the first version to feature the shiny new dependency resolver Molinillo, written by CocoaPods team member Samuel Giddins. For three months, Ruby Together member Stripe sponsored Samuel to develop a dependency resolver from scratch in Ruby. That project was a rousing success, and the resulting resolver has now shipped in both CocoaPods and Bundler. It's even been [submitted to RubyGems as a pull request](https://github.com/rubygems/rubygems/pull/1189). As a result of this cooperation between all three Ruby projects that manage dependencies, any improvements or bugfixes to the dependency resolver in one of the projects can be shared among all of them. You can [read more about the 1.9 release](http://bundler.io/blog/2015/03/21/hello-bundler-19.html) on the Bundler blog. ## RubyGems.org work log RubyGems.org maintenance this month included several security upgrades, including an upgrade to Ruby version 2.1.6. We also started work on a centralized logging service for all the systems that keep RubyGems.org running, which will be a big help when work needs to be done in the future. Development work included several small fixes and upgrades, while the primary focus was on designing and implementing an upcoming policy change: soon, yanked gems will be deleted rather than simply removed from the main gem index. This change should significantly reduce the number of support tickets that the RubyGems.org team has to answer, and make the entire yanking process act the way that users expect it to. ## Meet the team! This upcoming week, André, David, and several Ruby Together board members will all be attending RailsConf 2015 in Atlanta, GA. As well as attending, André will be giving a talk titled "How Does Bundler Work, Anyway?" on Tuesday, April 21 at 11am in room 204 CDE. If you'll be at the conference, say hello to us—we'll have Ruby Together stickers for you! ## Coming up… During May, the Bundler team will be working on finishing the 1.10 and 1.11 releases, which will include several useful new features and a major optimization to how long it takes to run `bundle install`. Keep an eye out for more about those changes in next month's newsletter. The RubyGems.org team will be working to finish the consolidated logging changes that were started in April, and starting work on revamping the worldwide gem mirrors to use the same automation infrastructure that was just finished for the main site. They'll also be working on implementing the server-side changes that are required for Bundler 1.10 and 1.11. ## New members In the last month, Stripe and Engine Yard joined Ruby Together as founding corporate members. Cloud City Development and Bleacher Report also joined as corporate members. 66 individual members also joined Ruby Together, including Tony Pitale, Mark Turner, Pat Allan, Becker, Sean Linsley, Carol (Nichols || Goulding), Youssef Chaker, Todd Eichel, John Wulff, Fred Jean, Zee Spencer, Luis Lavena, George Sheppard, David Hill, Josh Kaufman, Chris McGrath, Christopher Eckhardt, Derik Olsson, Henrik Hodne, Corey Csuhta, Jeremy Hinegardner, Philip Arndt, Andy Croll, Piotr Solnica, Andrew Broman, Justin Etheredge, Piotr Szotkowski, Tiago Amaro, Andrew White, Ezekiel Templin, Matt Jones, Garrett Dimon, Alexey Mogilnikov, Joe James, Mykola Kyryk, Mariusz Droździel, Dan Wagner, David Elliott, Ender Ahmet Yurt, Dan Fockler, Jason Waldrip, Ryan Clark, Joel Watson, Ching-Yen Ricky Pai, Badri Janakiraman, Matt Pruitt, and Jeremy Green. Thanks for the support, everyone! If your company hasn't joined Ruby Together yet, let them know about it! Ruby Together is both [good and good for companies](https://rubytogether.org/companies), and we'll be able to do more for the community as more companies join us. Until next time, André & the Ruby Together team
rubytogether/rubytogether.org
app/views/news/2015-04-19-april-2015-monthly-update.html.md
Markdown
mit
6,373
'use strict'; require('../common'); // This test ensures that zlib throws a RangeError if the final buffer needs to // be larger than kMaxLength and concatenation fails. // https://github.com/nodejs/node/pull/1811 const assert = require('assert'); // Change kMaxLength for zlib to trigger the error without having to allocate // large Buffers. const buffer = require('buffer'); const oldkMaxLength = buffer.kMaxLength; buffer.kMaxLength = 64; const zlib = require('zlib'); buffer.kMaxLength = oldkMaxLength; const encoded = Buffer.from('G38A+CXCIrFAIAM=', 'base64'); // Async zlib.brotliDecompress(encoded, function(err) { assert.ok(err instanceof RangeError); }); // Sync assert.throws(function() { zlib.brotliDecompressSync(encoded); }, RangeError);
enclose-io/compiler
current/test/parallel/test-zlib-brotli-kmaxlength-rangeerror.js
JavaScript
mit
762
const {createAddColumnMigration} = require('../../utils'); module.exports = createAddColumnMigration('posts_meta', 'email_only', { type: 'bool', nullable: false, defaultTo: false });
ErisDS/Ghost
core/server/data/migrations/versions/4.12/01-add-email-only-column-to-posts-meta-table.js
JavaScript
mit
196
import { EventsKey } from '../events'; import BaseEvent from '../events/Event'; import { Extent } from '../extent'; import Feature from '../Feature'; import Geometry from '../geom/Geometry'; import Point from '../geom/Point'; import { ObjectEvent } from '../Object'; import Projection from '../proj/Projection'; import { AttributionLike } from './Source'; import VectorSource, { VectorSourceEvent } from './Vector'; export interface Options { attributions?: AttributionLike; distance?: number; geometryFunction?: (p0: Feature<Geometry>) => Point; source?: VectorSource<Geometry>; wrapX?: boolean; } export default class Cluster extends VectorSource { constructor(options: Options); protected distance: number; protected features: Feature<Geometry>[]; protected geometryFunction: (feature: Feature<Geometry>) => Point; protected resolution: number; protected cluster(): void; protected createCluster(features: Feature<Geometry>[]): Feature<Geometry>; /** * Remove all features from the source. */ clear(opt_fast?: boolean): void; /** * Get the distance in pixels between clusters. */ getDistance(): number; getResolutions(): number[] | undefined; /** * Get a reference to the wrapped source. */ getSource(): VectorSource<Geometry>; loadFeatures(extent: Extent, resolution: number, projection: Projection): void; /** * Handle the source changing. */ refresh(): void; /** * Set the distance in pixels between clusters. */ setDistance(distance: number): void; /** * Replace the wrapped source. */ setSource(source: VectorSource<Geometry>): void; on(type: string | string[], listener: (p0: any) => any): EventsKey | EventsKey[]; once(type: string | string[], listener: (p0: any) => any): EventsKey | EventsKey[]; un(type: string | string[], listener: (p0: any) => any): void; on(type: 'addfeature', listener: (evt: VectorSourceEvent<Geometry>) => void): EventsKey; once(type: 'addfeature', listener: (evt: VectorSourceEvent<Geometry>) => void): EventsKey; un(type: 'addfeature', listener: (evt: VectorSourceEvent<Geometry>) => void): void; on(type: 'change', listener: (evt: BaseEvent) => void): EventsKey; once(type: 'change', listener: (evt: BaseEvent) => void): EventsKey; un(type: 'change', listener: (evt: BaseEvent) => void): void; on(type: 'changefeature', listener: (evt: VectorSourceEvent<Geometry>) => void): EventsKey; once(type: 'changefeature', listener: (evt: VectorSourceEvent<Geometry>) => void): EventsKey; un(type: 'changefeature', listener: (evt: VectorSourceEvent<Geometry>) => void): void; on(type: 'clear', listener: (evt: VectorSourceEvent<Geometry>) => void): EventsKey; once(type: 'clear', listener: (evt: VectorSourceEvent<Geometry>) => void): EventsKey; un(type: 'clear', listener: (evt: VectorSourceEvent<Geometry>) => void): void; on(type: 'error', listener: (evt: BaseEvent) => void): EventsKey; once(type: 'error', listener: (evt: BaseEvent) => void): EventsKey; un(type: 'error', listener: (evt: BaseEvent) => void): void; on(type: 'featuresloadend', listener: (evt: VectorSourceEvent<Geometry>) => void): EventsKey; once(type: 'featuresloadend', listener: (evt: VectorSourceEvent<Geometry>) => void): EventsKey; un(type: 'featuresloadend', listener: (evt: VectorSourceEvent<Geometry>) => void): void; on(type: 'featuresloaderror', listener: (evt: VectorSourceEvent<Geometry>) => void): EventsKey; once(type: 'featuresloaderror', listener: (evt: VectorSourceEvent<Geometry>) => void): EventsKey; un(type: 'featuresloaderror', listener: (evt: VectorSourceEvent<Geometry>) => void): void; on(type: 'featuresloadstart', listener: (evt: VectorSourceEvent<Geometry>) => void): EventsKey; once(type: 'featuresloadstart', listener: (evt: VectorSourceEvent<Geometry>) => void): EventsKey; un(type: 'featuresloadstart', listener: (evt: VectorSourceEvent<Geometry>) => void): void; on(type: 'propertychange', listener: (evt: ObjectEvent) => void): EventsKey; once(type: 'propertychange', listener: (evt: ObjectEvent) => void): EventsKey; un(type: 'propertychange', listener: (evt: ObjectEvent) => void): void; on(type: 'removefeature', listener: (evt: VectorSourceEvent<Geometry>) => void): EventsKey; once(type: 'removefeature', listener: (evt: VectorSourceEvent<Geometry>) => void): EventsKey; un(type: 'removefeature', listener: (evt: VectorSourceEvent<Geometry>) => void): void; }
georgemarshall/DefinitelyTyped
types/ol/source/Cluster.d.ts
TypeScript
mit
4,599
<?php require_once($argv[1]); // type.php require_once($argv[2]); // program.php $file_prefix = $argv[3]; ?> [apps..default] run = true count = 1 network.server.0.RPC_CHANNEL_TCP = NET_HDR_HTTP, dsn::tools::asio_network_provider, 65536 [apps.server] name = server type = server arguments = ports = 27001 run = true pools = THREAD_POOL_DEFAULT [apps.client] name = client type = client arguments = localhost 27001 count = 0 run = true pools = THREAD_POOL_DEFAULT <?php foreach ($_PROG->services as $svc) { ?> [apps.client.perf.<?=$svc->name?>] name = client.perf.<?=$svc->name?> type = client.perf.<?=$svc->name?> arguments = localhost 27001 count = 1 run = false <?php } ?> [core] ;tool = simulator tool = nativerun ;toollets = tracer ;toollets = tracer, profiler, fault_injector pause_on_start = false logging_factory_name = dsn::tools::screen_logger [tools.simulator] random_seed = 0 [network] ; how many network threads for network library(used by asio) io_service_worker_count = 2 ; specification for each thread pool [threadpool..default] [threadpool.THREAD_POOL_DEFAULT] name = default partitioned = false worker_count = 1 max_input_queue_length = 1024 worker_priority = THREAD_xPRIORITY_NORMAL [task..default] is_trace = true is_profile = true allow_inline = false rpc_call_channel = RPC_CHANNEL_TCP fast_execution_in_network_thread = false rpc_call_header_format_name = dsn rpc_timeout_milliseconds = 5000 perf_test_rounds = 10000 rpc_call_header_format = NET_HDR_HTTP [task.LPC_AIO_IMMEDIATE_CALLBACK] is_trace = false is_profile = false allow_inline = false [task.LPC_RPC_TIMEOUT] is_trace = false is_profile = false
glglwty/rDSN
bin/dsn.templates/js/single/config.ini.php
PHP
mit
1,649
package tenant import ( "context" "testing" "github.com/google/go-cmp/cmp" "github.com/influxdata/influxdb/v2" influxdbcontext "github.com/influxdata/influxdb/v2/context" "github.com/influxdata/influxdb/v2/kit/feature" "github.com/influxdata/influxdb/v2/kit/platform" "github.com/influxdata/influxdb/v2/kit/platform/errors" kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" "github.com/influxdata/influxdb/v2/mock" influxdbtesting "github.com/influxdata/influxdb/v2/testing" ) var idOne platform.ID = 1 var idTwo platform.ID = 2 var idThree platform.ID = 3 func TestURMService_FindUserResourceMappings(t *testing.T) { type fields struct { UserResourceMappingService influxdb.UserResourceMappingService OrgService influxdb.OrganizationService } type args struct { permissions []influxdb.Permission } type wants struct { err error urms []*influxdb.UserResourceMapping } tests := []struct { name string fields fields args args wants wants }{ { name: "authorized to see all users", fields: fields{ UserResourceMappingService: &mock.UserResourceMappingService{ FindMappingsFn: func(ctx context.Context, filter influxdb.UserResourceMappingFilter) ([]*influxdb.UserResourceMapping, int, error) { return []*influxdb.UserResourceMapping{ { ResourceID: 1, ResourceType: influxdb.BucketsResourceType, }, { ResourceID: 2, ResourceType: influxdb.BucketsResourceType, }, { ResourceID: 3, ResourceType: influxdb.BucketsResourceType, }, }, 3, nil }, }, }, args: args{ permissions: []influxdb.Permission{ { Action: "read", Resource: influxdb.Resource{ Type: influxdb.OrgsResourceType, ID: influxdbtesting.IDPtr(10), }, }, { Action: "read", Resource: influxdb.Resource{ Type: influxdb.BucketsResourceType, // ID: &idOne, OrgID: influxdbtesting.IDPtr(10), }, }, { Action: "read", Resource: influxdb.Resource{ Type: influxdb.BucketsResourceType, OrgID: influxdbtesting.IDPtr(10), }, }, { Action: "read", Resource: influxdb.Resource{ Type: influxdb.BucketsResourceType, OrgID: influxdbtesting.IDPtr(10), }, }, }, }, wants: wants{ urms: []*influxdb.UserResourceMapping{ { ResourceID: 1, ResourceType: influxdb.BucketsResourceType, }, { ResourceID: 2, ResourceType: influxdb.BucketsResourceType, }, { ResourceID: 3, ResourceType: influxdb.BucketsResourceType, }, }, }, }, { name: "authorized to see all users by org auth", fields: fields{ UserResourceMappingService: &mock.UserResourceMappingService{ FindMappingsFn: func(ctx context.Context, filter influxdb.UserResourceMappingFilter) ([]*influxdb.UserResourceMapping, int, error) { return []*influxdb.UserResourceMapping{ { ResourceID: 1, ResourceType: influxdb.BucketsResourceType, }, { ResourceID: 2, ResourceType: influxdb.BucketsResourceType, }, { ResourceID: 3, ResourceType: influxdb.BucketsResourceType, }, }, 3, nil }, }, }, args: args{ permissions: []influxdb.Permission{ { Action: "read", Resource: influxdb.Resource{ Type: influxdb.BucketsResourceType, OrgID: influxdbtesting.IDPtr(10), }, }, }, }, wants: wants{ err: ErrNotFound, }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { s := NewAuthedURMService(tt.fields.OrgService, tt.fields.UserResourceMappingService) orgID := influxdbtesting.IDPtr(10) ctx := context.WithValue(context.Background(), kithttp.CtxOrgKey, *orgID) ctx = influxdbcontext.SetAuthorizer(ctx, mock.NewMockAuthorizer(false, tt.args.permissions)) ctx, _ = feature.Annotate(ctx, feature.DefaultFlagger(), feature.MakeBoolFlag("Org Only Member list", "orgOnlyMemberList", "Compute Team", true, feature.Temporary, false, )) urms, _, err := s.FindUserResourceMappings(ctx, influxdb.UserResourceMappingFilter{}) influxdbtesting.ErrorsEqual(t, err, tt.wants.err) if diff := cmp.Diff(urms, tt.wants.urms); diff != "" { t.Errorf("urms are different -got/+want\ndiff %s", diff) } }) } } func TestURMService_FindUserResourceMappingsBucketAuth(t *testing.T) { type fields struct { UserResourceMappingService influxdb.UserResourceMappingService OrgService influxdb.OrganizationService } type args struct { permissions []influxdb.Permission } type wants struct { err error urms []*influxdb.UserResourceMapping } tests := []struct { name string fields fields args args wants wants }{ { name: "authorized to see all users by bucket auth", fields: fields{ UserResourceMappingService: &mock.UserResourceMappingService{ FindMappingsFn: func(ctx context.Context, filter influxdb.UserResourceMappingFilter) ([]*influxdb.UserResourceMapping, int, error) { return []*influxdb.UserResourceMapping{ { ResourceID: 1, ResourceType: influxdb.BucketsResourceType, }, { ResourceID: 2, ResourceType: influxdb.BucketsResourceType, }, { ResourceID: 3, ResourceType: influxdb.BucketsResourceType, }, }, 3, nil }, }, }, args: args{ permissions: []influxdb.Permission{ { Action: "read", Resource: influxdb.Resource{ Type: influxdb.BucketsResourceType, ID: &idOne, }, }, { Action: "read", Resource: influxdb.Resource{ Type: influxdb.BucketsResourceType, ID: &idTwo, }, }, { Action: "read", Resource: influxdb.Resource{ Type: influxdb.BucketsResourceType, ID: &idThree, }, }, }, }, wants: wants{ urms: []*influxdb.UserResourceMapping{ { ResourceID: 1, ResourceType: influxdb.BucketsResourceType, }, { ResourceID: 2, ResourceType: influxdb.BucketsResourceType, }, { ResourceID: 3, ResourceType: influxdb.BucketsResourceType, }, }, }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { s := NewAuthedURMService(tt.fields.OrgService, tt.fields.UserResourceMappingService) ctx := context.Background() ctx = influxdbcontext.SetAuthorizer(ctx, mock.NewMockAuthorizer(false, tt.args.permissions)) urms, _, err := s.FindUserResourceMappings(ctx, influxdb.UserResourceMappingFilter{}) influxdbtesting.ErrorsEqual(t, err, tt.wants.err) if diff := cmp.Diff(urms, tt.wants.urms); diff != "" { t.Errorf("urms are different -got/+want\ndiff %s", diff) } }) } } func TestURMService_WriteUserResourceMapping(t *testing.T) { type fields struct { UserResourceMappingService influxdb.UserResourceMappingService OrgService influxdb.OrganizationService } type args struct { permission influxdb.Permission } type wants struct { err error } tests := []struct { name string fields fields args args wants wants }{ { name: "authorized to write urm", fields: fields{ UserResourceMappingService: &mock.UserResourceMappingService{ CreateMappingFn: func(ctx context.Context, m *influxdb.UserResourceMapping) error { return nil }, DeleteMappingFn: func(ctx context.Context, rid, uid platform.ID) error { return nil }, FindMappingsFn: func(ctx context.Context, filter influxdb.UserResourceMappingFilter) ([]*influxdb.UserResourceMapping, int, error) { return []*influxdb.UserResourceMapping{ { ResourceID: 1, ResourceType: influxdb.BucketsResourceType, UserID: 100, }, }, 3, nil }, }, }, args: args{ permission: influxdb.Permission{ Action: "write", Resource: influxdb.Resource{ Type: influxdb.BucketsResourceType, ID: &idOne, OrgID: influxdbtesting.IDPtr(10), }, }, }, wants: wants{ err: nil, }, }, { name: "unauthorized to write urm", fields: fields{ UserResourceMappingService: &mock.UserResourceMappingService{ CreateMappingFn: func(ctx context.Context, m *influxdb.UserResourceMapping) error { return nil }, DeleteMappingFn: func(ctx context.Context, rid, uid platform.ID) error { return nil }, FindMappingsFn: func(ctx context.Context, filter influxdb.UserResourceMappingFilter) ([]*influxdb.UserResourceMapping, int, error) { return []*influxdb.UserResourceMapping{ { ResourceID: 1, ResourceType: influxdb.BucketsResourceType, UserID: 100, }, }, 3, nil }, }, }, args: args{ permission: influxdb.Permission{ Action: "write", Resource: influxdb.Resource{ Type: influxdb.BucketsResourceType, OrgID: influxdbtesting.IDPtr(11), }, }, }, wants: wants{ err: &errors.Error{ Msg: "write:buckets/0000000000000001 is unauthorized", Code: errors.EUnauthorized, }, }, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { s := NewAuthedURMService(tt.fields.OrgService, tt.fields.UserResourceMappingService) ctx := context.Background() ctx = influxdbcontext.SetAuthorizer(ctx, mock.NewMockAuthorizer(false, []influxdb.Permission{tt.args.permission})) t.Run("create urm", func(t *testing.T) { err := s.CreateUserResourceMapping(ctx, &influxdb.UserResourceMapping{ResourceType: influxdb.BucketsResourceType, ResourceID: 1}) influxdbtesting.ErrorsEqual(t, err, tt.wants.err) }) t.Run("delete urm", func(t *testing.T) { err := s.DeleteUserResourceMapping(ctx, 1, 100) influxdbtesting.ErrorsEqual(t, err, tt.wants.err) }) }) } }
influxdb/influxdb
tenant/middleware_urm_auth_test.go
GO
mit
10,152
package com.lichkin.framework.springboot.controllers.impl; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; import com.lichkin.framework.bases.LKDatas; import com.lichkin.framework.bases.annotations.WithOutLogin; import com.lichkin.framework.springboot.controllers.LKController; /** * 页面跳转逻辑 * @author SuZhou LichKin Information Technology Co., Ltd. */ @Controller @RequestMapping(value = "/demo") public class LKDemoController extends LKController { /** * 页面跳转 * @param requestDatas 请求参数,由框架自动解析请求的参数并注入。 * @param subUrl 子路径 * @return 页面路径,附带了请求参数及请求路径的相关信息。 */ @WithOutLogin @RequestMapping(value = "/{subUrl}.html", method = RequestMethod.GET) public ModelAndView toGo(final LKDatas requestDatas, @PathVariable(value = "subUrl") final String subUrl) { return getModelAndView(requestDatas); } }
china-zhuangxuxin/LKFramework
lichkin-springboot-demos/lichkin-springboot-demo-web/src/main/java/com/lichkin/framework/springboot/controllers/impl/LKDemoController.java
Java
mit
1,209
//currently commented out as TokenTester is causing a OOG error due to the Factory being too big //Not fully needed as factory & separate tests cover token creation. /*contract("TokenTester", function(accounts) { it("creates 10000 initial tokens", function(done) { var tester = TokenTester.at(TokenTester.deployed_address); tester.tokenContractAddress.call() .then(function(tokenContractAddr) { var tokenContract = HumanStandardToken.at(tokenContractAddr); return tokenContract.balanceOf.call(TokenTester.deployed_address); }).then(function (result) { assert.strictEqual(result.toNumber(), 10000); // 10000 as specified in TokenTester.sol done(); }).catch(done); }); //todo:add test on retrieving addresses });*/
PlutusIt/PlutusDEX
test/tokenTester.js
JavaScript
mit
816
module.exports = { "extends": "airbnb", "parser": "babel-eslint", "plugins": [ "react" ], "rules": { "react/prop-types": 0, "react/jsx-boolean-value": 0, "consistent-return": 0, "guard-for-in": 0, "no-use-before-define": 0, "space-before-function-paren": [2, { "anonymous": "never", "named": "always" }] } };
danieloliveira079/healthy-life-app-v1
.eslintrc.js
JavaScript
mit
351
package au.com.codeka.planetrender; import java.util.Random; import au.com.codeka.common.PerlinNoise; import au.com.codeka.common.Vector2; import au.com.codeka.common.Vector3; /** * This class takes a ray that's going in a certain direction and warps it based on a noise pattern. This is used * to generate misshapen asteroid images, for example. */ public class RayWarper { private NoiseGenerator mNoiseGenerator; private double mWarpFactor; public RayWarper(Template.WarpTemplate tmpl, Random rand) { if (tmpl.getNoiseGenerator() == Template.WarpTemplate.NoiseGenerator.Perlin) { mNoiseGenerator = new PerlinGenerator(tmpl, rand); } else if (tmpl.getNoiseGenerator() == Template.WarpTemplate.NoiseGenerator.Spiral) { mNoiseGenerator = new SpiralGenerator(tmpl, rand); } mWarpFactor = tmpl.getWarpFactor(); } public void warp(Vector3 vec, double u, double v) { mNoiseGenerator.warp(vec, u, v, mWarpFactor); } static abstract class NoiseGenerator { protected double getNoise(double u, double v) { return 0.0; } protected Vector3 getValue(double u, double v) { double x = getNoise(u * 0.25, v * 0.25); double y = getNoise(0.25 + u * 0.25, v * 0.25); double z = getNoise(u * 0.25, 0.25 + v * 0.25); return Vector3.pool.borrow().reset(x, y, z); } protected void warp(Vector3 vec, double u, double v, double factor) { Vector3 warpVector = getValue(u, v); warpVector.reset(warpVector.x * factor + (1.0 - factor), warpVector.y * factor + (1.0 - factor), warpVector.z * factor + (1.0 - factor)); vec.reset(vec.x * warpVector.x, vec.y * warpVector.y, vec.z * warpVector.z); Vector3.pool.release(warpVector); } } static class PerlinGenerator extends NoiseGenerator { private PerlinNoise mNoise; public PerlinGenerator(Template.WarpTemplate tmpl, Random rand) { mNoise = new TemplatedPerlinNoise(tmpl.getParameter(Template.PerlinNoiseTemplate.class), rand); } @Override public double getNoise(double u, double v) { return mNoise.getNoise(u, v); } } static class SpiralGenerator extends NoiseGenerator { public SpiralGenerator(Template.WarpTemplate tmpl, Random rand) { } @Override protected void warp(Vector3 vec, double u, double v, double factor) { Vector2 uv = Vector2.pool.borrow().reset(u, v); uv.rotate(factor * uv.length() * 2.0 * Math.PI * 2.0 / 360.0); vec.reset(uv.x, -uv.y, 1.0); Vector2.pool.release(uv); } } }
jife94/wwmmo
planet-render/src/au/com/codeka/planetrender/RayWarper.java
Java
mit
2,860
body { overflow-x: hidden; font-family: "Roboto Slab", "Helvetica Neue", Helvetica, Arial, sans-serif } .text-muted { color: #777 } .text-primary { color: #fed136 } p { font-size: 14px; line-height: 1.75 } p.large { font-size: 16px } a, a:hover, a:focus, a:active, a.active { outline: 0 } a { color: #fed136 } a:hover, a:focus, a:active, a.active { color: #fec503 } h1, h2, h3, h4, h5, h6 { font-family: Montserrat, "Helvetica Neue", Helvetica, Arial, sans-serif; text-transform: uppercase; font-weight: 700 } .img-centered { margin: 0 auto } .bg-light-gray { background-color: #f7f7f7 } .bg-darkest-gray { background-color: #222 } .btn-primary { color: #fff; background-color: #fed136; border-color: #fed136; font-family: Montserrat, "Helvetica Neue", Helvetica, Arial, sans-serif; text-transform: uppercase; font-weight: 700 } .btn-primary:hover, .btn-primary:focus, .btn-primary:active, .btn-primary.active, .open .dropdown-toggle.btn-primary { color: #fff; background-color: #fec503; border-color: #f6bf01 } .btn-primary:active, .btn-primary.active, .open .dropdown-toggle.btn-primary { background-image: none } .btn-primary.disabled, .btn-primary[disabled], fieldset[disabled] .btn-primary, .btn-primary.disabled:hover, .btn-primary[disabled]:hover, fieldset[disabled] .btn-primary:hover, .btn-primary.disabled:focus, .btn-primary[disabled]:focus, fieldset[disabled] .btn-primary:focus, .btn-primary.disabled:active, .btn-primary[disabled]:active, fieldset[disabled] .btn-primary:active, .btn-primary.disabled.active, .btn-primary[disabled].active, fieldset[disabled] .btn-primary.active { background-color: #fed136; border-color: #fed136 } .btn-primary .badge { color: #fed136; background-color: #fff } .btn-xl { color: #fff; background-color: #fed136; border-color: #fed136; font-family: Montserrat, "Helvetica Neue", Helvetica, Arial, sans-serif; text-transform: uppercase; font-weight: 700; border-radius: 3px; font-size: 18px; padding: 20px 40px; margin-top: 110px } .btn-xl:hover, .btn-xl:focus, .btn-xl:active, .btn-xl.active, .open .dropdown-toggle.btn-xl { color: #fff; background-color: #fec503; border-color: #f6bf01 } .btn-xl:active, .btn-xl.active, .open .dropdown-toggle.btn-xl { background-image: none } .btn-xl.disabled, .btn-xl[disabled], fieldset[disabled] .btn-xl, .btn-xl.disabled:hover, .btn-xl[disabled]:hover, fieldset[disabled] .btn-xl:hover, .btn-xl.disabled:focus, .btn-xl[disabled]:focus, fieldset[disabled] .btn-xl:focus, .btn-xl.disabled:active, .btn-xl[disabled]:active, fieldset[disabled] .btn-xl:active, .btn-xl.disabled.active, .btn-xl[disabled].active, fieldset[disabled] .btn-xl.active { background-color: #fed136; border-color: #fed136 } .btn-xl .badge { color: #fed136; background-color: #fff } .navbar-default { background-color: #222; border-color: transparent } .navbar-default .navbar-brand { color: #fed136; font-family: "Kaushan Script", "Helvetica Neue", Helvetica, Arial, cursive } .navbar-default .navbar-brand:hover, .navbar-default .navbar-brand:focus, .navbar-default .navbar-brand:active, .navbar-default .navbar-brand.active { color: #fec503 } .navbar-default .navbar-collapse { border-color: rgba(255, 255, 255, .02) } .navbar-default .navbar-toggle { background-color: #fed136; border-color: #fed136 } .navbar-default .navbar-toggle .icon-bar { background-color: #fff } .navbar-default .navbar-toggle:hover, .navbar-default .navbar-toggle:focus { background-color: #fed136 } .navbar-default .nav li a { font-family: Montserrat, "Helvetica Neue", Helvetica, Arial, sans-serif; text-transform: uppercase; font-weight: 400; letter-spacing: 1px; color: #fff } .navbar-default .nav li a:hover, .navbar-default .nav li a:focus { color: #fed136; outline: 0 } .navbar-default .navbar-nav>.active>a { border-radius: 0; color: #fff; background-color: #fed136 } .navbar-default .navbar-nav>.active>a:hover, .navbar-default .navbar-nav>.active>a:focus { color: #fff; background-color: #fec503 } @media (min-width:768px) { .navbar-default { background-color: transparent; padding: 25px 0; -webkit-transition: padding .3s; -moz-transition: padding .3s; transition: padding .3s; border: 0 } .navbar-default .navbar-brand { font-size: 2em; -webkit-transition: all .3s; -moz-transition: all .3s; transition: all .3s } .navbar-default .navbar-nav>.active>a { border-radius: 3px } .navbar-default.navbar-shrink { background-color: #51749a; padding: 10px 0 } .navbar-default.navbar-shrink .navbar-brand { font-size: 1.5em } } header { background-image: url(../img/header-bg.jpg); background-repeat: none; background-attachment: scroll; background-position: center center; -webkit-background-size: cover; -moz-background-size: cover; background-size: cover; -o-background-size: cover; text-align: center; color: #fff } header .intro-text { padding-top: 100px; padding-bottom: 50px } header .intro-text .intro-lead-in { font-family: "Droid Serif", "Helvetica Neue", Helvetica, Arial, sans-serif; font-style: italic; font-size: 22px; line-height: 22px; margin-bottom: 25px } header .intro-text .intro-heading { font-family: Montserrat, "Helvetica Neue", Helvetica, Arial, sans-serif; font-weight: 200; font-size: 20px; line-height: 20px; margin-bottom: 15px } @media (min-width:768px) { header .intro-text { padding-top: 300px; padding-bottom: 200px } header .intro-text .intro-lead-in { font-family: "Droid Serif", "Helvetica Neue", Helvetica, Arial, sans-serif; font-style: italic; font-size: 40px; line-height: 40px; margin-bottom: 25px } header .intro-text .intro-heading { font-family: Montserrat, "Helvetica Neue", Helvetica, Arial, sans-serif; font-weight: 200; font-size: 20px; line-height: 20px; margin-bottom: 15px } } section { padding: 50px 0 } section h2.section-heading { font-size: 40px; margin-top: 50px; margin-bottom: 15px } section h3.section-subheading { font-size: 16px; font-family: "Droid Serif", "Helvetica Neue", Helvetica, Arial, sans-serif; text-transform: none; font-style: italic; font-weight: 400; margin-bottom: 75px } @media (min-width:768px) { section { padding: 50px 0 } } .service-heading { margin: 15px 0; text-transform: none } .services-text-color { color: #fec503; font-style: bold; font-weight: 700;} #portfolio .portfolio-item { margin: 0 0 15px; right: 0 } #portfolio .portfolio-item .portfolio-link { display: block; position: relative; max-width: 400px; margin: 0 auto } #portfolio .portfolio-item .portfolio-link .portfolio-hover { background: rgba(254, 209, 54, .9); position: absolute; width: 100%; height: 100%; opacity: 0; transition: all ease .5s; -webkit-transition: all ease .5s; -moz-transition: all ease .5s } #portfolio .portfolio-item .portfolio-link .portfolio-hover:hover { opacity: 1 } #portfolio .portfolio-item .portfolio-link .portfolio-hover .portfolio-hover-content { position: absolute; width: 100%; height: 20px; font-size: 20px; text-align: center; top: 50%; margin-top: -12px; color: #fff } #portfolio .portfolio-item .portfolio-link .portfolio-hover .portfolio-hover-content i { margin-top: -12px } #portfolio .portfolio-item .portfolio-link .portfolio-hover .portfolio-hover-content h3, #portfolio .portfolio-item .portfolio-link .portfolio-hover .portfolio-hover-content h4 { margin: 0 } #portfolio .portfolio-item .portfolio-caption { max-width: 400px; margin: 0 auto; background-color: #fff; text-align: center; padding: 25px } #portfolio .portfolio-item .portfolio-caption h4 { text-transform: none; margin: 0 } #portfolio .portfolio-item .portfolio-caption p { font-family: "Droid Serif", "Helvetica Neue", Helvetica, Arial, sans-serif; font-style: italic; font-size: 16px; margin: 0 } #portfolio * { z-index: 2 } @media (min-width:767px) { #portfolio .portfolio-item { margin: 0 0 30px } } .timeline { list-style: none; padding: 0; position: relative } .timeline:before { top: 0; bottom: 0; position: absolute; content: ""; width: 2px; background-color: #f1f1f1; left: 40px; margin-left: -1.5px } .timeline>li { margin-bottom: 50px; position: relative; min-height: 50px } .timeline>li:before, .timeline>li:after { content: " "; display: table } .timeline>li:after { clear: both } .timeline>li .timeline-panel { width: 100%; float: right; padding: 0 20px 0 100px; position: relative; text-align: left } .timeline>li .timeline-panel:before { border-left-width: 0; border-right-width: 15px; left: -15px; right: auto } .timeline>li .timeline-panel:after { border-left-width: 0; border-right-width: 14px; left: -14px; right: auto } .timeline>li .timeline-image { left: 0; margin-left: 0; width: 80px; height: 80px; position: absolute; z-index: 100; background-color: #fed136; color: #fff; border-radius: 100%; border: 7px solid #f1f1f1; text-align: center } .timeline>li .timeline-image h4 { font-size: 10px; margin-top: 12px; line-height: 14px } .timeline>li.timeline-inverted>.timeline-panel { float: right; text-align: left; padding: 0 20px 0 100px } .timeline>li.timeline-inverted>.timeline-panel:before { border-left-width: 0; border-right-width: 15px; left: -15px; right: auto } .timeline>li.timeline-inverted>.timeline-panel:after { border-left-width: 0; border-right-width: 14px; left: -14px; right: auto } .timeline>li:last-child { margin-bottom: 0 } .timeline .timeline-heading h4 { margin-top: 0; color: inherit } .timeline .timeline-heading h4.subheading { text-transform: none } .timeline .timeline-body>p, .timeline .timeline-body>ul { margin-bottom: 0 } @media (min-width:768px) { .timeline:before { left: 50% } .timeline>li { margin-bottom: 100px; min-height: 100px } .timeline>li .timeline-panel { width: 41%; float: left; padding: 0 20px 20px 30px; text-align: right } .timeline>li .timeline-image { width: 100px; height: 100px; left: 50%; margin-left: -50px } .timeline>li .timeline-image h4 { font-size: 13px; margin-top: 16px; line-height: 18px } .timeline>li.timeline-inverted>.timeline-panel { float: right; text-align: left; padding: 0 30px 20px 20px } } @media (min-width:992px) { .timeline>li { min-height: 150px } .timeline>li .timeline-panel { padding: 0 20px 20px } .timeline>li .timeline-image { width: 150px; height: 150px; margin-left: -75px } .timeline>li .timeline-image h4 { font-size: 18px; margin-top: 30px; line-height: 26px } .timeline>li.timeline-inverted>.timeline-panel { padding: 0 20px 20px } } @media (min-width:1200px) { .timeline>li { min-height: 170px } .timeline>li .timeline-panel { padding: 0 20px 20px 100px } .timeline>li .timeline-image { width: 170px; height: 170px; margin-left: -85px } .timeline>li .timeline-image h4 { margin-top: 40px } .timeline>li.timeline-inverted>.timeline-panel { padding: 0 100px 20px 20px } } .team-member { text-align: center; margin-bottom: 50px } .team-member img { margin: 0 auto; border: 7px solid #fff } .team-member h4 { margin-top: 25px; margin-bottom: 0; text-transform: none } .team-member p { margin-top: 0 } aside.clients img { margin: 50px auto } section#contact { background-color: #374e68; } section#contact .section-heading { color: #fff } section#contact .form-group { margin-bottom: 25px } section#contact .form-group input, section#contact .form-group textarea { padding: 20px; } section#contact .form-group input.form-control { height: auto } section#contact .form-group textarea.form-control { height: 236px } section#contact .form-control:focus { border-color: #fed136; box-shadow: none } section#contact::-webkit-input-placeholder { font-family: Montserrat, "Helvetica Neue", Helvetica, Arial, sans-serif; text-transform: uppercase; font-weight: 700; color: #bbb } section#contact:-moz-placeholder { font-family: Montserrat, "Helvetica Neue", Helvetica, Arial, sans-serif; text-transform: uppercase; font-weight: 700; color: #bbb } section#contact::-moz-placeholder { font-family: Montserrat, "Helvetica Neue", Helvetica, Arial, sans-serif; text-transform: uppercase; font-weight: 700; color: #bbb } section#contact:-ms-input-placeholder { font-family: Montserrat, "Helvetica Neue", Helvetica, Arial, sans-serif; text-transform: uppercase; font-weight: 700; color: #bbb } section#contact .text-danger { color: #e74c3c } footer { padding: 25px 0; text-align: center } footer span.copyright { line-height: 40px; font-family: Montserrat, "Helvetica Neue", Helvetica, Arial, sans-serif; text-transform: uppercase; text-transform: none } footer ul.quicklinks { margin-bottom: 0; line-height: 40px; font-family: Montserrat, "Helvetica Neue", Helvetica, Arial, sans-serif; text-transform: uppercase; text-transform: none } ul.social-buttons { margin-bottom: 0 } ul.social-buttons li a { display: block; background-color: #222; height: 40px; width: 40px; border-radius: 100%; font-size: 20px; line-height: 40px; color: #fff; outline: 0; -webkit-transition: all .3s; -moz-transition: all .3s; transition: all .3s } ul.social-buttons li a:hover, ul.social-buttons li a:focus, ul.social-buttons li a:active { background-color: #fed136 } .btn:focus, .btn:active, .btn.active, .btn:active:focus { outline: 0 } .portfolio-modal .modal-content {border-radius:0;background-clip:border-box;-webkit-box-shadow:none;box-shadow:none;border:0;min-height:100%;padding:100px 0;text-align:center} .portfolio-modal .modal-content h2{margin-bottom:15px;font-size:3em} .portfolio-modal .modal-content p{margin-bottom:30px} .portfolio-modal .modal-content p.item-intro { margin: 20px 0 30px; font-family: "Droid Serif", "Helvetica Neue", Helvetica, Arial, sans-serif; font-style: italic; font-size: 16px } .portfolio-modal .modal-content ul.list-inline { margin-bottom: 30px; margin-top: 0 } .portfolio-modal .modal-content img { margin-bottom: 30px } .portfolio-modal .close-modal { position: absolute; width: 75px; height: 75px; background-color: transparent; top: 25px; right: 25px; cursor: pointer } .portfolio-modal .close-modal:hover { opacity: .3 } .portfolio-modal .close-modal .lr { height: 75px; width: 1px; margin-left: 35px; background-color: #222; transform: rotate(45deg); -ms-transform: rotate(45deg); -webkit-transform: rotate(45deg); z-index: 1051 } .portfolio-modal .close-modal .lr .rl { height: 75px; width: 1px; background-color: #222; transform: rotate(90deg); -ms-transform: rotate(90deg); -webkit-transform: rotate(90deg); z-index: 1052 } .portfolio-modal .modal-backdrop { opacity: 0; display: none } ::-moz-selection { text-shadow: none; background: #fed136 } ::selection { text-shadow: none; background: #fed136 } img::selection { background: 0 0 } img::-moz-selection { background: 0 0 } body { webkit-tap-highlight-color: #fed136 } .spacer { margin-top: 20px; } @media (min-width:768px) { .spacer { margin-top: 120px; } } .alert { font-size: 18px; font-weight: bold; } section img { max-width: 100%; } a.sponsor img { margin: 15px; } .up { color: #33CC00; } .down { color: #FF6600; } .has-error { color: #FF6600; }
AlexLaviolette/slack-gamebot
public/css/agency.css
CSS
mit
14,786
$demoPath = 'C:\Dropbox\GitRepos\MIcrosoftVIrtualAcademy\Testing PowerShell with Pester\Demos' ## Ensure no functions were just copied/pasted into session Remove-Item Function:\Start-ClusterTest,Function:\Restart-Cluster,Function:\Test-ClusterProblem -ErrorAction Ignore ## Import the ClusterTest module into the session Import-Module "$demoPath\Introduction\Project 1 - PowerShell Project\ClusterTest.psd1" ## Notice only a single function is exported Get-Command -Module ClusterTest ## One test from the Start-ClusterTest describe block above. ## Not all of the functions that are referenced inside of Start-ClusterTest are exported. ## FAIL! describe 'Start-ClusterTest' { ## Create mocks to simply let the function execute and essentially do nothing mock 'Write-Host' mock 'Test-ClusterProblem' { $true } mock 'Restart-Cluster' ## Null it 'tests the correct cluster' { $assMParams = @{ CommandName = 'Test-ClusterProblem' Times = 1 Exactly = $true ParameterFilter = { $ClusterName -eq 'DOESNOTMATTER' } } Assert-MockCalled @assMParams } } ## Mocks must be able to access functions to work. Use InModuleScope InModuleScope 'ClusterTest' { describe 'Start-ClusterTest' { ## Create mocks to simply let the function execute and essentially do nothing mock 'Write-Host' mock 'Test-ClusterProblem' { $true } mock 'Restart-Cluster' $result = Start-ClusterTest -ClusterName 'DOESNOTMATTER' it 'tests the correct cluster' { $assMParams = @{ CommandName = 'Test-ClusterProblem' Times = 1 Exactly = $true ParameterFilter = { $ClusterName -eq 'DOESNOTMATTER' } } Assert-MockCalled @assMParams } } }
kidchenko/playground
powershell-testing-powerShell-with-pester/Demos/Callouts/MockModules.ps1
PowerShell
mit
1,699
// // QNFormUpload.h // QiniuSDK // // Created by bailong on 15/1/4. // Copyright (c) 2015年 Qiniu. All rights reserved. // #import "QNHttpDelegate.h" #import "QNUpToken.h" #import "QNUploadManager.h" #import <Foundation/Foundation.h> @interface QNFormUpload : NSObject - (instancetype)initWithData:(NSData *)data withKey:(NSString *)key withFileName:(NSString *)fileName withToken:(QNUpToken *)token withCompletionHandler:(QNUpCompletionHandler)block withOption:(QNUploadOption *)option withHttpManager:(id<QNHttpDelegate>)http withConfiguration:(QNConfiguration *)config; - (void)put; @end
1001hotel/TWCommonMoudle
TWCommonMoudle/Pods/Qiniu/QiniuSDK/Storage/QNFormUpload.h
C
mit
707
## AzureResourceSchema These settings apply only when `--azureresourceschema` is specified on the command line. ### AzureResourceSchema multi-api ``` yaml $(azureresourceschema) && $(multiapi) batch: - tag: schema-kubernetes-2021-04-01-preview - tag: schema-kubernetes-2021-03-01 - tag: schema-kubernetes-2020-01-01-preview ``` Please also specify `--azureresourceschema-folder=<path to the root directory of your azure-resource-manager-schemas clone>`. ### Tag: schema-kubernetes-2021-04-01-preview and azureresourceschema ``` yaml $(tag) == 'schema-kubernetes-2021-04-01-preview' && $(azureresourceschema) output-folder: $(azureresourceschema-folder)/schemas # all the input files in this apiVersion input-file: - Microsoft.Kubernetes/preview/2021-04-01-preview/connectedClusters.json ``` ### Tag: schema-kubernetes-2021-03-01 and azureresourceschema ``` yaml $(tag) == 'schema-kubernetes-2021-03-01' && $(azureresourceschema) output-folder: $(azureresourceschema-folder)/schemas # all the input files in this apiVersion input-file: - Microsoft.Kubernetes/stable/2021-03-01/connectedClusters.json ``` ### Tag: schema-kubernetes-2020-01-01-preview and azureresourceschema ``` yaml $(tag) == 'schema-kubernetes-2020-01-01-preview' && $(azureresourceschema) output-folder: $(azureresourceschema-folder)/schemas # all the input files in this apiVersion input-file: - Microsoft.Kubernetes/preview/2020-01-01-preview/connectedClusters.json ```
AuxMon/azure-rest-api-specs
specification/hybridkubernetes/resource-manager/readme.azureresourceschema.md
Markdown
mit
1,469
<?php defined('SYSPATH') or die('No direct script access.'); class Jelly_Meta extends Jelly_Core_Meta {}
loonies/kohana-jelly
classes/jelly/meta.php
PHP
mit
106
//>>built define("clipart/SpinInput",["dojo/_base/declare","clipart/_clipart"],function(_1,_2){ return _1("clipart.SpinInput",[_2],{}); });
Bonome/pauline-desgrandchamp.com
lib/clipart/SpinInput.js
JavaScript
mit
140
// // RMMultipleViewsController.h // RMMultipleViewsController-Demo // // Created by Roland Moers on 29.08.13. // Copyright (c) 2013 Roland Moers // // Fade animation and arrow navigation strategy are based on: // AAMultiViewController.h // AAMultiViewController.m // Created by Richard Aurbach on 11/21/2013. // Copyright (c) 2013 Aurbach & Associates, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // #import <UIKit/UIKit.h> @class RMMultipleViewsController; /** * `UIViewController(RMMultipleViewsController)` is a category of `UIViewController` for providing mandatory properties and implementations so that a UIViewController can be used as a child view of `RMMultipleViewsController`. */ @interface UIViewController (RMMultipleViewsController) /** * When contained as a child in a `RMMultipleViewsController` this property contains a reference to the parent `RMMultipleViewsController`. If the `UIViewController` is not a child of any `RMMultipleViewsController` this property is nil. */ @property (nonatomic, weak) RMMultipleViewsController *multipleViewsController; /** * This method is called when a `RMMultipleViewsController` is about to show the called instance of `UIViewController`. The called `UIViewController` can use the parameters to update it's content such that no content will disappear below a toolbar. * * @param newInsets The new edge insets. */ - (void)adaptToEdgeInsets:(UIEdgeInsets)newInsets; @end /** * This is an enumeration of the supported animation types. */ typedef enum { RMMultipleViewsControllerAnimationSlideIn, RMMultipleViewsControllerAnimationFlip, RMMultipleViewsControllerAnimationFade, RMMultipleViewsControllerAnimationNone } RMMultipleViewsControllerAnimation; /** * This is an enumeration of the supported automated navigation strategies */ typedef enum { RMMultipleViewsControllerNavigationStrategySegmentedControl, RMMultipleViewsControllerNavigationStrategyArrows, RMMultipleViewsControllerNavigationStrategyNone } RMMultipleViewsControllerNavigationStrategy; /** * `RMMultipleViewsController` is an iOS control for showing multiple view controller in one view controller and selecting one with a segmented control. Every `RMMultipleViewsController` should be pushed into a `UINavigationController`. */ @interface RMMultipleViewsController : UIViewController /** * Provides access to the child view controllers. */ @property (nonatomic, strong) NSArray *viewController; /** * Used to change the animation type when switching from one view controller to another. */ @property (nonatomic, assign) RMMultipleViewsControllerAnimation animationStyle; /** * Used to control whether or not the `RMMultipleViewsController` will also show the left and right navigation bar button item of the currently shown child view controller. */ @property (nonatomic, assign) BOOL useNavigationBarButtonItemsOfCurrentViewController; /** * Used to control whether or not the `RMMultipleViewsController` will also show the toolbar items of the currently shown child view controller. */ @property (nonatomic, assign) BOOL useToolbarItemsOfCurrentViewController; /** * Used to control whether AAMultiViewController will auto-create, auto-display, and use a segmented control for navigation. */ @property (nonatomic, assign) RMMultipleViewsControllerNavigationStrategy navigationStrategy; /** * Used to initialize a new `RMMultipleViewsController`. * * @param someViewControllers An array of child view controllers. * * @return A new `RMMultipleViewsController`. */ - (instancetype)initWithViewControllers:(NSArray *)someViewControllers; /** * Call this method if you want to display a certain child view controller. * * @param aViewController The view controller you want to show. This view controller must be an element of the viewController array. * @param animated Used to enable or disable animations for this change. */ - (void)showViewController:(UIViewController *)aViewController animated:(BOOL)animated; @end
TaemoonCho/RMMultipleViewsController
RMMultipleViewsController/RMMultipleViewsController.h
C
mit
5,101
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="zh"> <head> <!-- Generated by javadoc (1.8.0_171) on Mon Apr 22 17:36:00 CST 2019 --> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>cn.jpush.im.android.api.exceptions 类分层结构 (android API)</title> <meta name="date" content="2019-04-22"> <link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="cn.jpush.im.android.api.exceptions \u7C7B\u5206\u5C42\u7ED3\u6784 (android API)"; } } catch(err) { } //--> </script> <noscript> <div>您的浏览器已禁用 JavaScript。</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="跳过导航链接">跳过导航链接</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="导航"> <li><a href="../../../../../../overview-summary.html">概览</a></li> <li><a href="package-summary.html">程序包</a></li> <li>类</li> <li class="navBarCell1Rev">树</li> <li><a href="../../../../../../deprecated-list.html">已过时</a></li> <li><a href="../../../../../../index-files/index-1.html">索引</a></li> <li><a href="../../../../../../help-doc.html">帮助</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../../../cn/jpush/im/android/api/event/package-tree.html">上一个</a></li> <li><a href="../../../../../../cn/jpush/im/android/api/jmrtc/package-tree.html">下一个</a></li> </ul> <ul class="navList"> <li><a href="../../../../../../index.html?cn/jpush/im/android/api/exceptions/package-tree.html" target="_top">框架</a></li> <li><a href="package-tree.html" target="_top">无框架</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../../allclasses-noframe.html">所有类</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h1 class="title">程序包cn.jpush.im.android.api.exceptions的分层结构</h1> <span class="packageHierarchyLabel">程序包分层结构:</span> <ul class="horizontal"> <li><a href="../../../../../../overview-tree.html">所有程序包</a></li> </ul> </div> <div class="contentContainer"> <h2 title="类分层结构">类分层结构</h2> <ul> <li type="circle">java.lang.Object <ul> <li type="circle">java.lang.Throwable (implements java.io.Serializable) <ul> <li type="circle">java.lang.Exception <ul> <li type="circle">cn.jpush.im.android.api.exceptions.<a href="../../../../../../cn/jpush/im/android/api/exceptions/JMessageException.html" title="cn.jpush.im.android.api.exceptions中的类"><span class="typeNameLink">JMessageException</span></a> <ul> <li type="circle">cn.jpush.im.android.api.exceptions.<a href="../../../../../../cn/jpush/im/android/api/exceptions/JMFileSizeExceedException.html" title="cn.jpush.im.android.api.exceptions中的类"><span class="typeNameLink">JMFileSizeExceedException</span></a></li> </ul> </li> </ul> </li> </ul> </li> </ul> </li> </ul> </div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="跳过导航链接">跳过导航链接</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="导航"> <li><a href="../../../../../../overview-summary.html">概览</a></li> <li><a href="package-summary.html">程序包</a></li> <li>类</li> <li class="navBarCell1Rev">树</li> <li><a href="../../../../../../deprecated-list.html">已过时</a></li> <li><a href="../../../../../../index-files/index-1.html">索引</a></li> <li><a href="../../../../../../help-doc.html">帮助</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../../../cn/jpush/im/android/api/event/package-tree.html">上一个</a></li> <li><a href="../../../../../../cn/jpush/im/android/api/jmrtc/package-tree.html">下一个</a></li> </ul> <ul class="navList"> <li><a href="../../../../../../index.html?cn/jpush/im/android/api/exceptions/package-tree.html" target="_top">框架</a></li> <li><a href="package-tree.html" target="_top">无框架</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../../allclasses-noframe.html">所有类</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> </body> </html>
raoxudong/jpush-docs
zh/jmessage/client/im_android_api_docs/cn/jpush/im/android/api/exceptions/package-tree.html
HTML
mit
5,357
## www.pubnub.com - PubNub Real-time push service in the cloud. # coding=utf8 ## PubNub Real-time Push APIs and Notifications Framework ## Copyright (c) 2010 Stephen Blum ## http://www.pubnub.com/ import sys from pubnub import PubnubTornado as Pubnub publish_key = len(sys.argv) > 1 and sys.argv[1] or 'demo' subscribe_key = len(sys.argv) > 2 and sys.argv[2] or 'demo' secret_key = len(sys.argv) > 3 and sys.argv[3] or 'demo' cipher_key = len(sys.argv) > 4 and sys.argv[4] or '' ssl_on = len(sys.argv) > 5 and bool(sys.argv[5]) or False ## ----------------------------------------------------------------------- ## Initiate Pubnub State ## ----------------------------------------------------------------------- pubnub = Pubnub(publish_key=publish_key, subscribe_key=subscribe_key, secret_key=secret_key, cipher_key=cipher_key, ssl_on=ssl_on) channel = 'hello_world' # Asynchronous usage def callback(message): print(message) pubnub.here_now(channel, callback=callback, error=callback) pubnub.start()
teddywing/pubnub-python
python-tornado/examples/here-now.py
Python
mit
1,031
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. using System; using System.Collections.Concurrent; using System.Net; using System.Threading; using System.Threading.Tasks; using Microsoft.Common.Core; using Microsoft.Common.Core.Logging; using Microsoft.R.Common.Core.Output; using static System.FormattableString; namespace Microsoft.R.Host.Client.BrokerServices { public class WebServer { private static ConcurrentDictionary<int, WebServer> Servers { get; } = new ConcurrentDictionary<int, WebServer>(); private static object _serverLock = new object(); private readonly IRemoteUriWebService _remoteUriService; private readonly string _baseAddress; private readonly IActionLog _log; private readonly IConsole _console; private readonly string _name; private HttpListener _listener; public string LocalHost { get; } public int LocalPort { get; private set; } public string RemoteHost { get; } public int RemotePort { get; } private WebServer(string remoteHostIp, int remotePort, string baseAddress, string name, IActionLog log, IConsole console) { _name = name.ToUpperInvariant(); _baseAddress = baseAddress; _log = log; _console = console; LocalHost = IPAddress.Loopback.ToString(); RemoteHost = remoteHostIp; RemotePort = remotePort; _remoteUriService = new RemoteUriWebService(baseAddress, log, console); } public void Initialize(CancellationToken ct) { Random r = new Random(); // if remote port is between 10000 and 32000, select a port in the same range. // R Help uses ports in that range. int localPortMin = (RemotePort >= 10000 && RemotePort <= 32000) ? 10000 : 49152; int localPortMax = (RemotePort >= 10000 && RemotePort <= 32000) ? 32000 : 65535; _console.WriteErrorLine(Resources.Info_RemoteWebServerStarting.FormatInvariant(_name)); while (true) { ct.ThrowIfCancellationRequested(); _listener = new HttpListener(); LocalPort = r.Next(localPortMin, localPortMax); _listener.Prefixes.Add(Invariant($"http://{LocalHost}:{LocalPort}/")); try { _listener.Start(); } catch (HttpListenerException) { _listener.Close(); continue; } catch (ObjectDisposedException) { // Socket got closed _log.WriteLine(LogVerbosity.Minimal, MessageCategory.Error, Resources.Error_RemoteWebServerCreationFailed.FormatInvariant(_name)); _console.WriteErrorLine(Resources.Error_RemoteWebServerCreationFailed.FormatInvariant(_name)); throw new OperationCanceledException(); } break; } try { _log.WriteLine(LogVerbosity.Minimal, MessageCategory.General, Resources.Info_RemoteWebServerStarted.FormatInvariant(_name, LocalHost, LocalPort)); _console.WriteErrorLine(Resources.Info_RemoteWebServerStarted.FormatInvariant(_name, LocalHost, LocalPort)); _console.WriteErrorLine(Resources.Info_RemoteWebServerDetails.FormatInvariant(Environment.MachineName, LocalHost, LocalPort, _name, _baseAddress)); } catch { } } private void Stop() { try { if (_listener.IsListening) { _listener.Stop(); } _listener.Close(); _log.WriteLine(LogVerbosity.Minimal, MessageCategory.General, Resources.Info_RemoteWebServerStopped.FormatInvariant(_name)); _console.WriteErrorLine(Resources.Info_RemoteWebServerStopped.FormatInvariant(_name)); } catch (Exception ex) when (!ex.IsCriticalException()) { } } public static void Stop(int port) { if (Servers.TryRemove(port, out WebServer server)) { server.Stop(); } } public static void StopAll() { var ports = Servers.Keys.AsArray(); foreach (var port in ports) { Stop(port); } } private async Task DoWorkAsync(CancellationToken ct = default(CancellationToken)) { try { while (_listener.IsListening) { if (ct.IsCancellationRequested) { _listener.Stop(); break; } HttpListenerContext context = await _listener.GetContextAsync(); string localUrl = $"{LocalHost}:{LocalPort}"; string remoteUrl = $"{RemoteHost}:{RemotePort}"; _remoteUriService.GetResponseAsync(context, localUrl, remoteUrl, ct).DoNotWait(); } } catch(Exception ex) { if (Servers.ContainsKey(RemotePort)) { // Log only if we expect this web server to be running and it fails. _log.WriteLine(LogVerbosity.Minimal, MessageCategory.Error, Resources.Error_RemoteWebServerFailed.FormatInvariant(_name, ex.Message)); _console.WriteErrorLine(Resources.Error_RemoteWebServerFailed.FormatInvariant(_name, ex.Message)); } } finally { Stop(RemotePort); } } public static Task<string> CreateWebServerAndHandleUrlAsync(string remoteUrl, string baseAddress, string name, IActionLog log, IConsole console, CancellationToken ct = default(CancellationToken)) { var remoteUri = new Uri(remoteUrl); var localUri = new UriBuilder(remoteUri); WebServer server; lock (_serverLock) { if (!Servers.TryGetValue(remoteUri.Port, out server)) { server = new WebServer(remoteUri.Host, remoteUri.Port, baseAddress, name, log, console); server.Initialize(ct); Servers.TryAdd(remoteUri.Port, server); } } server.DoWorkAsync(ct).DoNotWait(); localUri.Host = server.LocalHost; localUri.Port = server.LocalPort; return Task.FromResult(localUri.Uri.ToString()); } } }
AlexanderSher/RTVS
src/Windows/Host/Client/Impl/BrokerServices/WebServer.cs
C#
mit
6,593
<?php /* * Copyright 2014 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ require_once realpath(dirname(__FILE__) . '/../../../autoload.php'); /** * A blank storage class, for cases where caching is not * required. */ class Google_Cache_Null extends Google_Cache_Abstract { public function __construct(Google_Client $client) { } /** * @inheritDoc */ public function get($key, $expiration = false) { return false; } /** * @inheritDoc */ public function set($key, $value) { // Nop. } /** * @inheritDoc * @param String $key */ public function delete($key) { // Nop. } }
prashantevolvus/crux
google/src/Google/Cache/Null.php
PHP
mit
1,222
/** * Created by jiangli on 15/1/6. */ "use strict"; var request = require('request'); var iconv = require('iconv-lite'); var crypto = require('crypto'); var Buffer = require('buffer').Buffer; /** * [_parseYouku 解析优酷网] * @param [type] $url [description] * @return [type] [description] */ module.exports = function($url,callback){ var $matches = $url.match(/id\_([\w=]+)/); if ($matches&&$matches.length>1){ return _getYouku($matches[1].trim(),callback); }else{ return null; } } function _getYouku($vid,callback){ var $base = "http://v.youku.com/player/getPlaylist/VideoIDS/"; var $blink = $base+$vid; var $link = $blink+"/Pf/4/ctype/12/ev/1"; request($link, function(er, response,body) { if (er) return callback(er); var $retval = body; if($retval){ var $rs = JSON.parse($retval); request($blink, function(er, response,body) { if (er) return callback(er); var $data = { '1080Phd3':[], '超清hd2':[], '高清mp4':[], '高清flvhd':[], '标清flv':[], '高清3gphd':[], '3gp':[] }; var $bretval = body; var $brs = JSON.parse($bretval); var $rs_data = $rs.data[0]; var $brs_data = $brs.data[0]; if($rs_data.error){ return callback(null, $data['error'] = $rs_data.error); } var $streamtypes = $rs_data.streamtypes; //可以输出的视频清晰度 var $streamfileids = $rs_data.streamfileids; var $seed = $rs_data.seed; var $segs = $rs_data.segs; var $ip = $rs_data.ip; var $bsegs = $brs_data.segs; var yk_e_result = yk_e('becaf9be', yk_na($rs_data.ep)).split('_'); var $sid = yk_e_result[0], $token = yk_e_result[1]; for(var $key in $segs){ if(in_array($key,$streamtypes)){ var $segs_key_val = $segs[$key]; for(var kk=0;kk<$segs_key_val.length;kk++){ var $v = $segs_key_val[kk]; var $no = $v.no.toString(16).toUpperCase(); //转换为16进制 大写 if($no.length == 1){ $no ="0"+$no; //no 为每段视频序号 } //构建视频地址K值 var $_k = $v.k; if ((!$_k || $_k == '') || $_k == '-1') { $_k = $bsegs[$key][kk].k; } var $fileId = getFileid($streamfileids[$key],$seed); $fileId = $fileId.substr(0,8)+$no+$fileId.substr(10); var m0 = yk_e('bf7e5f01', $sid + '_' + $fileId + '_' + $token); var m1 = yk_d(m0); var iconv_result = iconv.decode(new Buffer(m1), 'UTF-8'); if(iconv_result!=""){ var $ep = urlencode(iconv_result); var $typeArray = []; $typeArray['flv']= 'flv'; $typeArray['mp4']= 'mp4'; $typeArray['hd2']= 'flv'; $typeArray['3gphd']= 'mp4'; $typeArray['3gp']= 'flv'; $typeArray['hd3']= 'flv'; //判断视频清晰度 var $sharpness = []; //清晰度 数组 $sharpness['flv']= '标清flv'; $sharpness['flvhd']= '高清flvhd'; $sharpness['mp4']= '高清mp4'; $sharpness['hd2']= '超清hd2'; $sharpness['3gphd']= '高清3gphd'; $sharpness['3gp']= '3gp'; $sharpness['hd3']= '1080Phd3'; var $fileType = $typeArray[$key]; $data[$sharpness[$key]][kk] = "http://k.youku.com/player/getFlvPath/sid/"+$sid+"_00/st/"+$fileType+"/fileid/"+$fileId+"?K="+$_k+"&hd=1&myp=0&ts="+((((($v['seconds']+'&ypp=0&ctype=12&ev=1&token=')+$token)+'&oip=')+$ip)+'&ep=')+$ep; } } } } //返回 图片 标题 链接 时长 视频地址 $data['coverImg'] = $rs['data'][0]['logo']; $data['title'] = $rs['data'][0]['title']; $data['seconds'] = $rs['data'][0]['seconds']; return callback(null,$data); }); }else{ return callback(null,null); } }) } function urlencode(str) { str = (str + '').toString(); return encodeURIComponent(str) .replace(/!/g, '%21') .replace(/'/g, '%27') .replace(/\(/g, '%28') .replace(/\)/g, '%29') .replace(/\*/g, '%2A') .replace(/%20/g, '+'); }; function in_array(needle, haystack, argStrict) { var key = '', strict = !! argStrict; if (strict) { for (key in haystack) { if (haystack[key] === needle) { return true; } } } else { for (key in haystack) { if (haystack[key] == needle) { return true; } } } return false; }; //start 获得优酷视频需要用到的方法 function getSid(){ var $sid = new Date().getTime()+(Math.random() * 9001+10000); return $sid; } function getKey($key1,$key2){ var $a = parseInt($key1,16); var $b = $a ^0xA55AA5A5; var $b = $b.toString(16); return $key2+$b; } function getFileid($fileId,$seed){ var $mixed = getMixString($seed); var $ids = $fileId.replace(/(\**$)/g, "").split('*'); //去掉末尾的*号分割为数组 var $realId = ""; for (var $i=0;$i<$ids.length;$i++){ var $idx = $ids[$i]; $realId += $mixed.substr($idx,1); } return $realId; } function getMixString($seed){ var $mixed = ""; var $source = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/\\:._-1234567890"; var $len = $source.length; for(var $i=0;$i<$len;$i++){ $seed = ($seed * 211 + 30031)%65536; var $index = ($seed / 65536 * $source.length); var $c = $source.substr($index,1); $mixed += $c; $source = $source.replace($c,""); } return $mixed; } function yk_d($a){ if (!$a) { return ''; } var $f = $a.length; var $b = 0; var $str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; for (var $c = ''; $b < $f;) { var $e = charCodeAt($a, $b++) & 255; if ($b == $f) { $c += charAt($str, $e >> 2); $c += charAt($str, ($e & 3) << 4); $c += '=='; break; } var $g = charCodeAt($a, $b++); if ($b == $f) { $c += charAt($str, $e >> 2); $c += charAt($str, ($e & 3) << 4 | ($g & 240) >> 4); $c += charAt($str, ($g & 15) << 2); $c += '='; break; } var $h = charCodeAt($a, $b++); $c += charAt($str, $e >> 2); $c += charAt($str, ($e & 3) << 4 | ($g & 240) >> 4); $c += charAt($str, ($g & 15) << 2 | ($h & 192) >> 6); $c += charAt($str, $h & 63); } return $c; } function yk_na($a){ if (!$a) { return ''; } var $sz = '-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1'; var $h = $sz.split(','); var $i = $a.length; var $f = 0; for (var $e = ''; $f < $i;) { var $c; do { $c = $h[charCodeAt($a, $f++) & 255]; } while ($f < $i && -1 == $c); if (-1 == $c) { break; } var $b; do { $b = $h[charCodeAt($a, $f++) & 255]; } while ($f < $i && -1 == $b); if (-1 == $b) { break; } $e += String.fromCharCode($c << 2 | ($b & 48) >> 4); do { $c = charCodeAt($a, $f++) & 255; if (61 == $c) { return $e; } $c = $h[$c]; } while ($f < $i && -1 == $c); if (-1 == $c) { break; } $e += String.fromCharCode(($b & 15) << 4 | ($c & 60) >> 2); do { $b = charCodeAt($a, $f++) & 255; if (61 == $b) { return $e; } $b = $h[$b]; } while ($f < $i && -1 == $b); if (-1 == $b) { break; } $e += String.fromCharCode(($c & 3) << 6 | $b); } return $e; } function yk_e($a, $c){ var $b = []; for (var $f = 0, $i, $e = '', $h = 0; 256 > $h; $h++) { $b[$h] = $h; } for ($h = 0; 256 > $h; $h++) { $f = (($f + $b[$h]) + charCodeAt($a, $h % $a.length)) % 256; $i = $b[$h]; $b[$h] = $b[$f]; $b[$f] = $i; } for (var $q = ($f = ($h = 0)); $q < $c.length; $q++) { $h = ($h + 1) % 256; $f = ($f + $b[$h]) % 256; $i = $b[$h]; $b[$h] = $b[$f]; $b[$f] = $i; $e += String.fromCharCode(charCodeAt($c, $q) ^ $b[($b[$h] + $b[$f]) % 256]); } return $e; } function md5(str){ var shasum = crypto.createHash('md5'); shasum.update(str); return shasum.digest('hex'); } function charCodeAt($str, $index){ var $charCode = []; var $key = md5($str); $index = $index + 1; if ($charCode[$key]) { return $charCode[$key][$index]; } $charCode[$key] = unpack('C*', $str); return $charCode[$key][$index]; } function charAt($str, $index){ return $str.substr($index, 1); } function unpack(format, data) { var formatPointer = 0, dataPointer = 0, result = {}, instruction = '', quantifier = '', label = '', currentData = '', i = 0, j = 0, word = '', fbits = 0, ebits = 0, dataByteLength = 0; var fromIEEE754 = function(bytes, ebits, fbits) { // Bytes to bits var bits = []; for (var i = bytes.length; i; i -= 1) { var m_byte = bytes[i - 1]; for (var j = 8; j; j -= 1) { bits.push(m_byte % 2 ? 1 : 0); m_byte = m_byte >> 1; } } bits.reverse(); var str = bits.join(''); // Unpack sign, exponent, fraction var bias = (1 << (ebits - 1)) - 1; var s = parseInt(str.substring(0, 1), 2) ? -1 : 1; var e = parseInt(str.substring(1, 1 + ebits), 2); var f = parseInt(str.substring(1 + ebits), 2); // Produce number if (e === (1 << ebits) - 1) { return f !== 0 ? NaN : s * Infinity; } else if (e > 0) { return s * Math.pow(2, e - bias) * (1 + f / Math.pow(2, fbits)); } else if (f !== 0) { return s * Math.pow(2, -(bias-1)) * (f / Math.pow(2, fbits)); } else { return s * 0; } } while (formatPointer < format.length) { instruction = format.charAt(formatPointer); // Start reading 'quantifier' quantifier = ''; formatPointer++; while ((formatPointer < format.length) && (format.charAt(formatPointer).match(/[\d\*]/) !== null)) { quantifier += format.charAt(formatPointer); formatPointer++; } if (quantifier === '') { quantifier = '1'; } // Start reading label label = ''; while ((formatPointer < format.length) && (format.charAt(formatPointer) !== '/')) { label += format.charAt(formatPointer); formatPointer++; } if (format.charAt(formatPointer) === '/') { formatPointer++; } // Process given instruction switch (instruction) { case 'a': // NUL-padded string case 'A': // SPACE-padded string if (quantifier === '*') { quantifier = data.length - dataPointer; } else { quantifier = parseInt(quantifier, 10); } currentData = data.substr(dataPointer, quantifier); dataPointer += quantifier; var currentResult; if (instruction === 'a') { currentResult = currentData.replace(/\0+$/, ''); } else { currentResult = currentData.replace(/ +$/, ''); } result[label] = currentResult; break; case 'h': // Hex string, low nibble first case 'H': // Hex string, high nibble first if (quantifier === '*') { quantifier = data.length - dataPointer; } else { quantifier = parseInt(quantifier, 10); } currentData = data.substr(dataPointer, quantifier); dataPointer += quantifier; if (quantifier > currentData.length) { throw new Error('Warning: unpack(): Type ' + instruction + ': not enough input, need ' + quantifier); } currentResult = ''; for (i = 0; i < currentData.length; i++) { word = currentData.charCodeAt(i).toString(16); if (instruction === 'h') { word = word[1] + word[0]; } currentResult += word; } result[label] = currentResult; break; case 'c': // signed char case 'C': // unsigned c if (quantifier === '*') { quantifier = data.length - dataPointer; } else { quantifier = parseInt(quantifier, 10); } currentData = data.substr(dataPointer, quantifier); dataPointer += quantifier; for (i = 0; i < currentData.length; i++) { currentResult = currentData.charCodeAt(i); if ((instruction === 'c') && (currentResult >= 128)) { currentResult -= 256; } result[label + (quantifier > 1 ? (i + 1) : '')] = currentResult; } break; case 'S': // unsigned short (always 16 bit, machine byte order) case 's': // signed short (always 16 bit, machine byte order) case 'v': // unsigned short (always 16 bit, little endian byte order) if (quantifier === '*') { quantifier = (data.length - dataPointer) / 2; } else { quantifier = parseInt(quantifier, 10); } currentData = data.substr(dataPointer, quantifier * 2); dataPointer += quantifier * 2; for (i = 0; i < currentData.length; i += 2) { // sum per word; currentResult = ((currentData.charCodeAt(i + 1) & 0xFF) << 8) + (currentData.charCodeAt(i) & 0xFF); if ((instruction === 's') && (currentResult >= 32768)) { currentResult -= 65536; } result[label + (quantifier > 1 ? ((i / 2) + 1) : '')] = currentResult; } break; case 'n': // unsigned short (always 16 bit, big endian byte order) if (quantifier === '*') { quantifier = (data.length - dataPointer) / 2; } else { quantifier = parseInt(quantifier, 10); } currentData = data.substr(dataPointer, quantifier * 2); dataPointer += quantifier * 2; for (i = 0; i < currentData.length; i += 2) { // sum per word; currentResult = ((currentData.charCodeAt(i) & 0xFF) << 8) + (currentData.charCodeAt(i + 1) & 0xFF); result[label + (quantifier > 1 ? ((i / 2) + 1) : '')] = currentResult; } break; case 'i': // signed integer (machine dependent size and byte order) case 'I': // unsigned integer (machine dependent size & byte order) case 'l': // signed long (always 32 bit, machine byte order) case 'L': // unsigned long (always 32 bit, machine byte order) case 'V': // unsigned long (always 32 bit, little endian byte order) if (quantifier === '*') { quantifier = (data.length - dataPointer) / 4; } else { quantifier = parseInt(quantifier, 10); } currentData = data.substr(dataPointer, quantifier * 4); dataPointer += quantifier * 4; for (i = 0; i < currentData.length; i += 4) { currentResult = ((currentData.charCodeAt(i + 3) & 0xFF) << 24) + ((currentData.charCodeAt(i + 2) & 0xFF) << 16) + ((currentData.charCodeAt(i + 1) & 0xFF) << 8) + ((currentData.charCodeAt(i) & 0xFF)); result[label + (quantifier > 1 ? ((i / 4) + 1) : '')] = currentResult; } break; case 'N': // unsigned long (always 32 bit, little endian byte order) if (quantifier === '*') { quantifier = (data.length - dataPointer) / 4; } else { quantifier = parseInt(quantifier, 10); } currentData = data.substr(dataPointer, quantifier * 4); dataPointer += quantifier * 4; for (i = 0; i < currentData.length; i += 4) { currentResult = ((currentData.charCodeAt(i) & 0xFF) << 24) + ((currentData.charCodeAt(i + 1) & 0xFF) << 16) + ((currentData.charCodeAt(i + 2) & 0xFF) << 8) + ((currentData.charCodeAt(i + 3) & 0xFF)); result[label + (quantifier > 1 ? ((i / 4) + 1) : '')] = currentResult; } break; case 'f': //float case 'd': //double ebits = 8; fbits = (instruction === 'f') ? 23 : 52; dataByteLength = 4; if (instruction === 'd') { ebits = 11; dataByteLength = 8; } if (quantifier === '*') { quantifier = (data.length - dataPointer) / dataByteLength; } else { quantifier = parseInt(quantifier, 10); } currentData = data.substr(dataPointer, quantifier * dataByteLength); dataPointer += quantifier * dataByteLength; for (i = 0; i < currentData.length; i += dataByteLength) { data = currentData.substr(i, dataByteLength); var bytes = []; for (j = data.length - 1; j >= 0; --j) { bytes.push(data.charCodeAt(j)); } result[label + (quantifier > 1 ? ((i / 4) + 1) : '')] = fromIEEE754(bytes, ebits, fbits); } break; case 'x': // NUL byte case 'X': // Back up one byte case '@': // NUL byte if (quantifier === '*') { quantifier = data.length - dataPointer; } else { quantifier = parseInt(quantifier, 10); } if (quantifier > 0) { if (instruction === 'X') { dataPointer -= quantifier; } else { if (instruction === 'x') { dataPointer += quantifier; } else { dataPointer = quantifier; } } } break; default: throw new Error('Warning: unpack() Type ' + instruction + ': unknown format code'); } } return result; }
jiangli373/nodeParseVideo
lib/youku.js
JavaScript
mit
21,702
/* * Copyright (c) 2011 Stephen A. Pratt * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ namespace org.critterai.interop { /// <summary> /// Indicates how an object's unmanaged resources have been allocated and are managed. /// </summary> public enum AllocType : byte { /// <summary> /// Unmanaged resources were allocated locally and must be freed locally. /// </summary> Local = 0, /// <summary> /// Unmanaged resources were allocated by an external library and a call must be made /// to the library to free them. /// </summary> External = 1, /// <summary> /// Unmanaged resources were allocated and are managed by an external library. There is /// no local responsiblity to directly free the resources. /// </summary> /// <remarks> /// <para> /// Objects of this type are usually allocated and owned by another unmanaged object. So /// its resources are freed by its owner when its owner is freed. /// </para> /// </remarks> ExternallyManaged = 2 } }
stevefsp/critterai
src/main/Assets/CAI/util/interop/AllocType.cs
C#
mit
2,238
package cn.mutils.app.alipay; import org.junit.Test; import static org.junit.Assert.*; /** * To work on unit tests, switch the Test Artifact in the Build Variants view. */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
lounien/OApp
Alipay/src/test/java/cn/mutils/app/alipay/ExampleUnitTest.java
Java
mit
313
class Post < ActiveRecord::Base validates :title, presence: true validates :slug, presence: true, uniqueness: true acts_as_url :title, :url_attribute => :slug default_scope order('created_at desc') def to_param slug end def external? !url.blank? end end
chanman82/ChandlerCollins.com
app/models/post.rb
Ruby
mit
280
--- title: Împlinirea Legii în totalitate date: 07/09/2017 --- `Cum împăcăm comentariul dezaprobator al lui Pavel, cu privire la datoria de a împlini „toată Legea” (Galateni 5:3), cu alte declaraţii ale sale despre împlinirea Legii? Compară Romani 10:5; Galateni 3:10,12; 5:3 cu Romani 8:4; 13:8; Galateni 5:14.` Mulţi consideră că afirmaţiile lui Pavel sunt contradictorii. Dar lucrurile nu stau aşa. Soluţia este dată de distincţia importantă pe care el o face între două moduri diferite de definire a comportamentului creştin în relaţie cu Legea. Pe de o parte, este comportamentul greşit al celor care trăiesc sub Lege, îndeplinind cerinţele ei în speranţa de a câştiga astfel aprobarea lui Dumnezeu. De cealaltă parte, este ascultarea celor care au găsit mântuirea în Hristos, a căror preocupare nu este de a bifa toate cerinţele pe care le-au îndeplinit. Comportamentul creştin merge dincolo de ascultarea formală de Lege; el trece la împlinirea Legii. Acest tip de ascultare a fost ilustrat de Isus: „Să nu credeţi că am venit să stric Legea sau Prorocii; am venit nu să stric, ci să împlinesc” (Matei 5:17). Aşadar, recomandarea lui Pavel nu este aceea de a minimaliza Legea. Dimpotrivă, prin cunoaşterea lui Hristos, credinciosul va cunoaşte adevăratul scop şi adevărata semnificaţie a întregii Legi! `Potrivit lui Pavel, la ce poruncă se poate rezuma întreaga Lege? Galateni 5:14; Leviticul 19:18; Marcu 12:31,33; Matei 19:19; Romani 13:9; Iacov 2:8.` Deşi citează din Leviticul, declaraţia lui Pavel din Galateni se bazează pe modul în care a citat Isus Leviticul 19:18. Totuşi Isus nu a fost singurul învăţător iudeu care a afirmat că acest text este un rezumat al întregii Legi. Rabinul Hillel, care a trăit cu aproape o generaţie înainte de Isus, a spus: „Nu îi face semenului tău ceea ce nu îţi place să ţi se facă; în aceasta stă toată Legea.” Însă perspectiva lui Isus a fost radical diferită: „Tot ce voiţi să vă facă vouă oamenii, faceţi-le şi voi la fel; căci în aceasta sunt cuprinse Legea şi Prorocii” (Matei 7:12). Nu numai că este o perspectivă pozitivă, ci ea demonstrează totodată faptul că Legea şi dragostea sunt compatibile. Fără dragoste, Legea este fără conţinut şi rece; fără Lege, dragostea nu are nicio direcţie. `Explicaţi în cuvinte proprii de ce dragostea pentru aproapele înseamnă împlinirea în totalitate a Legii!`
PrJared/sabbath-school-lessons
src/ro/2017-03/11/06.md
Markdown
mit
2,498
# -*- coding: utf-8 -*- import numbers import numpy as np from ..constants import BOLTZMANN_IN_MEV_K from ..energy import Energy class Analysis(object): r"""Class containing methods for the Data class Attributes ---------- detailed_balance_factor Methods ------- integrate position width scattering_function dynamic_susceptibility estimate_background get_keys get_bounds """ @property def detailed_balance_factor(self): r"""Returns the detailed balance factor (sometimes called the Bose factor) Parameters ---------- None Returns ------- dbf : ndarray The detailed balance factor (temperature correction) """ return 1. - np.exp(-self.Q[:, 3] / BOLTZMANN_IN_MEV_K / self.temp) def integrate(self, bounds=None, background=None, hkle=True): r"""Returns the integrated intensity within given bounds Parameters ---------- bounds : bool, optional A boolean expression representing the bounds inside which the calculation will be performed background : float or dict, optional Default: None hkle : bool, optional If True, integrates only over h, k, l, e dimensions, otherwise integrates over all dimensions in :py:attr:`.Data.data` Returns ------- result : float The integrated intensity either over all data, or within specified boundaries """ result = 0 for key in self.get_keys(hkle): result += np.trapz(self.intensity[self.get_bounds(bounds)] - self.estimate_background(background), np.squeeze(self.data[key][self.get_bounds(bounds)])) return result def position(self, bounds=None, background=None, hkle=True): r"""Returns the position of a peak within the given bounds Parameters ---------- bounds : bool, optional A boolean expression representing the bounds inside which the calculation will be performed background : float or dict, optional Default: None hkle : bool, optional If True, integrates only over h, k, l, e dimensions, otherwise integrates over all dimensions in :py:attr:`.Data.data` Returns ------- result : tup The result is a tuple with position in each dimension of Q, (h, k, l, e) """ result = () for key in self.get_keys(hkle): _result = 0 for key_integrate in self.get_keys(hkle): _result += np.trapz(self.data[key][self.get_bounds(bounds)] * (self.intensity[self.get_bounds(bounds)] - self.estimate_background(background)), self.data[key_integrate][self.get_bounds(bounds)]) / self.integrate(bounds, background) result += (np.squeeze(_result),) if hkle: return result else: return dict((key, value) for key, value in zip(self.get_keys(hkle), result)) def width(self, bounds=None, background=None, fwhm=False, hkle=True): r"""Returns the mean-squared width of a peak within the given bounds Parameters ---------- bounds : bool, optional A boolean expression representing the bounds inside which the calculation will be performed background : float or dict, optional Default: None fwhm : bool, optional If True, returns width in fwhm, otherwise in mean-squared width. Default: False hkle : bool, optional If True, integrates only over h, k, l, e dimensions, otherwise integrates over all dimensions in :py:attr:`.Data.data` Returns ------- result : tup The result is a tuple with the width in each dimension of Q, (h, k, l, e) """ result = () for key in self.get_keys(hkle): _result = 0 for key_integrate in self.get_keys(hkle): _result += np.trapz((self.data[key][self.get_bounds(bounds)] - self.position(bounds, background, hkle=False)[key]) ** 2 * (self.intensity[self.get_bounds(bounds)] - self.estimate_background(background)), self.data[key_integrate][self.get_bounds(bounds)]) / self.integrate(bounds, background) if fwhm: result += (np.sqrt(np.squeeze(_result)) * 2. * np.sqrt(2. * np.log(2.)),) else: result += (np.squeeze(_result),) if hkle: return result else: return dict((key, value) for key, value in zip(self.get_keys(hkle), result)) def scattering_function(self, material, ei): r"""Returns the neutron scattering function, i.e. the detector counts scaled by :math:`4 \pi / \sigma_{\mathrm{tot}} * k_i/k_f`. Parameters ---------- material : object Definition of the material given by the :py:class:`.Material` class ei : float Incident energy in meV Returns ------- counts : ndarray The detector counts scaled by the total scattering cross section and ki/kf """ ki = Energy(energy=ei).wavevector kf = Energy(energy=ei - self.e).wavevector return 4 * np.pi / material.total_scattering_cross_section * ki / kf * self.detector def dynamic_susceptibility(self, material, ei): r"""Returns the dynamic susceptibility :math:`\chi^{\prime\prime}(\mathbf{Q},\hbar\omega)` Parameters ---------- material : object Definition of the material given by the :py:class:`.Material` class ei : float Incident energy in meV Returns ------- counts : ndarray The detector counts turned into the scattering function multiplied by the detailed balance factor """ return self.scattering_function(material, ei) * self.detailed_balance_factor def estimate_background(self, bg_params): r"""Estimate the background according to ``type`` specified. Parameters ---------- bg_params : dict Input dictionary has keys 'type' and 'value'. Types are * 'constant' : background is the constant given by 'value' * 'percent' : background is estimated by the bottom x%, where x is value * 'minimum' : background is estimated as the detector counts Returns ------- background : float or ndarray Value determined to be the background. Will return ndarray only if `'type'` is `'constant'` and `'value'` is an ndarray """ if isinstance(bg_params, type(None)): return 0 elif isinstance(bg_params, numbers.Number): return bg_params elif bg_params['type'] == 'constant': return bg_params['value'] elif bg_params['type'] == 'percent': inten = self.intensity[self.intensity >= 0.] Npts = int(inten.size * (bg_params['value'] / 100.)) min_vals = inten[np.argsort(inten)[:Npts]] background = np.average(min_vals) return background elif bg_params['type'] == 'minimum': return min(self.intensity) else: return 0 def get_bounds(self, bounds): r"""Generates a to_fit tuple if bounds is present in kwargs Parameters ---------- bounds : dict Returns ------- to_fit : tuple Tuple of indices """ if bounds is not None: return np.where(bounds) else: return np.where(self.Q[:, 0]) def get_keys(self, hkle): r"""Returns all of the Dictionary key names Parameters ---------- hkle : bool If True only returns keys for h,k,l,e, otherwise returns all keys Returns ------- keys : list :py:attr:`.Data.data` dictionary keys """ if hkle: return [key for key in self.data if key in self.Q_keys.values()] else: return [key for key in self.data if key not in self.data_keys.values()]
neutronpy/neutronpy
neutronpy/data/analysis.py
Python
mit
8,726
deal
bonvio-opr/bonvioCRM
src/main/webapp/resources/templates/dealPage.html
HTML
mit
4
--- title: 'Два големи хора за благодарствени песни' date: 03/12/2019 --- `Прочетете Неемия 12:31-42. Защо музиката е толкова важна част от празника?` Част от богослужението по времето на Неемия е създаването на два хора за благодарствени песни, обикалящи из Йерусалим и пеещи под съпровод на музикални инструменти. Те тръгват от едно и също място, а след това се разделят, като всеки тръгва в различна посока покрай стените на града. Едната група се води от Ездра, който върви начело, а другата завършва с Неемия най-отзад. Двата хора отново се срещат при Портата на долината и оттам продължават към храма. Свещеници с тръби придружават и двете процесии. Щом хоровете влизат в храма, застават един срещу друг. Това е отлично организирана процесия и храмова служба. За да отговорим защо музиката е толкова важна част от празника и богослужението, трябва да разгледаме нейното значение в контекста на храма. Музиката в храма не е концерт за радост на хората, като концерт на Четвъртата симфония от Бетовен, изпълнявана в концертна зала. По-скоро, когато музикантите пеят и свирят с инструментите, народът коленичи за молитва. Това е част от тяхното поклонение. Централно място в храма и поклонението заема принасянето на жертвите, което само по себе си е неприятно действие. Всъщност те просто прерязват гърлата на невинни животни, нали? Красивата музика, освен че издига мислите на хората към небето, прави и цялото богослужение по-приятно. `Намерете примери от Библията, в които музиката е важен аспект от поклонението. Разгледайте Изход 15:1; 2 Летописи 20:21,22; Откровение 15:2-4.` Както на небето, така и на земята музиката е част от поклонението. Забележете, че в горепосочените стихове песните отразяват какво е направил Господ за Своя народ, включително да им помогне да победят „звяра“ (а как иначе щяха да постигнат победа?). Те прославят Бога за Неговите спасителни действия. `Назовете някои от нещата, които е сторил Бог за вас и които са добри основания да Го хвалите с песни?`
PrJared/sabbath-school-lessons
src/bg/2019-04/10/04.md
Markdown
mit
3,566
--- title: Moderador date: 06/01/2017 --- **Texto-Chave**: II Pedro 1:19-21 #### **Com o Estudo desta Lição, o Membro da unidade de ação Vai:** - **Aprender**: A compreender que a Bíblia é a vontade revelada de Deus, inspirada pelo Espírito Santo. É uma salvaguarda para a sua fé e um padrão pelo qual deve ser testado todo o ensino e experiência. - **Sentir**: A experiência de uma atitude de completa submissão à orientação do Espírito Santo através da Palavra de Deus, em vez de uma atitude de juízo independente e de orgulho humano. - **Fazer**: A escolha de deixar que o Espírito Santo molde o seu pensamento através da Palavra de Deus e através do poder e do impulso do Espírito, levando o membro a submeter quaisquer atitudes e atos não em harmonia com a inspirada Palavra de Deus. #### **Esboço da Aprendizagem:** 1. Aprender: A Compreender o Papel do Espírito Santo na Revelação e na Inspiração. + **A** Qual é a diferença entre os termos "revelação" e "inspiração"? + **B** Dado que o Espírito Santo atua através dos agentes humanos que escreveram a Bíblia, como podemos ter a certeza de que ela é a revelação confiável de Deus para nós? + **C** Como é que a inspiração molda o que Deus revela através dos autores bíblicos? 2. Sentir: Abordar a Bíblia com uma Atitude de Humildade. + **A** Como é que a atitude que temos ao abordar a Bíblia determina a capacidade do Espírito Santo para mudar-nos através dos textos das Escrituras? + **B** Por que razão é tão fácil substituir o que a Bíblia realmente diz por opiniões humanas acerca da Bíblia? 3. Fazer: Experimentar o Poder da Palavra. + **A** Porque é tão importante deixar que o Espírito Santo molde a nossa compreensão da Palavra de Deus? + **B** Que passos está Deus a levá-lo a dar na sua vida espiritual de maneira a poder apreciar mais a Bíblia e experimentar o seu poder transformador de maneira mais plena? **Sumário:** Quando decidimos responder à direção do Espírito Santo e humildemente aceitamos a instrução divina dada na Bíblia, a nossa vida é mudada pela graça de Deus e a nossa mente é protegida contra os enganos do diabo. #### **CICLO DA APRENDIZAGEM** ------ #### PASSO 1—MOTIVAR! **Realce da Escritura**: 2 Timóteo 3:16 e 17. **Conceito-Chave para Crescimento Espiritual**: A Bíblia é mais do que uma simples coleção de escritos inspiradores. É a Palavra de Deus, que tem autoridade e que muda vidas. Quando é lida com oração e com uma atitude humilde e disposta a aprender sob a influência do Espírito Santo, ela transforma a nossa vida. **Só para o Dinamizador**: A lição desta semana abre o estudo deste trimestre sobre o ministério do Espírito Santo. O Espírito Santo falou através da Palavra. Deus tem-Se revelado nas Escrituras. As verdades da Bíblia contam a história de Quem Deus é e de como Ele trabalha na vida dos seres humanos. Sem a ação do Espírito através da Palavra, seríamos deixados à mercê da nossa errada compreensão humana da verdade. Saliente o facto de que, sem a orientação do Espírito Santo, conhecer a vontade de Deus e compreender a Sua verdade seria uma questão de conjeturas que nos deixaria inseguros e confusos. A Palavra de Deus providencia clareza e certeza relativamente a conhecermos e entendermos a Sua vontade. **Atividade de Abertura**: Vamos supor que a irmã Joana frequenta a vossa Unidade de Ação pela primeira vez. A meio da discussão, ela levanta a mão e diz: “O Espírito Santo impressionou-me com a ideia de que estamos a viver no tempo do fim.” Você responde: “Bem, sim, irmã, certamente acreditamos nisso.” Ela continua: “Não, quero dizer que estamos mesmo perto. Foi-me mostrado que a economia vai cair, que os filhos de Deus não deveriam ter dívidas de espécie alguma e que deveríamos todos ir viver imediatamente para o campo, cultivando os nossos próprios alimentos. O fim pode acontecer dentro de dois ou três anos. Bom, eu não estou a pôr uma data para a volta de Jesus, porque sei que a Escritura diz: ‘O dia e a hora da sua vinda ninguém sabe’, mas deixem-me dizer-vos uma coisa, foi-me revelado que ela está mais próxima do que pensamos.” **PERGUNTAS PARA ANÁLISE**: 1. À luz da lição de hoje, como responderia à irmã Joana? Que ideias podem partilhar que sejam úteis para ela e para a Unidade? 2. Como é que a lição desta semana vos dá orientação na vossa resposta? Que princípios da Palavra de Deus seriam úteis para a irmã Joana? 3. Porque é que a Palavra de Deus é uma salvaguarda contra as ideias especulativas? #### 2 PASSO – ANALISAR! **Só para o Dinamizador**: Há uma diferença entre “revelação” e “inspiração”. “Revelação” tem que ver com o desvendar ou o revelar da verdade imutável de Deus. A verdade de Deus não depende, de modo algum, do pensamento nem da atividade humanos. Verdade é verdade, quer os seres humanos a aceitem e creiam nela ou não. A verdade de Deus é eterna e universal. É eterna, no sentido de que se aplica a todas as gerações em todos os tempos. É universal, no sentido de que se aplica a todas as pessoas em todas as culturas. A verdade de Deus, como a lei da gravidade, aplica-se em todos os tempos e em todos os lugares. A cultura não molda nem altera a verdade. A verdade modela e altera a cultura. “Inspiração”, por seu lado, é a ação de Deus através do Seu Espírito Santo para comunicar a Sua verdade por meio de agentes humanos. O mesmo Deus que revelou a verdade guiou os autores da Bíblia quando a escreveram. Deus não ditou cada palavra da Bíblia aos escritores bíblicos. Ele dirigiu os seus pensamentos, inspirou a sua mente e guiou os instrumentos com que escreviam. Eles escreveram nas suas próprias palavras, com vocabulários que lhes eram acessíveis, sob a inspiração do Espírito Santo, para comunicarem a infalível Palavra de Deus. ### **Comentário Bíblico** **I. O Espírito Santo: O Ensinador de Toda a Verdade** (Recapitule com a sua Unidade de Ação João 16:13.) Uma das funções do Espírito Santo é guiar-nos para a verdade. Reparem que o Espírito Santo não nos força a seguir a verdade. Não nos impõe a verdade. Não nos força a obedecer. Ele “guia-nos” em “toda a verdade”. Amavelmente, Ele leva-nos a compreender que o caminho de Deus, revelado na Sua Palavra, é o melhor. Quando o Espírito Santo nos guia, descobrimos que as palavras de Jesus – “Vim para que tenham vida, e a tenham em abundância” (João 10:10) – são verdadeiras na nossa vida. Qual é a verdade em que o Espírito Santo nos guia? É a verdade acerca de Deus. Cada doutrina da Bíblia revela alguma coisa da beleza da verdade acerca do Deus que nos ama e que deseja que estejamos salvos no Seu reino. À luz do grande conflito entre o bem e o mal, o propósito da Palavra Inspirada é revelar a verdade acerca do caráter de Deus, do Seu amor altruísta em contraste com o caráter de Satanás, de orgulho egoísta. Há, pelo menos, mais dois aspetos na orientação do Espírito ao levar-nos a toda a verdade. Primeiro, o Espírito Santo leva-nos a compreender as verdades doutrinais da Bíblia, para nos proteger dos enganos do maligno, enganos que distorcem o caráter de Deus. Jesus declara: “Santifica-os na verdade. A tua palavra é a verdade” (João 17:17). Ele também declara: “Conhecereis a verdade, e a verdade vos libertará” (João 8:32). A verdade liberta-nos dos erros teológicos que tanto têm escravizado o mundo religioso. Segundo, o Espírito Santo também nos guia à verdade acerca de nós mesmos. Quando vamos a Jesus, a nossa culpa desapareceu (I João 1:9; Rom. 8:1). Somos filhos e filhas de Deus, membros da Sua família (João 12:12; Efé. 2:19). Apesar dos nossos sentimentos pessoais de indignidade, de culpa ou de vergonha, o Espírito Santo guia-nos à verdade da Palavra. Fomos criados por Deus, redimidos por Cristo e transformados pelo Espírito Santo. A Palavra de Deus, soberana e infalível, não mente. Somos Seus filhos, sempre seguros no Seu amor e na Sua graça. **PERGUNTAS PARA ANÁLISE**: 1. Uma das funções do Espírito Santo é levar-nos, ou guiar-nos, a toda a verdade, por oposição a forçar-nos. Definam as duas palavras: guiar e forçar. Qual é a diferença entre as duas? O que revela essa diferença acerca da maneira como o Espírito nos guia? 2. A que verdade nos guia o Espírito? 3. De que nos liberta a verdade? Como é que ela faz isso? #### 3 PASSO – PRATICAR! **Só para o Dinamizador**: O mundo religioso está cheio de inúmeros supostos “Cristãos”, que têm uma experiência cristã muito superficial. Analise com a sua Unidade como evitar a armadilha da superficialidade religiosa. Falem sobre a razão pela qual tantos Cristãos passam tão pouco tempo a analisar a Palavra de Deus. **Perguntas para Reflexão:** 1. O que impede algumas pessoas de entenderem as verdades da Palavra de Deus? 2. Porque é que mesmo alguns Cristãos Adventistas não conseguem sentir a alegria de serem filhos e filhas redimidos de Deus? 3. De que maneira podemos entender melhor a Palavra e receber a bênção plena que Deus nos quer conceder? **PERGUNTA DE APLICAÇÃO**: Quais são algumas das coisas que nos impedem de ter uma experiência profunda e duradoura com Cristo através da Sua Palavra inspirada pelo Espírito? #### 4 PASSO – APLICAR! **Só para o Dinamizador**: O apóstolo Pedro resume bem os pensamentos-chave da nossa lição nestas palavras: “Sendo de novo gerados, não de semente corruptível, mas da incorruptível, pela palavra de Deus, viva, e que permanece para sempre” (I Pedro 1:23). O foco da nossa lição é duplo: Primeiro, a Palavra de Deus tem autoridade e revela a Sua verdade. Segundo, a Palavra de Deus muda a vida. Ajude cada membro da sua Unidade a ver que a verdade não é uma questão de opinião pessoal. A verdade encontra-se na Palavra de Deus. Leve os membros da sua Unidade a perceber que, ao estudarem a Palavra de Deus com um coração submisso e com oração, a sua vida será completamente transformada. **Atividade de Encerramento**: 1. Convide cada membro da Unidade a voltar-se para a pessoa que tem ao seu lado e a partilhar o pensamento-chave da lição de hoje que vai levar para casa. 2. Depois dessa partilha, convide os membros a partilharem com o grupo todo a coisa mais importante para a sua vida espiritual que descobriram pessoalmente na lição desta semana.
PrJared/sabbath-school-lessons
src/pt/2017-01/01/teacher-comments.md
Markdown
mit
10,587
# Strict mode When you create a new workspace or an application you have an option to create them in a strict mode using the `--strict` flag. Enabling this flag initializes your new workspace or application with a few new settings that improve maintainability, help you catch bugs ahead of time. Additionally, applications that use these stricter settings are easier to statically analyze, which can help the `ng update` command refactor code more safely and precisely when you are updating to future versions of Angular. Specifically, the `strict` flag does the following: * Enables [`strict` mode in TypeScript](https://www.typescriptlang.org/tsconfig#strict), as well as other strictness flags recommended by the TypeScript team. Specifically, `forceConsistentCasingInFileNames`, `noImplicitReturns`, `noFallthroughCasesInSwitch`. * Turns on strict Angular compiler flags [`strictTemplates`](guide/angular-compiler-options#stricttemplates), [`strictInjectionParameters`](guide/angular-compiler-options#strictinjectionparameters) and [`strictInputAccessModifiers`](guide/template-typecheck#troubleshooting-template-errors). * [Bundle size budgets](guide/build#configuring-size-budgets) have been reduced by ~75%. You can apply these settings at the workspace and project level. To create a new workspace and application using the strict mode, run the following command: <code-example language="sh" class="code-shell"> ng new [project-name] --strict </code-example> To create a new application in the strict mode within an existing non-strict workspace, run the following command: <code-example language="sh" class="code-shell"> ng generate application [project-name] --strict </code-example>
blesh/angular
aio/content/guide/strict-mode.md
Markdown
mit
1,708
pre { display: none; } table { font-family: inherit; font-size: inherit; border: inherit; } #groupparts { width: 100% !important; margin-left: auto; margin-right: auto; } #groupparts th { width: auto !important; } table.pgrouptable { background-color: inherit !important; } table.pgrouptable td { background-color: inherit !important; border: 0px; } table.pgrouptable thead th { background-color: inherit !important; border: 0px; }
mattsmart/uwaterloo-igem-2015
wiki/CSS/parts.css
CSS
mit
490
using System.IO; using Aspose.Cells; using System; namespace Aspose.Cells.Examples.CSharp.Data.Handling { public class AddingDataToCells { public static void Run() { // ExStart:1 // The path to the documents directory. string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); // Create directory if it is not already present. bool IsExists = System.IO.Directory.Exists(dataDir); if (!IsExists) System.IO.Directory.CreateDirectory(dataDir); // Instantiating a Workbook object Workbook workbook = new Workbook(); // Obtaining the reference of the first worksheet Worksheet worksheet = workbook.Worksheets[0]; // Adding a string value to the cell worksheet.Cells["A1"].PutValue("Hello World"); // Adding a double value to the cell worksheet.Cells["A2"].PutValue(20.5); // Adding an integer value to the cell worksheet.Cells["A3"].PutValue(15); // Adding a boolean value to the cell worksheet.Cells["A4"].PutValue(true); // Adding a date/time value to the cell worksheet.Cells["A5"].PutValue(DateTime.Now); // Setting the display format of the date Style style = worksheet.Cells["A5"].GetStyle(); style.Number = 15; worksheet.Cells["A5"].SetStyle(style); // Saving the Excel file workbook.Save(dataDir + "output.out.xls"); // ExEnd:1 } } }
aspose-cells/Aspose.Cells-for-.NET
Examples/CSharp/Data/Handling/AddingDataToCells.cs
C#
mit
1,673
<?php /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /** * LICENSE: * 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 3 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, see <http://www.gnu.org/licenses/>. * * * @categories Games/Entertainment, Systems Administration * @package Bright Game Panel * @author warhawk3407 <warhawk3407@gmail.com> @NOSPAM * @copyleft 2013 * @license GNU General Public License version 3.0 (GPLv3) * @version (Release 0) DEVELOPER BETA 8 * @link http://www.bgpanel.net/ */ $page = 'boxgamefile'; $tab = 3; $isSummary = TRUE; ### if (isset($_GET['id']) && is_numeric($_GET['id'])) { $boxid = $_GET['id']; } else { exit('Error: BoxID error.'); } ### $return = 'boxgamefile.php?id='.urlencode($boxid); require("../configuration.php"); require("./include.php"); require_once("../includes/func.ssh2.inc.php"); require_once("../libs/phpseclib/Crypt/AES.php"); require_once("../libs/gameinstaller/gameinstaller.php"); $title = T_('Box Game File Repositories'); if (query_numrows( "SELECT `name` FROM `".DBPREFIX."box` WHERE `boxid` = '".$boxid."'" ) == 0) { exit('Error: BoxID is invalid.'); } $rows = query_fetch_assoc( "SELECT * FROM `".DBPREFIX."box` WHERE `boxid` = '".$boxid."' LIMIT 1" ); $games = mysql_query( "SELECT * FROM `".DBPREFIX."game` ORDER BY `game`" ); $aes = new Crypt_AES(); $aes->setKeyLength(256); $aes->setKey(CRYPT_KEY); // Get SSH2 Object OR ERROR String $ssh = newNetSSH2($rows['ip'], $rows['sshport'], $rows['login'], $aes->decrypt($rows['password'])); if (!is_object($ssh)) { $_SESSION['msg1'] = T_('Connection Error!'); $_SESSION['msg2'] = $ssh; $_SESSION['msg-type'] = 'error'; } $gameInstaller = new GameInstaller( $ssh ); include("./bootstrap/header.php"); /** * Notifications */ include("./bootstrap/notifications.php"); ?> <ul class="nav nav-tabs"> <li><a href="boxsummary.php?id=<?php echo $boxid; ?>"><?php echo T_('Summary'); ?></a></li> <li><a href="boxprofile.php?id=<?php echo $boxid; ?>"><?php echo T_('Profile'); ?></a></li> <li><a href="boxip.php?id=<?php echo $boxid; ?>"><?php echo T_('IP Addresses'); ?></a></li> <li><a href="boxserver.php?id=<?php echo $boxid; ?>"><?php echo T_('Servers'); ?></a></li> <li><a href="boxchart.php?id=<?php echo $boxid; ?>"><?php echo T_('Charts'); ?></a></li> <li class="active"><a href="boxgamefile.php?id=<?php echo $boxid; ?>"><?php echo T_('Game File Repositories'); ?></a></li> <li><a href="boxlog.php?id=<?php echo $boxid; ?>"><?php echo T_('Activity Logs'); ?></a></li> </ul> <div class="well"> <table id="gamefiles" class="zebra-striped"> <thead> <tr> <th><?php echo T_('Game'); ?></th> <th><?php echo T_('Cache Directory'); ?></th> <th><?php echo T_('Disk Usage'); ?></th> <th><?php echo T_('Last Modification'); ?></th> <th><?php echo T_('Status'); ?></th> <th></th> <th></th> </tr> </thead> <tbody> <?php while ($rowsGames = mysql_fetch_assoc($games)) { $repoCacheInfo = $gameInstaller->getCacheInfo( $rowsGames['cachedir'] ); $gameExists = $gameInstaller->gameExists( $rowsGames['game'] ); ?> <tr> <td><?php echo htmlspecialchars($rowsGames['game'], ENT_QUOTES); ?></td> <td><?php echo htmlspecialchars($rowsGames['cachedir'], ENT_QUOTES); ?></td> <td><?php if ($repoCacheInfo != FALSE) { echo htmlspecialchars($repoCacheInfo['size'], ENT_QUOTES); } else { echo T_('None'); } ?></td> <td><?php if ($repoCacheInfo != FALSE) { echo @date('l | F j, Y | H:i', $repoCacheInfo['mtime']); } else { echo T_('Never'); } ?></td> <td><?php if ($gameExists == FALSE) { echo "<span class=\"label\">".T_('Game Not Supported')."</span>"; } else if ($repoCacheInfo == FALSE) { echo "<span class=\"label label-warning\">".T_('No Cache')."</span>"; } else if ($repoCacheInfo['status'] == 'Ready') { echo "<span class=\"label label-success\">Ready</span>"; } else if ($repoCacheInfo['status'] == 'Aborted') { echo "<span class=\"label label-important\">Aborted</span>"; } else { echo "<span class=\"label label-info\">".htmlspecialchars($repoCacheInfo['status'], ENT_QUOTES)."</span>"; } ?></td> <td> <!-- Actions --> <div style="text-align: center;"> <?php if ($gameExists) { if ( ($repoCacheInfo == FALSE) || ($repoCacheInfo['status'] == 'Aborted') ) { // No repo OR repo not ready ?> <a class="btn btn-small" href="#" onclick="doRepoAction('<?php echo $boxid; ?>', '<?php echo $rowsGames['gameid']; ?>', 'makeRepo', '<?php echo T_('create a new cache repository for'); ?>', '<?php echo htmlspecialchars($rowsGames['game'], ENT_QUOTES); ?>')"> <i class="icon-download-alt <?php echo formatIcon(); ?>"></i> </a> <?php } if ( ($repoCacheInfo != FALSE) && ($repoCacheInfo['status'] != 'Aborted') && ($repoCacheInfo['status'] != 'Ready') ) { // Operation in progress ?> <a class="btn btn-small" href="#" onclick="doRepoAction('<?php echo $boxid; ?>', '<?php echo $rowsGames['gameid']; ?>', 'abortOperation', '<?php echo T_('abort current operation for repository'); ?>', '<?php echo htmlspecialchars($rowsGames['game'], ENT_QUOTES); ?>')"> <i class="icon-stop <?php echo formatIcon(); ?>"></i> </a> <?php } if ( $repoCacheInfo['status'] == 'Ready') { // Cache Ready ?> <a class="btn btn-small" href="#" onclick="doRepoAction('<?php echo $boxid; ?>', '<?php echo $rowsGames['gameid']; ?>', 'makeRepo', '<?php echo T_('refresh repository contents for'); ?>', '<?php echo htmlspecialchars($rowsGames['game'], ENT_QUOTES); ?>')"> <i class="icon-repeat <?php echo formatIcon(); ?>"></i> </a> <?php } } ?> </div> </td> <td> <!-- Drop Action --> <div style="text-align: center;"> <?php if ($gameExists) { if ( ($repoCacheInfo != FALSE) && ( ($repoCacheInfo['status'] == 'Aborted') || ($repoCacheInfo['status'] == 'Ready') ) ) { // Repo exists AND no operation in progress ?> <a class="btn btn-small" href="#" onclick="doRepoAction('<?php echo $boxid; ?>', '<?php echo $rowsGames['gameid']; ?>', 'deleteRepo', '<?php echo T_('remove cache repository for'); ?>', '<?php echo htmlspecialchars($rowsGames['game'], ENT_QUOTES); ?>')"> <i class="icon-trash <?php echo formatIcon(); ?>"></i> </a> <?php } } ?> </div> </td> </tr> <?php } ?> </tbody> </table> <?php if (mysql_num_rows($games) != 0) { ?> <script type="text/javascript"> $(document).ready(function() { $("#gamefiles").tablesorter({ headers: { 5: { sorter: false }, 6: { sorter: false } }, sortList: [[0,0]] }); }); <!-- --> function doRepoAction(boxid, gameid, task, action, game) { if (confirm('<?php echo T_('Are you sure you want to'); ?> '+action+' '+game+' ?')) { window.location='boxprocess.php?boxid='+boxid+'&gameid='+gameid+'&task='+task; } } </script> <?php } unset($games); ?> </div> <?php include("./bootstrap/footer.php"); ?>
kinnngg/knightofsorrow.tk
bgp/admin/boxgamefile.php
PHP
mit
7,705
// // FKFlickrAuthOauthGetAccessToken.h // FlickrKit // // Generated by FKAPIBuilder on 19 Sep, 2014 at 10:49. // Copyright (c) 2013 DevedUp Ltd. All rights reserved. http://www.devedup.com // // DO NOT MODIFY THIS FILE - IT IS MACHINE GENERATED #import "FKFlickrAPIMethod.h" typedef enum { FKFlickrAuthOauthGetAccessTokenError_InvalidSignature = 96, /* The passed signature was invalid. */ FKFlickrAuthOauthGetAccessTokenError_MissingSignature = 97, /* The call required signing but no signature was sent. */ FKFlickrAuthOauthGetAccessTokenError_InvalidAPIKey = 100, /* The API key passed was not valid or has expired. */ FKFlickrAuthOauthGetAccessTokenError_ServiceCurrentlyUnavailable = 105, /* The requested service is temporarily unavailable. */ FKFlickrAuthOauthGetAccessTokenError_WriteOperationFailed = 106, /* The requested operation failed due to a temporary issue. */ FKFlickrAuthOauthGetAccessTokenError_FormatXXXNotFound = 111, /* The requested response format was not found. */ FKFlickrAuthOauthGetAccessTokenError_MethodXXXNotFound = 112, /* The requested method was not found. */ FKFlickrAuthOauthGetAccessTokenError_InvalidSOAPEnvelope = 114, /* The SOAP envelope send in the request could not be parsed. */ FKFlickrAuthOauthGetAccessTokenError_InvalidXMLRPCMethodCall = 115, /* The XML-RPC request document could not be parsed. */ FKFlickrAuthOauthGetAccessTokenError_BadURLFound = 116, /* One or more arguments contained a URL that has been used for abuse on Flickr. */ } FKFlickrAuthOauthGetAccessTokenError; /* Exchange an auth token from the old Authentication API, to an OAuth access token. Calling this method will delete the auth token used to make the request. Response: <auth> <access_token oauth_token="72157607082540144-8d5d7ea7696629bf" oauth_token_secret="f38bf58b2d95bc8b" /> </auth> */ @interface FKFlickrAuthOauthGetAccessToken : NSObject <FKFlickrAPIMethod> @end
king7532/TaylorSource
examples/Gallery/Pods/FlickrKit/Classes/Model/Generated/Auth/Oauth/FKFlickrAuthOauthGetAccessToken.h
C
mit
1,951
/** * * \file * * \brief This module contains NMC1000 SPI protocol bus APIs implementation. * * Copyright (c) 2016-2018 Microchip Technology Inc. and its subsidiaries. * * \asf_license_start * * \page License * * Subject to your compliance with these terms, you may use Microchip * software and any derivatives exclusively with Microchip products. * It is your responsibility to comply with third party license terms applicable * to your use of third party software (including open source software) that * may accompany Microchip software. * * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, * WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, * INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, * AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE * LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL * LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE * SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE * POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT * ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY * RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY, * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE. * * \asf_license_stop * */ #ifndef _NMSPI_H_ #define _NMSPI_H_ #include "common/include/nm_common.h" #ifdef __cplusplus extern "C" { #endif /** * @fn nm_spi_init * @brief Initialize the SPI * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure */ sint8 nm_spi_init(void); /** * @fn nm_spi_reset * @brief reset the SPI * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure */ sint8 nm_spi_reset(void); /** * @fn nm_spi_deinit * @brief DeInitialize the SPI * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure */ sint8 nm_spi_deinit(void); /** * @fn nm_spi_read_reg * @brief Read register * @param [in] u32Addr * Register address * @return Register value */ uint32 nm_spi_read_reg(uint32 u32Addr); /** * @fn nm_spi_read_reg_with_ret * @brief Read register with error code return * @param [in] u32Addr * Register address * @param [out] pu32RetVal * Pointer to u32 variable used to return the read value * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure */ sint8 nm_spi_read_reg_with_ret(uint32 u32Addr, uint32* pu32RetVal); /** * @fn nm_spi_write_reg * @brief write register * @param [in] u32Addr * Register address * @param [in] u32Val * Value to be written to the register * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure */ sint8 nm_spi_write_reg(uint32 u32Addr, uint32 u32Val); /** * @fn nm_spi_read_block * @brief Read block of data * @param [in] u32Addr * Start address * @param [out] puBuf * Pointer to a buffer used to return the read data * @param [in] u16Sz * Number of bytes to read. The buffer size must be >= u16Sz * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure */ sint8 nm_spi_read_block(uint32 u32Addr, uint8 *puBuf, uint16 u16Sz); /** * @fn nm_spi_write_block * @brief Write block of data * @param [in] u32Addr * Start address * @param [in] puBuf * Pointer to the buffer holding the data to be written * @param [in] u16Sz * Number of bytes to write. The buffer size must be >= u16Sz * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure */ sint8 nm_spi_write_block(uint32 u32Addr, uint8 *puBuf, uint16 u16Sz); #ifdef __cplusplus } #endif #endif /* _NMSPI_H_ */
openmv/openmv
src/drivers/winc1500/include/driver/include/nmspi.h
C
mit
3,627
/*plugin styles*/ .visualize { border: 1px solid #ccc; position: relative; background: #fafafa; margin:0 auto 30px auto; } .visualize canvas { position: absolute; } .visualize ul, .visualize li { margin: 0; padding: 0; } /*table title, key elements*/ .visualize .visualize-info { padding: 3px 5px; background: #fafafa; border: 1px solid #ccc; position: absolute; top: -20px; right: 10px; opacity: .8; } .visualize .visualize-title { display: block; color: #333; margin-bottom: 3px; font-size: 1.1em; } .visualize ul.visualize-key { list-style: none; } .visualize ul.visualize-key li { list-style: none; float: left; margin-right: 10px; padding-left: 10px; position: relative; background:none; } .visualize ul.visualize-key .visualize-key-color { width: 6px; height: 6px; left: 0; position: absolute; top: 50%; margin-top: -3px; } .visualize ul.visualize-key .visualize-key-label { color: #000; } /*pie labels*/ .visualize-pie .visualize-labels { list-style: none; } .visualize-pie .visualize-label-pos, .visualize-pie .visualize-label { position: absolute; margin: 0; padding:0; } .visualize-pie .visualize-label { display: block; color: #fff; font-weight: bold; font-size: 1em; } .visualize-pie-outside .visualize-label { color: #000; font-weight: normal; } /*line,bar, area labels*/ .visualize-labels-x,.visualize-labels-y { position: absolute; left: 0; top: 0; list-style: none; } .visualize-labels-x li, .visualize-labels-y li { position: absolute; bottom: 0; background:none; } .visualize-labels-x li span.label, .visualize-labels-y li span.label { position: absolute; color: #555; } .visualize-labels-x li span.line, .visualize-labels-y li span.line { position: absolute; border: 0 solid #ccc; } .visualize-labels-x li { height: 100%; } .visualize-labels-x li span.label { top: 100%; margin-top: 5px; } .visualize-labels-x li span.line { border-left-width: 1px; height: 100%; display: block; } .visualize-labels-x li span.line { border: 0;} /*hide vertical lines on area, line, bar*/ .visualize-labels-y li { width: 100%; } .visualize-labels-y li span.label { right: 100%; margin-right: 5px; display: block; width: 100px; text-align: right; } .visualize-labels-y li span.line { border-top-width: 1px; width: 100%; } .visualize-bar .visualize-labels-x li span.label { width: 100%; text-align: center; } .ie8 .visualize-interaction-tracker { margin-top:0 !important; } /*tooltips*/ .visualize .chart_tooltip { padding:6px 7px; background:#000; background:url(../img/jquery/visualize_tooltip.png) 0 0 repeat; margin:3px 4px 0; -webkit-border-radius:5px; -moz-border-radius:5px; border-radius:5px; color:#fff; font-size:10px; line-height:normal; }
cristinarandall/selfstarter
public/stylesheets/stats/jquery.visualize.css
CSS
mit
2,718
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // <auto-generated/> #nullable disable using System.Collections.Generic; using System.Text.Json; using Azure.Core; namespace Azure.Analytics.Synapse.Artifacts.Models { public partial class ShopifySource : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); if (Optional.IsDefined(Query)) { writer.WritePropertyName("query"); writer.WriteObjectValue(Query); } if (Optional.IsDefined(QueryTimeout)) { writer.WritePropertyName("queryTimeout"); writer.WriteObjectValue(QueryTimeout); } writer.WritePropertyName("type"); writer.WriteStringValue(Type); if (Optional.IsDefined(SourceRetryCount)) { writer.WritePropertyName("sourceRetryCount"); writer.WriteObjectValue(SourceRetryCount); } if (Optional.IsDefined(SourceRetryWait)) { writer.WritePropertyName("sourceRetryWait"); writer.WriteObjectValue(SourceRetryWait); } if (Optional.IsDefined(MaxConcurrentConnections)) { writer.WritePropertyName("maxConcurrentConnections"); writer.WriteObjectValue(MaxConcurrentConnections); } foreach (var item in AdditionalProperties) { writer.WritePropertyName(item.Key); writer.WriteObjectValue(item.Value); } writer.WriteEndObject(); } internal static ShopifySource DeserializeShopifySource(JsonElement element) { Optional<object> query = default; Optional<object> queryTimeout = default; string type = default; Optional<object> sourceRetryCount = default; Optional<object> sourceRetryWait = default; Optional<object> maxConcurrentConnections = default; IDictionary<string, object> additionalProperties = default; Dictionary<string, object> additionalPropertiesDictionary = new Dictionary<string, object>(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("query")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } query = property.Value.GetObject(); continue; } if (property.NameEquals("queryTimeout")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } queryTimeout = property.Value.GetObject(); continue; } if (property.NameEquals("type")) { type = property.Value.GetString(); continue; } if (property.NameEquals("sourceRetryCount")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } sourceRetryCount = property.Value.GetObject(); continue; } if (property.NameEquals("sourceRetryWait")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } sourceRetryWait = property.Value.GetObject(); continue; } if (property.NameEquals("maxConcurrentConnections")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } maxConcurrentConnections = property.Value.GetObject(); continue; } additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); } additionalProperties = additionalPropertiesDictionary; return new ShopifySource(type, sourceRetryCount.Value, sourceRetryWait.Value, maxConcurrentConnections.Value, additionalProperties, queryTimeout.Value, query.Value); } } }
brjohnstmsft/azure-sdk-for-net
sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/ShopifySource.Serialization.cs
C#
mit
5,009
// This file has been autogenerated. exports.setEnvironment = function() { process.env['AZURE_SUBSCRIPTION_ID'] = 'e0b81f36-36ba-44f7-b550-7c9344a35893'; }; exports.scopes = [[function (nock) { var result = nock('http://management.azure.com:443') .get('/subscriptions/e0b81f36-36ba-44f7-b550-7c9344a35893/resourceGroups/nodetestrg/providers/Microsoft.Devices/IotHubs/nodeTestHub/eventHubEndpoints/events/ConsumerGroups/testconsumergroup?api-version=2017-07-01') .reply(200, "{\"tags\":null,\"id\":\"/subscriptions/e0b81f36-36ba-44f7-b550-7c9344a35893/resourceGroups/nodetestrg/providers/Microsoft.Devices/IotHubs/nodeTestHub\",\"name\":\"testconsumergroup\"}", { 'cache-control': 'no-cache', pragma: 'no-cache', 'content-length': '173', 'content-type': 'application/json; charset=utf-8', expires: '-1', server: 'Microsoft-HTTPAPI/2.0', 'x-ms-ratelimit-remaining-subscription-reads': '14953', 'x-ms-request-id': 'be4cc550-e523-4bc7-898a-9c2a5aa64725', 'x-ms-correlation-request-id': 'be4cc550-e523-4bc7-898a-9c2a5aa64725', 'x-ms-routing-request-id': 'WESTUS:20170502T195224Z:be4cc550-e523-4bc7-898a-9c2a5aa64725', 'strict-transport-security': 'max-age=31536000; includeSubDomains', date: 'Tue, 02 May 2017 19:52:23 GMT', connection: 'close' }); return result; }, function (nock) { var result = nock('https://management.azure.com:443') .get('/subscriptions/e0b81f36-36ba-44f7-b550-7c9344a35893/resourceGroups/nodetestrg/providers/Microsoft.Devices/IotHubs/nodeTestHub/eventHubEndpoints/events/ConsumerGroups/testconsumergroup?api-version=2017-07-01') .reply(200, "{\"tags\":null,\"id\":\"/subscriptions/e0b81f36-36ba-44f7-b550-7c9344a35893/resourceGroups/nodetestrg/providers/Microsoft.Devices/IotHubs/nodeTestHub\",\"name\":\"testconsumergroup\"}", { 'cache-control': 'no-cache', pragma: 'no-cache', 'content-length': '173', 'content-type': 'application/json; charset=utf-8', expires: '-1', server: 'Microsoft-HTTPAPI/2.0', 'x-ms-ratelimit-remaining-subscription-reads': '14953', 'x-ms-request-id': 'be4cc550-e523-4bc7-898a-9c2a5aa64725', 'x-ms-correlation-request-id': 'be4cc550-e523-4bc7-898a-9c2a5aa64725', 'x-ms-routing-request-id': 'WESTUS:20170502T195224Z:be4cc550-e523-4bc7-898a-9c2a5aa64725', 'strict-transport-security': 'max-age=31536000; includeSubDomains', date: 'Tue, 02 May 2017 19:52:23 GMT', connection: 'close' }); return result; }]];
lmazuel/azure-sdk-for-node
test/recordings/iothub-tests/IoTHub_IoTHub_Lifecycle_Test_Suite_should_get_a_single_eventhub_consumer_group_successfully.nock.js
JavaScript
mit
2,416
/*M/////////////////////////////////////////////////////////////////////////////////////// // // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. // // By downloading, copying, installing or using the software you agree to this license. // If you do not agree to this license, do not download, install, // copy or use the software. // // // Intel License Agreement // For Open Source Computer Vision Library // // Copyright (C) 2000, Intel Corporation, all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: // // * Redistribution's of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // // * The name of Intel Corporation may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and // any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages // (including, but not limited to, procurement of substitute goods or services; // loss of use, data, or profits; or business interruption) however caused // and on any theory of liability, whether in contract, strict liability, // or tort (including negligence or otherwise) arising in any way out of // the use of this software, even if advised of the possibility of such damage. // //M*/ #include "precomp.hpp" // The function calculates center of gravity and the central second order moments static void icvCompleteMomentState( CvMoments* moments ) { double cx = 0, cy = 0; double mu20, mu11, mu02; assert( moments != 0 ); moments->inv_sqrt_m00 = 0; if( fabs(moments->m00) > DBL_EPSILON ) { double inv_m00 = 1. / moments->m00; cx = moments->m10 * inv_m00; cy = moments->m01 * inv_m00; moments->inv_sqrt_m00 = std::sqrt( fabs(inv_m00) ); } // mu20 = m20 - m10*cx mu20 = moments->m20 - moments->m10 * cx; // mu11 = m11 - m10*cy mu11 = moments->m11 - moments->m10 * cy; // mu02 = m02 - m01*cy mu02 = moments->m02 - moments->m01 * cy; moments->mu20 = mu20; moments->mu11 = mu11; moments->mu02 = mu02; // mu30 = m30 - cx*(3*mu20 + cx*m10) moments->mu30 = moments->m30 - cx * (3 * mu20 + cx * moments->m10); mu11 += mu11; // mu21 = m21 - cx*(2*mu11 + cx*m01) - cy*mu20 moments->mu21 = moments->m21 - cx * (mu11 + cx * moments->m01) - cy * mu20; // mu12 = m12 - cy*(2*mu11 + cy*m10) - cx*mu02 moments->mu12 = moments->m12 - cy * (mu11 + cy * moments->m10) - cx * mu02; // mu03 = m03 - cy*(3*mu02 + cy*m01) moments->mu03 = moments->m03 - cy * (3 * mu02 + cy * moments->m01); } static void icvContourMoments( CvSeq* contour, CvMoments* moments ) { int is_float = CV_SEQ_ELTYPE(contour) == CV_32FC2; if( contour->total ) { CvSeqReader reader; double a00, a10, a01, a20, a11, a02, a30, a21, a12, a03; double xi, yi, xi2, yi2, xi_1, yi_1, xi_12, yi_12, dxy, xii_1, yii_1; int lpt = contour->total; a00 = a10 = a01 = a20 = a11 = a02 = a30 = a21 = a12 = a03 = 0; cvStartReadSeq( contour, &reader, 0 ); if( !is_float ) { xi_1 = ((CvPoint*)(reader.ptr))->x; yi_1 = ((CvPoint*)(reader.ptr))->y; } else { xi_1 = ((CvPoint2D32f*)(reader.ptr))->x; yi_1 = ((CvPoint2D32f*)(reader.ptr))->y; } CV_NEXT_SEQ_ELEM( contour->elem_size, reader ); xi_12 = xi_1 * xi_1; yi_12 = yi_1 * yi_1; while( lpt-- > 0 ) { if( !is_float ) { xi = ((CvPoint*)(reader.ptr))->x; yi = ((CvPoint*)(reader.ptr))->y; } else { xi = ((CvPoint2D32f*)(reader.ptr))->x; yi = ((CvPoint2D32f*)(reader.ptr))->y; } CV_NEXT_SEQ_ELEM( contour->elem_size, reader ); xi2 = xi * xi; yi2 = yi * yi; dxy = xi_1 * yi - xi * yi_1; xii_1 = xi_1 + xi; yii_1 = yi_1 + yi; a00 += dxy; a10 += dxy * xii_1; a01 += dxy * yii_1; a20 += dxy * (xi_1 * xii_1 + xi2); a11 += dxy * (xi_1 * (yii_1 + yi_1) + xi * (yii_1 + yi)); a02 += dxy * (yi_1 * yii_1 + yi2); a30 += dxy * xii_1 * (xi_12 + xi2); a03 += dxy * yii_1 * (yi_12 + yi2); a21 += dxy * (xi_12 * (3 * yi_1 + yi) + 2 * xi * xi_1 * yii_1 + xi2 * (yi_1 + 3 * yi)); a12 += dxy * (yi_12 * (3 * xi_1 + xi) + 2 * yi * yi_1 * xii_1 + yi2 * (xi_1 + 3 * xi)); xi_1 = xi; yi_1 = yi; xi_12 = xi2; yi_12 = yi2; } double db1_2, db1_6, db1_12, db1_24, db1_20, db1_60; if( fabs(a00) > FLT_EPSILON ) { if( a00 > 0 ) { db1_2 = 0.5; db1_6 = 0.16666666666666666666666666666667; db1_12 = 0.083333333333333333333333333333333; db1_24 = 0.041666666666666666666666666666667; db1_20 = 0.05; db1_60 = 0.016666666666666666666666666666667; } else { db1_2 = -0.5; db1_6 = -0.16666666666666666666666666666667; db1_12 = -0.083333333333333333333333333333333; db1_24 = -0.041666666666666666666666666666667; db1_20 = -0.05; db1_60 = -0.016666666666666666666666666666667; } // spatial moments moments->m00 = a00 * db1_2; moments->m10 = a10 * db1_6; moments->m01 = a01 * db1_6; moments->m20 = a20 * db1_12; moments->m11 = a11 * db1_24; moments->m02 = a02 * db1_12; moments->m30 = a30 * db1_20; moments->m21 = a21 * db1_60; moments->m12 = a12 * db1_60; moments->m03 = a03 * db1_20; icvCompleteMomentState( moments ); } } } /****************************************************************************************\ * Spatial Raster Moments * \****************************************************************************************/ template<typename T, typename WT, typename MT> static void momentsInTile( const cv::Mat& img, double* moments ) { cv::Size size = img.size(); int x, y; MT mom[10] = {0,0,0,0,0,0,0,0,0,0}; for( y = 0; y < size.height; y++ ) { const T* ptr = (const T*)(img.data + y*img.step); WT x0 = 0, x1 = 0, x2 = 0; MT x3 = 0; for( x = 0; x < size.width; x++ ) { WT p = ptr[x]; WT xp = x * p, xxp; x0 += p; x1 += xp; xxp = xp * x; x2 += xxp; x3 += xxp * x; } WT py = y * x0, sy = y*y; mom[9] += ((MT)py) * sy; // m03 mom[8] += ((MT)x1) * sy; // m12 mom[7] += ((MT)x2) * y; // m21 mom[6] += x3; // m30 mom[5] += x0 * sy; // m02 mom[4] += x1 * y; // m11 mom[3] += x2; // m20 mom[2] += py; // m01 mom[1] += x1; // m10 mom[0] += x0; // m00 } for( x = 0; x < 10; x++ ) moments[x] = (double)mom[x]; } #if CV_SSE2 template<> void momentsInTile<uchar, int, int>( const cv::Mat& img, double* moments ) { typedef uchar T; typedef int WT; typedef int MT; cv::Size size = img.size(); int x, y; MT mom[10] = {0,0,0,0,0,0,0,0,0,0}; bool useSIMD = cv::checkHardwareSupport(CV_CPU_SSE2); for( y = 0; y < size.height; y++ ) { const T* ptr = img.ptr<T>(y); int x0 = 0, x1 = 0, x2 = 0, x3 = 0, x = 0; if( useSIMD ) { __m128i qx_init = _mm_setr_epi16(0, 1, 2, 3, 4, 5, 6, 7); __m128i dx = _mm_set1_epi16(8); __m128i z = _mm_setzero_si128(), qx0 = z, qx1 = z, qx2 = z, qx3 = z, qx = qx_init; for( ; x <= size.width - 8; x += 8 ) { __m128i p = _mm_unpacklo_epi8(_mm_loadl_epi64((const __m128i*)(ptr + x)), z); qx0 = _mm_add_epi32(qx0, _mm_sad_epu8(p, z)); __m128i px = _mm_mullo_epi16(p, qx); __m128i sx = _mm_mullo_epi16(qx, qx); qx1 = _mm_add_epi32(qx1, _mm_madd_epi16(p, qx)); qx2 = _mm_add_epi32(qx2, _mm_madd_epi16(p, sx)); qx3 = _mm_add_epi32(qx3, _mm_madd_epi16(px, sx)); qx = _mm_add_epi16(qx, dx); } int CV_DECL_ALIGNED(16) buf[4]; _mm_store_si128((__m128i*)buf, qx0); x0 = buf[0] + buf[1] + buf[2] + buf[3]; _mm_store_si128((__m128i*)buf, qx1); x1 = buf[0] + buf[1] + buf[2] + buf[3]; _mm_store_si128((__m128i*)buf, qx2); x2 = buf[0] + buf[1] + buf[2] + buf[3]; _mm_store_si128((__m128i*)buf, qx3); x3 = buf[0] + buf[1] + buf[2] + buf[3]; } for( ; x < size.width; x++ ) { WT p = ptr[x]; WT xp = x * p, xxp; x0 += p; x1 += xp; xxp = xp * x; x2 += xxp; x3 += xxp * x; } WT py = y * x0, sy = y*y; mom[9] += ((MT)py) * sy; // m03 mom[8] += ((MT)x1) * sy; // m12 mom[7] += ((MT)x2) * y; // m21 mom[6] += x3; // m30 mom[5] += x0 * sy; // m02 mom[4] += x1 * y; // m11 mom[3] += x2; // m20 mom[2] += py; // m01 mom[1] += x1; // m10 mom[0] += x0; // m00 } for( x = 0; x < 10; x++ ) moments[x] = (double)mom[x]; } #endif typedef void (*CvMomentsInTileFunc)(const cv::Mat& img, double* moments); CV_IMPL void cvMoments( const void* array, CvMoments* moments, int binary ) { const int TILE_SIZE = 32; int type, depth, cn, coi = 0; CvMat stub, *mat = (CvMat*)array; CvMomentsInTileFunc func = 0; CvContour contourHeader; CvSeq* contour = 0; CvSeqBlock block; double buf[TILE_SIZE*TILE_SIZE]; uchar nzbuf[TILE_SIZE*TILE_SIZE]; if( CV_IS_SEQ( array )) { contour = (CvSeq*)array; if( !CV_IS_SEQ_POINT_SET( contour )) CV_Error( CV_StsBadArg, "The passed sequence is not a valid contour" ); } if( !moments ) CV_Error( CV_StsNullPtr, "" ); memset( moments, 0, sizeof(*moments)); if( !contour ) { mat = cvGetMat( mat, &stub, &coi ); type = CV_MAT_TYPE( mat->type ); if( type == CV_32SC2 || type == CV_32FC2 ) { contour = cvPointSeqFromMat( CV_SEQ_KIND_CURVE | CV_SEQ_FLAG_CLOSED, mat, &contourHeader, &block ); } } if( contour ) { icvContourMoments( contour, moments ); return; } type = CV_MAT_TYPE( mat->type ); depth = CV_MAT_DEPTH( type ); cn = CV_MAT_CN( type ); cv::Size size = cvGetMatSize( mat ); if( cn > 1 && coi == 0 ) CV_Error( CV_StsBadArg, "Invalid image type" ); if( size.width <= 0 || size.height <= 0 ) return; if( binary || depth == CV_8U ) func = momentsInTile<uchar, int, int>; else if( depth == CV_16U ) func = momentsInTile<ushort, int, int64>; else if( depth == CV_16S ) func = momentsInTile<short, int, int64>; else if( depth == CV_32F ) func = momentsInTile<float, double, double>; else if( depth == CV_64F ) func = momentsInTile<double, double, double>; else CV_Error( CV_StsUnsupportedFormat, "" ); cv::Mat src0(mat); for( int y = 0; y < size.height; y += TILE_SIZE ) { cv::Size tileSize; tileSize.height = std::min(TILE_SIZE, size.height - y); for( int x = 0; x < size.width; x += TILE_SIZE ) { tileSize.width = std::min(TILE_SIZE, size.width - x); cv::Mat src(src0, cv::Rect(x, y, tileSize.width, tileSize.height)); if( coi > 0 ) { cv::Mat tmp(tileSize, depth, buf); int pairs[] = {coi-1, 0}; cv::mixChannels(&src, 1, &tmp, 1, pairs, 1); src = tmp; } if( binary ) { cv::Mat tmp(tileSize, CV_8U, nzbuf); cv::compare( src, 0, tmp, CV_CMP_NE ); src = tmp; } double mom[10]; func( src, mom ); if(binary) { double s = 1./255; for( int k = 0; k < 10; k++ ) mom[k] *= s; } double xm = x * mom[0], ym = y * mom[0]; // accumulate moments computed in each tile // + m00 ( = m00' ) moments->m00 += mom[0]; // + m10 ( = m10' + x*m00' ) moments->m10 += mom[1] + xm; // + m01 ( = m01' + y*m00' ) moments->m01 += mom[2] + ym; // + m20 ( = m20' + 2*x*m10' + x*x*m00' ) moments->m20 += mom[3] + x * (mom[1] * 2 + xm); // + m11 ( = m11' + x*m01' + y*m10' + x*y*m00' ) moments->m11 += mom[4] + x * (mom[2] + ym) + y * mom[1]; // + m02 ( = m02' + 2*y*m01' + y*y*m00' ) moments->m02 += mom[5] + y * (mom[2] * 2 + ym); // + m30 ( = m30' + 3*x*m20' + 3*x*x*m10' + x*x*x*m00' ) moments->m30 += mom[6] + x * (3. * mom[3] + x * (3. * mom[1] + xm)); // + m21 ( = m21' + x*(2*m11' + 2*y*m10' + x*m01' + x*y*m00') + y*m20') moments->m21 += mom[7] + x * (2 * (mom[4] + y * mom[1]) + x * (mom[2] + ym)) + y * mom[3]; // + m12 ( = m12' + y*(2*m11' + 2*x*m01' + y*m10' + x*y*m00') + x*m02') moments->m12 += mom[8] + y * (2 * (mom[4] + x * mom[2]) + y * (mom[1] + xm)) + x * mom[5]; // + m03 ( = m03' + 3*y*m02' + 3*y*y*m01' + y*y*y*m00' ) moments->m03 += mom[9] + y * (3. * mom[5] + y * (3. * mom[2] + ym)); } } icvCompleteMomentState( moments ); } CV_IMPL void cvGetHuMoments( CvMoments * mState, CvHuMoments * HuState ) { if( !mState || !HuState ) CV_Error( CV_StsNullPtr, "" ); double m00s = mState->inv_sqrt_m00, m00 = m00s * m00s, s2 = m00 * m00, s3 = s2 * m00s; double nu20 = mState->mu20 * s2, nu11 = mState->mu11 * s2, nu02 = mState->mu02 * s2, nu30 = mState->mu30 * s3, nu21 = mState->mu21 * s3, nu12 = mState->mu12 * s3, nu03 = mState->mu03 * s3; double t0 = nu30 + nu12; double t1 = nu21 + nu03; double q0 = t0 * t0, q1 = t1 * t1; double n4 = 4 * nu11; double s = nu20 + nu02; double d = nu20 - nu02; HuState->hu1 = s; HuState->hu2 = d * d + n4 * nu11; HuState->hu4 = q0 + q1; HuState->hu6 = d * (q0 - q1) + n4 * t0 * t1; t0 *= q0 - 3 * q1; t1 *= 3 * q0 - q1; q0 = nu30 - 3 * nu12; q1 = 3 * nu21 - nu03; HuState->hu3 = q0 * q0 + q1 * q1; HuState->hu5 = q0 * t0 + q1 * t1; HuState->hu7 = q1 * t0 - q0 * t1; } CV_IMPL double cvGetSpatialMoment( CvMoments * moments, int x_order, int y_order ) { int order = x_order + y_order; if( !moments ) CV_Error( CV_StsNullPtr, "" ); if( (x_order | y_order) < 0 || order > 3 ) CV_Error( CV_StsOutOfRange, "" ); return (&(moments->m00))[order + (order >> 1) + (order > 2) * 2 + y_order]; } CV_IMPL double cvGetCentralMoment( CvMoments * moments, int x_order, int y_order ) { int order = x_order + y_order; if( !moments ) CV_Error( CV_StsNullPtr, "" ); if( (x_order | y_order) < 0 || order > 3 ) CV_Error( CV_StsOutOfRange, "" ); return order >= 2 ? (&(moments->m00))[4 + order * 3 + y_order] : order == 0 ? moments->m00 : 0; } CV_IMPL double cvGetNormalizedCentralMoment( CvMoments * moments, int x_order, int y_order ) { int order = x_order + y_order; double mu = cvGetCentralMoment( moments, x_order, y_order ); double m00s = moments->inv_sqrt_m00; while( --order >= 0 ) mu *= m00s; return mu * m00s * m00s; } namespace cv { Moments::Moments() { m00 = m10 = m01 = m20 = m11 = m02 = m30 = m21 = m12 = m03 = mu20 = mu11 = mu02 = mu30 = mu21 = mu12 = mu03 = nu20 = nu11 = nu02 = nu30 = nu21 = nu12 = nu03 = 0.; } Moments::Moments( double _m00, double _m10, double _m01, double _m20, double _m11, double _m02, double _m30, double _m21, double _m12, double _m03 ) { m00 = _m00; m10 = _m10; m01 = _m01; m20 = _m20; m11 = _m11; m02 = _m02; m30 = _m30; m21 = _m21; m12 = _m12; m03 = _m03; double cx = 0, cy = 0, inv_m00 = 0; if( std::abs(m00) > DBL_EPSILON ) { inv_m00 = 1./m00; cx = m10*inv_m00; cy = m01*inv_m00; } mu20 = m20 - m10*cx; mu11 = m11 - m10*cy; mu02 = m02 - m01*cy; mu30 = m30 - cx*(3*mu20 + cx*m10); mu21 = m21 - cx*(2*mu11 + cx*m01) - cy*mu20; mu12 = m12 - cy*(2*mu11 + cy*m10) - cx*mu02; mu03 = m03 - cy*(3*mu02 + cy*m01); double inv_sqrt_m00 = std::sqrt(std::abs(inv_m00)); double s2 = inv_m00*inv_m00, s3 = s2*inv_sqrt_m00; nu20 = mu20*s2; nu11 = mu11*s2; nu02 = mu02*s2; nu30 = mu30*s3; nu21 = mu21*s3; nu12 = mu12*s3; nu03 = mu03*s3; } Moments::Moments( const CvMoments& m ) { *this = Moments(m.m00, m.m10, m.m01, m.m20, m.m11, m.m02, m.m30, m.m21, m.m12, m.m03); } Moments::operator CvMoments() const { CvMoments m; m.m00 = m00; m.m10 = m10; m.m01 = m01; m.m20 = m20; m.m11 = m11; m.m02 = m02; m.m30 = m30; m.m21 = m21; m.m12 = m12; m.m03 = m03; m.mu20 = mu20; m.mu11 = mu11; m.mu02 = mu02; m.mu30 = mu30; m.mu21 = mu21; m.mu12 = mu12; m.mu03 = mu03; double am00 = std::abs(m00); m.inv_sqrt_m00 = am00 > DBL_EPSILON ? 1./std::sqrt(am00) : 0; return m; } } cv::Moments cv::moments( const Mat& array, bool binaryImage ) { CvMoments om; CvMat _array = array; cvMoments(&_array, &om, binaryImage); return om; } void cv::HuMoments( const Moments& m, double hu[7] ) { double t0 = m.nu30 + m.nu12; double t1 = m.nu21 + m.nu03; double q0 = t0 * t0, q1 = t1 * t1; double n4 = 4 * m.nu11; double s = m.nu20 + m.nu02; double d = m.nu20 - m.nu02; hu[0] = s; hu[1] = d * d + n4 * m.nu11; hu[3] = q0 + q1; hu[5] = d * (q0 - q1) + n4 * t0 * t1; t0 *= q0 - 3 * q1; t1 *= 3 * q0 - q1; q0 = m.nu30 - 3 * m.nu12; q1 = 3 * m.nu21 - m.nu03; hu[2] = q0 * q0 + q1 * q1; hu[4] = q0 * t0 + q1 * t1; hu[6] = q1 * t0 - q0 * t1; } /* End of file. */
eirTony/INDI1
to/lang/OpenCV-2.2.0/modules/imgproc/src/moments.cpp
C++
mit
19,603
## About threex.tweencontrols.js * NOTES: is it position only ? * it gives the currentPosition * it gives the targetPosition * it gives a transitionDelay * targetPosition is dynamic - everytime it changes, test if a tweening is in progress - if current tweening, don't change the delay - else put default delay * which function for the tweening ? ## About size variations * if focus generation changes, the display size will change too * could that be handled at the css level ## About dynamic generation based on wikipedia content * how to query it from wikipedia * query some info from a page * query related pages from a page - build from it * cache all that * how to build it dynamically ## About threex.peppernodestaticcontrols.js ### About controls strategy * i went for a dynamic physics - it seems hard to controls - it is hard to predict too * what about a hardcoded topology - like a given tree portion will be visualized this way - with very little freedom, thus very predictive - a given tree portion got a single visualisation - switch from a portion to another is just a tweening on top - it seems possible and seems to be simpler, what about the details ### Deterministic visualisation * without animation for now, as a simplification assumption. - go for the simplest * focused node at the center * children of a node spread around the parent node - equal angle between each link - so the parent is included in the computation * the length of a link is relative to the child node generation #### Nice... how to code it now * if generation === 1, then position.set(0,0,0) * the world position of children is set by the parent * so setting position of each node is only done on a node if it got children - what is the algo to apply to each node ? - reccursive function: handle current node and forward to all child - to handle a node is finding its position in world space #### Pseudo code for computePosition(node) ``` function computePosition(node){ // special case of focus node position var isFocusedNode = node.parent !== null ? true : false if( isFocusedNode ){ node.position.set(0,0,0) } // if no children, do nothing more if( node.children.length === 0 ) continue; // ... here compute the position of each node // forward to each child node.children.forEach(function(child){ computePosition(child) }) } ``` **how to compute the position of each child ?** * is there a node.parent ? * how many children are there. ``` var linksCount = node.children.length + (node.parent !== null? 1 : 0) var deltaAngle = Math.PI*2 / linksCount var startAngle = 0 if( node.parent !== null ){ var deltaY = node.parent.position.y - node.position.y var deltaX = node.parent.position.x - node.position.x startAngle = Math.atan2(deltaY, deltaX) startAngle += deltaAngle } // compute the radius var radiuses= [0,100, 40] console.assert(node.generation >= 1 && node.generation < radiuses.length ) var radius = radiuses[node.generation] var angle = startAngle node.children.forEach(function(nodeChild){ nodeChild.position.x = Math.cos(angle)*radius nodeChild.position.y = Math.sin(angle)*radius angle += deltaAngle }) ```
atj1979/threex
src/threex.peppernodes/examples/TODO_static.md
Markdown
mit
3,307
/********************************************************************** *< FILE: RealWorldMapUtils.h DESCRIPTION: Utilities for supporting real-world maps size parameters CREATED BY: Scott Morrison HISTORY: created Feb. 1, 2005 *> Copyright (c) 2005, All Rights Reserved. **********************************************************************/ #pragma once //! Class for creating undo record for any class with a "Real-World Map Size" property. //! //! This is a template class where the template parameter T is the type //! which supports the real-world map size property. This class must have //! a method called SetUsePhysicalScaleUVs(BOOL state). template <class T> class RealWorldScaleRecord: public RestoreObj { public: //! Create a real-world map size undo record //! \param[in] pObj - the object which supports the undo/redo toggle //! \param[in] oldState - the state of the real-world map size toggle to restore to. RealWorldScaleRecord(T* pObj, BOOL oldState) { mpObj = pObj; mOldState = oldState; } //! \see RestoreObj::Restore void Restore(int isUndo) { if (isUndo) mpObj->SetUsePhysicalScaleUVs(mOldState); } //! \see RestoreObj::Redo void Redo() { mpObj->SetUsePhysicalScaleUVs(!mOldState); } private: T* mpObj; BOOL mOldState; }; //! The class ID of the real-world scale interface RealWorldMapSizeInterface. #define RWS_INTERFACE Interface_ID(0x9ff44ef, 0x6c050704) //! The unique instance of the real worls map size interface extern CoreExport FPInterfaceDesc gRealWorldMapSizeDesc; //! \brief The commong mix-in interface for setting realWorldMapSize properties on //! objects and modifiers //! //! Details follow here. //! This class is used with multiple inheritence from a class //! which exports a "real-world map size" toggle. The class must //! implement two abstract methods for setting and getting this value. //! The class must implement the following method: //! BaseInterface* GetInterface(Interface_ID id) //! { //! if (id == RWS_INTERFACE) //! return this; //! else //! return FPMixinInterface::GetInterface(id); //! } //! The client class must add this interface the first time ClassDesc::Create() //! is called on the class's class descriptor. //! See maxsdk/samples/objects/boxobj.cpp for an example of the use of this class. class RealWorldMapSizeInterface: public FPMixinInterface { public: //! Gets the state of the real-world map size toggle //! \return the current state of the toggle virtual BOOL GetUsePhysicalScaleUVs() = 0; //! Set the real-world map size toggle //! \param[in] flag - the new value of the toggle virtual void SetUsePhysicalScaleUVs(BOOL flag) = 0; //From FPMixinInterface //! \see FPMixinInterface::GetDesc FPInterfaceDesc* GetDesc() { return &gRealWorldMapSizeDesc; } //! Function published properties for real-world map size enum{ rws_getRealWorldMapSize, rws_setRealWorldMapSize}; // Function Map for Function Publishing System //*********************************** BEGIN_FUNCTION_MAP PROP_FNS (rws_getRealWorldMapSize, GetUsePhysicalScaleUVs, rws_setRealWorldMapSize, SetUsePhysicalScaleUVs, TYPE_BOOL ); END_FUNCTION_MAP }; //@{ //! These methods are used by many objects and modifiers to handle //! the app data required to tag an object as using phyically scaled UVs. //! \param[in] pAnim - The object to query for the real-world app data. //! \return the current value of the flag stored in the app date. CoreExport BOOL GetUsePhysicalScaleUVs(Animatable* pAnim); //! \param[in] pAnim - The object to set for the real-world app data on. //! \param[in] flag - the new value of the toggle to set in the app data. CoreExport void SetUsePhysicalScaleUVs(Animatable* pAnim, BOOL flag); //@} //@{ //! Set/Get the property which says we should use real-world map size by default. //! This value is stored in the market defaults INI file. //! \return the current value of the flag from the market defaults file. CoreExport BOOL GetPhysicalScaleUVsDisabled(); //! Set the value of this flag. //! \param[in] disable - the new value of the flag to store in the market defaults file. CoreExport void SetPhysicalScaleUVsDisabled(BOOL disable); //@}
palestar/medusa
Tools/MedusaExport/max9/include/RealWorldMapUtils.h
C
mit
4,364
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.ComponentModel.Composition; using Microsoft.CodeAnalysis.Editor; using Microsoft.CodeAnalysis.Editor.Host; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Interactive; using Microsoft.VisualStudio.InteractiveWindow; using Microsoft.VisualStudio.Text.Editor; using Microsoft.VisualStudio.Text.Operations; using Microsoft.VisualStudio.Utilities; namespace Microsoft.VisualStudio.LanguageServices.CSharp.Interactive { [ExportInteractive(typeof(IExecuteInInteractiveCommandHandler), ContentTypeNames.CSharpContentType)] internal sealed class CSharpInteractiveCommandHandler : InteractiveCommandHandler, IExecuteInInteractiveCommandHandler { private readonly CSharpVsInteractiveWindowProvider _interactiveWindowProvider; private readonly ISendToInteractiveSubmissionProvider _sendToInteractiveSubmissionProvider; [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public CSharpInteractiveCommandHandler( CSharpVsInteractiveWindowProvider interactiveWindowProvider, ISendToInteractiveSubmissionProvider sendToInteractiveSubmissionProvider, IContentTypeRegistryService contentTypeRegistryService, IEditorOptionsFactoryService editorOptionsFactoryService, IEditorOperationsFactoryService editorOperationsFactoryService) : base(contentTypeRegistryService, editorOptionsFactoryService, editorOperationsFactoryService) { _interactiveWindowProvider = interactiveWindowProvider; _sendToInteractiveSubmissionProvider = sendToInteractiveSubmissionProvider; } protected override ISendToInteractiveSubmissionProvider SendToInteractiveSubmissionProvider => _sendToInteractiveSubmissionProvider; protected override IInteractiveWindow OpenInteractiveWindow(bool focus) => _interactiveWindowProvider.Open(instanceId: 0, focus: focus).InteractiveWindow; } }
dotnet/roslyn
src/VisualStudio/CSharp/Impl/Interactive/CSharpInteractiveCommandHandler.cs
C#
mit
2,251
class AddIndexes < ActiveRecord::Migration def self.up add_index :authentications, :user_id add_index :games, :black_player_id add_index :games, :white_player_id add_index :games, :current_player_id add_index :games, [:id, :current_player_id, :finished_at] end def self.down remove_index :authentications, :user_id remove_index :games, :black_player_id remove_index :games, :white_player_id remove_index :games, :current_player_id remove_index :games, :column => [:id, :current_player_id, :finished_at] end end
brownman/alone.in.the.galaxy
db/migrate/20101017234019_add_indexes.rb
Ruby
mit
560
module.exports = { getMeta: function(meta) { var d = meta.metaDescription || meta.description || meta.Description; if (d && d instanceof Array) { d = d[0]; } return { description: d } } };
loklak/loklak_webclient
iframely/plugins/meta/description.js
JavaScript
mit
264
![preview Long Haul](/preview.jpg) Long Haul is a minimal jekyll theme built with COMPASS / SASS / SUSY and focuses on long form blog plosts. It is meant to used as a starting point for a jekyll blog/website. If you really enjoy Long Haul and want to give me credit somewhere on the send or tweet out your experience with Long Haul and tag me [@brianmaierjr](https://twitter.com/brianmaier). ####[View Demo](http://brianmaierjr.com/long-haul) ## Features - Minimal, Type Focused Design - Built with SASS + COMPASS - Layout with SUSY Grid - SVG Social Icons - Responsive Nav Menu - XML Feed for RSS Readers - Contact Form via Formspree - 5 Post Loop with excerpt on Home Page - Previous / Next Post Navigation - Estimated Reading Time for posts - Stylish Drop Cap on posts - A Better Type Scale for all devices ## Setup 1. [Install Jekyll](http://jekyllrb.com) 2. Fork the [Long Haul repo](http://github.com/brianmaierjr/long-haul) 3. Clone it 4. Install susy `gem install susy` 5. Install normalize `gem install normalize-scss` 6. Run Jekyll `jekyll serve -w` 7. Run `compass watch` 8. Customize! ## Site Settings The main settings can be found inside the `_config.yml` file: - **title:** title of your site - **description:** description of your site - **url:** your url - **paginate:** the amount of posts displayed on homepage - **navigation:** these are the links in the main site navigation - **social** diverse social media usernames (optional) - **google_analytics** Google Analytics key (optional) ## License This is [MIT](LICENSE) with no added caveats, so feel free to use this Jekyll theme on your site without linking back to me or using a disclaimer.
mhaslam/long-haul
README.md
Markdown
mit
1,677
#ifndef _BMP_IO_H #define _BMP_IO_H #include <stdio.h> #include "dot_matrix_font_to_bmp.h" int read_and_alloc_one_bmp(FILE *fp, bmp_file_t *ptrbmp); void free_bmp(bmp_file_t *ptrbmp); int output_bmp(FILE *fp, bmp_file_t *ptrbmp); #endif
lin2724/dot_matrix_font_to_bmp
src/bmp_io.h
C
mit
240
/* * Treeview 1.5pre - jQuery plugin to hide and show branches of a tree * * http://bassistance.de/jquery-plugins/jquery-plugin-treeview/ * http://docs.jquery.com/Plugins/Treeview * * Copyright (c) 2007 Jörn Zaefferer * * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * * Revision: $Id: jquery.treeview.js 5759 2008-07-01 07:50:28Z joern.zaefferer $ * */ ;(function($) { // TODO rewrite as a widget, removing all the extra plugins $.extend($.fn, { swapClass: function(c1, c2) { var c1Elements = this.filter('.' + c1); this.filter('.' + c2).removeClass(c2).addClass(c1); c1Elements.removeClass(c1).addClass(c2); return this; }, replaceClass: function(c1, c2) { return this.filter('.' + c1).removeClass(c1).addClass(c2).end(); }, hoverClass: function(className) { className = className || "hover"; return this.hover(function() { $(this).addClass(className); }, function() { $(this).removeClass(className); }); }, heightToggle: function(animated, callback) { animated ? this.animate({ height: "toggle" }, animated, callback) : this.each(function(){ jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ](); if(callback) callback.apply(this, arguments); }); }, heightHide: function(animated, callback) { if (animated) { this.animate({ height: "hide" }, animated, callback); } else { this.hide(); if (callback) this.each(callback); } }, prepareBranches: function(settings) { if (!settings.prerendered) { // mark last tree items this.filter(":last-child:not(ul)").addClass(CLASSES.last); // collapse whole tree, or only those marked as closed, anyway except those marked as open this.filter((settings.collapsed ? "" : "." + CLASSES.closed) + ":not(." + CLASSES.open + ")").find(">ul").hide(); } // return all items with sublists return this.filter(":has(>ul)"); }, applyClasses: function(settings, toggler) { // TODO use event delegation this.filter(":has(>ul):not(:has(>a))").find(">span").unbind("click.treeview").bind("click.treeview", function(event) { // don't handle click events on children, eg. checkboxes if ( this == event.target ) toggler.apply($(this).next()); }).add( $("a", this) ).hoverClass(); if (!settings.prerendered) { // handle closed ones first this.filter(":has(>ul:hidden)") .addClass(CLASSES.expandable) .replaceClass(CLASSES.last, CLASSES.lastExpandable); // handle open ones this.not(":has(>ul:hidden)") .addClass(CLASSES.collapsable) .replaceClass(CLASSES.last, CLASSES.lastCollapsable); // create hitarea if not present var hitarea = this.find("div." + CLASSES.hitarea); if (!hitarea.length) hitarea = this.prepend("<div class=\"" + CLASSES.hitarea + "\"/>").find("div." + CLASSES.hitarea); hitarea.removeClass().addClass(CLASSES.hitarea).each(function() { var classes = ""; $.each($(this).parent().attr("class").split(" "), function() { classes += this + "-hitarea "; }); $(this).addClass( classes ); }) } // apply event to hitarea this.find("div." + CLASSES.hitarea).click( toggler ); }, treeview: function(settings) { settings = $.extend({ cookieId: "treeview" }, settings); if ( settings.toggle ) { var callback = settings.toggle; settings.toggle = function() { return callback.apply($(this).parent()[0], arguments); }; } // factory for treecontroller function treeController(tree, control) { // factory for click handlers function handler(filter) { return function() { // reuse toggle event handler, applying the elements to toggle // start searching for all hitareas toggler.apply( $("div." + CLASSES.hitarea, tree).filter(function() { // for plain toggle, no filter is provided, otherwise we need to check the parent element return filter ? $(this).parent("." + filter).length : true; }) ); return false; }; } // click on first element to collapse tree $("a:eq(0)", control).click( handler(CLASSES.collapsable) ); // click on second to expand tree $("a:eq(1)", control).click( handler(CLASSES.expandable) ); // click on third to toggle tree $("a:eq(2)", control).click( handler() ); } // handle toggle event function toggler() { $(this) .parent() // swap classes for hitarea .find(">.hitarea") .swapClass( CLASSES.collapsableHitarea, CLASSES.expandableHitarea ) .swapClass( CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea ) .end() // swap classes for parent li .swapClass( CLASSES.collapsable, CLASSES.expandable ) .swapClass( CLASSES.lastCollapsable, CLASSES.lastExpandable ) // find child lists .find( ">ul" ) // toggle them .heightToggle( settings.animated, settings.toggle ); if ( settings.unique ) { $(this).parent() .siblings() // swap classes for hitarea .find(">.hitarea") .replaceClass( CLASSES.collapsableHitarea, CLASSES.expandableHitarea ) .replaceClass( CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea ) .end() .replaceClass( CLASSES.collapsable, CLASSES.expandable ) .replaceClass( CLASSES.lastCollapsable, CLASSES.lastExpandable ) .find( ">ul" ) .heightHide( settings.animated, settings.toggle ); } } this.data("toggler", toggler); function serialize() { function binary(arg) { return arg ? 1 : 0; } var data = []; branches.each(function(i, e) { data[i] = $(e).is(":has(>ul:visible)") ? 1 : 0; }); $.cookie(settings.cookieId, data.join(""), settings.cookieOptions ); } function deserialize() { var stored = $.cookie(settings.cookieId); if ( stored ) { var data = stored.split(""); branches.each(function(i, e) { $(e).find(">ul")[ parseInt(data[i]) ? "show" : "hide" ](); }); } } // add treeview class to activate styles this.addClass("treeview"); // prepare branches and find all tree items with child lists var branches = this.find("li").prepareBranches(settings); switch(settings.persist) { case "cookie": var toggleCallback = settings.toggle; settings.toggle = function() { serialize(); if (toggleCallback) { toggleCallback.apply(this, arguments); } }; deserialize(); break; case "location": var current = this.find("a").filter(function() { return this.href.toLowerCase() == location.href.toLowerCase(); }); if ( current.length ) { // TODO update the open/closed classes var items = current.addClass("selected").parents("ul, li").add( current.next() ).show(); if (settings.prerendered) { // if prerendered is on, replicate the basic class swapping items.filter("li") .swapClass( CLASSES.collapsable, CLASSES.expandable ) .swapClass( CLASSES.lastCollapsable, CLASSES.lastExpandable ) .find(">.hitarea") .swapClass( CLASSES.collapsableHitarea, CLASSES.expandableHitarea ) .swapClass( CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea ); } } break; } branches.applyClasses(settings, toggler); // if control option is set, create the treecontroller and show it if ( settings.control ) { treeController(this, settings.control); $(settings.control).show(); } return this; } }); // classes used by the plugin // need to be styled via external stylesheet, see first example $.treeview = {}; var CLASSES = ($.treeview.classes = { open: "open", closed: "closed", expandable: "expandable", expandableHitarea: "expandable-hitarea", lastExpandableHitarea: "lastExpandable-hitarea", collapsable: "collapsable", collapsableHitarea: "collapsable-hitarea", lastCollapsableHitarea: "lastCollapsable-hitarea", lastCollapsable: "lastCollapsable", lastExpandable: "lastExpandable", last: "last", hitarea: "hitarea" }); })(jQuery);
rgeraads/phpDocumentor2
data/templates/responsive-twig/js/jquery.treeview.js
JavaScript
mit
8,204
--- title: '如何玩想玩的断恨我和大家一样是一个喜欢举高高的人.' layout: post tags: - bootstrap - simple - css - web --- 我和大家一样是一个喜欢举高高的人.
sickpoet/sickpoet.github.io
_posts/2017-10-25-css-bootstrap-simple-myfirsttest2.md
Markdown
mit
209
<?php /* * This file is part of the phpflo\phpflo-fbp package. * * (c) Marc Aschmann <maschmann@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace PhpFlo\Fbp\Loader\Tests; use org\bovigo\vfs\vfsStream; use org\bovigo\vfs\vfsStreamFile; use PhpFlo\Common\Exception\LoaderException; use PhpFlo\Fbp\Loader\Loader; use PhpFlo\Fbp\Test\TestCase; class LoaderTest extends TestCase { /** * @var vfsStreamFile */ private $file; /** * @expectedException \PhpFlo\Common\Exception\LoaderException */ public function testStaticLoadException() { $data = Loader::load('test.yml'); } public function testLoadYamlFile() { $yaml = <<<EOF properties: name: '' initializers: { } processes: ReadFile: component: ReadFile metadata: { label: ReadFile } SplitbyLines: component: SplitStr metadata: { label: SplitStr } Display: component: Output metadata: { label: Output } CountLines: component: Counter metadata: { label: Counter } connections: - src: { process: ReadFile, port: OUT } tgt: { process: SplitbyLines, port: IN } - src: { process: ReadFile, port: ERROR } tgt: { process: Display, port: IN } - src: { process: SplitbyLines, port: OUT } tgt: { process: CountLines, port: IN } - src: { process: CountLines, port: COUNT } tgt: { process: Display, port: IN } EOF; $url = $this->createFile('test.yml', $yaml); $definition = Loader::load($url); $this->assertArrayHasKey('connections', $definition->toArray()); } public function testLoadJsonFile() { $json = <<< EOF { "properties": { "name": "" }, "initializers": [], "processes": { "ReadFile": { "component": "ReadFile", "metadata": { "label": "ReadFile" } }, "SplitbyLines": { "component": "SplitStr", "metadata": { "label": "SplitStr" } }, "Display": { "component": "Output", "metadata": { "label": "Output" } }, "CountLines": { "component": "Counter", "metadata": { "label": "Counter" } } }, "connections": [ { "src": { "process": "ReadFile", "port": "OUT" }, "tgt": { "process": "SplitbyLines", "port": "IN" } }, { "src": { "process": "ReadFile", "port": "ERROR" }, "tgt": { "process": "Display", "port": "IN" } }, { "src": { "process": "SplitbyLines", "port": "OUT" }, "tgt": { "process": "CountLines", "port": "IN" } }, { "src": { "process": "CountLines", "port": "COUNT" }, "tgt": { "process": "Display", "port": "IN" } } ] } EOF; $url = $this->createFile('test.json', $json); $definition = Loader::load($url); $this->assertArrayHasKey('connections', $definition->toArray()); } public function testLoadFbpFile() { $fbp = <<<EOF ReadFile(ReadFile) OUT -> IN SplitbyLines(SplitStr) ReadFile(ReadFile) ERROR -> IN Display(Output) SplitbyLines(SplitStr) OUT -> IN CountLines(Counter) CountLines(Counter) COUNT -> IN Display(Output) EOF; $url = $this->createFile('test.fbp', $fbp); $definition = Loader::load($url); $this->assertArrayHasKey('connections', $definition->toArray()); } /** * @expectedException \PhpFlo\Common\Exception\LoaderException */ public function testLoadEmptyFileWithException() { $uri = $this->createFile('test.fbp', ''); Loader::load($uri); } /** * @expectedException \PhpFlo\Common\Exception\LoaderException */ public function testUnsupportedFileTypeException() { Loader::load('my/file/test.xyz'); } /** * @expectedException \PhpFlo\Common\Exception\LoaderException */ public function testFileNotFoundExcetion() { Loader::load('test.fbp'); } private function createFile($name, $content) { $root = vfsStream::setup(); $this->file = vfsStream::newFile($name)->at($root); $this->file->setContent($content); return $this->file->url(); } }
bergie/phpflo
src/PhpFlo/Fbp/Tests/Loader/LoaderTest.php
PHP
mit
4,944
!((document, $) => { var clip = new Clipboard('.copy-button'); clip.on('success', function(e) { $('.copied').show(); $('.copied').fadeOut(2000); }); })(document, jQuery);
cehfisher/a11y-style-guide
src/global/js/copy-button.js
JavaScript
mit
186
--- title: Christ’s Messages for Then and Now date: 09/01/2019 --- There were more than seven churches in Asia, but Jesus spoke 7 distinctive messages (Rev 2&3) for the churches in that province. This suggests the symbolic significance of these messages for Christians (Rev 1:11, 19, 20). Their meanings apply on three levels: **Historical:** The recipients were 7 churches in prosperous cities of 1st Century Asia where emperor worship had been set in as a token of their loyalty to Rome. Participation in this and other pagan religious rituals became compulsory. The Christians who refused to participate faced trials and at times martyrdom. **Prophetic Application:** Revelation is a prophetic book, the messages are of prophetic character as well. The spiritual conditions in the 7 churches coincide with the spiritual conditions of God’s church in different historical periods and are a panoramic survey of the spiritual state of Christianity from the 1st century to the end of the world. **Universal Application:** Just as the entire book was sent as one letter that was to be read in every church (Rev 1:11; 22:16) so the seven messages also contain lessons that can apply to Christians in every age. While the general characteristic of Christianity today is Laodicean, some Christians may identify with the characteristics of the other churches.
PrJared/sabbath-school-lessons
src/en/2019-01-45-sec/02/05.md
Markdown
mit
1,370
/* Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ .yui-h-slider, .yui-v-slider { position: relative; } .yui-h-slider .yui-slider-thumb, .yui-v-slider .yui-slider-thumb { position: absolute; cursor: default; } .yui-skin-sam .yui-h-slider { background: url(bg-h.gif) no-repeat 5px 0; height: 28px; width: 228px; } .yui-skin-sam .yui-h-slider .yui-slider-thumb { top: 4px; } .yui-skin-sam .yui-v-slider { background: url(bg-v.gif) no-repeat 12px 0; height: 228px; width: 48px; } .cke_uicolor_picker .yui-picker-panel { background: #e3e3e3; border-color: #888; } .cke_uicolor_picker .yui-picker-panel .hd { background-color: #ccc; font-size: 100%; line-height: 100%; border: 1px solid #e3e3e3; font-weight: bold; overflow: hidden; padding: 6px; color: #000; } .cke_uicolor_picker .yui-picker-panel .bd { background: #e8e8e8; margin: 1px; height: 200px; } .cke_uicolor_picker .yui-picker-panel .ft { background: #e8e8e8; margin: 1px; padding: 1px; } .cke_uicolor_picker .yui-picker { position: relative; } .cke_uicolor_picker .yui-picker-hue-thumb { cursor: default; width: 18px; height: 18px; top: -8px; left: -2px; z-index: 9; position: absolute; } .cke_uicolor_picker .yui-picker-hue-bg { -moz-outline: none; outline: 0 none; position: absolute; left: 200px; height: 183px; width: 14px; background: url(hue_bg.png) no-repeat; top: 4px; } .cke_uicolor_picker .yui-picker-bg { -moz-outline: none; outline: 0 none; position: absolute; top: 4px; left: 4px; height: 182px; width: 182px; background-color: #F00; background-image: url(picker_mask.png); } *html .cke_uicolor_picker .yui-picker-bg { background-image: none; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src = 'picker_mask.png', sizingMethod = 'scale'); } .cke_uicolor_picker .yui-picker-mask { position: absolute; z-index: 1; top: 0; left: 0; } .cke_uicolor_picker .yui-picker-thumb { cursor: default; width: 11px; height: 11px; z-index: 9; position: absolute; top: -4px; left: -4px; } .cke_uicolor_picker .yui-picker-swatch { position: absolute; left: 240px; top: 4px; height: 60px; width: 55px; border: 1px solid #888; } .cke_uicolor_picker .yui-picker-websafe-swatch { position: absolute; left: 304px; top: 4px; height: 24px; width: 24px; border: 1px solid #888; } .cke_uicolor_picker .yui-picker-controls { position: absolute; top: 72px; left: 226px; font: 1em monospace; } .cke_uicolor_picker .yui-picker-controls .hd { background: transparent; border-width: 0 !important; } .cke_uicolor_picker .yui-picker-controls .bd { height: 100px; border-width: 0 !important; } .cke_uicolor_picker .yui-picker-controls ul { float: left; padding: 0 2px 0 0; margin: 0; } .cke_uicolor_picker .yui-picker-controls li { padding: 2px; list-style: none; margin: 0; } .cke_uicolor_picker .yui-picker-controls input { font-size: .85em; width: 2.4em; } .cke_uicolor_picker .yui-picker-hex-controls { clear: both; padding: 2px; } .cke_uicolor_picker .yui-picker-hex-controls input { width: 4.6em; } .cke_uicolor_picker .yui-picker-controls a { font: 1em arial, helvetica, clean, sans-serif; display: block; *display: inline-block; padding: 0; color: #000; }
LeanLaunchLab/LeanLaunchLab
public/ckeditor/plugins/uicolor/yui/assets/yui.css
CSS
mit
3,433
<!DOCTYPE html> <html> <head> <title>Centering grid content</title> <meta content="text/html; charset=utf-8" http-equiv="content-type"> <meta name="description" content="Centering grid content" /> <meta name="keywords" content="javascript, dynamic, grid, layout, jquery plugin, flex layouts"/> <link rel="icon" href="favicon.ico" type="image/x-icon" /> <link rel="stylesheet" type="text/css" href="css/style.css" /> <script type="text/javascript" src="js/jquery-1.10.2.min.js"></script> <script type="text/javascript" src="../freewall.js"></script> <script type="text/javascript" src="../plugin/centering.js"></script> <style type="text/css"> .free-wall { margin: 15px; } </style> </head> <body> <div class='header'> <div class="clearfix"> <div class="float-left"> <h1><a href="http://vnjs.net/www/project/freewall/">Free Wall</a></h1> <div class='target'>Creating dynamic grid layouts.</div> </div> </div> </div> <div id="freewall" class="free-wall"> <div class="brick size32"> <div class='cover'> <h2>Centering grid content</h2> </div> </div> <div class="brick size12 add-more"> <div class='cover'> <h2>Add more block</h2> </div> </div> </div> <script type="text/javascript"> var colour = [ "rgb(142, 68, 173)", "rgb(243, 156, 18)", "rgb(211, 84, 0)", "rgb(0, 106, 63)", "rgb(41, 128, 185)", "rgb(192, 57, 43)", "rgb(135, 0, 0)", "rgb(39, 174, 96)" ]; $(".brick").each(function() { this.style.backgroundColor = colour[colour.length * Math.random() << 0]; }); $(function() { var wall = new Freewall("#freewall"); wall.reset({ selector: '.brick', animate: true, cellW: 160, cellH: 160, delay: 50, onResize: function() { wall.fitWidth(); } }); wall.fitWidth(); var temp = '<div class="brick {size}" style="background-color: {color}"><div class="cover"></div></div>'; var size = "size23 size22 size21 size13 size12 size11".split(" "); $(".add-more").click(function() { var html = temp.replace('{size}', size[size.length * Math.random() << 0]) .replace('{color}', colour[colour.length * Math.random() << 0]); wall.prepend(html); }); }); </script> </body> </html>
kombai/freewall
example/centering-grid.html
HTML
mit
2,327
var binary = require('node-pre-gyp'); var path = require('path'); var binding_path = binary.find(path.resolve(path.join(__dirname,'./package.json'))); var binding = require(binding_path); var Stream = require('stream').Stream, inherits = require('util').inherits; function Snapshot() {} Snapshot.prototype.getHeader = function() { return { typeId: this.typeId, uid: this.uid, title: this.title } } /** * @param {Snapshot} other * @returns {Object} */ Snapshot.prototype.compare = function(other) { var selfHist = nodesHist(this), otherHist = nodesHist(other), keys = Object.keys(selfHist).concat(Object.keys(otherHist)), diff = {}; keys.forEach(function(key) { if (key in diff) return; var selfCount = selfHist[key] || 0, otherCount = otherHist[key] || 0; diff[key] = otherCount - selfCount; }); return diff; }; function ExportStream() { Stream.Transform.call(this); this._transform = function noTransform(chunk, encoding, done) { done(null, chunk); } } inherits(ExportStream, Stream.Transform); /** * @param {Stream.Writable|function} dataReceiver * @returns {Stream|undefined} */ Snapshot.prototype.export = function(dataReceiver) { dataReceiver = dataReceiver || new ExportStream(); var toStream = dataReceiver instanceof Stream, chunks = toStream ? null : []; function onChunk(chunk, len) { if (toStream) dataReceiver.write(chunk); else chunks.push(chunk); } function onDone() { if (toStream) dataReceiver.end(); else dataReceiver(null, chunks.join('')); } this.serialize(onChunk, onDone); return toStream ? dataReceiver : undefined; }; function nodes(snapshot) { var n = snapshot.nodesCount, i, nodes = []; for (i = 0; i < n; i++) { nodes[i] = snapshot.getNode(i); } return nodes; }; function nodesHist(snapshot) { var objects = {}; nodes(snapshot).forEach(function(node){ var key = node.type === "Object" ? node.name : node.type; objects[key] = objects[node.name] || 0; objects[key]++; }); return objects; }; function CpuProfile() {} CpuProfile.prototype.getHeader = function() { return { typeId: this.typeId, uid: this.uid, title: this.title } } CpuProfile.prototype.export = function(dataReceiver) { dataReceiver = dataReceiver || new ExportStream(); var toStream = dataReceiver instanceof Stream; var error, result; try { result = JSON.stringify(this); } catch (err) { error = err; } process.nextTick(function() { if (toStream) { if (error) { dataReceiver.emit('error', error); } dataReceiver.end(result); } else { dataReceiver(error, result); } }); return toStream ? dataReceiver : undefined; }; var startTime, endTime; var activeProfiles = []; var profiler = { /*HEAP PROFILER API*/ get snapshots() { return binding.heap.snapshots; }, takeSnapshot: function(name, control) { var snapshot = binding.heap.takeSnapshot.apply(null, arguments); snapshot.__proto__ = Snapshot.prototype; snapshot.title = name; return snapshot; }, getSnapshot: function(index) { var snapshot = binding.heap.snapshots[index]; if (!snapshot) return; snapshot.__proto__ = Snapshot.prototype; return snapshot; }, findSnapshot: function(uid) { var snapshot = binding.heap.snapshots.filter(function(snapshot) { return snapshot.uid == uid; })[0]; if (!snapshot) return; snapshot.__proto__ = Snapshot.prototype; return snapshot; }, deleteAllSnapshots: function () { binding.heap.snapshots.forEach(function(snapshot) { snapshot.delete(); }); }, startTrackingHeapObjects: binding.heap.startTrackingHeapObjects, stopTrackingHeapObjects: binding.heap.stopTrackingHeapObjects, getHeapStats: binding.heap.getHeapStats, getObjectByHeapObjectId: binding.heap.getObjectByHeapObjectId, /*CPU PROFILER API*/ get profiles() { return binding.cpu.profiles; }, startProfiling: function(name, recsamples) { if (activeProfiles.length == 0 && typeof process._startProfilerIdleNotifier == "function") process._startProfilerIdleNotifier(); name = name || ""; if (activeProfiles.indexOf(name) < 0) activeProfiles.push(name) startTime = Date.now(); binding.cpu.startProfiling(name, recsamples); }, stopProfiling: function(name) { var index = activeProfiles.indexOf(name); if (name && index < 0) return; var profile = binding.cpu.stopProfiling(name); endTime = Date.now(); profile.__proto__ = CpuProfile.prototype; if (!profile.startTime) profile.startTime = startTime; if (!profile.endTime) profile.endTime = endTime; if (name) activeProfiles.splice(index, 1); else activeProfiles.length = activeProfiles.length - 1; if (activeProfiles.length == 0 && typeof process._stopProfilerIdleNotifier == "function") process._stopProfilerIdleNotifier(); return profile; }, getProfile: function(index) { return binding.cpu.profiles[index]; }, findProfile: function(uid) { var profile = binding.cpu.profiles.filter(function(profile) { return profile.uid == uid; })[0]; return profile; }, deleteAllProfiles: function() { binding.cpu.profiles.forEach(function(profile) { profile.delete(); }); } }; module.exports = profiler; process.profiler = profiler;
timmyg/pedalwagon-api
node_modules/node-inspector/node_modules/v8-profiler/v8-profiler.js
JavaScript
mit
5,446
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2019 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. /** * Server/client environment: argument handling, config file parsing, * thread wrappers, startup time */ #ifndef BITCOIN_UTIL_SYSTEM_H #define BITCOIN_UTIL_SYSTEM_H #if defined(HAVE_CONFIG_H) #include <config/bitcoin-config.h> #endif #include <attributes.h> #include <compat.h> #include <compat/assumptions.h> #include <fs.h> #include <logging.h> #include <sync.h> #include <tinyformat.h> #include <util/memory.h> #include <util/threadnames.h> #include <util/time.h> #include <exception> #include <map> #include <set> #include <stdint.h> #include <string> #include <utility> #include <vector> #include <boost/thread/condition_variable.hpp> // for boost::thread_interrupted // Application startup time (used for uptime calculation) int64_t GetStartupTime(); extern const char * const BITCOIN_CONF_FILENAME; void SetupEnvironment(); bool SetupNetworking(); template<typename... Args> bool error(const char* fmt, const Args&... args) { LogPrintf("ERROR: %s\n", tfm::format(fmt, args...)); return false; } void PrintExceptionContinue(const std::exception *pex, const char* pszThread); bool FileCommit(FILE *file); bool TruncateFile(FILE *file, unsigned int length); int RaiseFileDescriptorLimit(int nMinFD); void AllocateFileRange(FILE *file, unsigned int offset, unsigned int length); bool RenameOver(fs::path src, fs::path dest); bool LockDirectory(const fs::path& directory, const std::string lockfile_name, bool probe_only=false); void UnlockDirectory(const fs::path& directory, const std::string& lockfile_name); bool DirIsWritable(const fs::path& directory); bool CheckDiskSpace(const fs::path& dir, uint64_t additional_bytes = 0); /** Release all directory locks. This is used for unit testing only, at runtime * the global destructor will take care of the locks. */ void ReleaseDirectoryLocks(); bool TryCreateDirectories(const fs::path& p); fs::path GetDefaultDataDir(); // The blocks directory is always net specific. const fs::path &GetBlocksDir(); const fs::path &GetDataDir(bool fNetSpecific = true); // Return true if -datadir option points to a valid directory or is not specified. bool CheckDataDirOption(); /** Tests only */ void ClearDatadirCache(); fs::path GetConfigFile(const std::string& confPath); #ifdef WIN32 fs::path GetSpecialFolderPath(int nFolder, bool fCreate = true); #endif #if HAVE_SYSTEM void runCommand(const std::string& strCommand); #endif /** * Most paths passed as configuration arguments are treated as relative to * the datadir if they are not absolute. * * @param path The path to be conditionally prefixed with datadir. * @param net_specific Forwarded to GetDataDir(). * @return The normalized path. */ fs::path AbsPathForConfigVal(const fs::path& path, bool net_specific = true); inline bool IsSwitchChar(char c) { #ifdef WIN32 return c == '-' || c == '/'; #else return c == '-'; #endif } enum class OptionsCategory { OPTIONS, CONNECTION, WALLET, WALLET_DEBUG_TEST, ZMQ, DEBUG_TEST, CHAINPARAMS, NODE_RELAY, BLOCK_CREATION, RPC, GUI, COMMANDS, REGISTER_COMMANDS, HIDDEN // Always the last option to avoid printing these in the help }; struct SectionInfo { std::string m_name; std::string m_file; int m_line; }; class ArgsManager { public: enum Flags { NONE = 0x00, // Boolean options can accept negation syntax -noOPTION or -noOPTION=1 ALLOW_BOOL = 0x01, ALLOW_INT = 0x02, ALLOW_STRING = 0x04, ALLOW_ANY = ALLOW_BOOL | ALLOW_INT | ALLOW_STRING, DEBUG_ONLY = 0x100, /* Some options would cause cross-contamination if values for * mainnet were used while running on regtest/testnet (or vice-versa). * Setting them as NETWORK_ONLY ensures that sharing a config file * between mainnet and regtest/testnet won't cause problems due to these * parameters by accident. */ NETWORK_ONLY = 0x200, }; protected: friend class ArgsManagerHelper; struct Arg { std::string m_help_param; std::string m_help_text; unsigned int m_flags; }; mutable CCriticalSection cs_args; std::map<std::string, std::vector<std::string>> m_override_args GUARDED_BY(cs_args); std::map<std::string, std::vector<std::string>> m_config_args GUARDED_BY(cs_args); std::string m_network GUARDED_BY(cs_args); std::set<std::string> m_network_only_args GUARDED_BY(cs_args); std::map<OptionsCategory, std::map<std::string, Arg>> m_available_args GUARDED_BY(cs_args); std::list<SectionInfo> m_config_sections GUARDED_BY(cs_args); NODISCARD bool ReadConfigStream(std::istream& stream, const std::string& filepath, std::string& error, bool ignore_invalid_keys = false); public: ArgsManager(); /** * Select the network in use */ void SelectConfigNetwork(const std::string& network); NODISCARD bool ParseParameters(int argc, const char* const argv[], std::string& error); NODISCARD bool ReadConfigFiles(std::string& error, bool ignore_invalid_keys = false); /** * Log warnings for options in m_section_only_args when * they are specified in the default section but not overridden * on the command line or in a network-specific section in the * config file. */ const std::set<std::string> GetUnsuitableSectionOnlyArgs() const; /** * Log warnings for unrecognized section names in the config file. */ const std::list<SectionInfo> GetUnrecognizedSections() const; /** * Return a vector of strings of the given argument * * @param strArg Argument to get (e.g. "-foo") * @return command-line arguments */ std::vector<std::string> GetArgs(const std::string& strArg) const; /** * Return true if the given argument has been manually set * * @param strArg Argument to get (e.g. "-foo") * @return true if the argument has been set */ bool IsArgSet(const std::string& strArg) const; /** * Return true if the argument was originally passed as a negated option, * i.e. -nofoo. * * @param strArg Argument to get (e.g. "-foo") * @return true if the argument was passed negated */ bool IsArgNegated(const std::string& strArg) const; /** * Return string argument or default value * * @param strArg Argument to get (e.g. "-foo") * @param strDefault (e.g. "1") * @return command-line argument or default value */ std::string GetArg(const std::string& strArg, const std::string& strDefault) const; /** * Return integer argument or default value * * @param strArg Argument to get (e.g. "-foo") * @param nDefault (e.g. 1) * @return command-line argument (0 if invalid number) or default value */ int64_t GetArg(const std::string& strArg, int64_t nDefault) const; /** * Return boolean argument or default value * * @param strArg Argument to get (e.g. "-foo") * @param fDefault (true or false) * @return command-line argument or default value */ bool GetBoolArg(const std::string& strArg, bool fDefault) const; /** * Set an argument if it doesn't already have a value * * @param strArg Argument to set (e.g. "-foo") * @param strValue Value (e.g. "1") * @return true if argument gets set, false if it already had a value */ bool SoftSetArg(const std::string& strArg, const std::string& strValue); /** * Set a boolean argument if it doesn't already have a value * * @param strArg Argument to set (e.g. "-foo") * @param fValue Value (e.g. false) * @return true if argument gets set, false if it already had a value */ bool SoftSetBoolArg(const std::string& strArg, bool fValue); // Forces an arg setting. Called by SoftSetArg() if the arg hasn't already // been set. Also called directly in testing. void ForceSetArg(const std::string& strArg, const std::string& strValue); /** * Looks for -regtest, -testnet and returns the appropriate BIP70 chain name. * @return CBaseChainParams::MAIN by default; raises runtime error if an invalid combination is given. */ std::string GetChainName() const; /** * Add argument */ void AddArg(const std::string& name, const std::string& help, unsigned int flags, const OptionsCategory& cat); /** * Add many hidden arguments */ void AddHiddenArgs(const std::vector<std::string>& args); /** * Clear available arguments */ void ClearArgs() { LOCK(cs_args); m_available_args.clear(); m_network_only_args.clear(); } /** * Get the help string */ std::string GetHelpMessage() const; /** * Return Flags for known arg. * Return ArgsManager::NONE for unknown arg. */ unsigned int FlagsOfKnownArg(const std::string& key) const; }; extern ArgsManager gArgs; /** * @return true if help has been requested via a command-line arg */ bool HelpRequested(const ArgsManager& args); /** Add help options to the args manager */ void SetupHelpOptions(ArgsManager& args); /** * Format a string to be used as group of options in help messages * * @param message Group name (e.g. "RPC server options:") * @return the formatted string */ std::string HelpMessageGroup(const std::string& message); /** * Format a string to be used as option description in help messages * * @param option Option message (e.g. "-rpcuser=<user>") * @param message Option description (e.g. "Username for JSON-RPC connections") * @return the formatted string */ std::string HelpMessageOpt(const std::string& option, const std::string& message); /** * Return the number of cores available on the current system. * @note This does count virtual cores, such as those provided by HyperThreading. */ int GetNumCores(); /** * .. and a wrapper that just calls func once */ template <typename Callable> void TraceThread(const char* name, Callable func) { util::ThreadRename(name); try { LogPrintf("%s thread start\n", name); func(); LogPrintf("%s thread exit\n", name); } catch (const boost::thread_interrupted&) { LogPrintf("%s thread interrupt\n", name); throw; } catch (const std::exception& e) { PrintExceptionContinue(&e, name); throw; } catch (...) { PrintExceptionContinue(nullptr, name); throw; } } std::string CopyrightHolders(const std::string& strPrefix); /** * On platforms that support it, tell the kernel the calling thread is * CPU-intensive and non-interactive. See SCHED_BATCH in sched(7) for details. * * @return The return value of sched_setschedule(), or 1 on systems without * sched_setschedule(). */ int ScheduleBatchPriority(); namespace util { //! Simplification of std insertion template <typename Tdst, typename Tsrc> inline void insert(Tdst& dst, const Tsrc& src) { dst.insert(dst.begin(), src.begin(), src.end()); } template <typename TsetT, typename Tsrc> inline void insert(std::set<TsetT>& dst, const Tsrc& src) { dst.insert(src.begin(), src.end()); } #ifdef WIN32 class WinCmdLineArgs { public: WinCmdLineArgs(); ~WinCmdLineArgs(); std::pair<int, char**> get(); private: int argc; char** argv; std::vector<std::string> args; }; #endif } // namespace util #endif // BITCOIN_UTIL_SYSTEM_H
CryptArc/bitcoin
src/util/system.h
C
mit
11,747
<?php /* * This file is part of the Sonata Project package. * * (c) Thomas Rabaix <thomas.rabaix@sonata-project.org> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Sonata\AdminBundle\DependencyInjection; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\DependencyInjection\Extension; /** * Class AbstractSonataAdminExtension. * * @author Thomas Rabaix <thomas.rabaix@sonata-project.org> */ abstract class AbstractSonataAdminExtension extends Extension { /** * Fix template configuration. * * @param array $configs * @param ContainerBuilder $container * @param array $defaultSonataDoctrineConfig * * @return array */ protected function fixTemplatesConfiguration(array $configs, ContainerBuilder $container, array $defaultSonataDoctrineConfig = array()) { $defaultConfig = array( 'templates' => array( 'types' => array( 'list' => array( 'array' => 'SonataAdminBundle:CRUD:list_array.html.twig', 'boolean' => 'SonataAdminBundle:CRUD:list_boolean.html.twig', 'date' => 'SonataAdminBundle:CRUD:list_date.html.twig', 'time' => 'SonataAdminBundle:CRUD:list_time.html.twig', 'datetime' => 'SonataAdminBundle:CRUD:list_datetime.html.twig', 'text' => 'SonataAdminBundle:CRUD:list_string.html.twig', 'textarea' => 'SonataAdminBundle:CRUD:list_string.html.twig', 'email' => 'SonataAdminBundle:CRUD:list_string.html.twig', 'trans' => 'SonataAdminBundle:CRUD:list_trans.html.twig', 'string' => 'SonataAdminBundle:CRUD:list_string.html.twig', 'smallint' => 'SonataAdminBundle:CRUD:list_string.html.twig', 'bigint' => 'SonataAdminBundle:CRUD:list_string.html.twig', 'integer' => 'SonataAdminBundle:CRUD:list_string.html.twig', 'decimal' => 'SonataAdminBundle:CRUD:list_string.html.twig', 'identifier' => 'SonataAdminBundle:CRUD:list_string.html.twig', 'currency' => 'SonataAdminBundle:CRUD:list_currency.html.twig', 'percent' => 'SonataAdminBundle:CRUD:list_percent.html.twig', 'choice' => 'SonataAdminBundle:CRUD:list_choice.html.twig', 'url' => 'SonataAdminBundle:CRUD:list_url.html.twig', 'html' => 'SonataAdminBundle:CRUD:list_html.html.twig', ), 'show' => array( 'array' => 'SonataAdminBundle:CRUD:show_array.html.twig', 'boolean' => 'SonataAdminBundle:CRUD:show_boolean.html.twig', 'date' => 'SonataAdminBundle:CRUD:show_date.html.twig', 'time' => 'SonataAdminBundle:CRUD:show_time.html.twig', 'datetime' => 'SonataAdminBundle:CRUD:show_datetime.html.twig', 'text' => 'SonataAdminBundle:CRUD:base_show_field.html.twig', 'trans' => 'SonataAdminBundle:CRUD:show_trans.html.twig', 'string' => 'SonataAdminBundle:CRUD:base_show_field.html.twig', 'smallint' => 'SonataAdminBundle:CRUD:base_show_field.html.twig', 'bigint' => 'SonataAdminBundle:CRUD:base_show_field.html.twig', 'integer' => 'SonataAdminBundle:CRUD:base_show_field.html.twig', 'decimal' => 'SonataAdminBundle:CRUD:base_show_field.html.twig', 'currency' => 'SonataAdminBundle:CRUD:show_currency.html.twig', 'percent' => 'SonataAdminBundle:CRUD:show_percent.html.twig', 'choice' => 'SonataAdminBundle:CRUD:show_choice.html.twig', 'url' => 'SonataAdminBundle:CRUD:show_url.html.twig', 'html' => 'SonataAdminBundle:CRUD:show_html.html.twig', ), ), ), ); // let's add some magic, only overwrite template if the SonataIntlBundle is enabled $bundles = $container->getParameter('kernel.bundles'); if (isset($bundles['SonataIntlBundle'])) { $defaultConfig['templates']['types']['list'] = array_merge($defaultConfig['templates']['types']['list'], array( 'date' => 'SonataIntlBundle:CRUD:list_date.html.twig', 'datetime' => 'SonataIntlBundle:CRUD:list_datetime.html.twig', 'smallint' => 'SonataIntlBundle:CRUD:list_decimal.html.twig', 'bigint' => 'SonataIntlBundle:CRUD:list_decimal.html.twig', 'integer' => 'SonataIntlBundle:CRUD:list_decimal.html.twig', 'decimal' => 'SonataIntlBundle:CRUD:list_decimal.html.twig', 'currency' => 'SonataIntlBundle:CRUD:list_currency.html.twig', 'percent' => 'SonataIntlBundle:CRUD:list_percent.html.twig', )); $defaultConfig['templates']['types']['show'] = array_merge($defaultConfig['templates']['types']['show'], array( 'date' => 'SonataIntlBundle:CRUD:show_date.html.twig', 'datetime' => 'SonataIntlBundle:CRUD:show_datetime.html.twig', 'smallint' => 'SonataIntlBundle:CRUD:show_decimal.html.twig', 'bigint' => 'SonataIntlBundle:CRUD:show_decimal.html.twig', 'integer' => 'SonataIntlBundle:CRUD:show_decimal.html.twig', 'decimal' => 'SonataIntlBundle:CRUD:show_decimal.html.twig', 'currency' => 'SonataIntlBundle:CRUD:show_currency.html.twig', 'percent' => 'SonataIntlBundle:CRUD:show_percent.html.twig', )); } if (!empty($defaultSonataDoctrineConfig)) { $defaultConfig = array_merge_recursive($defaultConfig, $defaultSonataDoctrineConfig); } array_unshift($configs, $defaultConfig); return $configs; } }
nico06530/tutolympique
vendor/sonata-project/admin-bundle/DependencyInjection/AbstractSonataAdminExtension.php
PHP
mit
6,338
<?php namespace Druidfi; class Envs { const ENV_DEVELOPMENT = 'development'; const ENV_TESTING = 'testing'; const ENV_STAGING = 'staging'; const ENV_PRODUCTION = 'production'; const ERROR_NOT_VALID = 'Error: env "%s" is not valid! Please use one of the following: %s'; /** * Get error message for invalid env * * @param $env * * @return string */ public static function getNotValidErrorMessage($env) { return sprintf(self::ERROR_NOT_VALID, $env, join(', ', self::getValidEnvs())); } /** * Get list of valid environments * * @return array Valid environments */ public static function getValidEnvs() { return [ self::ENV_DEVELOPMENT, self::ENV_TESTING, self::ENV_STAGING, self::ENV_PRODUCTION, ]; } /** * Check if given env is valid * * @param $env * * @return bool */ public static function isValidEnv($env) { return in_array($env, self::getValidEnvs()); } }
druidfi/build-tools-beta
src/Druidfi/Envs.php
PHP
mit
1,091
// This file was generated based on 'C:\ProgramData\Uno\Packages\Fuse.Reactive\0.18.8\$.uno'. // WARNING: Changes might be lost if you edit this file directly. #pragma once #include <Fuse.Behavior.h> namespace g{namespace Fuse{namespace Reactive{struct Binding;}}} namespace g{namespace Fuse{struct Node;}} namespace g{ namespace Fuse{ namespace Reactive{ // public abstract class Binding :450 // { struct Binding_type : ::g::Fuse::Behavior_type { void(*fp_NewValue)(::g::Fuse::Reactive::Binding*, uObject*); }; Binding_type* Binding_typeof(); void Binding__ctor_1_fn(Binding* __this, uString* key); void Binding__get_Key_fn(Binding* __this, uString** __retval); void Binding__set_Key_fn(Binding* __this, uString* value); void Binding__get_Node_fn(Binding* __this, ::g::Fuse::Node** __retval); void Binding__OnRooted_fn(Binding* __this, ::g::Fuse::Node* n); void Binding__OnUnrooted_fn(Binding* __this, ::g::Fuse::Node* n); struct Binding : ::g::Fuse::Behavior { uStrong<uObject*> _pathSubscription; uStrong<uString*> _Key; void ctor_1(uString* key); uString* Key(); void Key(uString* value); void NewValue(uObject* obj) { (((Binding_type*)__type)->fp_NewValue)(this, obj); } ::g::Fuse::Node* Node(); }; // } }}} // ::g::Fuse::Reactive
blyk/BlackCode-Fuse
TestApp/.build/Simulator/Android/include/Fuse.Reactive.Binding.h
C
mit
1,275
from itertools import imap, chain def set_name(name, f): try: f.__pipetools__name__ = name except (AttributeError, UnicodeEncodeError): pass return f def get_name(f): from pipetools.main import Pipe pipetools_name = getattr(f, '__pipetools__name__', None) if pipetools_name: return pipetools_name() if callable(pipetools_name) else pipetools_name if isinstance(f, Pipe): return repr(f) return f.__name__ if hasattr(f, '__name__') else repr(f) def repr_args(*args, **kwargs): return ', '.join(chain( imap('{0!r}'.format, args), imap('{0[0]}={0[1]!r}'.format, kwargs.iteritems())))
katakumpo/pipetools
pipetools/debug.py
Python
mit
672
# gl-geometry [![experimental](http://badges.github.io/stability-badges/dist/experimental.svg)](http://github.com/badges/stability-badges) A flexible wrapper for [gl-vao](http://github.com/mikolalysenko/gl-vao) and [gl-buffer](http://github.com/mikolalysenko/gl-buffer) that you can use to set up renderable WebGL geometries from a variety of different formats. ## Usage ## [![NPM](https://nodei.co/npm/gl-geometry.png)](https://nodei.co/npm/gl-geometry/) ### geom = createGeometry(gl) ### Creates a new geometry attached to the WebGL canvas context `gl`. ### geom.attr(name, values[, opt]) ### Define a new attribute value, for example using a simplicial complex: ``` javascript var createGeometry = require('gl-geometry') var bunny = require('bunny') var geom = createGeometry(gl) .attr('positions', bunny) ``` The following vertex formats are supported and will be normalized: * Arrays of arrays, e.g. `[[0, 0, 0], [1, 0, 0], [1, 1, 0]]`. * Flat arrays, e.g. `[0, 0, 0, 1, 0, 0, 1, 1, 0]`. * [Typed arrays](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays), preferably a `Float32Array`. * 1-dimensional [ndarrays](http://github.com/mikolalysenko/ndarray). * [simplicial complexes](https://github.com/mikolalysenko/simplicial-complex), i.e. an object with a `positions` array and a `cells` array. The former is a list of unique vertices in the mesh (if you've used three.js, think `THREE.Vector3`), and the latter is an index mapping these vertices to faces (`THREE.Face3`) in the mesh. It looks something like this: ``` json { "positions": [ [0.0, 0.0, 0.0], [1.5, 0.0, 0.0], [1.5, 1.5, 0.0], [0.0, 1.5, 0.0] ], "cells": [ [0, 1, 2], [1, 2, 3] ] } ``` You can specify `opt.size` for the vertex size, defaults to 3. ### geom.faces(values[, opt]) ### Pass a simplicial complex's `cells` property here in any of the above formats to use it as your index when drawing the geometry. For example: ``` javascript var createGeometry = require('gl-geometry') var bunny = require('bunny') bunny.normals = normals.vertexNormals( bunny.cells , bunny.positions ) var geom = createGeometry(gl) .attr('positions', bunny.positions) .attr('normals', bunny.normals) .faces(bunny.cells) ``` You can specify `opt.size` for the cell size, defaults to 3. ### geom.bind([shader]) ### Binds the underlying [VAO](https://github.com/gl-modules/gl-vao) – this must be called before calling `geom.draw`. Optionally, you can pass in a [gl-shader](http://github.com/gl-modules/gl-shader) or [glslify](http://github.com/chrisdickinson/glslify) shader instance to automatically set up your attribute locations for you. ### geom.draw(mode, start, stop) ### Draws the geometry to the screen using the currently bound shader. Optionally, you can pass in the drawing mode, which should be one of the following: * `gl.POINTS` * `gl.LINES` * `gl.LINE_STRIP` * `gl.LINE_LOOP` * `gl.TRIANGLES` * `gl.TRIANGLE_STRIP` * `gl.TRIANGLE_FAN` The default value is `gl.TRIANGLES`. You're also able to pass in a `start` and `stop` range for the points you want to render, just the same as you would with `gl.drawArrays` or `gl.drawElements`. ### geom.unbind() ### Unbinds the underlying VAO. This *must* be done when you're finished drawing, unless you're binding to another gl-geometry or gl-vao instance. ### geom.dispose() ### Disposes the underlying element and array buffers, as well as the VAO. ## See Also * [ArrayBuffer and Typed Arrays](https://www.khronos.org/registry/webgl/specs/1.0/#5.13) * [The WebGL Context](https://www.khronos.org/registry/webgl/specs/1.0/#5.14) * [simplicial-complex](http://github.com/mikolalysenko/simplicial-complex) * [ndarray](http://github.com/mikolalysenko/ndarray) * [gl-shader](http://github.com/mikolalysenko/gl-shader) * [gl-buffer](http://github.com/mikolalysenko/gl-buffer) * [gl-vao](http://github.com/mikolalysenko/gl-vao) ## License MIT. See [LICENSE.md](http://github.com/hughsk/is-typedarray/blob/master/LICENSE.md) for details.
1wheel/webgl-workshop
node_modules/gl-geometry/README.md
Markdown
mit
4,082
--- title: СТРАЖДАННЯ І ПРИКЛАД ХРИСТА date: 01/05/2017 --- ### СТРАЖДАННЯ І ПРИКЛАД ХРИСТА `Прочитайте уривок 1 Петра 3:13-22. Як християни повинні відповідати тим, хто завдає їм страждань через їхню віру? Який зв’язок між стражданнями Ісуса та стражданнями віруючих за свою віру?` Коли Петро каже: «А коли й терпите через праведність, то ви – блаженні» (1 Петра 3:14), він повторює слова Ісуса: «Блаженні переслідувані за праведність» (Матв. 5:10). Потім апостол застерігає, що християнам не слід боятися своїх кривдників, натомість вони повинні освячувати (шанувати) Христа як Господа у своїх серцях (див. 1 Петра 3:15). Таке визнання Ісуса в серці допоможе подолати страх, який викликають їхні вороги. Далі Петро пише, що християнам необхідно завжди бути готовими дати відповідь про свою надію з лагідністю і шанобливістю (див. 1 Петра 3:15, 16). Апостол наполягає: християни повинні бути впевнені, що не дають іншим приводу для звинувачень на свою адресу. Їм слід мати «добру совість» (1 Петра 3:16). Це важливо, оскільки в такому разі обвинувачі християнина будуть посоромлені його непорочним життям. Звичайно, немає жодної заслуги в стражданні за злочин (див. 1 Петра 3:17). Саме страждання за добру справу, за правильний учинок справляють позитивний вплив. «Бо краще, якщо на те Божа воля, страждати, будучи доброчинцем, аніж злочинцем» (1 Петра 3:17). Петро наводить Ісуса як приклад. Сам Христос постраждав за Свою праведність; святість і чистота Його життя були постійним докором для Його ненависників. Якщо хтось і постраждав за свої добрі діла, так це Ісус. Однак Його страждання також здобули єдиний засіб спасіння. Він помер замість грішників («праведний за неправедних», 1 Петра 3:18), щоб віруючі в Нього отримали обітницю вічного життя. `Чи страждали ви колись через свій правильний вчинок? Розкажіть про цей досвід. Чи навчив він вас, що значить бути християнином та відображати характер Христа?`
imasaru/sabbath-school-lessons
src/uk/2017-02/06/03.md
Markdown
mit
3,419
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"/><!-- using block title in layout.dt--><!-- using block ddox.defs in ddox.layout.dt--><!-- using block ddox.title in ddox.layout.dt--> <title>Class FilePath</title> <link rel="stylesheet" type="text/css" href="../../styles/ddox.css"/> <link rel="stylesheet" href="../../prettify/prettify.css" type="text/css"/> <script type="text/javascript" src="../../scripts/jquery.js">/**/</script> <script type="text/javascript" src="../../prettify/prettify.js">/**/</script> <script type="text/javascript" src="../../scripts/ddox.js">/**/</script> </head> <body onload="prettyPrint(); setupDdox();"> <nav id="main-nav"><!-- using block navigation in layout.dt--> <ul class="tree-view"> <li class="collapsed tree-view"> <a href="#" class="package">components</a> <ul class="tree-view"> <li> <a href="../../components/animation.html" class=" module">animation</a> </li> <li> <a href="../../components/assetanimation.html" class=" module">assetanimation</a> </li> <li> <a href="../../components/assets.html" class=" module">assets</a> </li> <li> <a href="../../components/camera.html" class=" module">camera</a> </li> <li> <a href="../../components/icomponent.html" class=" module">icomponent</a> </li> <li> <a href="../../components/lights.html" class=" module">lights</a> </li> <li> <a href="../../components/material.html" class=" module">material</a> </li> <li> <a href="../../components/mesh.html" class=" module">mesh</a> </li> <li> <a href="../../components/userinterface.html" class=" module">userinterface</a> </li> </ul> </li> <li class="collapsed tree-view"> <a href="#" class="package">core</a> <ul class="tree-view"> <li> <a href="../../core/dgame.html" class=" module">dgame</a> </li> <li> <a href="../../core/gameobject.html" class=" module">gameobject</a> </li> <li> <a href="../../core/gameobjectcollection.html" class=" module">gameobjectcollection</a> </li> <li> <a href="../../core/prefabs.html" class=" module">prefabs</a> </li> <li> <a href="../../core/properties.html" class=" module">properties</a> </li> <li> <a href="../../core/reflection.html" class=" module">reflection</a> </li> <li> <a href="../../core/scene.html" class=" module">scene</a> </li> </ul> </li> <li class="collapsed tree-view"> <a href="#" class="package">graphics</a> <ul class="tree-view"> <li class="collapsed tree-view"> <a href="#" class="package">adapters</a> <ul class="tree-view"> <li> <a href="../../graphics/adapters/adapter.html" class=" module">adapter</a> </li> <li> <a href="../../graphics/adapters/linux.html" class=" module">linux</a> </li> <li> <a href="../../graphics/adapters/mac.html" class=" module">mac</a> </li> <li> <a href="../../graphics/adapters/win32.html" class=" module">win32</a> </li> </ul> </li> <li class="collapsed tree-view"> <a href="#" class="package">shaders</a> <ul class="tree-view"> <li class="collapsed tree-view"> <a href="#" class="package">glsl</a> <ul class="tree-view"> <li> <a href="../../graphics/shaders/glsl/ambientlight.html" class=" module">ambientlight</a> </li> <li> <a href="../../graphics/shaders/glsl/animatedgeometry.html" class=" module">animatedgeometry</a> </li> <li> <a href="../../graphics/shaders/glsl/directionallight.html" class=" module">directionallight</a> </li> <li> <a href="../../graphics/shaders/glsl/geometry.html" class=" module">geometry</a> </li> <li> <a href="../../graphics/shaders/glsl/pointlight.html" class=" module">pointlight</a> </li> <li> <a href="../../graphics/shaders/glsl/userinterface.html" class=" module">userinterface</a> </li> </ul> </li> <li> <a href="../../graphics/shaders/glsl.html" class=" module">glsl</a> </li> <li> <a href="../../graphics/shaders/shaders.html" class=" module">shaders</a> </li> </ul> </li> <li> <a href="../../graphics/adapters.html" class=" module">adapters</a> </li> <li> <a href="../../graphics/graphics.html" class=" module">graphics</a> </li> <li> <a href="../../graphics/shaders.html" class=" module">shaders</a> </li> </ul> </li> <li class=" tree-view"> <a href="#" class="package">utility</a> <ul class="tree-view"> <li> <a href="../../utility/awesomium.html" class=" module">awesomium</a> </li> <li> <a href="../../utility/concurrency.html" class=" module">concurrency</a> </li> <li> <a href="../../utility/config.html" class=" module">config</a> </li> <li> <a href="../../utility/filepath.html" class="selected module">filepath</a> </li> <li> <a href="../../utility/input.html" class=" module">input</a> </li> <li> <a href="../../utility/output.html" class=" module">output</a> </li> <li> <a href="../../utility/string.html" class=" module">string</a> </li> <li> <a href="../../utility/time.html" class=" module">time</a> </li> </ul> </li> <li> <a href="../../components.html" class=" module">components</a> </li> <li> <a href="../../core.html" class=" module">core</a> </li> <li> <a href="../../graphics.html" class=" module">graphics</a> </li> <li> <a href="../../utility.html" class=" module">utility</a> </li> </ul> <noscript> <p style="color: red">The search functionality needs JavaScript enabled</p> </noscript> <div id="symbolSearchPane" style="display: none"> <p> <input id="symbolSearch" type="text" placeholder="Search for symbols" onchange="performSymbolSearch(24);" onkeypress="this.onchange();" onpaste="this.onchange();" oninput="this.onchange();"/> </p> <ul id="symbolSearchResults" style="display: none"></ul> <script type="application/javascript" src="../../symbols.js"></script> <script type="application/javascript"> //<![CDATA[ var symbolSearchRootDir = "../../"; $('#symbolSearchPane').show(); //]]> </script> </div> </nav> <div id="main-contents"> <h1>Class FilePath</h1><!-- using block body in layout.dt--><!-- using block ddox.description in ddox.layout.dt--> <p> A class which stores default resource paths, and handles path manipulation. </p> <section> </section> <section> <h2>Inherits from</h2> <ul> <li> <code class="prettyprint lang-d"><code class="prettyprint lang-d">Object</code></code> (base class) </li> </ul> </section><!-- using block ddox.sections in ddox.layout.dt--> <!-- using block ddox.members in ddox.layout.dt--> <section> <h2>Constructors</h2> <table> <col class="caption"/> <tr> <th>Name</th> <th>Description</th> </tr> <tr> <td> <a href="../../utility/filepath/FilePath.this.html" class="public"> <code>this</code> </a> </td> <td> Create an instance based on a given file <a href="../../utility/filepath/FilePath.this.html#path"><code class="prettyprint lang-d">path</code></a>. </td> </tr> </table> </section> <section> <h2>Fields</h2> <table> <col class="caption"/> <tr> <th>Name</th> <th>Type</th> <th>Description</th> </tr> <tr> <td> <a href="../../utility/filepath/FilePath.ResourceHome.html" class="public"><code>ResourceHome</code></a> </td> <td><code class="prettyprint lang-d">string</code></td> <td> The path to the resources home folder. </td> </tr> </table> </section> <section> <h2>Properties</h2> <table> <col class="caption"/> <tr> <th>Name</th> <th>Type</th> <th>Description</th> </tr> <tr> <td> <a href="../../utility/filepath/FilePath.baseFileName.html" class="public property"><code>baseFileName</code></a> <span class="tableEntryAnnotation">[get]</span> </td> <td><code class="prettyprint lang-d">string</code></td> <td> The name of the file without its <a href="../../utility/filepath/FilePath.extension.html"><code class="prettyprint lang-d">extension</code></a>. </td> </tr> <tr> <td> <a href="../../utility/filepath/FilePath.directory.html" class="public property"><code>directory</code></a> <span class="tableEntryAnnotation">[get]</span> </td> <td><code class="prettyprint lang-d">string</code></td> <td> The path to the <code class="prettyprint lang-d">directory</code> containing the file. </td> </tr> <tr> <td> <a href="../../utility/filepath/FilePath.extension.html" class="public property"><code>extension</code></a> <span class="tableEntryAnnotation">[get]</span> </td> <td><code class="prettyprint lang-d">string</code></td> <td> The extensino of the file. </td> </tr> <tr> <td> <a href="../../utility/filepath/FilePath.fileName.html" class="public property"><code>fileName</code></a> <span class="tableEntryAnnotation">[get]</span> </td> <td><code class="prettyprint lang-d">string</code></td> <td> The name of the file with its <a href="../../utility/filepath/FilePath.extension.html"><code class="prettyprint lang-d">extension</code></a>. </td> </tr> <tr> <td> <a href="../../utility/filepath/FilePath.fullPath.html" class="public property"><code>fullPath</code></a> <span class="tableEntryAnnotation">[get]</span> </td> <td><code class="prettyprint lang-d">string</code></td> <td> The full path to the file. </td> </tr> <tr> <td> <a href="../../utility/filepath/FilePath.relativePath.html" class="public property"><code>relativePath</code></a> <span class="tableEntryAnnotation">[get]</span> </td> <td><code class="prettyprint lang-d">string</code></td> <td> The relative path from the executable to the file. </td> </tr> </table> </section> <section> <h2>Methods</h2> <table> <col class="caption"/> <tr> <th>Name</th> <th>Description</th> </tr> <tr> <td> <a href="../../utility/filepath/FilePath.getContents.html" class="public"> <code>getContents</code> </a> </td> <td> TODO </td> </tr> <tr> <td> <a href="../../utility/filepath/FilePath.scanDirectory.html" class="public"> <code>scanDirectory</code> </a> </td> <td> Get all files in a given <a href="../../utility/filepath/FilePath.directory.html"><code class="prettyprint lang-d">directory</code></a>. </td> </tr> <tr> <td> <a href="../../utility/filepath/FilePath.toFile.html" class="public"> <code>toFile</code> </a> </td> <td> Converts to a std.stdio.File </td> </tr> </table> </section> <section> <h2>Enums</h2> <table> <col class="caption"/> <tr> <th>Name</th> <th>Description</th> </tr> <tr> <td> <a href="../../utility/filepath/FilePath.Resources.html" class="public"> <code>Resources</code> </a> </td> <td> Paths to the different resource files. </td> </tr> </table> </section> <section> <h2>Authors</h2><!-- using block ddox.authors in ddox.layout.dt--> </section> <section> <h2>Copyright</h2><!-- using block ddox.copyright in ddox.layout.dt--> </section> <section> <h2>License</h2><!-- using block ddox.license in ddox.layout.dt--> </section> </div> </body> </html>
Circular-Studios/Dash-Docs
api/v0.6.2/utility/filepath/FilePath.html
HTML
mit
12,443
{% if page.meta_description %} {% assign meta_description = page.meta_description %} {% else %} {% assign meta_description = page.content | strip_html | strip_newlines | truncate: 150 %} {% endif %} <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# website: http://ogp.me/ns/website#"> <title>{{ page.meta_title }}</title> <meta charset="utf-8" /> <meta name="keywords" content="{{ page.keywords | default: site.keywords }}" /> <meta name="description" content="{{ meta_description }}" /> <meta name="author" content="{{ page.author | default: site.author }}" /> <meta name="robots" content="index, follow" /> <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1.0" /> <link rel="canonical" href="{{ page.url | replace:'index.html','' | prepend: site.url }}" /> <!-- Verifications --> <meta name="p:domain_verify" content="{{ site.pinterest_verify }}" /> <meta name="msvalidate.01" content="{{ site.bing_verify }}" /> <!-- Facebook Open Graph Info --> <meta property="og:type" content="website" /> <meta property="og:url" content="{{ page.url | replace:'index.html','' | prepend: site.url }}" /> <meta property="og:title" content="{{ meta_title }}" /> <meta property="og:description" content="{{ meta_description | truncate: 160 }}" /> <meta property="fb:app_id" content="{{ site.fb_app_id }}" /> <meta property="fb:admins" content="{{ site.fb_admins }}" /> <meta property="fb:profile_id" content="{{ site.fb_profile_id }}" /> <meta property="og:image" content="{{ site.images | prepend: site.url }}/{{ page.og_image | default: site.og_image }}" /> <meta property="og:image:type" content="image/jpeg" /> <meta property="og:image:width" content="1500" /> <meta property="og:image:height" content="785" /> <!-- Favicons etc --> <link rel="apple-touch-icon" sizes="57x57" href="{{ site.images }}/favicons/apple-icon-57x57.png" /> <link rel="apple-touch-icon" sizes="60x60" href="{{ site.images }}/favicons/apple-icon-60x60.png" /> <link rel="apple-touch-icon" sizes="72x72" href="{{ site.images }}/favicons/apple-icon-72x72.png" /> <link rel="apple-touch-icon" sizes="76x76" href="{{ site.images }}/favicons/apple-icon-76x76.png" /> <link rel="apple-touch-icon" sizes="114x114" href="{{ site.images }}/favicons/apple-icon-114x114.png" /> <link rel="apple-touch-icon" sizes="120x120" href="{{ site.images }}/favicons/apple-icon-120x120.png" /> <link rel="apple-touch-icon" sizes="144x144" href="{{ site.images }}/favicons/apple-icon-144x144.png" /> <link rel="apple-touch-icon" sizes="152x152" href="{{ site.images }}/favicons/apple-icon-152x152.png" /> <link rel="apple-touch-icon" sizes="180x180" href="{{ site.images }}/favicons/apple-icon-180x180.png" /> <link rel="icon" type="image/png" sizes="192x192" href="{{ site.images }}/favicons/android-icon-192x192.png" /> <link rel="icon" type="image/png" sizes="32x32" href="{{ site.images }}/favicons/favicon-32x32.png" /> <link rel="icon" type="image/png" sizes="96x96" href="{{ site.images }}/favicons/favicon-96x96.png" /> <link rel="icon" type="image/png" sizes="16x16" href="{{ site.images }}/favicons/favicon-16x16.png" /> <link rel="manifest" href="{{ site.images }}/favicons/manifest.json" /> <meta name="msapplication-TileColor" content="#ffffff" /> <meta name="msapplication-TileImage" content="{{ site.images }}/favicons/ms-icon-144x144.png" /> <meta name="theme-color" content="#ffffff" /> <script> // Add a class to the html element if JS is enabled (function(html) { html.classList.add('js'); })(document.documentElement); </script> <link href="{{ site.assets }}/css/main.css?v=@version@" rel="stylesheet" /> <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,700,700i|Playfair+Display:900" rel="stylesheet" /> </head>
ChrisSargent/stickypixel
src/_includes/head.html
HTML
mit
4,077
--- layout: media title: "In front of book shelves" excerpt: "PaperFaces portrait of @mr_craig drawn with Paper by 53 on an iPad." image: feature: paperfaces-mr-craig-twitter-lg.jpg thumb: paperfaces-mr-craig-twitter-150.jpg category: paperfaces tags: [portrait, illustration, paper by 53] --- PaperFaces portrait of [@mr_craig](http://twitter.com/mr_craig). {% include paperfaces-boilerplate.html %}
jrbarnett/real-site
_posts/paperfaces/2012-11-05-mr-craig-portrait.md
Markdown
mit
407
using System; using NPoco; using Umbraco.Cms.Infrastructure.Persistence.DatabaseAnnotations; namespace Umbraco.Cms.Infrastructure.Persistence.Dtos { [TableName(TableName)] [ExplicitColumns] [PrimaryKey("Id")] internal class TwoFactorLoginDto { public const string TableName = Cms.Core.Constants.DatabaseSchema.Tables.TwoFactorLogin; [Column("id")] [PrimaryKeyColumn] public int Id { get; set; } [Column("userOrMemberKey")] [Index(IndexTypes.NonClustered)] public Guid UserOrMemberKey { get; set; } [Column("providerName")] [Length(400)] [NullSetting(NullSetting = NullSettings.NotNull)] [Index(IndexTypes.UniqueNonClustered, ForColumns = "providerName,userOrMemberKey", Name = "IX_" + TableName + "_ProviderName")] public string ProviderName { get; set; } [Column("secret")] [Length(400)] [NullSetting(NullSetting = NullSettings.NotNull)] public string Secret { get; set; } } }
marcemarc/Umbraco-CMS
src/Umbraco.Infrastructure/Persistence/Dtos/TwoFactorLoginDto.cs
C#
mit
1,035
/** * webdriverio * https://github.com/Camme/webdriverio * * A WebDriver module for nodejs. Either use the super easy help commands or use the base * Webdriver wire protocol commands. Its totally inspired by jellyfishs webdriver, but the * goal is to make all the webdriver protocol items available, as near the original as possible. * * Copyright (c) 2013 Camilo Tapia <camilo.tapia@gmail.com> * Licensed under the MIT license. * * Contributors: * Dan Jenkins <dan.jenkins@holidayextras.com> * Christian Bromann <mail@christian-bromann.com> * Vincent Voyer <vincent@zeroload.net> */ import WebdriverIO from './lib/webdriverio' import Multibrowser from './lib/multibrowser' import ErrorHandler from './lib/utils/ErrorHandler' import getImplementedCommands from './lib/helpers/getImplementedCommands' import pkg from './package.json' const IMPLEMENTED_COMMANDS = getImplementedCommands() const VERSION = pkg.version let remote = function (options = {}, modifier) { /** * initialise monad */ let wdio = WebdriverIO(options, modifier) /** * build prototype: commands */ for (let commandName of Object.keys(IMPLEMENTED_COMMANDS)) { wdio.lift(commandName, IMPLEMENTED_COMMANDS[commandName]) } let prototype = wdio() prototype.defer.resolve() return prototype } let multiremote = function (options) { let multibrowser = new Multibrowser() for (let browserName of Object.keys(options)) { multibrowser.addInstance( browserName, remote(options[browserName], multibrowser.getInstanceModifier()) ) } return remote(options, multibrowser.getModifier()) } export { remote, multiremote, VERSION, ErrorHandler }
testingbot/webdriverjs
index.js
JavaScript
mit
1,748
<?php /* * This file is part of the Elcodi package. * * Copyright (c) 2014-2015 Elcodi.com * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * Feel free to edit as you please, and have fun. * * @author Marc Morera <yuhu@mmoreram.com> * @author Aldo Chiecchia <zimage@tiscali.it> * @author Elcodi Team <tech@elcodi.com> */ namespace Elcodi\Component\Currency\Adapter\CurrencyExchangeRatesProvider; use GuzzleHttp\Client; use Elcodi\Component\Currency\Adapter\CurrencyExchangeRatesProvider\Interfaces\CurrencyExchangeRatesProviderAdapterInterface; /** * Class YahooFinanceProviderAdapter */ class YahooFinanceProviderAdapter implements CurrencyExchangeRatesProviderAdapterInterface { /** * @var Client * * Client */ private $client; /** * Service constructor * * @param Client $client Guzzle client for requests */ public function __construct(Client $client) { $this->client = $client; } /** * Get the latest exchange rates. * * This method will take in account always that the base currency is USD, * and the result must complain this format. * * [ * "EUR" => "1,78342784", * "YEN" => "0,67438268", * ... * ] * * @return array exchange rates */ public function getExchangeRates() { $exchangeRates = []; $response = $this ->client ->get( 'http://finance.yahoo.com/webservice/v1/symbols/allcurrencies/quote', [ 'query' => [ 'format' => 'json', ], ] ) ->json(); foreach ($response['list']['resources'] as $resource) { $fields = $resource['resource']['fields']; $symbol = str_replace('=X', '', $fields['symbol']); $exchangeRates[$symbol] = (float) $fields['price']; } return $exchangeRates; } }
shopery/elcodi
src/Elcodi/Component/Currency/Adapter/CurrencyExchangeRatesProvider/YahooFinanceProviderAdapter.php
PHP
mit
2,097
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Unicode Manipulation: GLib Reference Manual</title> <meta name="generator" content="DocBook XSL Stylesheets V1.78.1"> <link rel="home" href="index.html" title="GLib Reference Manual"> <link rel="up" href="glib-utilities.html" title="GLib Utilities"> <link rel="prev" href="glib-Character-Set-Conversion.html" title="Character Set Conversion"> <link rel="next" href="glib-Base64-Encoding.html" title="Base64 Encoding"> <meta name="generator" content="GTK-Doc V1.24 (XML mode)"> <link rel="stylesheet" href="style.css" type="text/css"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle"> <td width="100%" align="left" class="shortcuts"> <a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span>  <a href="#glib-Unicode-Manipulation.description" class="shortcut">Description</a></span> </td> <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td> <td><a accesskey="u" href="glib-utilities.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td> <td><a accesskey="p" href="glib-Character-Set-Conversion.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td> <td><a accesskey="n" href="glib-Base64-Encoding.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td> </tr></table> <div class="refentry"> <a name="glib-Unicode-Manipulation"></a><div class="titlepage"></div> <div class="refnamediv"><table width="100%"><tr> <td valign="top"> <h2><span class="refentrytitle"><a name="glib-Unicode-Manipulation.top_of_page"></a>Unicode Manipulation</span></h2> <p>Unicode Manipulation — functions operating on Unicode characters and UTF-8 strings</p> </td> <td class="gallery_image" valign="top" align="right"></td> </tr></table></div> <div class="refsect1"> <a name="glib-Unicode-Manipulation.functions"></a><h2>Functions</h2> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="functions_return"> <col class="functions_name"> </colgroup> <tbody> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-validate" title="g_unichar_validate ()">g_unichar_validate</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-isalnum" title="g_unichar_isalnum ()">g_unichar_isalnum</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-isalpha" title="g_unichar_isalpha ()">g_unichar_isalpha</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-iscntrl" title="g_unichar_iscntrl ()">g_unichar_iscntrl</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-isdefined" title="g_unichar_isdefined ()">g_unichar_isdefined</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-isdigit" title="g_unichar_isdigit ()">g_unichar_isdigit</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-isgraph" title="g_unichar_isgraph ()">g_unichar_isgraph</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-islower" title="g_unichar_islower ()">g_unichar_islower</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-ismark" title="g_unichar_ismark ()">g_unichar_ismark</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-isprint" title="g_unichar_isprint ()">g_unichar_isprint</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-ispunct" title="g_unichar_ispunct ()">g_unichar_ispunct</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-isspace" title="g_unichar_isspace ()">g_unichar_isspace</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-istitle" title="g_unichar_istitle ()">g_unichar_istitle</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-isupper" title="g_unichar_isupper ()">g_unichar_isupper</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-isxdigit" title="g_unichar_isxdigit ()">g_unichar_isxdigit</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-iswide" title="g_unichar_iswide ()">g_unichar_iswide</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-iswide-cjk" title="g_unichar_iswide_cjk ()">g_unichar_iswide_cjk</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-iszerowidth" title="g_unichar_iszerowidth ()">g_unichar_iszerowidth</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="returnvalue">gunichar</span></a> </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-toupper" title="g_unichar_toupper ()">g_unichar_toupper</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="returnvalue">gunichar</span></a> </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-tolower" title="g_unichar_tolower ()">g_unichar_tolower</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="returnvalue">gunichar</span></a> </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-totitle" title="g_unichar_totitle ()">g_unichar_totitle</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-digit-value" title="g_unichar_digit_value ()">g_unichar_digit_value</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-xdigit-value" title="g_unichar_xdigit_value ()">g_unichar_xdigit_value</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-compose" title="g_unichar_compose ()">g_unichar_compose</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-decompose" title="g_unichar_decompose ()">g_unichar_decompose</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="returnvalue">gsize</span></a> </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-fully-decompose" title="g_unichar_fully_decompose ()">g_unichar_fully_decompose</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Unicode-Manipulation.html#GUnicodeType" title="enum GUnicodeType"><span class="returnvalue">GUnicodeType</span></a> </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-type" title="g_unichar_type ()">g_unichar_type</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Unicode-Manipulation.html#GUnicodeBreakType" title="enum GUnicodeBreakType"><span class="returnvalue">GUnicodeBreakType</span></a> </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-break-type" title="g_unichar_break_type ()">g_unichar_break_type</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-combining-class" title="g_unichar_combining_class ()">g_unichar_combining_class</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <span class="returnvalue">void</span> </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-unicode-canonical-ordering" title="g_unicode_canonical_ordering ()">g_unicode_canonical_ordering</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="returnvalue">gunichar</span></a> * </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-unicode-canonical-decomposition" title="g_unicode_canonical_decomposition ()">g_unicode_canonical_decomposition</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-get-mirror-char" title="g_unichar_get_mirror_char ()">g_unichar_get_mirror_char</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Unicode-Manipulation.html#GUnicodeScript" title="enum GUnicodeScript"><span class="returnvalue">GUnicodeScript</span></a> </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-get-script" title="g_unichar_get_script ()">g_unichar_get_script</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Unicode-Manipulation.html#GUnicodeScript" title="enum GUnicodeScript"><span class="returnvalue">GUnicodeScript</span></a> </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-unicode-script-from-iso15924" title="g_unicode_script_from_iso15924 ()">g_unicode_script_from_iso15924</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#guint32" title="guint32"><span class="returnvalue">guint32</span></a> </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-unicode-script-to-iso15924" title="g_unicode_script_to_iso15924 ()">g_unicode_script_to_iso15924</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="define_keyword">#define</td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-next-char" title="g_utf8_next_char()">g_utf8_next_char</a><span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="returnvalue">gunichar</span></a> </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-get-char" title="g_utf8_get_char ()">g_utf8_get_char</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="returnvalue">gunichar</span></a> </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-get-char-validated" title="g_utf8_get_char_validated ()">g_utf8_get_char_validated</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-offset-to-pointer" title="g_utf8_offset_to_pointer ()">g_utf8_offset_to_pointer</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#glong" title="glong"><span class="returnvalue">glong</span></a> </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-pointer-to-offset" title="g_utf8_pointer_to_offset ()">g_utf8_pointer_to_offset</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-prev-char" title="g_utf8_prev_char ()">g_utf8_prev_char</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-find-next-char" title="g_utf8_find_next_char ()">g_utf8_find_next_char</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-find-prev-char" title="g_utf8_find_prev_char ()">g_utf8_find_prev_char</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#glong" title="glong"><span class="returnvalue">glong</span></a> </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-strlen" title="g_utf8_strlen ()">g_utf8_strlen</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-strncpy" title="g_utf8_strncpy ()">g_utf8_strncpy</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-strchr" title="g_utf8_strchr ()">g_utf8_strchr</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-strrchr" title="g_utf8_strrchr ()">g_utf8_strrchr</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-strreverse" title="g_utf8_strreverse ()">g_utf8_strreverse</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-substring" title="g_utf8_substring ()">g_utf8_substring</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-validate" title="g_utf8_validate ()">g_utf8_validate</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-strup" title="g_utf8_strup ()">g_utf8_strup</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-strdown" title="g_utf8_strdown ()">g_utf8_strdown</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-casefold" title="g_utf8_casefold ()">g_utf8_casefold</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-normalize" title="g_utf8_normalize ()">g_utf8_normalize</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-collate" title="g_utf8_collate ()">g_utf8_collate</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-collate-key" title="g_utf8_collate_key ()">g_utf8_collate_key</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-collate-key-for-filename" title="g_utf8_collate_key_for_filename ()">g_utf8_collate_key_for_filename</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Unicode-Manipulation.html#gunichar2" title="gunichar2"><span class="returnvalue">gunichar2</span></a> * </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-to-utf16" title="g_utf8_to_utf16 ()">g_utf8_to_utf16</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="returnvalue">gunichar</span></a> * </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-to-ucs4" title="g_utf8_to_ucs4 ()">g_utf8_to_ucs4</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="returnvalue">gunichar</span></a> * </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-to-ucs4-fast" title="g_utf8_to_ucs4_fast ()">g_utf8_to_ucs4_fast</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="returnvalue">gunichar</span></a> * </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-utf16-to-ucs4" title="g_utf16_to_ucs4 ()">g_utf16_to_ucs4</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-utf16-to-utf8" title="g_utf16_to_utf8 ()">g_utf16_to_utf8</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Unicode-Manipulation.html#gunichar2" title="gunichar2"><span class="returnvalue">gunichar2</span></a> * </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-ucs4-to-utf16" title="g_ucs4_to_utf16 ()">g_ucs4_to_utf16</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-ucs4-to-utf8" title="g_ucs4_to_utf8 ()">g_ucs4_to_utf8</a> <span class="c_punctuation">()</span> </td> </tr> <tr> <td class="function_type"> <a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> </td> <td class="function_name"> <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-to-utf8" title="g_unichar_to_utf8 ()">g_unichar_to_utf8</a> <span class="c_punctuation">()</span> </td> </tr> </tbody> </table></div> </div> <div class="refsect1"> <a name="glib-Unicode-Manipulation.other"></a><h2>Types and Values</h2> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="name"> <col class="description"> </colgroup> <tbody> <tr> <td class="typedef_keyword">typedef</td> <td class="function_name"><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar">gunichar</a></td> </tr> <tr> <td class="typedef_keyword">typedef</td> <td class="function_name"><a class="link" href="glib-Unicode-Manipulation.html#gunichar2" title="gunichar2">gunichar2</a></td> </tr> <tr> <td class="define_keyword">#define</td> <td class="function_name"><a class="link" href="glib-Unicode-Manipulation.html#G-UNICHAR-MAX-DECOMPOSITION-LENGTH:CAPS" title="G_UNICHAR_MAX_DECOMPOSITION_LENGTH">G_UNICHAR_MAX_DECOMPOSITION_LENGTH</a></td> </tr> <tr> <td class="datatype_keyword">enum</td> <td class="function_name"><a class="link" href="glib-Unicode-Manipulation.html#GUnicodeType" title="enum GUnicodeType">GUnicodeType</a></td> </tr> <tr> <td class="define_keyword">#define</td> <td class="function_name"><a class="link" href="glib-Unicode-Manipulation.html#G-UNICODE-COMBINING-MARK:CAPS" title="G_UNICODE_COMBINING_MARK">G_UNICODE_COMBINING_MARK</a></td> </tr> <tr> <td class="datatype_keyword">enum</td> <td class="function_name"><a class="link" href="glib-Unicode-Manipulation.html#GUnicodeBreakType" title="enum GUnicodeBreakType">GUnicodeBreakType</a></td> </tr> <tr> <td class="datatype_keyword">enum</td> <td class="function_name"><a class="link" href="glib-Unicode-Manipulation.html#GUnicodeScript" title="enum GUnicodeScript">GUnicodeScript</a></td> </tr> <tr> <td class="datatype_keyword">enum</td> <td class="function_name"><a class="link" href="glib-Unicode-Manipulation.html#GNormalizeMode" title="enum GNormalizeMode">GNormalizeMode</a></td> </tr> </tbody> </table></div> </div> <div class="refsect1"> <a name="glib-Unicode-Manipulation.includes"></a><h2>Includes</h2> <pre class="synopsis">#include &lt;glib.h&gt; </pre> </div> <div class="refsect1"> <a name="glib-Unicode-Manipulation.description"></a><h2>Description</h2> <p>This section describes a number of functions for dealing with Unicode characters and strings. There are analogues of the traditional <code class="literal">ctype.h</code> character classification and case conversion functions, UTF-8 analogues of some string utility functions, functions to perform normalization, case conversion and collation on UTF-8 strings and finally functions to convert between the UTF-8, UTF-16 and UCS-4 encodings of Unicode.</p> <p>The implementations of the Unicode functions in GLib are based on the Unicode Character Data tables, which are available from <a class="ulink" href="http://www.unicode.org/" target="_top">www.unicode.org</a>. GLib 2.8 supports Unicode 4.0, GLib 2.10 supports Unicode 4.1, GLib 2.12 supports Unicode 5.0, GLib 2.16.3 supports Unicode 5.1, GLib 2.30 supports Unicode 6.0.</p> </div> <div class="refsect1"> <a name="glib-Unicode-Manipulation.functions_details"></a><h2>Functions</h2> <div class="refsect2"> <a name="g-unichar-validate"></a><h3>g_unichar_validate ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_unichar_validate (<em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> ch</code></em>);</pre> <p>Checks whether <em class="parameter"><code>ch</code></em> is a valid Unicode character. Some possible integer values of <em class="parameter"><code>ch</code></em> will not be valid. 0 is considered a valid character, though it's normally a string terminator.</p> <div class="refsect3"> <a name="id-1.5.4.7.2.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>ch</p></td> <td class="parameter_description"><p>a Unicode character</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.2.6"></a><h4>Returns</h4> <p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>ch</code></em> is a valid Unicode character</p> </div> </div> <hr> <div class="refsect2"> <a name="g-unichar-isalnum"></a><h3>g_unichar_isalnum ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_unichar_isalnum (<em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> c</code></em>);</pre> <p>Determines whether a character is alphanumeric. Given some UTF-8 text, obtain a character value with <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-get-char" title="g_utf8_get_char ()"><code class="function">g_utf8_get_char()</code></a>.</p> <div class="refsect3"> <a name="id-1.5.4.7.3.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>c</p></td> <td class="parameter_description"><p>a Unicode character</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.3.6"></a><h4>Returns</h4> <p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>c</code></em> is an alphanumeric character</p> </div> </div> <hr> <div class="refsect2"> <a name="g-unichar-isalpha"></a><h3>g_unichar_isalpha ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_unichar_isalpha (<em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> c</code></em>);</pre> <p>Determines whether a character is alphabetic (i.e. a letter). Given some UTF-8 text, obtain a character value with <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-get-char" title="g_utf8_get_char ()"><code class="function">g_utf8_get_char()</code></a>.</p> <div class="refsect3"> <a name="id-1.5.4.7.4.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>c</p></td> <td class="parameter_description"><p>a Unicode character</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.4.6"></a><h4>Returns</h4> <p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>c</code></em> is an alphabetic character</p> </div> </div> <hr> <div class="refsect2"> <a name="g-unichar-iscntrl"></a><h3>g_unichar_iscntrl ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_unichar_iscntrl (<em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> c</code></em>);</pre> <p>Determines whether a character is a control character. Given some UTF-8 text, obtain a character value with <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-get-char" title="g_utf8_get_char ()"><code class="function">g_utf8_get_char()</code></a>.</p> <div class="refsect3"> <a name="id-1.5.4.7.5.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>c</p></td> <td class="parameter_description"><p>a Unicode character</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.5.6"></a><h4>Returns</h4> <p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>c</code></em> is a control character</p> </div> </div> <hr> <div class="refsect2"> <a name="g-unichar-isdefined"></a><h3>g_unichar_isdefined ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_unichar_isdefined (<em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> c</code></em>);</pre> <p>Determines if a given character is assigned in the Unicode standard.</p> <div class="refsect3"> <a name="id-1.5.4.7.6.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>c</p></td> <td class="parameter_description"><p>a Unicode character</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.6.6"></a><h4>Returns</h4> <p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the character has an assigned value</p> </div> </div> <hr> <div class="refsect2"> <a name="g-unichar-isdigit"></a><h3>g_unichar_isdigit ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_unichar_isdigit (<em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> c</code></em>);</pre> <p>Determines whether a character is numeric (i.e. a digit). This covers ASCII 0-9 and also digits in other languages/scripts. Given some UTF-8 text, obtain a character value with <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-get-char" title="g_utf8_get_char ()"><code class="function">g_utf8_get_char()</code></a>.</p> <div class="refsect3"> <a name="id-1.5.4.7.7.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>c</p></td> <td class="parameter_description"><p>a Unicode character</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.7.6"></a><h4>Returns</h4> <p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>c</code></em> is a digit</p> </div> </div> <hr> <div class="refsect2"> <a name="g-unichar-isgraph"></a><h3>g_unichar_isgraph ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_unichar_isgraph (<em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> c</code></em>);</pre> <p>Determines whether a character is printable and not a space (returns <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> for control characters, format characters, and spaces). <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-isprint" title="g_unichar_isprint ()"><code class="function">g_unichar_isprint()</code></a> is similar, but returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> for spaces. Given some UTF-8 text, obtain a character value with <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-get-char" title="g_utf8_get_char ()"><code class="function">g_utf8_get_char()</code></a>.</p> <div class="refsect3"> <a name="id-1.5.4.7.8.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>c</p></td> <td class="parameter_description"><p>a Unicode character</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.8.6"></a><h4>Returns</h4> <p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>c</code></em> is printable unless it's a space</p> </div> </div> <hr> <div class="refsect2"> <a name="g-unichar-islower"></a><h3>g_unichar_islower ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_unichar_islower (<em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> c</code></em>);</pre> <p>Determines whether a character is a lowercase letter. Given some UTF-8 text, obtain a character value with <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-get-char" title="g_utf8_get_char ()"><code class="function">g_utf8_get_char()</code></a>.</p> <div class="refsect3"> <a name="id-1.5.4.7.9.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>c</p></td> <td class="parameter_description"><p>a Unicode character</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.9.6"></a><h4>Returns</h4> <p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>c</code></em> is a lowercase letter</p> </div> </div> <hr> <div class="refsect2"> <a name="g-unichar-ismark"></a><h3>g_unichar_ismark ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_unichar_ismark (<em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> c</code></em>);</pre> <p>Determines whether a character is a mark (non-spacing mark, combining mark, or enclosing mark in Unicode speak). Given some UTF-8 text, obtain a character value with <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-get-char" title="g_utf8_get_char ()"><code class="function">g_utf8_get_char()</code></a>.</p> <p>Note: in most cases where isalpha characters are allowed, ismark characters should be allowed to as they are essential for writing most European languages as well as many non-Latin scripts.</p> <div class="refsect3"> <a name="id-1.5.4.7.10.6"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>c</p></td> <td class="parameter_description"><p>a Unicode character</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.10.7"></a><h4>Returns</h4> <p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>c</code></em> is a mark character</p> </div> <p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p> </div> <hr> <div class="refsect2"> <a name="g-unichar-isprint"></a><h3>g_unichar_isprint ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_unichar_isprint (<em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> c</code></em>);</pre> <p>Determines whether a character is printable. Unlike <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-isgraph" title="g_unichar_isgraph ()"><code class="function">g_unichar_isgraph()</code></a>, returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> for spaces. Given some UTF-8 text, obtain a character value with <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-get-char" title="g_utf8_get_char ()"><code class="function">g_utf8_get_char()</code></a>.</p> <div class="refsect3"> <a name="id-1.5.4.7.11.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>c</p></td> <td class="parameter_description"><p>a Unicode character</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.11.6"></a><h4>Returns</h4> <p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>c</code></em> is printable</p> </div> </div> <hr> <div class="refsect2"> <a name="g-unichar-ispunct"></a><h3>g_unichar_ispunct ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_unichar_ispunct (<em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> c</code></em>);</pre> <p>Determines whether a character is punctuation or a symbol. Given some UTF-8 text, obtain a character value with <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-get-char" title="g_utf8_get_char ()"><code class="function">g_utf8_get_char()</code></a>.</p> <div class="refsect3"> <a name="id-1.5.4.7.12.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>c</p></td> <td class="parameter_description"><p>a Unicode character</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.12.6"></a><h4>Returns</h4> <p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>c</code></em> is a punctuation or symbol character</p> </div> </div> <hr> <div class="refsect2"> <a name="g-unichar-isspace"></a><h3>g_unichar_isspace ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_unichar_isspace (<em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> c</code></em>);</pre> <p>Determines whether a character is a space, tab, or line separator (newline, carriage return, etc.). Given some UTF-8 text, obtain a character value with <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-get-char" title="g_utf8_get_char ()"><code class="function">g_utf8_get_char()</code></a>.</p> <p>(Note: don't use this to do word breaking; you have to use Pango or equivalent to get word breaking right, the algorithm is fairly complex.)</p> <div class="refsect3"> <a name="id-1.5.4.7.13.6"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>c</p></td> <td class="parameter_description"><p>a Unicode character</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.13.7"></a><h4>Returns</h4> <p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>c</code></em> is a space character</p> </div> </div> <hr> <div class="refsect2"> <a name="g-unichar-istitle"></a><h3>g_unichar_istitle ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_unichar_istitle (<em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> c</code></em>);</pre> <p>Determines if a character is titlecase. Some characters in Unicode which are composites, such as the DZ digraph have three case variants instead of just two. The titlecase form is used at the beginning of a word where only the first letter is capitalized. The titlecase form of the DZ digraph is U+01F2 LATIN CAPITAL LETTTER D WITH SMALL LETTER Z.</p> <div class="refsect3"> <a name="id-1.5.4.7.14.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>c</p></td> <td class="parameter_description"><p>a Unicode character</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.14.6"></a><h4>Returns</h4> <p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the character is titlecase</p> </div> </div> <hr> <div class="refsect2"> <a name="g-unichar-isupper"></a><h3>g_unichar_isupper ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_unichar_isupper (<em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> c</code></em>);</pre> <p>Determines if a character is uppercase.</p> <div class="refsect3"> <a name="id-1.5.4.7.15.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>c</p></td> <td class="parameter_description"><p>a Unicode character</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.15.6"></a><h4>Returns</h4> <p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>c</code></em> is an uppercase character</p> </div> </div> <hr> <div class="refsect2"> <a name="g-unichar-isxdigit"></a><h3>g_unichar_isxdigit ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_unichar_isxdigit (<em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> c</code></em>);</pre> <p>Determines if a character is a hexidecimal digit.</p> <div class="refsect3"> <a name="id-1.5.4.7.16.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>c</p></td> <td class="parameter_description"><p>a Unicode character.</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.16.6"></a><h4>Returns</h4> <p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the character is a hexadecimal digit</p> </div> </div> <hr> <div class="refsect2"> <a name="g-unichar-iswide"></a><h3>g_unichar_iswide ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_unichar_iswide (<em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> c</code></em>);</pre> <p>Determines if a character is typically rendered in a double-width cell.</p> <div class="refsect3"> <a name="id-1.5.4.7.17.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>c</p></td> <td class="parameter_description"><p>a Unicode character</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.17.6"></a><h4>Returns</h4> <p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the character is wide</p> </div> </div> <hr> <div class="refsect2"> <a name="g-unichar-iswide-cjk"></a><h3>g_unichar_iswide_cjk ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_unichar_iswide_cjk (<em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> c</code></em>);</pre> <p>Determines if a character is typically rendered in a double-width cell under legacy East Asian locales. If a character is wide according to <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-iswide" title="g_unichar_iswide ()"><code class="function">g_unichar_iswide()</code></a>, then it is also reported wide with this function, but the converse is not necessarily true. See the <a class="ulink" href="http://www.unicode.org/reports/tr11/" target="_top">Unicode Standard Annex <span class="type">11</span></a> for details.</p> <p>If a character passes the <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-iswide" title="g_unichar_iswide ()"><code class="function">g_unichar_iswide()</code></a> test then it will also pass this test, but not the other way around. Note that some characters may pass both this test and <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-iszerowidth" title="g_unichar_iszerowidth ()"><code class="function">g_unichar_iszerowidth()</code></a>.</p> <div class="refsect3"> <a name="id-1.5.4.7.18.6"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>c</p></td> <td class="parameter_description"><p>a Unicode character</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.18.7"></a><h4>Returns</h4> <p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the character is wide in legacy East Asian locales</p> </div> <p class="since">Since: <a class="link" href="api-index-2-12.html#api-index-2.12">2.12</a></p> </div> <hr> <div class="refsect2"> <a name="g-unichar-iszerowidth"></a><h3>g_unichar_iszerowidth ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_unichar_iszerowidth (<em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> c</code></em>);</pre> <p>Determines if a given character typically takes zero width when rendered. The return value is <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> for all non-spacing and enclosing marks (e.g., combining accents), format characters, zero-width space, but not U+00AD SOFT HYPHEN.</p> <p>A typical use of this function is with one of <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-iswide" title="g_unichar_iswide ()"><code class="function">g_unichar_iswide()</code></a> or <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-iswide-cjk" title="g_unichar_iswide_cjk ()"><code class="function">g_unichar_iswide_cjk()</code></a> to determine the number of cells a string occupies when displayed on a grid display (terminals). However, note that not all terminals support zero-width rendering of zero-width marks.</p> <div class="refsect3"> <a name="id-1.5.4.7.19.6"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>c</p></td> <td class="parameter_description"><p>a Unicode character</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.19.7"></a><h4>Returns</h4> <p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the character has zero width</p> </div> <p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p> </div> <hr> <div class="refsect2"> <a name="g-unichar-toupper"></a><h3>g_unichar_toupper ()</h3> <pre class="programlisting"><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="returnvalue">gunichar</span></a> g_unichar_toupper (<em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> c</code></em>);</pre> <p>Converts a character to uppercase.</p> <div class="refsect3"> <a name="id-1.5.4.7.20.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>c</p></td> <td class="parameter_description"><p>a Unicode character</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.20.6"></a><h4>Returns</h4> <p> the result of converting <em class="parameter"><code>c</code></em> to uppercase. If <em class="parameter"><code>c</code></em> is not an lowercase or titlecase character, or has no upper case equivalent <em class="parameter"><code>c</code></em> is returned unchanged.</p> </div> </div> <hr> <div class="refsect2"> <a name="g-unichar-tolower"></a><h3>g_unichar_tolower ()</h3> <pre class="programlisting"><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="returnvalue">gunichar</span></a> g_unichar_tolower (<em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> c</code></em>);</pre> <p>Converts a character to lower case.</p> <div class="refsect3"> <a name="id-1.5.4.7.21.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>c</p></td> <td class="parameter_description"><p>a Unicode character.</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.21.6"></a><h4>Returns</h4> <p> the result of converting <em class="parameter"><code>c</code></em> to lower case. If <em class="parameter"><code>c</code></em> is not an upperlower or titlecase character, or has no lowercase equivalent <em class="parameter"><code>c</code></em> is returned unchanged.</p> </div> </div> <hr> <div class="refsect2"> <a name="g-unichar-totitle"></a><h3>g_unichar_totitle ()</h3> <pre class="programlisting"><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="returnvalue">gunichar</span></a> g_unichar_totitle (<em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> c</code></em>);</pre> <p>Converts a character to the titlecase.</p> <div class="refsect3"> <a name="id-1.5.4.7.22.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>c</p></td> <td class="parameter_description"><p>a Unicode character</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.22.6"></a><h4>Returns</h4> <p> the result of converting <em class="parameter"><code>c</code></em> to titlecase. If <em class="parameter"><code>c</code></em> is not an uppercase or lowercase character, <em class="parameter"><code>c</code></em> is returned unchanged.</p> </div> </div> <hr> <div class="refsect2"> <a name="g-unichar-digit-value"></a><h3>g_unichar_digit_value ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> g_unichar_digit_value (<em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> c</code></em>);</pre> <p>Determines the numeric value of a character as a decimal digit.</p> <div class="refsect3"> <a name="id-1.5.4.7.23.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>c</p></td> <td class="parameter_description"><p>a Unicode character</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.23.6"></a><h4>Returns</h4> <p> If <em class="parameter"><code>c</code></em> is a decimal digit (according to <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-isdigit" title="g_unichar_isdigit ()"><code class="function">g_unichar_isdigit()</code></a>), its numeric value. Otherwise, -1.</p> </div> </div> <hr> <div class="refsect2"> <a name="g-unichar-xdigit-value"></a><h3>g_unichar_xdigit_value ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> g_unichar_xdigit_value (<em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> c</code></em>);</pre> <p>Determines the numeric value of a character as a hexidecimal digit.</p> <div class="refsect3"> <a name="id-1.5.4.7.24.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>c</p></td> <td class="parameter_description"><p>a Unicode character</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.24.6"></a><h4>Returns</h4> <p> If <em class="parameter"><code>c</code></em> is a hex digit (according to <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-isxdigit" title="g_unichar_isxdigit ()"><code class="function">g_unichar_isxdigit()</code></a>), its numeric value. Otherwise, -1.</p> </div> </div> <hr> <div class="refsect2"> <a name="g-unichar-compose"></a><h3>g_unichar_compose ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_unichar_compose (<em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> a</code></em>, <em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> b</code></em>, <em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> *ch</code></em>);</pre> <p>Performs a single composition step of the Unicode canonical composition algorithm.</p> <p>This function includes algorithmic Hangul Jamo composition, but it is not exactly the inverse of <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-decompose" title="g_unichar_decompose ()"><code class="function">g_unichar_decompose()</code></a>. No composition can have either of <em class="parameter"><code>a</code></em> or <em class="parameter"><code>b</code></em> equal to zero. To be precise, this function composes if and only if there exists a Primary Composite P which is canonically equivalent to the sequence &lt;<em class="parameter"><code>a</code></em> ,<em class="parameter"><code>b</code></em> &gt;. See the Unicode Standard for the definition of Primary Composite.</p> <p>If <em class="parameter"><code>a</code></em> and <em class="parameter"><code>b</code></em> do not compose a new character, <em class="parameter"><code>ch</code></em> is set to zero.</p> <p>See <a class="ulink" href="http://unicode.org/reports/tr15/" target="_top">UAX<span class="type">15</span></a> for details.</p> <div class="refsect3"> <a name="id-1.5.4.7.25.8"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>a</p></td> <td class="parameter_description"><p>a Unicode character</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>b</p></td> <td class="parameter_description"><p>a Unicode character</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>ch</p></td> <td class="parameter_description"><p>return location for the composed character</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.25.9"></a><h4>Returns</h4> <p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the characters could be composed</p> </div> <p class="since">Since: <a class="link" href="api-index-2-30.html#api-index-2.30">2.30</a></p> </div> <hr> <div class="refsect2"> <a name="g-unichar-decompose"></a><h3>g_unichar_decompose ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_unichar_decompose (<em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> ch</code></em>, <em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> *a</code></em>, <em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> *b</code></em>);</pre> <p>Performs a single decomposition step of the Unicode canonical decomposition algorithm.</p> <p>This function does not include compatibility decompositions. It does, however, include algorithmic Hangul Jamo decomposition, as well as 'singleton' decompositions which replace a character by a single other character. In the case of singletons *<em class="parameter"><code>b</code></em> will be set to zero.</p> <p>If <em class="parameter"><code>ch</code></em> is not decomposable, *<em class="parameter"><code>a</code></em> is set to <em class="parameter"><code>ch</code></em> and *<em class="parameter"><code>b</code></em> is set to zero.</p> <p>Note that the way Unicode decomposition pairs are defined, it is guaranteed that <em class="parameter"><code>b</code></em> would not decompose further, but <em class="parameter"><code>a</code></em> may itself decompose. To get the full canonical decomposition for <em class="parameter"><code>ch</code></em> , one would need to recursively call this function on <em class="parameter"><code>a</code></em> . Or use <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-fully-decompose" title="g_unichar_fully_decompose ()"><code class="function">g_unichar_fully_decompose()</code></a>.</p> <p>See <a class="ulink" href="http://unicode.org/reports/tr15/" target="_top">UAX<span class="type">15</span></a> for details.</p> <div class="refsect3"> <a name="id-1.5.4.7.26.9"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>ch</p></td> <td class="parameter_description"><p>a Unicode character</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>a</p></td> <td class="parameter_description"><p>return location for the first component of <em class="parameter"><code>ch</code></em> </p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>b</p></td> <td class="parameter_description"><p>return location for the second component of <em class="parameter"><code>ch</code></em> </p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.26.10"></a><h4>Returns</h4> <p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the character could be decomposed</p> </div> <p class="since">Since: <a class="link" href="api-index-2-30.html#api-index-2.30">2.30</a></p> </div> <hr> <div class="refsect2"> <a name="g-unichar-fully-decompose"></a><h3>g_unichar_fully_decompose ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="returnvalue">gsize</span></a> g_unichar_fully_decompose (<em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> ch</code></em>, <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="type">gboolean</span></a> compat</code></em>, <em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> *result</code></em>, <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> result_len</code></em>);</pre> <p>Computes the canonical or compatibility decomposition of a Unicode character. For compatibility decomposition, pass <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> for <em class="parameter"><code>compat</code></em> ; for canonical decomposition pass <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> for <em class="parameter"><code>compat</code></em> .</p> <p>The decomposed sequence is placed in <em class="parameter"><code>result</code></em> . Only up to <em class="parameter"><code>result_len</code></em> characters are written into <em class="parameter"><code>result</code></em> . The length of the full decomposition (irrespective of <em class="parameter"><code>result_len</code></em> ) is returned by the function. For canonical decomposition, currently all decompositions are of length at most 4, but this may change in the future (very unlikely though). At any rate, Unicode does guarantee that a buffer of length 18 is always enough for both compatibility and canonical decompositions, so that is the size recommended. This is provided as <a class="link" href="glib-Unicode-Manipulation.html#G-UNICHAR-MAX-DECOMPOSITION-LENGTH:CAPS" title="G_UNICHAR_MAX_DECOMPOSITION_LENGTH"><code class="literal">G_UNICHAR_MAX_DECOMPOSITION_LENGTH</code></a>.</p> <p>See <a class="ulink" href="http://unicode.org/reports/tr15/" target="_top">UAX<span class="type">15</span></a> for details.</p> <div class="refsect3"> <a name="id-1.5.4.7.27.7"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>ch</p></td> <td class="parameter_description"><p>a Unicode character.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>compat</p></td> <td class="parameter_description"><p>whether perform canonical or compatibility decomposition</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>result</p></td> <td class="parameter_description"><p> location to store decomposed result, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>result_len</p></td> <td class="parameter_description"><p>length of <em class="parameter"><code>result</code></em> </p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.27.8"></a><h4>Returns</h4> <p> the length of the full decomposition.</p> </div> <p class="since">Since: <a class="link" href="api-index-2-30.html#api-index-2.30">2.30</a></p> </div> <hr> <div class="refsect2"> <a name="g-unichar-type"></a><h3>g_unichar_type ()</h3> <pre class="programlisting"><a class="link" href="glib-Unicode-Manipulation.html#GUnicodeType" title="enum GUnicodeType"><span class="returnvalue">GUnicodeType</span></a> g_unichar_type (<em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> c</code></em>);</pre> <p>Classifies a Unicode character by type.</p> <div class="refsect3"> <a name="id-1.5.4.7.28.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>c</p></td> <td class="parameter_description"><p>a Unicode character</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.28.6"></a><h4>Returns</h4> <p> the type of the character.</p> </div> </div> <hr> <div class="refsect2"> <a name="g-unichar-break-type"></a><h3>g_unichar_break_type ()</h3> <pre class="programlisting"><a class="link" href="glib-Unicode-Manipulation.html#GUnicodeBreakType" title="enum GUnicodeBreakType"><span class="returnvalue">GUnicodeBreakType</span></a> g_unichar_break_type (<em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> c</code></em>);</pre> <p>Determines the break type of <em class="parameter"><code>c</code></em> . <em class="parameter"><code>c</code></em> should be a Unicode character (to derive a character from UTF-8 encoded text, use <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-get-char" title="g_utf8_get_char ()"><code class="function">g_utf8_get_char()</code></a>). The break type is used to find word and line breaks ("text boundaries"), Pango implements the Unicode boundary resolution algorithms and normally you would use a function such as <code class="function">pango_break()</code> instead of caring about break types yourself.</p> <div class="refsect3"> <a name="id-1.5.4.7.29.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>c</p></td> <td class="parameter_description"><p>a Unicode character</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.29.6"></a><h4>Returns</h4> <p> the break type of <em class="parameter"><code>c</code></em> </p> </div> </div> <hr> <div class="refsect2"> <a name="g-unichar-combining-class"></a><h3>g_unichar_combining_class ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> g_unichar_combining_class (<em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> uc</code></em>);</pre> <p>Determines the canonical combining class of a Unicode character.</p> <div class="refsect3"> <a name="id-1.5.4.7.30.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>uc</p></td> <td class="parameter_description"><p>a Unicode character</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.30.6"></a><h4>Returns</h4> <p> the combining class of the character</p> </div> <p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p> </div> <hr> <div class="refsect2"> <a name="g-unicode-canonical-ordering"></a><h3>g_unicode_canonical_ordering ()</h3> <pre class="programlisting"><span class="returnvalue">void</span> g_unicode_canonical_ordering (<em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> *string</code></em>, <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> len</code></em>);</pre> <p>Computes the canonical ordering of a string in-place. This rearranges decomposed characters in the string according to their combining classes. See the Unicode manual for more information.</p> <div class="refsect3"> <a name="id-1.5.4.7.31.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>string</p></td> <td class="parameter_description"><p>a UCS-4 encoded string.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>len</p></td> <td class="parameter_description"><p>the maximum length of <em class="parameter"><code>string</code></em> to use.</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> </div> <hr> <div class="refsect2"> <a name="g-unicode-canonical-decomposition"></a><h3>g_unicode_canonical_decomposition ()</h3> <pre class="programlisting"><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="returnvalue">gunichar</span></a> * g_unicode_canonical_decomposition (<em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> ch</code></em>, <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> *result_len</code></em>);</pre> <div class="warning"> <p><code class="literal">g_unicode_canonical_decomposition</code> has been deprecated since version 2.30 and should not be used in newly-written code.</p> <p>Use the more flexible <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-fully-decompose" title="g_unichar_fully_decompose ()"><code class="function">g_unichar_fully_decompose()</code></a> instead.</p> </div> <p>Computes the canonical decomposition of a Unicode character.</p> <div class="refsect3"> <a name="id-1.5.4.7.32.6"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>ch</p></td> <td class="parameter_description"><p>a Unicode character.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>result_len</p></td> <td class="parameter_description"><p>location to store the length of the return value.</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.32.7"></a><h4>Returns</h4> <p> a newly allocated string of Unicode characters. <em class="parameter"><code>result_len</code></em> is set to the resulting length of the string.</p> </div> </div> <hr> <div class="refsect2"> <a name="g-unichar-get-mirror-char"></a><h3>g_unichar_get_mirror_char ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_unichar_get_mirror_char (<em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> ch</code></em>, <em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> *mirrored_ch</code></em>);</pre> <p>In Unicode, some characters are "mirrored". This means that their images are mirrored horizontally in text that is laid out from right to left. For instance, "(" would become its mirror image, ")", in right-to-left text.</p> <p>If <em class="parameter"><code>ch</code></em> has the Unicode mirrored property and there is another unicode character that typically has a glyph that is the mirror image of <em class="parameter"><code>ch</code></em> 's glyph and <em class="parameter"><code>mirrored_ch</code></em> is set, it puts that character in the address pointed to by <em class="parameter"><code>mirrored_ch</code></em> . Otherwise the original character is put.</p> <div class="refsect3"> <a name="id-1.5.4.7.33.6"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>ch</p></td> <td class="parameter_description"><p>a Unicode character</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>mirrored_ch</p></td> <td class="parameter_description"><p>location to store the mirrored character</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.33.7"></a><h4>Returns</h4> <p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if <em class="parameter"><code>ch</code></em> has a mirrored character, <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> otherwise</p> </div> <p class="since">Since: <a class="link" href="api-index-2-4.html#api-index-2.4">2.4</a></p> </div> <hr> <div class="refsect2"> <a name="g-unichar-get-script"></a><h3>g_unichar_get_script ()</h3> <pre class="programlisting"><a class="link" href="glib-Unicode-Manipulation.html#GUnicodeScript" title="enum GUnicodeScript"><span class="returnvalue">GUnicodeScript</span></a> g_unichar_get_script (<em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> ch</code></em>);</pre> <p>Looks up the <a class="link" href="glib-Unicode-Manipulation.html#GUnicodeScript" title="enum GUnicodeScript"><span class="type">GUnicodeScript</span></a> for a particular character (as defined by Unicode Standard Annex #24). No check is made for <em class="parameter"><code>ch</code></em> being a valid Unicode character; if you pass in invalid character, the result is undefined.</p> <p>This function is equivalent to <code class="function">pango_script_for_unichar()</code> and the two are interchangeable.</p> <div class="refsect3"> <a name="id-1.5.4.7.34.6"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>ch</p></td> <td class="parameter_description"><p>a Unicode character</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.34.7"></a><h4>Returns</h4> <p> the <a class="link" href="glib-Unicode-Manipulation.html#GUnicodeScript" title="enum GUnicodeScript"><span class="type">GUnicodeScript</span></a> for the character.</p> </div> <p class="since">Since: <a class="link" href="api-index-2-14.html#api-index-2.14">2.14</a></p> </div> <hr> <div class="refsect2"> <a name="g-unicode-script-from-iso15924"></a><h3>g_unicode_script_from_iso15924 ()</h3> <pre class="programlisting"><a class="link" href="glib-Unicode-Manipulation.html#GUnicodeScript" title="enum GUnicodeScript"><span class="returnvalue">GUnicodeScript</span></a> g_unicode_script_from_iso15924 (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint32" title="guint32"><span class="type">guint32</span></a> iso15924</code></em>);</pre> <p>Looks up the Unicode script for <em class="parameter"><code>iso15924</code></em> . ISO 15924 assigns four-letter codes to scripts. For example, the code for Arabic is 'Arab'. This function accepts four letter codes encoded as a <em class="parameter"><code>guint32</code></em> in a big-endian fashion. That is, the code expected for Arabic is 0x41726162 (0x41 is ASCII code for 'A', 0x72 is ASCII code for 'r', etc).</p> <p>See <a class="ulink" href="http://unicode.org/iso15924/codelists.html" target="_top">Codes for the representation of names of scripts</a> for details.</p> <div class="refsect3"> <a name="id-1.5.4.7.35.6"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>iso15924</p></td> <td class="parameter_description"><p>a Unicode script</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.35.7"></a><h4>Returns</h4> <p> the Unicode script for <em class="parameter"><code>iso15924</code></em> , or of <a class="link" href="glib-Unicode-Manipulation.html#G-UNICODE-SCRIPT-INVALID-CODE:CAPS"><code class="literal">G_UNICODE_SCRIPT_INVALID_CODE</code></a> if <em class="parameter"><code>iso15924</code></em> is zero and <a class="link" href="glib-Unicode-Manipulation.html#G-UNICODE-SCRIPT-UNKNOWN:CAPS"><code class="literal">G_UNICODE_SCRIPT_UNKNOWN</code></a> if <em class="parameter"><code>iso15924</code></em> is unknown.</p> </div> <p class="since">Since: <a class="link" href="api-index-2-30.html#api-index-2.30">2.30</a></p> </div> <hr> <div class="refsect2"> <a name="g-unicode-script-to-iso15924"></a><h3>g_unicode_script_to_iso15924 ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint32" title="guint32"><span class="returnvalue">guint32</span></a> g_unicode_script_to_iso15924 (<em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#GUnicodeScript" title="enum GUnicodeScript"><span class="type">GUnicodeScript</span></a> script</code></em>);</pre> <p>Looks up the ISO 15924 code for <em class="parameter"><code>script</code></em> . ISO 15924 assigns four-letter codes to scripts. For example, the code for Arabic is 'Arab'. The four letter codes are encoded as a <em class="parameter"><code>guint32</code></em> by this function in a big-endian fashion. That is, the code returned for Arabic is 0x41726162 (0x41 is ASCII code for 'A', 0x72 is ASCII code for 'r', etc).</p> <p>See <a class="ulink" href="http://unicode.org/iso15924/codelists.html" target="_top">Codes for the representation of names of scripts</a> for details.</p> <div class="refsect3"> <a name="id-1.5.4.7.36.6"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>script</p></td> <td class="parameter_description"><p>a Unicode script</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.36.7"></a><h4>Returns</h4> <p> the ISO 15924 code for <em class="parameter"><code>script</code></em> , encoded as an integer, of zero if <em class="parameter"><code>script</code></em> is <a class="link" href="glib-Unicode-Manipulation.html#G-UNICODE-SCRIPT-INVALID-CODE:CAPS"><code class="literal">G_UNICODE_SCRIPT_INVALID_CODE</code></a> or ISO 15924 code 'Zzzz' (script code for UNKNOWN) if <em class="parameter"><code>script</code></em> is not understood.</p> </div> <p class="since">Since: <a class="link" href="api-index-2-30.html#api-index-2.30">2.30</a></p> </div> <hr> <div class="refsect2"> <a name="g-utf8-next-char"></a><h3>g_utf8_next_char()</h3> <pre class="programlisting">#define g_utf8_next_char(p)</pre> <p>Skips to the next character in a UTF-8 string. The string must be valid; this macro is as fast as possible, and has no error-checking. You would use this macro to iterate over a string character by character. The macro returns the start of the next UTF-8 character. Before using this macro, use <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-validate" title="g_utf8_validate ()"><code class="function">g_utf8_validate()</code></a> to validate strings that may contain invalid UTF-8.</p> <div class="refsect3"> <a name="id-1.5.4.7.37.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>p</p></td> <td class="parameter_description"><p>Pointer to the start of a valid UTF-8 character</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> </div> <hr> <div class="refsect2"> <a name="g-utf8-get-char"></a><h3>g_utf8_get_char ()</h3> <pre class="programlisting"><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="returnvalue">gunichar</span></a> g_utf8_get_char (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *p</code></em>);</pre> <p>Converts a sequence of bytes encoded as UTF-8 to a Unicode character.</p> <p>If <em class="parameter"><code>p</code></em> does not point to a valid UTF-8 encoded character, results are undefined. If you are not sure that the bytes are complete valid Unicode characters, you should use <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-get-char-validated" title="g_utf8_get_char_validated ()"><code class="function">g_utf8_get_char_validated()</code></a> instead.</p> <div class="refsect3"> <a name="id-1.5.4.7.38.6"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>p</p></td> <td class="parameter_description"><p>a pointer to Unicode character encoded as UTF-8</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.38.7"></a><h4>Returns</h4> <p> the resulting character</p> </div> </div> <hr> <div class="refsect2"> <a name="g-utf8-get-char-validated"></a><h3>g_utf8_get_char_validated ()</h3> <pre class="programlisting"><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="returnvalue">gunichar</span></a> g_utf8_get_char_validated (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *p</code></em>, <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gssize" title="gssize"><span class="type">gssize</span></a> max_len</code></em>);</pre> <p>Convert a sequence of bytes encoded as UTF-8 to a Unicode character. This function checks for incomplete characters, for invalid characters such as characters that are out of the range of Unicode, and for overlong encodings of valid characters.</p> <div class="refsect3"> <a name="id-1.5.4.7.39.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>p</p></td> <td class="parameter_description"><p>a pointer to Unicode character encoded as UTF-8</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>max_len</p></td> <td class="parameter_description"><p>the maximum number of bytes to read, or -1, for no maximum or if <em class="parameter"><code>p</code></em> is nul-terminated</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.39.6"></a><h4>Returns</h4> <p> the resulting character. If <em class="parameter"><code>p</code></em> points to a partial sequence at the end of a string that could begin a valid character (or if <em class="parameter"><code>max_len</code></em> is zero), returns (gunichar)-2; otherwise, if <em class="parameter"><code>p</code></em> does not point to a valid UTF-8 encoded Unicode character, returns (gunichar)-1.</p> </div> </div> <hr> <div class="refsect2"> <a name="g-utf8-offset-to-pointer"></a><h3>g_utf8_offset_to_pointer ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * g_utf8_offset_to_pointer (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *str</code></em>, <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#glong" title="glong"><span class="type">glong</span></a> offset</code></em>);</pre> <p>Converts from an integer character offset to a pointer to a position within the string.</p> <p>Since 2.10, this function allows to pass a negative <em class="parameter"><code>offset</code></em> to step backwards. It is usually worth stepping backwards from the end instead of forwards if <em class="parameter"><code>offset</code></em> is in the last fourth of the string, since moving forward is about 3 times faster than moving backward.</p> <p>Note that this function doesn't abort when reaching the end of <em class="parameter"><code>str</code></em> . Therefore you should be sure that <em class="parameter"><code>offset</code></em> is within string boundaries before calling that function. Call <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-strlen" title="g_utf8_strlen ()"><code class="function">g_utf8_strlen()</code></a> when unsure. This limitation exists as this function is called frequently during text rendering and therefore has to be as fast as possible.</p> <div class="refsect3"> <a name="id-1.5.4.7.40.7"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>str</p></td> <td class="parameter_description"><p>a UTF-8 encoded string</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>offset</p></td> <td class="parameter_description"><p>a character offset within <em class="parameter"><code>str</code></em> </p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.40.8"></a><h4>Returns</h4> <p> the resulting pointer</p> </div> </div> <hr> <div class="refsect2"> <a name="g-utf8-pointer-to-offset"></a><h3>g_utf8_pointer_to_offset ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#glong" title="glong"><span class="returnvalue">glong</span></a> g_utf8_pointer_to_offset (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *str</code></em>, <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *pos</code></em>);</pre> <p>Converts from a pointer to position within a string to a integer character offset.</p> <p>Since 2.10, this function allows <em class="parameter"><code>pos</code></em> to be before <em class="parameter"><code>str</code></em> , and returns a negative offset in this case.</p> <div class="refsect3"> <a name="id-1.5.4.7.41.6"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>str</p></td> <td class="parameter_description"><p>a UTF-8 encoded string</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>pos</p></td> <td class="parameter_description"><p>a pointer to a position within <em class="parameter"><code>str</code></em> </p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.41.7"></a><h4>Returns</h4> <p> the resulting character offset</p> </div> </div> <hr> <div class="refsect2"> <a name="g-utf8-prev-char"></a><h3>g_utf8_prev_char ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * g_utf8_prev_char (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *p</code></em>);</pre> <p>Finds the previous UTF-8 character in the string before <em class="parameter"><code>p</code></em> .</p> <p><em class="parameter"><code>p</code></em> does not have to be at the beginning of a UTF-8 character. No check is made to see if the character found is actually valid other than it starts with an appropriate byte. If <em class="parameter"><code>p</code></em> might be the first character of the string, you must use <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-find-prev-char" title="g_utf8_find_prev_char ()"><code class="function">g_utf8_find_prev_char()</code></a> instead.</p> <div class="refsect3"> <a name="id-1.5.4.7.42.6"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody><tr> <td class="parameter_name"><p>p</p></td> <td class="parameter_description"><p>a pointer to a position within a UTF-8 encoded string</p></td> <td class="parameter_annotations"> </td> </tr></tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.42.7"></a><h4>Returns</h4> <p> a pointer to the found character</p> </div> </div> <hr> <div class="refsect2"> <a name="g-utf8-find-next-char"></a><h3>g_utf8_find_next_char ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * g_utf8_find_next_char (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *p</code></em>, <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *end</code></em>);</pre> <p>Finds the start of the next UTF-8 character in the string after <em class="parameter"><code>p</code></em> .</p> <p><em class="parameter"><code>p</code></em> does not have to be at the beginning of a UTF-8 character. No check is made to see if the character found is actually valid other than it starts with an appropriate byte.</p> <div class="refsect3"> <a name="id-1.5.4.7.43.6"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>p</p></td> <td class="parameter_description"><p>a pointer to a position within a UTF-8 encoded string</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>end</p></td> <td class="parameter_description"><p>a pointer to the byte following the end of the string, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> to indicate that the string is nul-terminated</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.43.7"></a><h4>Returns</h4> <p> a pointer to the found character or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a></p> </div> </div> <hr> <div class="refsect2"> <a name="g-utf8-find-prev-char"></a><h3>g_utf8_find_prev_char ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * g_utf8_find_prev_char (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *str</code></em>, <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *p</code></em>);</pre> <p>Given a position <em class="parameter"><code>p</code></em> with a UTF-8 encoded string <em class="parameter"><code>str</code></em> , find the start of the previous UTF-8 character starting before <em class="parameter"><code>p</code></em> . Returns <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> if no UTF-8 characters are present in <em class="parameter"><code>str</code></em> before <em class="parameter"><code>p</code></em> .</p> <p><em class="parameter"><code>p</code></em> does not have to be at the beginning of a UTF-8 character. No check is made to see if the character found is actually valid other than it starts with an appropriate byte.</p> <div class="refsect3"> <a name="id-1.5.4.7.44.6"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>str</p></td> <td class="parameter_description"><p>pointer to the beginning of a UTF-8 encoded string</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>p</p></td> <td class="parameter_description"><p>pointer to some position within <em class="parameter"><code>str</code></em> </p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.44.7"></a><h4>Returns</h4> <p> a pointer to the found character or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>.</p> </div> </div> <hr> <div class="refsect2"> <a name="g-utf8-strlen"></a><h3>g_utf8_strlen ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#glong" title="glong"><span class="returnvalue">glong</span></a> g_utf8_strlen (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *p</code></em>, <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gssize" title="gssize"><span class="type">gssize</span></a> max</code></em>);</pre> <p>Computes the length of the string in characters, not including the terminating nul character. If the <em class="parameter"><code>max</code></em> 'th byte falls in the middle of a character, the last (partial) character is not counted.</p> <div class="refsect3"> <a name="id-1.5.4.7.45.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>p</p></td> <td class="parameter_description"><p>pointer to the start of a UTF-8 encoded string</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>max</p></td> <td class="parameter_description"><p>the maximum number of bytes to examine. If <em class="parameter"><code>max</code></em> is less than 0, then the string is assumed to be nul-terminated. If <em class="parameter"><code>max</code></em> is 0, <em class="parameter"><code>p</code></em> will not be examined and may be <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. If <em class="parameter"><code>max</code></em> is greater than 0, up to <em class="parameter"><code>max</code></em> bytes are examined</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.45.6"></a><h4>Returns</h4> <p> the length of the string in characters</p> </div> </div> <hr> <div class="refsect2"> <a name="g-utf8-strncpy"></a><h3>g_utf8_strncpy ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * g_utf8_strncpy (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *dest</code></em>, <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *src</code></em>, <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gsize" title="gsize"><span class="type">gsize</span></a> n</code></em>);</pre> <p>Like the standard C <code class="function">strncpy()</code> function, but copies a given number of characters instead of a given number of bytes. The <em class="parameter"><code>src</code></em> string must be valid UTF-8 encoded text. (Use <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-validate" title="g_utf8_validate ()"><code class="function">g_utf8_validate()</code></a> on all text before trying to use UTF-8 utility functions with it.)</p> <div class="refsect3"> <a name="id-1.5.4.7.46.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>dest</p></td> <td class="parameter_description"><p>buffer to fill with characters from <em class="parameter"><code>src</code></em> </p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>src</p></td> <td class="parameter_description"><p>UTF-8 encoded string</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>n</p></td> <td class="parameter_description"><p>character count</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.46.6"></a><h4>Returns</h4> <p> <em class="parameter"><code>dest</code></em> </p> </div> </div> <hr> <div class="refsect2"> <a name="g-utf8-strchr"></a><h3>g_utf8_strchr ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * g_utf8_strchr (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *p</code></em>, <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gssize" title="gssize"><span class="type">gssize</span></a> len</code></em>, <em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> c</code></em>);</pre> <p>Finds the leftmost occurrence of the given Unicode character in a UTF-8 encoded string, while limiting the search to <em class="parameter"><code>len</code></em> bytes. If <em class="parameter"><code>len</code></em> is -1, allow unbounded search.</p> <div class="refsect3"> <a name="id-1.5.4.7.47.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>p</p></td> <td class="parameter_description"><p>a nul-terminated UTF-8 encoded string</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>len</p></td> <td class="parameter_description"><p>the maximum length of <em class="parameter"><code>p</code></em> </p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>c</p></td> <td class="parameter_description"><p>a Unicode character</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.47.6"></a><h4>Returns</h4> <p> <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> if the string does not contain the character, otherwise, a pointer to the start of the leftmost occurrence of the character in the string.</p> </div> </div> <hr> <div class="refsect2"> <a name="g-utf8-strrchr"></a><h3>g_utf8_strrchr ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * g_utf8_strrchr (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *p</code></em>, <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gssize" title="gssize"><span class="type">gssize</span></a> len</code></em>, <em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> c</code></em>);</pre> <p>Find the rightmost occurrence of the given Unicode character in a UTF-8 encoded string, while limiting the search to <em class="parameter"><code>len</code></em> bytes. If <em class="parameter"><code>len</code></em> is -1, allow unbounded search.</p> <div class="refsect3"> <a name="id-1.5.4.7.48.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>p</p></td> <td class="parameter_description"><p>a nul-terminated UTF-8 encoded string</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>len</p></td> <td class="parameter_description"><p>the maximum length of <em class="parameter"><code>p</code></em> </p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>c</p></td> <td class="parameter_description"><p>a Unicode character</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.48.6"></a><h4>Returns</h4> <p> <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> if the string does not contain the character, otherwise, a pointer to the start of the rightmost occurrence of the character in the string.</p> </div> </div> <hr> <div class="refsect2"> <a name="g-utf8-strreverse"></a><h3>g_utf8_strreverse ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * g_utf8_strreverse (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *str</code></em>, <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gssize" title="gssize"><span class="type">gssize</span></a> len</code></em>);</pre> <p>Reverses a UTF-8 string. <em class="parameter"><code>str</code></em> must be valid UTF-8 encoded text. (Use <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-validate" title="g_utf8_validate ()"><code class="function">g_utf8_validate()</code></a> on all text before trying to use UTF-8 utility functions with it.)</p> <p>This function is intended for programmatic uses of reversed strings. It pays no attention to decomposed characters, combining marks, byte order marks, directional indicators (LRM, LRO, etc) and similar characters which might need special handling when reversing a string for display purposes.</p> <p>Note that unlike <a class="link" href="glib-String-Utility-Functions.html#g-strreverse" title="g_strreverse ()"><code class="function">g_strreverse()</code></a>, this function returns newly-allocated memory, which should be freed with <a class="link" href="glib-Memory-Allocation.html#g-free" title="g_free ()"><code class="function">g_free()</code></a> when no longer needed.</p> <div class="refsect3"> <a name="id-1.5.4.7.49.7"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>str</p></td> <td class="parameter_description"><p>a UTF-8 encoded string</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>len</p></td> <td class="parameter_description"><p>the maximum length of <em class="parameter"><code>str</code></em> to use, in bytes. If <em class="parameter"><code>len</code></em> &lt; 0, then the string is nul-terminated.</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.49.8"></a><h4>Returns</h4> <p> a newly-allocated string which is the reverse of <em class="parameter"><code>str</code></em> </p> </div> <p class="since">Since: <a class="link" href="api-index-2-2.html#api-index-2.2">2.2</a></p> </div> <hr> <div class="refsect2"> <a name="g-utf8-substring"></a><h3>g_utf8_substring ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * g_utf8_substring (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *str</code></em>, <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#glong" title="glong"><span class="type">glong</span></a> start_pos</code></em>, <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#glong" title="glong"><span class="type">glong</span></a> end_pos</code></em>);</pre> <p>Copies a substring out of a UTF-8 encoded string. The substring will contain <em class="parameter"><code>end_pos</code></em> - <em class="parameter"><code>start_pos</code></em> characters.</p> <div class="refsect3"> <a name="id-1.5.4.7.50.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>str</p></td> <td class="parameter_description"><p>a UTF-8 encoded string</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>start_pos</p></td> <td class="parameter_description"><p>a character offset within <em class="parameter"><code>str</code></em> </p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>end_pos</p></td> <td class="parameter_description"><p>another character offset within <em class="parameter"><code>str</code></em> </p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.50.6"></a><h4>Returns</h4> <p> a newly allocated copy of the requested substring. Free with <a class="link" href="glib-Memory-Allocation.html#g-free" title="g_free ()"><code class="function">g_free()</code></a> when no longer needed.</p> </div> <p class="since">Since: <a class="link" href="api-index-2-30.html#api-index-2.30">2.30</a></p> </div> <hr> <div class="refsect2"> <a name="g-utf8-validate"></a><h3>g_utf8_validate ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a> g_utf8_validate (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *str</code></em>, <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gssize" title="gssize"><span class="type">gssize</span></a> max_len</code></em>, <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> **end</code></em>);</pre> <p>Validates UTF-8 encoded text. <em class="parameter"><code>str</code></em> is the text to validate; if <em class="parameter"><code>str</code></em> is nul-terminated, then <em class="parameter"><code>max_len</code></em> can be -1, otherwise <em class="parameter"><code>max_len</code></em> should be the number of bytes to validate. If <em class="parameter"><code>end</code></em> is non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>, then the end of the valid range will be stored there (i.e. the start of the first invalid character if some bytes were invalid, or the end of the text being validated otherwise).</p> <p>Note that <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-validate" title="g_utf8_validate ()"><code class="function">g_utf8_validate()</code></a> returns <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> if <em class="parameter"><code>max_len</code></em> is positive and any of the <em class="parameter"><code>max_len</code></em> bytes are nul.</p> <p>Returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if all of <em class="parameter"><code>str</code></em> was valid. Many GLib and GTK+ routines require valid UTF-8 as input; so data read from a file or the network should be checked with <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-validate" title="g_utf8_validate ()"><code class="function">g_utf8_validate()</code></a> before doing anything else with it.</p> <div class="refsect3"> <a name="id-1.5.4.7.51.7"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>str</p></td> <td class="parameter_description"><p> a pointer to character data. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> length=max_len][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> guint8]</span></td> </tr> <tr> <td class="parameter_name"><p>max_len</p></td> <td class="parameter_description"><p>max bytes to validate, or -1 to go until NUL</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>end</p></td> <td class="parameter_description"><p> return location for end of valid data. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>][<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>][<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.51.8"></a><h4>Returns</h4> <p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the text was valid UTF-8</p> </div> </div> <hr> <div class="refsect2"> <a name="g-utf8-strup"></a><h3>g_utf8_strup ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * g_utf8_strup (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *str</code></em>, <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gssize" title="gssize"><span class="type">gssize</span></a> len</code></em>);</pre> <p>Converts all Unicode characters in the string that have a case to uppercase. The exact manner that this is done depends on the current locale, and may result in the number of characters in the string increasing. (For instance, the German ess-zet will be changed to SS.)</p> <div class="refsect3"> <a name="id-1.5.4.7.52.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>str</p></td> <td class="parameter_description"><p>a UTF-8 encoded string</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>len</p></td> <td class="parameter_description"><p>length of <em class="parameter"><code>str</code></em> , in bytes, or -1 if <em class="parameter"><code>str</code></em> is nul-terminated.</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.52.6"></a><h4>Returns</h4> <p> a newly allocated string, with all characters converted to uppercase. </p> </div> </div> <hr> <div class="refsect2"> <a name="g-utf8-strdown"></a><h3>g_utf8_strdown ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * g_utf8_strdown (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *str</code></em>, <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gssize" title="gssize"><span class="type">gssize</span></a> len</code></em>);</pre> <p>Converts all Unicode characters in the string that have a case to lowercase. The exact manner that this is done depends on the current locale, and may result in the number of characters in the string changing.</p> <div class="refsect3"> <a name="id-1.5.4.7.53.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>str</p></td> <td class="parameter_description"><p>a UTF-8 encoded string</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>len</p></td> <td class="parameter_description"><p>length of <em class="parameter"><code>str</code></em> , in bytes, or -1 if <em class="parameter"><code>str</code></em> is nul-terminated.</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.53.6"></a><h4>Returns</h4> <p> a newly allocated string, with all characters converted to lowercase. </p> </div> </div> <hr> <div class="refsect2"> <a name="g-utf8-casefold"></a><h3>g_utf8_casefold ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * g_utf8_casefold (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *str</code></em>, <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gssize" title="gssize"><span class="type">gssize</span></a> len</code></em>);</pre> <p>Converts a string into a form that is independent of case. The result will not correspond to any particular case, but can be compared for equality or ordered with the results of calling <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-casefold" title="g_utf8_casefold ()"><code class="function">g_utf8_casefold()</code></a> on other strings.</p> <p>Note that calling <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-casefold" title="g_utf8_casefold ()"><code class="function">g_utf8_casefold()</code></a> followed by <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-collate" title="g_utf8_collate ()"><code class="function">g_utf8_collate()</code></a> is only an approximation to the correct linguistic case insensitive ordering, though it is a fairly good one. Getting this exactly right would require a more sophisticated collation function that takes case sensitivity into account. GLib does not currently provide such a function.</p> <div class="refsect3"> <a name="id-1.5.4.7.54.6"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>str</p></td> <td class="parameter_description"><p>a UTF-8 encoded string</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>len</p></td> <td class="parameter_description"><p>length of <em class="parameter"><code>str</code></em> , in bytes, or -1 if <em class="parameter"><code>str</code></em> is nul-terminated.</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.54.7"></a><h4>Returns</h4> <p> a newly allocated string, that is a case independent form of <em class="parameter"><code>str</code></em> .</p> </div> </div> <hr> <div class="refsect2"> <a name="g-utf8-normalize"></a><h3>g_utf8_normalize ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * g_utf8_normalize (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *str</code></em>, <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gssize" title="gssize"><span class="type">gssize</span></a> len</code></em>, <em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#GNormalizeMode" title="enum GNormalizeMode"><span class="type">GNormalizeMode</span></a> mode</code></em>);</pre> <p>Converts a string into canonical form, standardizing such issues as whether a character with an accent is represented as a base character and combining accent or as a single precomposed character. The string has to be valid UTF-8, otherwise <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> is returned. You should generally call <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-normalize" title="g_utf8_normalize ()"><code class="function">g_utf8_normalize()</code></a> before comparing two Unicode strings.</p> <p>The normalization mode <a class="link" href="glib-Unicode-Manipulation.html#G-NORMALIZE-DEFAULT:CAPS"><code class="literal">G_NORMALIZE_DEFAULT</code></a> only standardizes differences that do not affect the text content, such as the above-mentioned accent representation. <a class="link" href="glib-Unicode-Manipulation.html#G-NORMALIZE-ALL:CAPS"><code class="literal">G_NORMALIZE_ALL</code></a> also standardizes the "compatibility" characters in Unicode, such as SUPERSCRIPT THREE to the standard forms (in this case DIGIT THREE). Formatting information may be lost but for most text operations such characters should be considered the same.</p> <p><a class="link" href="glib-Unicode-Manipulation.html#G-NORMALIZE-DEFAULT-COMPOSE:CAPS"><code class="literal">G_NORMALIZE_DEFAULT_COMPOSE</code></a> and <a class="link" href="glib-Unicode-Manipulation.html#G-NORMALIZE-ALL-COMPOSE:CAPS"><code class="literal">G_NORMALIZE_ALL_COMPOSE</code></a> are like <a class="link" href="glib-Unicode-Manipulation.html#G-NORMALIZE-DEFAULT:CAPS"><code class="literal">G_NORMALIZE_DEFAULT</code></a> and <a class="link" href="glib-Unicode-Manipulation.html#G-NORMALIZE-ALL:CAPS"><code class="literal">G_NORMALIZE_ALL</code></a>, but returned a result with composed forms rather than a maximally decomposed form. This is often useful if you intend to convert the string to a legacy encoding or pass it to a system with less capable Unicode handling.</p> <div class="refsect3"> <a name="id-1.5.4.7.55.7"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>str</p></td> <td class="parameter_description"><p>a UTF-8 encoded string.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>len</p></td> <td class="parameter_description"><p>length of <em class="parameter"><code>str</code></em> , in bytes, or -1 if <em class="parameter"><code>str</code></em> is nul-terminated.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>mode</p></td> <td class="parameter_description"><p>the type of normalization to perform.</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.55.8"></a><h4>Returns</h4> <p> a newly allocated string, that is the normalized form of <em class="parameter"><code>str</code></em> , or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> if <em class="parameter"><code>str</code></em> is not valid UTF-8.</p> </div> </div> <hr> <div class="refsect2"> <a name="g-utf8-collate"></a><h3>g_utf8_collate ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> g_utf8_collate (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *str1</code></em>, <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *str2</code></em>);</pre> <p>Compares two strings for ordering using the linguistically correct rules for the <a class="link" href="glib-running.html#setlocale" title="Locale">current locale</a>. When sorting a large number of strings, it will be significantly faster to obtain collation keys with <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-collate-key" title="g_utf8_collate_key ()"><code class="function">g_utf8_collate_key()</code></a> and compare the keys with <code class="function">strcmp()</code> when sorting instead of sorting the original strings.</p> <div class="refsect3"> <a name="id-1.5.4.7.56.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>str1</p></td> <td class="parameter_description"><p>a UTF-8 encoded string</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>str2</p></td> <td class="parameter_description"><p>a UTF-8 encoded string</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.56.6"></a><h4>Returns</h4> <p> &lt; 0 if <em class="parameter"><code>str1</code></em> compares before <em class="parameter"><code>str2</code></em> , 0 if they compare equal, &gt; 0 if <em class="parameter"><code>str1</code></em> compares after <em class="parameter"><code>str2</code></em> .</p> </div> </div> <hr> <div class="refsect2"> <a name="g-utf8-collate-key"></a><h3>g_utf8_collate_key ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * g_utf8_collate_key (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *str</code></em>, <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gssize" title="gssize"><span class="type">gssize</span></a> len</code></em>);</pre> <p>Converts a string into a collation key that can be compared with other collation keys produced by the same function using <code class="function">strcmp()</code>. </p> <p>The results of comparing the collation keys of two strings with <code class="function">strcmp()</code> will always be the same as comparing the two original keys with <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-collate" title="g_utf8_collate ()"><code class="function">g_utf8_collate()</code></a>.</p> <p>Note that this function depends on the <a class="link" href="glib-running.html#setlocale" title="Locale">current locale</a>.</p> <div class="refsect3"> <a name="id-1.5.4.7.57.7"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>str</p></td> <td class="parameter_description"><p>a UTF-8 encoded string.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>len</p></td> <td class="parameter_description"><p>length of <em class="parameter"><code>str</code></em> , in bytes, or -1 if <em class="parameter"><code>str</code></em> is nul-terminated.</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.57.8"></a><h4>Returns</h4> <p> a newly allocated string. This string should be freed with <a class="link" href="glib-Memory-Allocation.html#g-free" title="g_free ()"><code class="function">g_free()</code></a> when you are done with it.</p> </div> </div> <hr> <div class="refsect2"> <a name="g-utf8-collate-key-for-filename"></a><h3>g_utf8_collate_key_for_filename ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * g_utf8_collate_key_for_filename (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *str</code></em>, <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gssize" title="gssize"><span class="type">gssize</span></a> len</code></em>);</pre> <p>Converts a string into a collation key that can be compared with other collation keys produced by the same function using <code class="function">strcmp()</code>. </p> <p>In order to sort filenames correctly, this function treats the dot '.' as a special case. Most dictionary orderings seem to consider it insignificant, thus producing the ordering "event.c" "eventgenerator.c" "event.h" instead of "event.c" "event.h" "eventgenerator.c". Also, we would like to treat numbers intelligently so that "file1" "file10" "file5" is sorted as "file1" "file5" "file10".</p> <p>Note that this function depends on the <a class="link" href="glib-running.html#setlocale" title="Locale">current locale</a>.</p> <div class="refsect3"> <a name="id-1.5.4.7.58.7"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>str</p></td> <td class="parameter_description"><p>a UTF-8 encoded string.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>len</p></td> <td class="parameter_description"><p>length of <em class="parameter"><code>str</code></em> , in bytes, or -1 if <em class="parameter"><code>str</code></em> is nul-terminated.</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.58.8"></a><h4>Returns</h4> <p> a newly allocated string. This string should be freed with <a class="link" href="glib-Memory-Allocation.html#g-free" title="g_free ()"><code class="function">g_free()</code></a> when you are done with it.</p> </div> <p class="since">Since: <a class="link" href="api-index-2-8.html#api-index-2.8">2.8</a></p> </div> <hr> <div class="refsect2"> <a name="g-utf8-to-utf16"></a><h3>g_utf8_to_utf16 ()</h3> <pre class="programlisting"><a class="link" href="glib-Unicode-Manipulation.html#gunichar2" title="gunichar2"><span class="returnvalue">gunichar2</span></a> * g_utf8_to_utf16 (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *str</code></em>, <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#glong" title="glong"><span class="type">glong</span></a> len</code></em>, <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#glong" title="glong"><span class="type">glong</span></a> *items_read</code></em>, <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#glong" title="glong"><span class="type">glong</span></a> *items_written</code></em>, <em class="parameter"><code><a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a> **error</code></em>);</pre> <p>Convert a string from UTF-8 to UTF-16. A 0 character will be added to the result after the converted text.</p> <div class="refsect3"> <a name="id-1.5.4.7.59.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>str</p></td> <td class="parameter_description"><p>a UTF-8 encoded string</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>len</p></td> <td class="parameter_description"><p>the maximum length (number of bytes) of <em class="parameter"><code>str</code></em> to use. If <em class="parameter"><code>len</code></em> &lt; 0, then the string is nul-terminated.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>items_read</p></td> <td class="parameter_description"><p> location to store number of bytes read, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. If <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>, then <a class="link" href="glib-Character-Set-Conversion.html#G-CONVERT-ERROR-PARTIAL-INPUT:CAPS"><code class="literal">G_CONVERT_ERROR_PARTIAL_INPUT</code></a> will be returned in case <em class="parameter"><code>str</code></em> contains a trailing partial character. If an error occurs then the index of the invalid input is stored here. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>items_written</p></td> <td class="parameter_description"><p> location to store number of <a class="link" href="glib-Unicode-Manipulation.html#gunichar2" title="gunichar2"><span class="type">gunichar2</span></a> written, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. The value stored here does not include the trailing 0. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>error</p></td> <td class="parameter_description"><p>location to store the error occurring, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> to ignore errors. Any of the errors in <a class="link" href="glib-Character-Set-Conversion.html#GConvertError" title="enum GConvertError"><span class="type">GConvertError</span></a> other than <a class="link" href="glib-Character-Set-Conversion.html#G-CONVERT-ERROR-NO-CONVERSION:CAPS"><code class="literal">G_CONVERT_ERROR_NO_CONVERSION</code></a> may occur.</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.59.6"></a><h4>Returns</h4> <p> a pointer to a newly allocated UTF-16 string. This value must be freed with <a class="link" href="glib-Memory-Allocation.html#g-free" title="g_free ()"><code class="function">g_free()</code></a>. If an error occurs, <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> will be returned and <em class="parameter"><code>error</code></em> set.</p> </div> </div> <hr> <div class="refsect2"> <a name="g-utf8-to-ucs4"></a><h3>g_utf8_to_ucs4 ()</h3> <pre class="programlisting"><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="returnvalue">gunichar</span></a> * g_utf8_to_ucs4 (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *str</code></em>, <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#glong" title="glong"><span class="type">glong</span></a> len</code></em>, <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#glong" title="glong"><span class="type">glong</span></a> *items_read</code></em>, <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#glong" title="glong"><span class="type">glong</span></a> *items_written</code></em>, <em class="parameter"><code><a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a> **error</code></em>);</pre> <p>Convert a string from UTF-8 to a 32-bit fixed width representation as UCS-4. A trailing 0 character will be added to the string after the converted text.</p> <div class="refsect3"> <a name="id-1.5.4.7.60.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>str</p></td> <td class="parameter_description"><p>a UTF-8 encoded string</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>len</p></td> <td class="parameter_description"><p>the maximum length of <em class="parameter"><code>str</code></em> to use, in bytes. If <em class="parameter"><code>len</code></em> &lt; 0, then the string is nul-terminated.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>items_read</p></td> <td class="parameter_description"><p> location to store number of bytes read, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. If <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>, then <a class="link" href="glib-Character-Set-Conversion.html#G-CONVERT-ERROR-PARTIAL-INPUT:CAPS"><code class="literal">G_CONVERT_ERROR_PARTIAL_INPUT</code></a> will be returned in case <em class="parameter"><code>str</code></em> contains a trailing partial character. If an error occurs then the index of the invalid input is stored here. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>items_written</p></td> <td class="parameter_description"><p> location to store number of characters written or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. The value here stored does not include the trailing 0 character. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>error</p></td> <td class="parameter_description"><p>location to store the error occurring, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> to ignore errors. Any of the errors in <a class="link" href="glib-Character-Set-Conversion.html#GConvertError" title="enum GConvertError"><span class="type">GConvertError</span></a> other than <a class="link" href="glib-Character-Set-Conversion.html#G-CONVERT-ERROR-NO-CONVERSION:CAPS"><code class="literal">G_CONVERT_ERROR_NO_CONVERSION</code></a> may occur.</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.60.6"></a><h4>Returns</h4> <p> a pointer to a newly allocated UCS-4 string. This value must be freed with <a class="link" href="glib-Memory-Allocation.html#g-free" title="g_free ()"><code class="function">g_free()</code></a>. If an error occurs, <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> will be returned and <em class="parameter"><code>error</code></em> set.</p> </div> </div> <hr> <div class="refsect2"> <a name="g-utf8-to-ucs4-fast"></a><h3>g_utf8_to_ucs4_fast ()</h3> <pre class="programlisting"><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="returnvalue">gunichar</span></a> * g_utf8_to_ucs4_fast (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *str</code></em>, <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#glong" title="glong"><span class="type">glong</span></a> len</code></em>, <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#glong" title="glong"><span class="type">glong</span></a> *items_written</code></em>);</pre> <p>Convert a string from UTF-8 to a 32-bit fixed width representation as UCS-4, assuming valid UTF-8 input. This function is roughly twice as fast as <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-to-ucs4" title="g_utf8_to_ucs4 ()"><code class="function">g_utf8_to_ucs4()</code></a> but does no error checking on the input. A trailing 0 character will be added to the string after the converted text.</p> <div class="refsect3"> <a name="id-1.5.4.7.61.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>str</p></td> <td class="parameter_description"><p>a UTF-8 encoded string</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>len</p></td> <td class="parameter_description"><p>the maximum length of <em class="parameter"><code>str</code></em> to use, in bytes. If <em class="parameter"><code>len</code></em> &lt; 0, then the string is nul-terminated.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>items_written</p></td> <td class="parameter_description"><p> location to store the number of characters in the result, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.61.6"></a><h4>Returns</h4> <p> a pointer to a newly allocated UCS-4 string. This value must be freed with <a class="link" href="glib-Memory-Allocation.html#g-free" title="g_free ()"><code class="function">g_free()</code></a>.</p> </div> </div> <hr> <div class="refsect2"> <a name="g-utf16-to-ucs4"></a><h3>g_utf16_to_ucs4 ()</h3> <pre class="programlisting"><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="returnvalue">gunichar</span></a> * g_utf16_to_ucs4 (<em class="parameter"><code>const <a class="link" href="glib-Unicode-Manipulation.html#gunichar2" title="gunichar2"><span class="type">gunichar2</span></a> *str</code></em>, <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#glong" title="glong"><span class="type">glong</span></a> len</code></em>, <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#glong" title="glong"><span class="type">glong</span></a> *items_read</code></em>, <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#glong" title="glong"><span class="type">glong</span></a> *items_written</code></em>, <em class="parameter"><code><a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a> **error</code></em>);</pre> <p>Convert a string from UTF-16 to UCS-4. The result will be nul-terminated.</p> <div class="refsect3"> <a name="id-1.5.4.7.62.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>str</p></td> <td class="parameter_description"><p>a UTF-16 encoded string</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>len</p></td> <td class="parameter_description"><p>the maximum length (number of <a class="link" href="glib-Unicode-Manipulation.html#gunichar2" title="gunichar2"><span class="type">gunichar2</span></a>) of <em class="parameter"><code>str</code></em> to use. If <em class="parameter"><code>len</code></em> &lt; 0, then the string is nul-terminated.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>items_read</p></td> <td class="parameter_description"><p> location to store number of words read, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. If <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>, then <a class="link" href="glib-Character-Set-Conversion.html#G-CONVERT-ERROR-PARTIAL-INPUT:CAPS"><code class="literal">G_CONVERT_ERROR_PARTIAL_INPUT</code></a> will be returned in case <em class="parameter"><code>str</code></em> contains a trailing partial character. If an error occurs then the index of the invalid input is stored here. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>items_written</p></td> <td class="parameter_description"><p> location to store number of characters written, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. The value stored here does not include the trailing 0 character. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>error</p></td> <td class="parameter_description"><p>location to store the error occurring, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> to ignore errors. Any of the errors in <a class="link" href="glib-Character-Set-Conversion.html#GConvertError" title="enum GConvertError"><span class="type">GConvertError</span></a> other than <a class="link" href="glib-Character-Set-Conversion.html#G-CONVERT-ERROR-NO-CONVERSION:CAPS"><code class="literal">G_CONVERT_ERROR_NO_CONVERSION</code></a> may occur.</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.62.6"></a><h4>Returns</h4> <p> a pointer to a newly allocated UCS-4 string. This value must be freed with <a class="link" href="glib-Memory-Allocation.html#g-free" title="g_free ()"><code class="function">g_free()</code></a>. If an error occurs, <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> will be returned and <em class="parameter"><code>error</code></em> set.</p> </div> </div> <hr> <div class="refsect2"> <a name="g-utf16-to-utf8"></a><h3>g_utf16_to_utf8 ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * g_utf16_to_utf8 (<em class="parameter"><code>const <a class="link" href="glib-Unicode-Manipulation.html#gunichar2" title="gunichar2"><span class="type">gunichar2</span></a> *str</code></em>, <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#glong" title="glong"><span class="type">glong</span></a> len</code></em>, <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#glong" title="glong"><span class="type">glong</span></a> *items_read</code></em>, <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#glong" title="glong"><span class="type">glong</span></a> *items_written</code></em>, <em class="parameter"><code><a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a> **error</code></em>);</pre> <p>Convert a string from UTF-16 to UTF-8. The result will be terminated with a 0 byte.</p> <p>Note that the input is expected to be already in native endianness, an initial byte-order-mark character is not handled specially. <a class="link" href="glib-Character-Set-Conversion.html#g-convert" title="g_convert ()"><code class="function">g_convert()</code></a> can be used to convert a byte buffer of UTF-16 data of ambiguous endianess.</p> <p>Further note that this function does not validate the result string; it may e.g. include embedded NUL characters. The only validation done by this function is to ensure that the input can be correctly interpreted as UTF-16, i.e. it doesn't contain things unpaired surrogates.</p> <div class="refsect3"> <a name="id-1.5.4.7.63.7"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>str</p></td> <td class="parameter_description"><p>a UTF-16 encoded string</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>len</p></td> <td class="parameter_description"><p>the maximum length (number of <a class="link" href="glib-Unicode-Manipulation.html#gunichar2" title="gunichar2"><span class="type">gunichar2</span></a>) of <em class="parameter"><code>str</code></em> to use. If <em class="parameter"><code>len</code></em> &lt; 0, then the string is nul-terminated.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>items_read</p></td> <td class="parameter_description"><p> location to store number of words read, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. If <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>, then <a class="link" href="glib-Character-Set-Conversion.html#G-CONVERT-ERROR-PARTIAL-INPUT:CAPS"><code class="literal">G_CONVERT_ERROR_PARTIAL_INPUT</code></a> will be returned in case <em class="parameter"><code>str</code></em> contains a trailing partial character. If an error occurs then the index of the invalid input is stored here. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>items_written</p></td> <td class="parameter_description"><p> location to store number of bytes written, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. The value stored here does not include the trailing 0 byte. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>error</p></td> <td class="parameter_description"><p>location to store the error occurring, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> to ignore errors. Any of the errors in <a class="link" href="glib-Character-Set-Conversion.html#GConvertError" title="enum GConvertError"><span class="type">GConvertError</span></a> other than <a class="link" href="glib-Character-Set-Conversion.html#G-CONVERT-ERROR-NO-CONVERSION:CAPS"><code class="literal">G_CONVERT_ERROR_NO_CONVERSION</code></a> may occur.</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.63.8"></a><h4>Returns</h4> <p> a pointer to a newly allocated UTF-8 string. This value must be freed with <a class="link" href="glib-Memory-Allocation.html#g-free" title="g_free ()"><code class="function">g_free()</code></a>. If an error occurs, <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> will be returned and <em class="parameter"><code>error</code></em> set.</p> </div> </div> <hr> <div class="refsect2"> <a name="g-ucs4-to-utf16"></a><h3>g_ucs4_to_utf16 ()</h3> <pre class="programlisting"><a class="link" href="glib-Unicode-Manipulation.html#gunichar2" title="gunichar2"><span class="returnvalue">gunichar2</span></a> * g_ucs4_to_utf16 (<em class="parameter"><code>const <a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> *str</code></em>, <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#glong" title="glong"><span class="type">glong</span></a> len</code></em>, <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#glong" title="glong"><span class="type">glong</span></a> *items_read</code></em>, <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#glong" title="glong"><span class="type">glong</span></a> *items_written</code></em>, <em class="parameter"><code><a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a> **error</code></em>);</pre> <p>Convert a string from UCS-4 to UTF-16. A 0 character will be added to the result after the converted text.</p> <div class="refsect3"> <a name="id-1.5.4.7.64.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>str</p></td> <td class="parameter_description"><p>a UCS-4 encoded string</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>len</p></td> <td class="parameter_description"><p>the maximum length (number of characters) of <em class="parameter"><code>str</code></em> to use. If <em class="parameter"><code>len</code></em> &lt; 0, then the string is nul-terminated.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>items_read</p></td> <td class="parameter_description"><p> location to store number of bytes read, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. If an error occurs then the index of the invalid input is stored here. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>items_written</p></td> <td class="parameter_description"><p> location to store number of <a class="link" href="glib-Unicode-Manipulation.html#gunichar2" title="gunichar2"><span class="type">gunichar2</span></a> written, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. The value stored here does not include the trailing 0. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>error</p></td> <td class="parameter_description"><p>location to store the error occurring, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> to ignore errors. Any of the errors in <a class="link" href="glib-Character-Set-Conversion.html#GConvertError" title="enum GConvertError"><span class="type">GConvertError</span></a> other than <a class="link" href="glib-Character-Set-Conversion.html#G-CONVERT-ERROR-NO-CONVERSION:CAPS"><code class="literal">G_CONVERT_ERROR_NO_CONVERSION</code></a> may occur.</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.64.6"></a><h4>Returns</h4> <p> a pointer to a newly allocated UTF-16 string. This value must be freed with <a class="link" href="glib-Memory-Allocation.html#g-free" title="g_free ()"><code class="function">g_free()</code></a>. If an error occurs, <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> will be returned and <em class="parameter"><code>error</code></em> set.</p> </div> </div> <hr> <div class="refsect2"> <a name="g-ucs4-to-utf8"></a><h3>g_ucs4_to_utf8 ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="returnvalue">gchar</span></a> * g_ucs4_to_utf8 (<em class="parameter"><code>const <a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> *str</code></em>, <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#glong" title="glong"><span class="type">glong</span></a> len</code></em>, <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#glong" title="glong"><span class="type">glong</span></a> *items_read</code></em>, <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#glong" title="glong"><span class="type">glong</span></a> *items_written</code></em>, <em class="parameter"><code><a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a> **error</code></em>);</pre> <p>Convert a string from a 32-bit fixed width representation as UCS-4. to UTF-8. The result will be terminated with a 0 byte.</p> <div class="refsect3"> <a name="id-1.5.4.7.65.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>str</p></td> <td class="parameter_description"><p>a UCS-4 encoded string</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>len</p></td> <td class="parameter_description"><p>the maximum length (number of characters) of <em class="parameter"><code>str</code></em> to use. If <em class="parameter"><code>len</code></em> &lt; 0, then the string is nul-terminated.</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>items_read</p></td> <td class="parameter_description"><p> location to store number of characters read, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>items_written</p></td> <td class="parameter_description"><p> location to store number of bytes written or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>. The value here stored does not include the trailing 0 byte. </p></td> <td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td> </tr> <tr> <td class="parameter_name"><p>error</p></td> <td class="parameter_description"><p>location to store the error occurring, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> to ignore errors. Any of the errors in <a class="link" href="glib-Character-Set-Conversion.html#GConvertError" title="enum GConvertError"><span class="type">GConvertError</span></a> other than <a class="link" href="glib-Character-Set-Conversion.html#G-CONVERT-ERROR-NO-CONVERSION:CAPS"><code class="literal">G_CONVERT_ERROR_NO_CONVERSION</code></a> may occur.</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.65.6"></a><h4>Returns</h4> <p> a pointer to a newly allocated UTF-8 string. This value must be freed with <a class="link" href="glib-Memory-Allocation.html#g-free" title="g_free ()"><code class="function">g_free()</code></a>. If an error occurs, <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> will be returned and <em class="parameter"><code>error</code></em> set. In that case, <em class="parameter"><code>items_read</code></em> will be set to the position of the first invalid input character.</p> </div> </div> <hr> <div class="refsect2"> <a name="g-unichar-to-utf8"></a><h3>g_unichar_to_utf8 ()</h3> <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint" title="gint"><span class="returnvalue">gint</span></a> g_unichar_to_utf8 (<em class="parameter"><code><a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a> c</code></em>, <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *outbuf</code></em>);</pre> <p>Converts a single character to UTF-8.</p> <div class="refsect3"> <a name="id-1.5.4.7.66.5"></a><h4>Parameters</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="150px" class="parameters_name"> <col class="parameters_description"> <col width="200px" class="parameters_annotations"> </colgroup> <tbody> <tr> <td class="parameter_name"><p>c</p></td> <td class="parameter_description"><p>a Unicode character code</p></td> <td class="parameter_annotations"> </td> </tr> <tr> <td class="parameter_name"><p>outbuf</p></td> <td class="parameter_description"><p>output buffer, must have at least 6 bytes of space. If <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>, the length will be computed and returned and nothing will be written to <em class="parameter"><code>outbuf</code></em> .</p></td> <td class="parameter_annotations"> </td> </tr> </tbody> </table></div> </div> <div class="refsect3"> <a name="id-1.5.4.7.66.6"></a><h4>Returns</h4> <p> number of bytes written</p> </div> </div> </div> <div class="refsect1"> <a name="glib-Unicode-Manipulation.other_details"></a><h2>Types and Values</h2> <div class="refsect2"> <a name="gunichar"></a><h3>gunichar</h3> <pre class="programlisting">typedef guint32 gunichar; </pre> <p>A type which can hold any UTF-32 or UCS-4 character code, also known as a Unicode code point.</p> <p>If you want to produce the UTF-8 representation of a <a class="link" href="glib-Unicode-Manipulation.html#gunichar" title="gunichar"><span class="type">gunichar</span></a>, use <a class="link" href="glib-Unicode-Manipulation.html#g-ucs4-to-utf8" title="g_ucs4_to_utf8 ()"><code class="function">g_ucs4_to_utf8()</code></a>. See also <a class="link" href="glib-Unicode-Manipulation.html#g-utf8-to-ucs4" title="g_utf8_to_ucs4 ()"><code class="function">g_utf8_to_ucs4()</code></a> for the reverse process.</p> <p>To print/scan values of this type as integer, use <a class="link" href="glib-Basic-Types.html#G-GINT32-MODIFIER:CAPS" title="G_GINT32_MODIFIER"><code class="literal">G_GINT32_MODIFIER</code></a> and/or <a class="link" href="glib-Basic-Types.html#G-GUINT32-FORMAT:CAPS" title="G_GUINT32_FORMAT"><code class="literal">G_GUINT32_FORMAT</code></a>.</p> <p>The notation to express a Unicode code point in running text is as a hexadecimal number with four to six digits and uppercase letters, prefixed by the string "U+". Leading zeros are omitted, unless the code point would have fewer than four hexadecimal digits. For example, "U+0041 LATIN CAPITAL LETTER A". To print a code point in the U+-notation, use the format string "U+%04"G_GINT32_FORMAT"X". To scan, use the format string "U+%06"G_GINT32_FORMAT"X".</p> <div class="informalexample"> <table class="listing_frame" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td class="listing_lines" align="right"><pre>1 2 3</pre></td> <td class="listing_code"><pre class="programlisting">gunichar c<span class="gtkdoc opt">;</span> <span class="function">sscanf</span> <span class="gtkdoc opt">(</span><span class="string">&quot;U+0041&quot;</span><span class="gtkdoc opt">,</span> <span class="string">&quot;U+%06&quot;</span>G_GINT32_FORMAT<span class="string">&quot;X&quot;</span><span class="gtkdoc opt">, &amp;</span>c<span class="gtkdoc opt">)</span> <span class="function"><a href="glib-Warnings-and-Assertions.html#g-print">g_print</a></span> <span class="gtkdoc opt">(</span><span class="string">&quot;Read U+%04&quot;</span>G_GINT32_FORMAT<span class="string">&quot;X&quot;</span><span class="gtkdoc opt">,</span> c<span class="gtkdoc opt">);</span></pre></td> </tr> </tbody> </table> </div> <p></p> </div> <hr> <div class="refsect2"> <a name="gunichar2"></a><h3>gunichar2</h3> <pre class="programlisting">typedef guint16 gunichar2; </pre> <p>A type which can hold any UTF-16 code point&lt;footnote id="utf16_surrogate_pairs"&gt;UTF-16 also has so called &lt;firstterm&gt;surrogate pairs&lt;/firstterm&gt; to encode characters beyond the BMP as pairs of 16bit numbers. Surrogate pairs cannot be stored in a single gunichar2 field, but all GLib functions accepting gunichar2 arrays will correctly interpret surrogate pairs.&lt;/footnote&gt;.</p> <p>To print/scan values of this type to/from text you need to convert to/from UTF-8, using <a class="link" href="glib-Unicode-Manipulation.html#g-utf16-to-utf8" title="g_utf16_to_utf8 ()"><code class="function">g_utf16_to_utf8()</code></a>/<a class="link" href="glib-Unicode-Manipulation.html#g-utf8-to-utf16" title="g_utf8_to_utf16 ()"><code class="function">g_utf8_to_utf16()</code></a>.</p> <p>To print/scan values of this type as integer, use <a class="link" href="glib-Basic-Types.html#G-GINT16-MODIFIER:CAPS" title="G_GINT16_MODIFIER"><code class="literal">G_GINT16_MODIFIER</code></a> and/or <a class="link" href="glib-Basic-Types.html#G-GUINT16-FORMAT:CAPS" title="G_GUINT16_FORMAT"><code class="literal">G_GUINT16_FORMAT</code></a>.</p> </div> <hr> <div class="refsect2"> <a name="G-UNICHAR-MAX-DECOMPOSITION-LENGTH:CAPS"></a><h3>G_UNICHAR_MAX_DECOMPOSITION_LENGTH</h3> <pre class="programlisting">#define G_UNICHAR_MAX_DECOMPOSITION_LENGTH 18 /* codepoints */ </pre> <p>The maximum length (in codepoints) of a compatibility or canonical decomposition of a single Unicode character.</p> <p>This is as defined by Unicode 6.1.</p> <p class="since">Since: <a class="link" href="api-index-2-32.html#api-index-2.32">2.32</a></p> </div> <hr> <div class="refsect2"> <a name="GUnicodeType"></a><h3>enum GUnicodeType</h3> <p>These are the possible character classifications from the Unicode specification. See &lt;ulink url="http://www.unicode.org/Public/UNIDATA/UnicodeData.html"&gt;http://www.unicode.org/Public/UNIDATA/UnicodeData.html&lt;/ulink&gt;.</p> <div class="refsect3"> <a name="id-1.5.4.8.5.4"></a><h4>Members</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="300px" class="enum_members_name"> <col class="enum_members_description"> <col width="200px" class="enum_members_annotations"> </colgroup> <tbody> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-CONTROL:CAPS"></a>G_UNICODE_CONTROL</p></td> <td class="enum_member_description"> <p>General category "Other, Control" (Cc)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-FORMAT:CAPS"></a>G_UNICODE_FORMAT</p></td> <td class="enum_member_description"> <p>General category "Other, Format" (Cf)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-UNASSIGNED:CAPS"></a>G_UNICODE_UNASSIGNED</p></td> <td class="enum_member_description"> <p>General category "Other, Not Assigned" (Cn)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-PRIVATE-USE:CAPS"></a>G_UNICODE_PRIVATE_USE</p></td> <td class="enum_member_description"> <p>General category "Other, Private Use" (Co)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SURROGATE:CAPS"></a>G_UNICODE_SURROGATE</p></td> <td class="enum_member_description"> <p>General category "Other, Surrogate" (Cs)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-LOWERCASE-LETTER:CAPS"></a>G_UNICODE_LOWERCASE_LETTER</p></td> <td class="enum_member_description"> <p>General category "Letter, Lowercase" (Ll)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-MODIFIER-LETTER:CAPS"></a>G_UNICODE_MODIFIER_LETTER</p></td> <td class="enum_member_description"> <p>General category "Letter, Modifier" (Lm)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-OTHER-LETTER:CAPS"></a>G_UNICODE_OTHER_LETTER</p></td> <td class="enum_member_description"> <p>General category "Letter, Other" (Lo)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-TITLECASE-LETTER:CAPS"></a>G_UNICODE_TITLECASE_LETTER</p></td> <td class="enum_member_description"> <p>General category "Letter, Titlecase" (Lt)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-UPPERCASE-LETTER:CAPS"></a>G_UNICODE_UPPERCASE_LETTER</p></td> <td class="enum_member_description"> <p>General category "Letter, Uppercase" (Lu)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SPACING-MARK:CAPS"></a>G_UNICODE_SPACING_MARK</p></td> <td class="enum_member_description"> <p>General category "Mark, Spacing" (Mc)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-ENCLOSING-MARK:CAPS"></a>G_UNICODE_ENCLOSING_MARK</p></td> <td class="enum_member_description"> <p>General category "Mark, Enclosing" (Me)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-NON-SPACING-MARK:CAPS"></a>G_UNICODE_NON_SPACING_MARK</p></td> <td class="enum_member_description"> <p>General category "Mark, Nonspacing" (Mn)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-DECIMAL-NUMBER:CAPS"></a>G_UNICODE_DECIMAL_NUMBER</p></td> <td class="enum_member_description"> <p>General category "Number, Decimal Digit" (Nd)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-LETTER-NUMBER:CAPS"></a>G_UNICODE_LETTER_NUMBER</p></td> <td class="enum_member_description"> <p>General category "Number, Letter" (Nl)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-OTHER-NUMBER:CAPS"></a>G_UNICODE_OTHER_NUMBER</p></td> <td class="enum_member_description"> <p>General category "Number, Other" (No)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-CONNECT-PUNCTUATION:CAPS"></a>G_UNICODE_CONNECT_PUNCTUATION</p></td> <td class="enum_member_description"> <p>General category "Punctuation, Connector" (Pc)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-DASH-PUNCTUATION:CAPS"></a>G_UNICODE_DASH_PUNCTUATION</p></td> <td class="enum_member_description"> <p>General category "Punctuation, Dash" (Pd)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-CLOSE-PUNCTUATION:CAPS"></a>G_UNICODE_CLOSE_PUNCTUATION</p></td> <td class="enum_member_description"> <p>General category "Punctuation, Close" (Pe)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-FINAL-PUNCTUATION:CAPS"></a>G_UNICODE_FINAL_PUNCTUATION</p></td> <td class="enum_member_description"> <p>General category "Punctuation, Final quote" (Pf)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-INITIAL-PUNCTUATION:CAPS"></a>G_UNICODE_INITIAL_PUNCTUATION</p></td> <td class="enum_member_description"> <p>General category "Punctuation, Initial quote" (Pi)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-OTHER-PUNCTUATION:CAPS"></a>G_UNICODE_OTHER_PUNCTUATION</p></td> <td class="enum_member_description"> <p>General category "Punctuation, Other" (Po)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-OPEN-PUNCTUATION:CAPS"></a>G_UNICODE_OPEN_PUNCTUATION</p></td> <td class="enum_member_description"> <p>General category "Punctuation, Open" (Ps)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-CURRENCY-SYMBOL:CAPS"></a>G_UNICODE_CURRENCY_SYMBOL</p></td> <td class="enum_member_description"> <p>General category "Symbol, Currency" (Sc)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-MODIFIER-SYMBOL:CAPS"></a>G_UNICODE_MODIFIER_SYMBOL</p></td> <td class="enum_member_description"> <p>General category "Symbol, Modifier" (Sk)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-MATH-SYMBOL:CAPS"></a>G_UNICODE_MATH_SYMBOL</p></td> <td class="enum_member_description"> <p>General category "Symbol, Math" (Sm)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-OTHER-SYMBOL:CAPS"></a>G_UNICODE_OTHER_SYMBOL</p></td> <td class="enum_member_description"> <p>General category "Symbol, Other" (So)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-LINE-SEPARATOR:CAPS"></a>G_UNICODE_LINE_SEPARATOR</p></td> <td class="enum_member_description"> <p>General category "Separator, Line" (Zl)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-PARAGRAPH-SEPARATOR:CAPS"></a>G_UNICODE_PARAGRAPH_SEPARATOR</p></td> <td class="enum_member_description"> <p>General category "Separator, Paragraph" (Zp)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SPACE-SEPARATOR:CAPS"></a>G_UNICODE_SPACE_SEPARATOR</p></td> <td class="enum_member_description"> <p>General category "Separator, Space" (Zs)</p> </td> <td class="enum_member_annotations"> </td> </tr> </tbody> </table></div> </div> </div> <hr> <div class="refsect2"> <a name="G-UNICODE-COMBINING-MARK:CAPS"></a><h3>G_UNICODE_COMBINING_MARK</h3> <pre class="programlisting">#define G_UNICODE_COMBINING_MARK G_UNICODE_SPACING_MARK </pre> <div class="warning"> <p><code class="literal">G_UNICODE_COMBINING_MARK</code> has been deprecated since version 2.30 and should not be used in newly-written code.</p> <p>Use <a class="link" href="glib-Unicode-Manipulation.html#G-UNICODE-SPACING-MARK:CAPS"><code class="literal">G_UNICODE_SPACING_MARK</code></a>.</p> </div> <p>Older name for <a class="link" href="glib-Unicode-Manipulation.html#G-UNICODE-SPACING-MARK:CAPS"><code class="literal">G_UNICODE_SPACING_MARK</code></a>.</p> </div> <hr> <div class="refsect2"> <a name="GUnicodeBreakType"></a><h3>enum GUnicodeBreakType</h3> <p>These are the possible line break classifications.</p> <p>Since new unicode versions may add new types here, applications should be ready to handle unknown values. They may be regarded as <a class="link" href="glib-Unicode-Manipulation.html#G-UNICODE-BREAK-UNKNOWN:CAPS"><code class="literal">G_UNICODE_BREAK_UNKNOWN</code></a>.</p> <p>See &lt;ulink url="http://www.unicode.org/unicode/reports/tr14/"&gt;http://www.unicode.org/unicode/reports/tr14/&lt;/ulink&gt;.</p> <div class="refsect3"> <a name="id-1.5.4.8.7.6"></a><h4>Members</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="300px" class="enum_members_name"> <col class="enum_members_description"> <col width="200px" class="enum_members_annotations"> </colgroup> <tbody> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-BREAK-MANDATORY:CAPS"></a>G_UNICODE_BREAK_MANDATORY</p></td> <td class="enum_member_description"> <p>Mandatory Break (BK)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-BREAK-CARRIAGE-RETURN:CAPS"></a>G_UNICODE_BREAK_CARRIAGE_RETURN</p></td> <td class="enum_member_description"> <p>Carriage Return (CR)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-BREAK-LINE-FEED:CAPS"></a>G_UNICODE_BREAK_LINE_FEED</p></td> <td class="enum_member_description"> <p>Line Feed (LF)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-BREAK-COMBINING-MARK:CAPS"></a>G_UNICODE_BREAK_COMBINING_MARK</p></td> <td class="enum_member_description"> <p>Attached Characters and Combining Marks (CM)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-BREAK-SURROGATE:CAPS"></a>G_UNICODE_BREAK_SURROGATE</p></td> <td class="enum_member_description"> <p>Surrogates (SG)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-BREAK-ZERO-WIDTH-SPACE:CAPS"></a>G_UNICODE_BREAK_ZERO_WIDTH_SPACE</p></td> <td class="enum_member_description"> <p>Zero Width Space (ZW)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-BREAK-INSEPARABLE:CAPS"></a>G_UNICODE_BREAK_INSEPARABLE</p></td> <td class="enum_member_description"> <p>Inseparable (IN)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-BREAK-NON-BREAKING-GLUE:CAPS"></a>G_UNICODE_BREAK_NON_BREAKING_GLUE</p></td> <td class="enum_member_description"> <p>Non-breaking ("Glue") (GL)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-BREAK-CONTINGENT:CAPS"></a>G_UNICODE_BREAK_CONTINGENT</p></td> <td class="enum_member_description"> <p>Contingent Break Opportunity (CB)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-BREAK-SPACE:CAPS"></a>G_UNICODE_BREAK_SPACE</p></td> <td class="enum_member_description"> <p>Space (SP)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-BREAK-AFTER:CAPS"></a>G_UNICODE_BREAK_AFTER</p></td> <td class="enum_member_description"> <p>Break Opportunity After (BA)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-BREAK-BEFORE:CAPS"></a>G_UNICODE_BREAK_BEFORE</p></td> <td class="enum_member_description"> <p>Break Opportunity Before (BB)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-BREAK-BEFORE-AND-AFTER:CAPS"></a>G_UNICODE_BREAK_BEFORE_AND_AFTER</p></td> <td class="enum_member_description"> <p>Break Opportunity Before and After (B2)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-BREAK-HYPHEN:CAPS"></a>G_UNICODE_BREAK_HYPHEN</p></td> <td class="enum_member_description"> <p>Hyphen (HY)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-BREAK-NON-STARTER:CAPS"></a>G_UNICODE_BREAK_NON_STARTER</p></td> <td class="enum_member_description"> <p>Nonstarter (NS)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-BREAK-OPEN-PUNCTUATION:CAPS"></a>G_UNICODE_BREAK_OPEN_PUNCTUATION</p></td> <td class="enum_member_description"> <p>Opening Punctuation (OP)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-BREAK-CLOSE-PUNCTUATION:CAPS"></a>G_UNICODE_BREAK_CLOSE_PUNCTUATION</p></td> <td class="enum_member_description"> <p>Closing Punctuation (CL)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-BREAK-QUOTATION:CAPS"></a>G_UNICODE_BREAK_QUOTATION</p></td> <td class="enum_member_description"> <p>Ambiguous Quotation (QU)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-BREAK-EXCLAMATION:CAPS"></a>G_UNICODE_BREAK_EXCLAMATION</p></td> <td class="enum_member_description"> <p>Exclamation/Interrogation (EX)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-BREAK-IDEOGRAPHIC:CAPS"></a>G_UNICODE_BREAK_IDEOGRAPHIC</p></td> <td class="enum_member_description"> <p>Ideographic (ID)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-BREAK-NUMERIC:CAPS"></a>G_UNICODE_BREAK_NUMERIC</p></td> <td class="enum_member_description"> <p>Numeric (NU)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-BREAK-INFIX-SEPARATOR:CAPS"></a>G_UNICODE_BREAK_INFIX_SEPARATOR</p></td> <td class="enum_member_description"> <p>Infix Separator (Numeric) (IS)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-BREAK-SYMBOL:CAPS"></a>G_UNICODE_BREAK_SYMBOL</p></td> <td class="enum_member_description"> <p>Symbols Allowing Break After (SY)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-BREAK-ALPHABETIC:CAPS"></a>G_UNICODE_BREAK_ALPHABETIC</p></td> <td class="enum_member_description"> <p>Ordinary Alphabetic and Symbol Characters (AL)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-BREAK-PREFIX:CAPS"></a>G_UNICODE_BREAK_PREFIX</p></td> <td class="enum_member_description"> <p>Prefix (Numeric) (PR)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-BREAK-POSTFIX:CAPS"></a>G_UNICODE_BREAK_POSTFIX</p></td> <td class="enum_member_description"> <p>Postfix (Numeric) (PO)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-BREAK-COMPLEX-CONTEXT:CAPS"></a>G_UNICODE_BREAK_COMPLEX_CONTEXT</p></td> <td class="enum_member_description"> <p>Complex Content Dependent (South East Asian) (SA)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-BREAK-AMBIGUOUS:CAPS"></a>G_UNICODE_BREAK_AMBIGUOUS</p></td> <td class="enum_member_description"> <p>Ambiguous (Alphabetic or Ideographic) (AI)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-BREAK-UNKNOWN:CAPS"></a>G_UNICODE_BREAK_UNKNOWN</p></td> <td class="enum_member_description"> <p>Unknown (XX)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-BREAK-NEXT-LINE:CAPS"></a>G_UNICODE_BREAK_NEXT_LINE</p></td> <td class="enum_member_description"> <p>Next Line (NL)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-BREAK-WORD-JOINER:CAPS"></a>G_UNICODE_BREAK_WORD_JOINER</p></td> <td class="enum_member_description"> <p>Word Joiner (WJ)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-BREAK-HANGUL-L-JAMO:CAPS"></a>G_UNICODE_BREAK_HANGUL_L_JAMO</p></td> <td class="enum_member_description"> <p>Hangul L Jamo (JL)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-BREAK-HANGUL-V-JAMO:CAPS"></a>G_UNICODE_BREAK_HANGUL_V_JAMO</p></td> <td class="enum_member_description"> <p>Hangul V Jamo (JV)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-BREAK-HANGUL-T-JAMO:CAPS"></a>G_UNICODE_BREAK_HANGUL_T_JAMO</p></td> <td class="enum_member_description"> <p>Hangul T Jamo (JT)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-BREAK-HANGUL-LV-SYLLABLE:CAPS"></a>G_UNICODE_BREAK_HANGUL_LV_SYLLABLE</p></td> <td class="enum_member_description"> <p>Hangul LV Syllable (H2)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-BREAK-HANGUL-LVT-SYLLABLE:CAPS"></a>G_UNICODE_BREAK_HANGUL_LVT_SYLLABLE</p></td> <td class="enum_member_description"> <p>Hangul LVT Syllable (H3)</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-BREAK-CLOSE-PARANTHESIS:CAPS"></a>G_UNICODE_BREAK_CLOSE_PARANTHESIS</p></td> <td class="enum_member_description"> <p>Closing Parenthesis (CP). Since 2.28</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-BREAK-CONDITIONAL-JAPANESE-STARTER:CAPS"></a>G_UNICODE_BREAK_CONDITIONAL_JAPANESE_STARTER</p></td> <td class="enum_member_description"> <p>Conditional Japanese Starter (CJ). Since: 2.32</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-BREAK-HEBREW-LETTER:CAPS"></a>G_UNICODE_BREAK_HEBREW_LETTER</p></td> <td class="enum_member_description"> <p>Hebrew Letter (HL). Since: 2.32</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-BREAK-REGIONAL-INDICATOR:CAPS"></a>G_UNICODE_BREAK_REGIONAL_INDICATOR</p></td> <td class="enum_member_description"> <p>Regional Indicator (RI). Since: 2.36</p> </td> <td class="enum_member_annotations"> </td> </tr> </tbody> </table></div> </div> </div> <hr> <div class="refsect2"> <a name="GUnicodeScript"></a><h3>enum GUnicodeScript</h3> <p>The <a class="link" href="glib-Unicode-Manipulation.html#GUnicodeScript" title="enum GUnicodeScript"><span class="type">GUnicodeScript</span></a> enumeration identifies different writing systems. The values correspond to the names as defined in the Unicode standard. The enumeration has been added in GLib 2.14, and is interchangeable with <span class="type">PangoScript</span>.</p> <p>Note that new types may be added in the future. Applications should be ready to handle unknown values. See &lt;ulink url="http://www.unicode.org/reports/tr24/"&gt;Unicode Standard Annex <span class="type">24</span>: Script names&lt;/ulink&gt;.</p> <div class="refsect3"> <a name="id-1.5.4.8.8.5"></a><h4>Members</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="300px" class="enum_members_name"> <col class="enum_members_description"> <col width="200px" class="enum_members_annotations"> </colgroup> <tbody> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-INVALID-CODE:CAPS"></a>G_UNICODE_SCRIPT_INVALID_CODE</p></td> <td class="enum_member_description"> <p> a value never returned from <a class="link" href="glib-Unicode-Manipulation.html#g-unichar-get-script" title="g_unichar_get_script ()"><code class="function">g_unichar_get_script()</code></a></p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-COMMON:CAPS"></a>G_UNICODE_SCRIPT_COMMON</p></td> <td class="enum_member_description"> <p>a character used by multiple different scripts</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-INHERITED:CAPS"></a>G_UNICODE_SCRIPT_INHERITED</p></td> <td class="enum_member_description"> <p>a mark glyph that takes its script from the base glyph to which it is attached</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-ARABIC:CAPS"></a>G_UNICODE_SCRIPT_ARABIC</p></td> <td class="enum_member_description"> <p>Arabic</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-ARMENIAN:CAPS"></a>G_UNICODE_SCRIPT_ARMENIAN</p></td> <td class="enum_member_description"> <p>Armenian</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-BENGALI:CAPS"></a>G_UNICODE_SCRIPT_BENGALI</p></td> <td class="enum_member_description"> <p>Bengali</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-BOPOMOFO:CAPS"></a>G_UNICODE_SCRIPT_BOPOMOFO</p></td> <td class="enum_member_description"> <p>Bopomofo</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-CHEROKEE:CAPS"></a>G_UNICODE_SCRIPT_CHEROKEE</p></td> <td class="enum_member_description"> <p>Cherokee</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-COPTIC:CAPS"></a>G_UNICODE_SCRIPT_COPTIC</p></td> <td class="enum_member_description"> <p>Coptic</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-CYRILLIC:CAPS"></a>G_UNICODE_SCRIPT_CYRILLIC</p></td> <td class="enum_member_description"> <p>Cyrillic</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-DESERET:CAPS"></a>G_UNICODE_SCRIPT_DESERET</p></td> <td class="enum_member_description"> <p>Deseret</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-DEVANAGARI:CAPS"></a>G_UNICODE_SCRIPT_DEVANAGARI</p></td> <td class="enum_member_description"> <p>Devanagari</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-ETHIOPIC:CAPS"></a>G_UNICODE_SCRIPT_ETHIOPIC</p></td> <td class="enum_member_description"> <p>Ethiopic</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-GEORGIAN:CAPS"></a>G_UNICODE_SCRIPT_GEORGIAN</p></td> <td class="enum_member_description"> <p>Georgian</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-GOTHIC:CAPS"></a>G_UNICODE_SCRIPT_GOTHIC</p></td> <td class="enum_member_description"> <p>Gothic</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-GREEK:CAPS"></a>G_UNICODE_SCRIPT_GREEK</p></td> <td class="enum_member_description"> <p>Greek</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-GUJARATI:CAPS"></a>G_UNICODE_SCRIPT_GUJARATI</p></td> <td class="enum_member_description"> <p>Gujarati</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-GURMUKHI:CAPS"></a>G_UNICODE_SCRIPT_GURMUKHI</p></td> <td class="enum_member_description"> <p>Gurmukhi</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-HAN:CAPS"></a>G_UNICODE_SCRIPT_HAN</p></td> <td class="enum_member_description"> <p>Han</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-HANGUL:CAPS"></a>G_UNICODE_SCRIPT_HANGUL</p></td> <td class="enum_member_description"> <p>Hangul</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-HEBREW:CAPS"></a>G_UNICODE_SCRIPT_HEBREW</p></td> <td class="enum_member_description"> <p>Hebrew</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-HIRAGANA:CAPS"></a>G_UNICODE_SCRIPT_HIRAGANA</p></td> <td class="enum_member_description"> <p>Hiragana</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-KANNADA:CAPS"></a>G_UNICODE_SCRIPT_KANNADA</p></td> <td class="enum_member_description"> <p>Kannada</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-KATAKANA:CAPS"></a>G_UNICODE_SCRIPT_KATAKANA</p></td> <td class="enum_member_description"> <p>Katakana</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-KHMER:CAPS"></a>G_UNICODE_SCRIPT_KHMER</p></td> <td class="enum_member_description"> <p>Khmer</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-LAO:CAPS"></a>G_UNICODE_SCRIPT_LAO</p></td> <td class="enum_member_description"> <p>Lao</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-LATIN:CAPS"></a>G_UNICODE_SCRIPT_LATIN</p></td> <td class="enum_member_description"> <p>Latin</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-MALAYALAM:CAPS"></a>G_UNICODE_SCRIPT_MALAYALAM</p></td> <td class="enum_member_description"> <p>Malayalam</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-MONGOLIAN:CAPS"></a>G_UNICODE_SCRIPT_MONGOLIAN</p></td> <td class="enum_member_description"> <p>Mongolian</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-MYANMAR:CAPS"></a>G_UNICODE_SCRIPT_MYANMAR</p></td> <td class="enum_member_description"> <p>Myanmar</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-OGHAM:CAPS"></a>G_UNICODE_SCRIPT_OGHAM</p></td> <td class="enum_member_description"> <p>Ogham</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-OLD-ITALIC:CAPS"></a>G_UNICODE_SCRIPT_OLD_ITALIC</p></td> <td class="enum_member_description"> <p>Old Italic</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-ORIYA:CAPS"></a>G_UNICODE_SCRIPT_ORIYA</p></td> <td class="enum_member_description"> <p>Oriya</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-RUNIC:CAPS"></a>G_UNICODE_SCRIPT_RUNIC</p></td> <td class="enum_member_description"> <p>Runic</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-SINHALA:CAPS"></a>G_UNICODE_SCRIPT_SINHALA</p></td> <td class="enum_member_description"> <p>Sinhala</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-SYRIAC:CAPS"></a>G_UNICODE_SCRIPT_SYRIAC</p></td> <td class="enum_member_description"> <p>Syriac</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-TAMIL:CAPS"></a>G_UNICODE_SCRIPT_TAMIL</p></td> <td class="enum_member_description"> <p>Tamil</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-TELUGU:CAPS"></a>G_UNICODE_SCRIPT_TELUGU</p></td> <td class="enum_member_description"> <p>Telugu</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-THAANA:CAPS"></a>G_UNICODE_SCRIPT_THAANA</p></td> <td class="enum_member_description"> <p>Thaana</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-THAI:CAPS"></a>G_UNICODE_SCRIPT_THAI</p></td> <td class="enum_member_description"> <p>Thai</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-TIBETAN:CAPS"></a>G_UNICODE_SCRIPT_TIBETAN</p></td> <td class="enum_member_description"> <p>Tibetan</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-CANADIAN-ABORIGINAL:CAPS"></a>G_UNICODE_SCRIPT_CANADIAN_ABORIGINAL</p></td> <td class="enum_member_description"> <p> Canadian Aboriginal</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-YI:CAPS"></a>G_UNICODE_SCRIPT_YI</p></td> <td class="enum_member_description"> <p>Yi</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-TAGALOG:CAPS"></a>G_UNICODE_SCRIPT_TAGALOG</p></td> <td class="enum_member_description"> <p>Tagalog</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-HANUNOO:CAPS"></a>G_UNICODE_SCRIPT_HANUNOO</p></td> <td class="enum_member_description"> <p>Hanunoo</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-BUHID:CAPS"></a>G_UNICODE_SCRIPT_BUHID</p></td> <td class="enum_member_description"> <p>Buhid</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-TAGBANWA:CAPS"></a>G_UNICODE_SCRIPT_TAGBANWA</p></td> <td class="enum_member_description"> <p>Tagbanwa</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-BRAILLE:CAPS"></a>G_UNICODE_SCRIPT_BRAILLE</p></td> <td class="enum_member_description"> <p>Braille</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-CYPRIOT:CAPS"></a>G_UNICODE_SCRIPT_CYPRIOT</p></td> <td class="enum_member_description"> <p>Cypriot</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-LIMBU:CAPS"></a>G_UNICODE_SCRIPT_LIMBU</p></td> <td class="enum_member_description"> <p>Limbu</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-OSMANYA:CAPS"></a>G_UNICODE_SCRIPT_OSMANYA</p></td> <td class="enum_member_description"> <p>Osmanya</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-SHAVIAN:CAPS"></a>G_UNICODE_SCRIPT_SHAVIAN</p></td> <td class="enum_member_description"> <p>Shavian</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-LINEAR-B:CAPS"></a>G_UNICODE_SCRIPT_LINEAR_B</p></td> <td class="enum_member_description"> <p>Linear B</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-TAI-LE:CAPS"></a>G_UNICODE_SCRIPT_TAI_LE</p></td> <td class="enum_member_description"> <p>Tai Le</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-UGARITIC:CAPS"></a>G_UNICODE_SCRIPT_UGARITIC</p></td> <td class="enum_member_description"> <p>Ugaritic</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-NEW-TAI-LUE:CAPS"></a>G_UNICODE_SCRIPT_NEW_TAI_LUE</p></td> <td class="enum_member_description"> <p> New Tai Lue</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-BUGINESE:CAPS"></a>G_UNICODE_SCRIPT_BUGINESE</p></td> <td class="enum_member_description"> <p>Buginese</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-GLAGOLITIC:CAPS"></a>G_UNICODE_SCRIPT_GLAGOLITIC</p></td> <td class="enum_member_description"> <p>Glagolitic</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-TIFINAGH:CAPS"></a>G_UNICODE_SCRIPT_TIFINAGH</p></td> <td class="enum_member_description"> <p>Tifinagh</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-SYLOTI-NAGRI:CAPS"></a>G_UNICODE_SCRIPT_SYLOTI_NAGRI</p></td> <td class="enum_member_description"> <p> Syloti Nagri</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-OLD-PERSIAN:CAPS"></a>G_UNICODE_SCRIPT_OLD_PERSIAN</p></td> <td class="enum_member_description"> <p> Old Persian</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-KHAROSHTHI:CAPS"></a>G_UNICODE_SCRIPT_KHAROSHTHI</p></td> <td class="enum_member_description"> <p>Kharoshthi</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-UNKNOWN:CAPS"></a>G_UNICODE_SCRIPT_UNKNOWN</p></td> <td class="enum_member_description"> <p>an unassigned code point</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-BALINESE:CAPS"></a>G_UNICODE_SCRIPT_BALINESE</p></td> <td class="enum_member_description"> <p>Balinese</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-CUNEIFORM:CAPS"></a>G_UNICODE_SCRIPT_CUNEIFORM</p></td> <td class="enum_member_description"> <p>Cuneiform</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-PHOENICIAN:CAPS"></a>G_UNICODE_SCRIPT_PHOENICIAN</p></td> <td class="enum_member_description"> <p>Phoenician</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-PHAGS-PA:CAPS"></a>G_UNICODE_SCRIPT_PHAGS_PA</p></td> <td class="enum_member_description"> <p>Phags-pa</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-NKO:CAPS"></a>G_UNICODE_SCRIPT_NKO</p></td> <td class="enum_member_description"> <p>N'Ko</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-KAYAH-LI:CAPS"></a>G_UNICODE_SCRIPT_KAYAH_LI</p></td> <td class="enum_member_description"> <p>Kayah Li. Since 2.16.3</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-LEPCHA:CAPS"></a>G_UNICODE_SCRIPT_LEPCHA</p></td> <td class="enum_member_description"> <p>Lepcha. Since 2.16.3</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-REJANG:CAPS"></a>G_UNICODE_SCRIPT_REJANG</p></td> <td class="enum_member_description"> <p>Rejang. Since 2.16.3</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-SUNDANESE:CAPS"></a>G_UNICODE_SCRIPT_SUNDANESE</p></td> <td class="enum_member_description"> <p>Sundanese. Since 2.16.3</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-SAURASHTRA:CAPS"></a>G_UNICODE_SCRIPT_SAURASHTRA</p></td> <td class="enum_member_description"> <p>Saurashtra. Since 2.16.3</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-CHAM:CAPS"></a>G_UNICODE_SCRIPT_CHAM</p></td> <td class="enum_member_description"> <p>Cham. Since 2.16.3</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-OL-CHIKI:CAPS"></a>G_UNICODE_SCRIPT_OL_CHIKI</p></td> <td class="enum_member_description"> <p>Ol Chiki. Since 2.16.3</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-VAI:CAPS"></a>G_UNICODE_SCRIPT_VAI</p></td> <td class="enum_member_description"> <p>Vai. Since 2.16.3</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-CARIAN:CAPS"></a>G_UNICODE_SCRIPT_CARIAN</p></td> <td class="enum_member_description"> <p>Carian. Since 2.16.3</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-LYCIAN:CAPS"></a>G_UNICODE_SCRIPT_LYCIAN</p></td> <td class="enum_member_description"> <p>Lycian. Since 2.16.3</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-LYDIAN:CAPS"></a>G_UNICODE_SCRIPT_LYDIAN</p></td> <td class="enum_member_description"> <p>Lydian. Since 2.16.3</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-AVESTAN:CAPS"></a>G_UNICODE_SCRIPT_AVESTAN</p></td> <td class="enum_member_description"> <p>Avestan. Since 2.26</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-BAMUM:CAPS"></a>G_UNICODE_SCRIPT_BAMUM</p></td> <td class="enum_member_description"> <p>Bamum. Since 2.26</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-EGYPTIAN-HIEROGLYPHS:CAPS"></a>G_UNICODE_SCRIPT_EGYPTIAN_HIEROGLYPHS</p></td> <td class="enum_member_description"> <p> Egyptian Hieroglpyhs. Since 2.26</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-IMPERIAL-ARAMAIC:CAPS"></a>G_UNICODE_SCRIPT_IMPERIAL_ARAMAIC</p></td> <td class="enum_member_description"> <p> Imperial Aramaic. Since 2.26</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-INSCRIPTIONAL-PAHLAVI:CAPS"></a>G_UNICODE_SCRIPT_INSCRIPTIONAL_PAHLAVI</p></td> <td class="enum_member_description"> <p> Inscriptional Pahlavi. Since 2.26</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-INSCRIPTIONAL-PARTHIAN:CAPS"></a>G_UNICODE_SCRIPT_INSCRIPTIONAL_PARTHIAN</p></td> <td class="enum_member_description"> <p> Inscriptional Parthian. Since 2.26</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-JAVANESE:CAPS"></a>G_UNICODE_SCRIPT_JAVANESE</p></td> <td class="enum_member_description"> <p>Javanese. Since 2.26</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-KAITHI:CAPS"></a>G_UNICODE_SCRIPT_KAITHI</p></td> <td class="enum_member_description"> <p>Kaithi. Since 2.26</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-LISU:CAPS"></a>G_UNICODE_SCRIPT_LISU</p></td> <td class="enum_member_description"> <p>Lisu. Since 2.26</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-MEETEI-MAYEK:CAPS"></a>G_UNICODE_SCRIPT_MEETEI_MAYEK</p></td> <td class="enum_member_description"> <p> Meetei Mayek. Since 2.26</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-OLD-SOUTH-ARABIAN:CAPS"></a>G_UNICODE_SCRIPT_OLD_SOUTH_ARABIAN</p></td> <td class="enum_member_description"> <p> Old South Arabian. Since 2.26</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-OLD-TURKIC:CAPS"></a>G_UNICODE_SCRIPT_OLD_TURKIC</p></td> <td class="enum_member_description"> <p>Old Turkic. Since 2.28</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-SAMARITAN:CAPS"></a>G_UNICODE_SCRIPT_SAMARITAN</p></td> <td class="enum_member_description"> <p>Samaritan. Since 2.26</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-TAI-THAM:CAPS"></a>G_UNICODE_SCRIPT_TAI_THAM</p></td> <td class="enum_member_description"> <p>Tai Tham. Since 2.26</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-TAI-VIET:CAPS"></a>G_UNICODE_SCRIPT_TAI_VIET</p></td> <td class="enum_member_description"> <p>Tai Viet. Since 2.26</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-BATAK:CAPS"></a>G_UNICODE_SCRIPT_BATAK</p></td> <td class="enum_member_description"> <p>Batak. Since 2.28</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-BRAHMI:CAPS"></a>G_UNICODE_SCRIPT_BRAHMI</p></td> <td class="enum_member_description"> <p>Brahmi. Since 2.28</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-MANDAIC:CAPS"></a>G_UNICODE_SCRIPT_MANDAIC</p></td> <td class="enum_member_description"> <p>Mandaic. Since 2.28</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-CHAKMA:CAPS"></a>G_UNICODE_SCRIPT_CHAKMA</p></td> <td class="enum_member_description"> <p>Chakma. Since: 2.32</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-MEROITIC-CURSIVE:CAPS"></a>G_UNICODE_SCRIPT_MEROITIC_CURSIVE</p></td> <td class="enum_member_description"> <p>Meroitic Cursive. Since: 2.32</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-MEROITIC-HIEROGLYPHS:CAPS"></a>G_UNICODE_SCRIPT_MEROITIC_HIEROGLYPHS</p></td> <td class="enum_member_description"> <p>Meroitic Hieroglyphs. Since: 2.32</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-MIAO:CAPS"></a>G_UNICODE_SCRIPT_MIAO</p></td> <td class="enum_member_description"> <p>Miao. Since: 2.32</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-SHARADA:CAPS"></a>G_UNICODE_SCRIPT_SHARADA</p></td> <td class="enum_member_description"> <p>Sharada. Since: 2.32</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-SORA-SOMPENG:CAPS"></a>G_UNICODE_SCRIPT_SORA_SOMPENG</p></td> <td class="enum_member_description"> <p>Sora Sompeng. Since: 2.32</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-TAKRI:CAPS"></a>G_UNICODE_SCRIPT_TAKRI</p></td> <td class="enum_member_description"> <p>Takri. Since: 2.32</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-BASSA-VAH:CAPS"></a>G_UNICODE_SCRIPT_BASSA_VAH</p></td> <td class="enum_member_description"> <p>Bassa. Since: 2.42</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-CAUCASIAN-ALBANIAN:CAPS"></a>G_UNICODE_SCRIPT_CAUCASIAN_ALBANIAN</p></td> <td class="enum_member_description"> <p>Caucasian Albanian. Since: 2.42</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-DUPLOYAN:CAPS"></a>G_UNICODE_SCRIPT_DUPLOYAN</p></td> <td class="enum_member_description"> <p>Duployan. Since: 2.42</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-ELBASAN:CAPS"></a>G_UNICODE_SCRIPT_ELBASAN</p></td> <td class="enum_member_description"> <p>Elbasan. Since: 2.42</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-GRANTHA:CAPS"></a>G_UNICODE_SCRIPT_GRANTHA</p></td> <td class="enum_member_description"> <p>Grantha. Since: 2.42</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-KHOJKI:CAPS"></a>G_UNICODE_SCRIPT_KHOJKI</p></td> <td class="enum_member_description"> <p>Kjohki. Since: 2.42</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-KHUDAWADI:CAPS"></a>G_UNICODE_SCRIPT_KHUDAWADI</p></td> <td class="enum_member_description"> <p>Khudawadi, Sindhi. Since: 2.42</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-LINEAR-A:CAPS"></a>G_UNICODE_SCRIPT_LINEAR_A</p></td> <td class="enum_member_description"> <p>Linear A. Since: 2.42</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-MAHAJANI:CAPS"></a>G_UNICODE_SCRIPT_MAHAJANI</p></td> <td class="enum_member_description"> <p>Mahajani. Since: 2.42</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-MANICHAEAN:CAPS"></a>G_UNICODE_SCRIPT_MANICHAEAN</p></td> <td class="enum_member_description"> <p>Manichaean. Since: 2.42</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-MENDE-KIKAKUI:CAPS"></a>G_UNICODE_SCRIPT_MENDE_KIKAKUI</p></td> <td class="enum_member_description"> <p>Mende Kikakui. Since: 2.42</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-MODI:CAPS"></a>G_UNICODE_SCRIPT_MODI</p></td> <td class="enum_member_description"> <p>Modi. Since: 2.42</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-MRO:CAPS"></a>G_UNICODE_SCRIPT_MRO</p></td> <td class="enum_member_description"> <p>Mro. Since: 2.42</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-NABATAEAN:CAPS"></a>G_UNICODE_SCRIPT_NABATAEAN</p></td> <td class="enum_member_description"> <p>Nabataean. Since: 2.42</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-OLD-NORTH-ARABIAN:CAPS"></a>G_UNICODE_SCRIPT_OLD_NORTH_ARABIAN</p></td> <td class="enum_member_description"> <p>Old North Arabian. Since: 2.42</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-OLD-PERMIC:CAPS"></a>G_UNICODE_SCRIPT_OLD_PERMIC</p></td> <td class="enum_member_description"> <p>Old Permic. Since: 2.42</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-PAHAWH-HMONG:CAPS"></a>G_UNICODE_SCRIPT_PAHAWH_HMONG</p></td> <td class="enum_member_description"> <p>Pahawh Hmong. Since: 2.42</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-PALMYRENE:CAPS"></a>G_UNICODE_SCRIPT_PALMYRENE</p></td> <td class="enum_member_description"> <p>Palmyrene. Since: 2.42</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-PAU-CIN-HAU:CAPS"></a>G_UNICODE_SCRIPT_PAU_CIN_HAU</p></td> <td class="enum_member_description"> <p>Pau Cin Hau. Since: 2.42</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-PSALTER-PAHLAVI:CAPS"></a>G_UNICODE_SCRIPT_PSALTER_PAHLAVI</p></td> <td class="enum_member_description"> <p>Psalter Pahlavi. Since: 2.42</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-SIDDHAM:CAPS"></a>G_UNICODE_SCRIPT_SIDDHAM</p></td> <td class="enum_member_description"> <p>Siddham. Since: 2.42</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-TIRHUTA:CAPS"></a>G_UNICODE_SCRIPT_TIRHUTA</p></td> <td class="enum_member_description"> <p>Tirhuta. Since: 2.42</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-UNICODE-SCRIPT-WARANG-CITI:CAPS"></a>G_UNICODE_SCRIPT_WARANG_CITI</p></td> <td class="enum_member_description"> <p>Warang Citi. Since: 2.42</p> </td> <td class="enum_member_annotations"> </td> </tr> </tbody> </table></div> </div> </div> <hr> <div class="refsect2"> <a name="GNormalizeMode"></a><h3>enum GNormalizeMode</h3> <p>Defines how a Unicode string is transformed in a canonical form, standardizing such issues as whether a character with an accent is represented as a base character and combining accent or as a single precomposed character. Unicode strings should generally be normalized before comparing them.</p> <div class="refsect3"> <a name="id-1.5.4.8.9.4"></a><h4>Members</h4> <div class="informaltable"><table width="100%" border="0"> <colgroup> <col width="300px" class="enum_members_name"> <col class="enum_members_description"> <col width="200px" class="enum_members_annotations"> </colgroup> <tbody> <tr> <td class="enum_member_name"><p><a name="G-NORMALIZE-DEFAULT:CAPS"></a>G_NORMALIZE_DEFAULT</p></td> <td class="enum_member_description"> <p>standardize differences that do not affect the text content, such as the above-mentioned accent representation</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-NORMALIZE-NFD:CAPS"></a>G_NORMALIZE_NFD</p></td> <td class="enum_member_description"> <p>another name for <a class="link" href="glib-Unicode-Manipulation.html#G-NORMALIZE-DEFAULT:CAPS"><code class="literal">G_NORMALIZE_DEFAULT</code></a></p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-NORMALIZE-DEFAULT-COMPOSE:CAPS"></a>G_NORMALIZE_DEFAULT_COMPOSE</p></td> <td class="enum_member_description"> <p>like <a class="link" href="glib-Unicode-Manipulation.html#G-NORMALIZE-DEFAULT:CAPS"><code class="literal">G_NORMALIZE_DEFAULT</code></a>, but with composed forms rather than a maximally decomposed form</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-NORMALIZE-NFC:CAPS"></a>G_NORMALIZE_NFC</p></td> <td class="enum_member_description"> <p>another name for <a class="link" href="glib-Unicode-Manipulation.html#G-NORMALIZE-DEFAULT-COMPOSE:CAPS"><code class="literal">G_NORMALIZE_DEFAULT_COMPOSE</code></a></p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-NORMALIZE-ALL:CAPS"></a>G_NORMALIZE_ALL</p></td> <td class="enum_member_description"> <p>beyond <a class="link" href="glib-Unicode-Manipulation.html#G-NORMALIZE-DEFAULT:CAPS"><code class="literal">G_NORMALIZE_DEFAULT</code></a> also standardize the "compatibility" characters in Unicode, such as SUPERSCRIPT THREE to the standard forms (in this case DIGIT THREE). Formatting information may be lost but for most text operations such characters should be considered the same</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-NORMALIZE-NFKD:CAPS"></a>G_NORMALIZE_NFKD</p></td> <td class="enum_member_description"> <p>another name for <a class="link" href="glib-Unicode-Manipulation.html#G-NORMALIZE-ALL:CAPS"><code class="literal">G_NORMALIZE_ALL</code></a></p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-NORMALIZE-ALL-COMPOSE:CAPS"></a>G_NORMALIZE_ALL_COMPOSE</p></td> <td class="enum_member_description"> <p>like <a class="link" href="glib-Unicode-Manipulation.html#G-NORMALIZE-ALL:CAPS"><code class="literal">G_NORMALIZE_ALL</code></a>, but with composed forms rather than a maximally decomposed form</p> </td> <td class="enum_member_annotations"> </td> </tr> <tr> <td class="enum_member_name"><p><a name="G-NORMALIZE-NFKC:CAPS"></a>G_NORMALIZE_NFKC</p></td> <td class="enum_member_description"> <p>another name for <a class="link" href="glib-Unicode-Manipulation.html#G-NORMALIZE-ALL-COMPOSE:CAPS"><code class="literal">G_NORMALIZE_ALL_COMPOSE</code></a></p> </td> <td class="enum_member_annotations"> </td> </tr> </tbody> </table></div> </div> </div> </div> <div class="refsect1"> <a name="glib-Unicode-Manipulation.see-also"></a><h2>See Also</h2> <p>g_locale_to_utf8(), <a class="link" href="glib-Character-Set-Conversion.html#g-locale-from-utf8" title="g_locale_from_utf8 ()"><code class="function">g_locale_from_utf8()</code></a></p> </div> </div> <div class="footer"> <hr>Generated by GTK-Doc V1.24</div> </body> </html>
imx6uldev/depedency_tools
glib/glib-2.46.2/docs/reference/glib/html/glib-Unicode-Manipulation.html
HTML
mit
232,765
package org.telegram.android.views.dialog; import android.content.Context; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.os.Handler; import android.os.Looper; import android.os.Message; import android.os.SystemClock; import android.text.TextPaint; import android.util.AttributeSet; import android.util.TypedValue; import android.view.View; import android.widget.AbsListView; import android.widget.HeaderViewListAdapter; import android.widget.ListAdapter; import android.widget.ListView; import org.telegram.android.R; import org.telegram.android.TelegramApplication; import org.telegram.android.log.Logger; import org.telegram.android.ui.FontController; import org.telegram.android.ui.TextUtil; /** * Created by ex3ndr on 15.11.13. */ public class ConversationListView extends ListView { private static final String TAG = "ConversationListView"; private static final int DELTA = 26; private static final long ANIMATION_DURATION = 200; private static final int ACTIVATE_DELTA = 50; private static final long UI_TIMEOUT = 900; private TelegramApplication application; private String visibleDate = null; private int formattedVisibleDate = -1; private int timeDivMeasure; private String visibleDateNext = null; private int formattedVisibleDateNext = -1; private int timeDivMeasureNext; private TextPaint timeDivPaint; private Drawable serviceDrawable; private Rect servicePadding; private int offset; private int oldHeight; private long animationTime = 0; private boolean isTimeVisible = false; private Handler handler = new Handler(Looper.getMainLooper()) { @Override public void handleMessage(Message msg) { Logger.d(TAG, "notify"); if (msg.what == 0) { if (isTimeVisible) { isTimeVisible = false; scrollDistance = 0; animationTime = SystemClock.uptimeMillis(); } invalidate(); } else if (msg.what == 1) { isTimeVisible = true; invalidate(); } } }; private int scrollDistance; public ConversationListView(Context context) { super(context); init(); } public ConversationListView(Context context, AttributeSet attrs) { super(context, attrs); init(); } public ConversationListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); init(); } public VisibleViewItem[] dump() { int childCount = getChildCount(); int idCount = 0; int headerCount = 0; for (int i = 0; i < childCount; i++) { int index = getFirstVisiblePosition() + i; long id = getItemIdAtPosition(index); if (id > 0) { idCount++; } else { headerCount++; } } VisibleViewItem[] res = new VisibleViewItem[idCount]; int resIndex = 0; for (int i = 0; i < childCount; i++) { View v = getChildAt(i); int index = getFirstVisiblePosition() + i; long id = getItemIdAtPosition(index); if (id > 0) { int top = ((v == null) ? 0 : v.getTop()) - getPaddingTop(); res[resIndex++] = new VisibleViewItem(index + headerCount, top, id); } } return res; } @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { VisibleViewItem[] items = null; if (changed) { items = dump(); } super.onLayout(changed, l, t, r, b); if (changed) { final int changeDelta = (b - t) - oldHeight; if (changeDelta < 0 && items.length > 0) { final VisibleViewItem item = items[items.length - 1]; setSelectionFromTop(item.getIndex(), item.getTop() + changeDelta); post(new Runnable() { @Override public void run() { setSelectionFromTop(item.getIndex(), item.getTop() + changeDelta); } }); } } oldHeight = b - t; } private void init() { application = (TelegramApplication) getContext().getApplicationContext(); setOnScrollListener(new ScrollListener()); serviceDrawable = getResources().getDrawable(R.drawable.st_bubble_service); servicePadding = new Rect(); serviceDrawable.getPadding(servicePadding); timeDivPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.SUBPIXEL_TEXT_FLAG); timeDivPaint.setTextSize(getSp(15)); timeDivPaint.setColor(0xffFFFFFF); timeDivPaint.setTypeface(FontController.loadTypeface(getContext(), "regular")); } private void drawTime(Canvas canvas, int drawOffset, float alpha, boolean first) { int w = first ? timeDivMeasure : timeDivMeasureNext; serviceDrawable.setAlpha((int) (alpha * 255)); timeDivPaint.setAlpha((int) (alpha * 255)); serviceDrawable.setBounds( getWidth() / 2 - w / 2 - servicePadding.left, getPx(44 - 8) - serviceDrawable.getIntrinsicHeight() + drawOffset, getWidth() / 2 + w / 2 + servicePadding.right, getPx(44 - 8) + drawOffset); serviceDrawable.draw(canvas); canvas.drawText(first ? visibleDate : visibleDateNext, getWidth() / 2 - w / 2, getPx(44 - 17) + drawOffset, timeDivPaint); } @Override public void draw(Canvas canvas) { super.draw(canvas); boolean isAnimated = false; boolean isShown; if (isTimeVisible) { isShown = isTimeVisible; } else { isShown = SystemClock.uptimeMillis() - animationTime < ANIMATION_DURATION; } if (isShown) { float animationRatio = 1.0f; if (SystemClock.uptimeMillis() - animationTime < ANIMATION_DURATION) { isAnimated = true; animationRatio = (SystemClock.uptimeMillis() - animationTime) / ((float) ANIMATION_DURATION); if (animationRatio > 1.0f) { animationRatio = 1.0f; } if (!isTimeVisible) { animationRatio = 1.0f - animationRatio; } } int drawOffset = offset; if (offset == 0) { if (visibleDate != null) { drawTime(canvas, drawOffset, 1.0f * animationRatio, true); } } else { float ratio = Math.min(1.0f, Math.abs(offset / (float) getPx(DELTA))); if (visibleDateNext != null) { drawTime(canvas, drawOffset + getPx(DELTA), ratio * animationRatio, false); } if (visibleDate != null) { drawTime(canvas, drawOffset, (1.0f - ratio) * animationRatio, true); } } } if (isAnimated) { invalidate(); } } protected int getPx(float dp) { return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, getResources().getDisplayMetrics()); } protected int getSp(float sp) { return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, sp, getResources().getDisplayMetrics()); } private class ScrollListener implements OnScrollListener { private int state = SCROLL_STATE_IDLE; private int lastVisibleItem = -1; private int lastTop = 0; private int lastScrollY = -1; @Override public void onScrollStateChanged(AbsListView absListView, int i) { if (i == SCROLL_STATE_FLING || i == SCROLL_STATE_TOUCH_SCROLL) { handler.removeMessages(0); } if (i == SCROLL_STATE_IDLE) { handler.removeMessages(0); handler.sendEmptyMessageDelayed(0, UI_TIMEOUT); } state = i; } @Override public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount, int totalItemCount) { // if (lastScrollY == -1) { // lastScrollY = getScrollY(); // } else if (lastScrollY != getScrollY()) { // lastScrollY = getScrollY(); // application.getImageController().doPause(); // } if (lastVisibleItem == -1 || lastVisibleItem != firstVisibleItem || state == SCROLL_STATE_IDLE) { lastVisibleItem = firstVisibleItem; lastTop = 0; View view = getChildAt(0 + getHeaderViewsCount()); if (view != null) { lastTop = view.getTop(); } } else { View view = getChildAt(0 + getHeaderViewsCount()); if (view != null) { int topDelta = Math.abs(view.getTop() - lastTop); lastTop = view.getTop(); scrollDistance += topDelta; if (scrollDistance > getPx(ACTIVATE_DELTA) && !isTimeVisible) { isTimeVisible = true; animationTime = SystemClock.uptimeMillis(); handler.removeMessages(0); } } } // handler.removeMessages(0); ListAdapter adapter = getAdapter(); if (adapter instanceof HeaderViewListAdapter) { adapter = ((HeaderViewListAdapter) adapter).getWrappedAdapter(); } if (adapter instanceof ConversationAdapter) { if (firstVisibleItem == 0) { visibleDate = null; visibleDateNext = null; formattedVisibleDate = -1; formattedVisibleDateNext = -1; View view = getChildAt(1); if (view != null) { offset = Math.min(view.getTop() - getPx(DELTA), 0); if (adapter.getCount() > 0) { int date = ((ConversationAdapter) adapter).getItemDate(0); visibleDateNext = TextUtil.formatDateLong(date); timeDivMeasureNext = (int) timeDivPaint.measureText(visibleDateNext); } } return; } int realFirstVisibleItem = firstVisibleItem - getHeaderViewsCount(); if (realFirstVisibleItem >= 0 && realFirstVisibleItem < adapter.getCount()) { int date = ((ConversationAdapter) adapter).getItemDate(realFirstVisibleItem); int prevDate = date; boolean isSameDays = true; if (realFirstVisibleItem > 0 && realFirstVisibleItem + 2 < adapter.getCount()) { prevDate = ((ConversationAdapter) adapter).getItemDate(realFirstVisibleItem + 1); isSameDays = TextUtil.areSameDays(prevDate, date); } if (isSameDays) { offset = 0; } else { View view = getChildAt(firstVisibleItem - realFirstVisibleItem); if (view != null) { offset = Math.min(view.getTop() - getPx(DELTA), 0); } if (!TextUtil.areSameDays(prevDate, System.currentTimeMillis() / 1000)) { if (!TextUtil.areSameDays(prevDate, formattedVisibleDateNext)) { formattedVisibleDateNext = prevDate; visibleDateNext = TextUtil.formatDateLong(prevDate); timeDivMeasureNext = (int) timeDivPaint.measureText(visibleDateNext); } } else { visibleDateNext = null; formattedVisibleDateNext = -1; } } if (!TextUtil.areSameDays(date, System.currentTimeMillis() / 1000)) { if (!TextUtil.areSameDays(date, formattedVisibleDate)) { formattedVisibleDate = date; visibleDate = TextUtil.formatDateLong(date); timeDivMeasure = (int) timeDivPaint.measureText(visibleDate); } } else { visibleDate = null; formattedVisibleDate = -1; } } } } } }
ex3ndr/telegram
app/src/main/java/org/telegram/android/views/dialog/ConversationListView.java
Java
mit
13,050
/* ----------------------------------------------------------------------------- This source file is part of OGRE (Object-oriented Graphics Rendering Engine) For the latest info, see http://www.ogre3d.org/ Copyright (c) 2000-2014 Torus Knot Software Ltd Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------------- */ #include "OgreOverlay.h" #include "OgreRoot.h" #include "OgreSceneManager.h" #include "OgreOverlayContainer.h" #include "OgreCamera.h" #include "OgreOverlayManager.h" #include "OgreQuaternion.h" #include "OgreVector3.h" namespace Ogre { //--------------------------------------------------------------------- Overlay::Overlay(const String& name) : mName(name), mRotate(0.0f), mScrollX(0.0f), mScrollY(0.0f), mScaleX(1.0f), mScaleY(1.0f), mTransformOutOfDate(true), mTransformUpdated(true), mZOrder(100), mVisible(false), mInitialised(false) { mRootNode = OGRE_NEW SceneNode(NULL); } //--------------------------------------------------------------------- Overlay::~Overlay() { // remove children OGRE_DELETE mRootNode; for (OverlayContainerList::iterator i = m2DElements.begin(); i != m2DElements.end(); ++i) { (*i)->_notifyParent(0, 0); } } //--------------------------------------------------------------------- const String& Overlay::getName(void) const { return mName; } //--------------------------------------------------------------------- void Overlay::assignZOrders() { ushort zorder = static_cast<ushort>(mZOrder * 100.0f); // Notify attached 2D elements OverlayContainerList::iterator i, iend; iend = m2DElements.end(); for (i = m2DElements.begin(); i != iend; ++i) { zorder = (*i)->_notifyZOrder(zorder); } } //--------------------------------------------------------------------- void Overlay::setZOrder(ushort zorder) { // Limit to 650 since this is multiplied by 100 to pad out for containers assert (zorder <= 650 && "Overlay Z-order cannot be greater than 650!"); mZOrder = zorder; assignZOrders(); } //--------------------------------------------------------------------- ushort Overlay::getZOrder(void) const { return (ushort)mZOrder; } //--------------------------------------------------------------------- bool Overlay::isVisible(void) const { return mVisible; } //--------------------------------------------------------------------- void Overlay::show(void) { mVisible = true; if (!mInitialised) { initialise(); } } //--------------------------------------------------------------------- void Overlay::hide(void) { mVisible = false; } //--------------------------------------------------------------------- void Overlay::initialise(void) { OverlayContainerList::iterator i, iend; iend = m2DElements.end(); for (i = m2DElements.begin(); i != m2DElements.end(); ++i) { (*i)->initialise(); } mInitialised = true; } //--------------------------------------------------------------------- void Overlay::add2D(OverlayContainer* cont) { m2DElements.push_back(cont); // Notify parent cont->_notifyParent(0, this); assignZOrders(); Matrix4 xform; _getWorldTransforms(&xform); cont->_notifyWorldTransforms(xform); cont->_notifyViewport(); } //--------------------------------------------------------------------- void Overlay::remove2D(OverlayContainer* cont) { m2DElements.remove(cont); cont->_notifyParent(0, 0); assignZOrders(); } //--------------------------------------------------------------------- void Overlay::add3D(SceneNode* node) { mRootNode->addChild(node); } //--------------------------------------------------------------------- void Overlay::remove3D(SceneNode* node) { mRootNode->removeChild(node->getName()); } //--------------------------------------------------------------------- void Overlay::clear(void) { mRootNode->removeAllChildren(); m2DElements.clear(); // Note no deallocation, memory handled by OverlayManager & SceneManager } //--------------------------------------------------------------------- void Overlay::setScroll(Real x, Real y) { mScrollX = x; mScrollY = y; mTransformOutOfDate = true; mTransformUpdated = true; } //--------------------------------------------------------------------- Real Overlay::getScrollX(void) const { return mScrollX; } //--------------------------------------------------------------------- Real Overlay::getScrollY(void) const { return mScrollY; } //--------------------------------------------------------------------- OverlayContainer* Overlay::getChild(const String& name) { OverlayContainerList::iterator i, iend; iend = m2DElements.end(); for (i = m2DElements.begin(); i != iend; ++i) { if ((*i)->getName() == name) { return *i; } } return NULL; } //--------------------------------------------------------------------- void Overlay::scroll(Real xoff, Real yoff) { mScrollX += xoff; mScrollY += yoff; mTransformOutOfDate = true; mTransformUpdated = true; } //--------------------------------------------------------------------- void Overlay::setRotate(const Radian& angle) { mRotate = angle; mTransformOutOfDate = true; mTransformUpdated = true; } //--------------------------------------------------------------------- void Overlay::rotate(const Radian& angle) { setRotate(mRotate + angle); } //--------------------------------------------------------------------- void Overlay::setScale(Real x, Real y) { mScaleX = x; mScaleY = y; mTransformOutOfDate = true; mTransformUpdated = true; } //--------------------------------------------------------------------- Real Overlay::getScaleX(void) const { return mScaleX; } //--------------------------------------------------------------------- Real Overlay::getScaleY(void) const { return mScaleY; } //--------------------------------------------------------------------- void Overlay::_getWorldTransforms(Matrix4* xform) const { if (mTransformOutOfDate) { updateTransform(); } *xform = mTransform; } //--------------------------------------------------------------------- void Overlay::_findVisibleObjects(Camera* cam, RenderQueue* queue) { OverlayContainerList::iterator i, iend; if (OverlayManager::getSingleton().hasViewportChanged()) { iend = m2DElements.end(); for (i = m2DElements.begin(); i != iend; ++i) { (*i)->_notifyViewport(); } } // update elements if (mTransformUpdated) { Matrix4 xform; _getWorldTransforms(&xform); iend = m2DElements.end(); for (i = m2DElements.begin(); i != iend; ++i) { (*i)->_notifyWorldTransforms(xform); } mTransformUpdated = false; } if (mVisible) { // Add 3D elements mRootNode->setPosition(cam->getDerivedPosition()); mRootNode->setOrientation(cam->getDerivedOrientation()); mRootNode->_update(true, false); // Set up the default queue group for the objects about to be added uint8 oldgrp = queue->getDefaultQueueGroup(); ushort oldPriority = queue-> getDefaultRenderablePriority(); queue->setDefaultQueueGroup(RENDER_QUEUE_OVERLAY); queue->setDefaultRenderablePriority(static_cast<ushort>((mZOrder*100)-1)); mRootNode->_findVisibleObjects(cam, queue, NULL, true, false); // Reset the group queue->setDefaultQueueGroup(oldgrp); queue->setDefaultRenderablePriority(oldPriority); // Add 2D elements iend = m2DElements.end(); for (i = m2DElements.begin(); i != iend; ++i) { (*i)->_update(); (*i)->_updateRenderQueue(queue); } } } //--------------------------------------------------------------------- void Overlay::updateTransform(void) const { // Ordering: // 1. Scale // 2. Rotate // 3. Translate Radian orientationRotation = Radian(0); #if OGRE_NO_VIEWPORT_ORIENTATIONMODE == 0 orientationRotation = Radian(OverlayManager::getSingleton().getViewportOrientationMode() * Math::HALF_PI); #endif Matrix3 rot3x3, scale3x3; rot3x3.FromEulerAnglesXYZ(Radian(0), Radian(0), mRotate + orientationRotation); scale3x3 = Matrix3::ZERO; scale3x3[0][0] = mScaleX; scale3x3[1][1] = mScaleY; scale3x3[2][2] = 1.0f; mTransform = Matrix4::IDENTITY; mTransform = rot3x3 * scale3x3; mTransform.setTrans(Vector3(mScrollX, mScrollY, 0)); mTransformOutOfDate = false; } //--------------------------------------------------------------------- OverlayElement* Overlay::findElementAt(Real x, Real y) { OverlayElement* ret = NULL; int currZ = -1; OverlayContainerList::iterator i, iend; iend = m2DElements.end(); for (i = m2DElements.begin(); i != iend; ++i) { int z = (*i)->getZOrder(); if (z > currZ) { OverlayElement* elementFound = (*i)->findElementAt(x,y); if(elementFound) { currZ = elementFound->getZOrder(); ret = elementFound; } } } return ret; } }
xsilium-frameworks/xsilium-engine
Library/Ogre/Components/Overlay/src/OgreOverlay.cpp
C++
mit
11,191
#pragma once #include <GLUL/Config.h> #include <GLUL/Input/Event.h> #include <GLUL/Input/Types.h> #include <glm/vec2.hpp> namespace GLUL { namespace Input { class GLUL_API MouseButtonEvent : public Event { public: MouseButtonEvent(); MouseButtonEvent(MouseButton button, Action action, float x, float y); MouseButtonEvent(MouseButton button, Action action, const glm::vec2& position); float getX() const; float getY() const; const glm::vec2& getPosition() const; MouseButton getMouseButton() const; Action getAction() const; void setX(float x); void setY(float y); void setPosition(const glm::vec2& position); void setMouseButton(MouseButton button); void setAction(Action action); public: MouseButtonEvent* asMouseButtonEvent(); const MouseButtonEvent* asMouseButtonEvent() const; private: void _abstract() { } MouseButton _button; Action _action; glm::vec2 _position; }; } }
RippeR37/GLUL
include/GLUL/Input/EventTypes/MouseButtonEvent.h
C
mit
1,287
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>FreeType-2.5.0 API Reference</title> <style type="text/css"> body { font-family: Verdana, Geneva, Arial, Helvetica, serif; color: #000000; background: #FFFFFF; } p { text-align: justify; } h1 { text-align: center; } li { text-align: justify; } td { padding: 0 0.5em 0 0.5em; } td.left { padding: 0 0.5em 0 0.5em; text-align: left; } a:link { color: #0000EF; } a:visited { color: #51188E; } a:hover { color: #FF0000; } span.keyword { font-family: monospace; text-align: left; white-space: pre; color: darkblue; } pre.colored { color: blue; } ul.empty { list-style-type: none; } </style> </head> <body> <table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td> <td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> <center><h1>FreeType-2.5.0 API Reference</h1></center> <center><h1> LCD Filtering </h1></center> <h2>Synopsis</h2> <table align=center cellspacing=5 cellpadding=0 border=0> <tr><td></td><td><a href="#FT_LcdFilter">FT_LcdFilter</a></td><td></td><td><a href="#FT_Library_SetLcdFilterWeights">FT_Library_SetLcdFilterWeights</a></td></tr> <tr><td></td><td><a href="#FT_Library_SetLcdFilter">FT_Library_SetLcdFilter</a></td><td></td><td></td></tr> </table><br><br> <table align=center width="87%"><tr><td> <p>The <a href="ft2-lcd_filtering.html#FT_Library_SetLcdFilter">FT_Library_SetLcdFilter</a> API can be used to specify a low-pass filter which is then applied to LCD-optimized bitmaps generated through <a href="ft2-base_interface.html#FT_Render_Glyph">FT_Render_Glyph</a>. This is useful to reduce color fringes which would occur with unfiltered rendering.</p> <p>Note that no filter is active by default, and that this function is <b>not</b> implemented in default builds of the library. You need to #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING in your &lsquo;ftoption.h&rsquo; file in order to activate it.</p> <p>FreeType generates alpha coverage maps, which are linear by nature. For instance, the value 0x80 in bitmap representation means that (within numerical precision) 0x80/0xff fraction of that pixel is covered by the glyph's outline. The blending function for placing text over a background is</p> <pre class="colored"> dst = alpha * src + (1 - alpha) * dst , </pre> <p>which is known as OVER. However, when calculating the output of the OVER operator, the source colors should first be transformed to a linear color space, then alpha blended in that space, and transformed back to the output color space.</p> <p>When linear light blending is used, the default FIR5 filtering weights (as given by FT_LCD_FILTER_DEFAULT) are no longer optimal, as they have been designed for black on white rendering while lacking gamma correction. To preserve color neutrality, weights for a FIR5 filter should be chosen according to two free parameters &lsquo;a&rsquo; and &lsquo;c&rsquo;, and the FIR weights should be</p> <pre class="colored"> [a - c, a + c, 2 * a, a + c, a - c] . </pre> <p>This formula generates equal weights for all the color primaries across the filter kernel, which makes it colorless. One suggested set of weights is</p> <pre class="colored"> [0x10, 0x50, 0x60, 0x50, 0x10] , </pre> <p>where &lsquo;a&rsquo; has value 0x30 and &lsquo;b&rsquo; value 0x20. The weights in filter may have a sum larger than 0x100, which increases coloration slightly but also improves contrast.</p> </td></tr></table><br> <table align=center width="75%"><tr><td> <h4><a name="FT_LcdFilter">FT_LcdFilter</a></h4> <table align=center width="87%"><tr><td> Defined in FT_LCD_FILTER_H (freetype/ftlcdfil.h). </td></tr></table><br> <table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre> <span class="keyword">typedef</span> <span class="keyword">enum</span> FT_LcdFilter_ { <a href="ft2-lcd_filtering.html#FT_LcdFilter">FT_LCD_FILTER_NONE</a> = 0, <a href="ft2-lcd_filtering.html#FT_LcdFilter">FT_LCD_FILTER_DEFAULT</a> = 1, <a href="ft2-lcd_filtering.html#FT_LcdFilter">FT_LCD_FILTER_LIGHT</a> = 2, <a href="ft2-lcd_filtering.html#FT_LcdFilter">FT_LCD_FILTER_LEGACY</a> = 16, FT_LCD_FILTER_MAX /* do not remove */ } <b>FT_LcdFilter</b>; </pre></table><br> <table align=center width="87%"><tr><td> <p>A list of values to identify various types of LCD filters.</p> </td></tr></table><br> <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>values</b></em></td></tr><tr><td> <p></p> <table cellpadding=3 border=0> <tr valign=top><td><b>FT_LCD_FILTER_NONE</b></td><td> <p>Do not perform filtering. When used with subpixel rendering, this results in sometimes severe color fringes.</p> </td></tr> <tr valign=top><td><b>FT_LCD_FILTER_DEFAULT</b></td><td> <p>The default filter reduces color fringes considerably, at the cost of a slight blurriness in the output.</p> </td></tr> <tr valign=top><td><b>FT_LCD_FILTER_LIGHT</b></td><td> <p>The light filter is a variant that produces less blurriness at the cost of slightly more color fringes than the default one. It might be better, depending on taste, your monitor, or your personal vision.</p> </td></tr> <tr valign=top><td><b>FT_LCD_FILTER_LEGACY</b></td><td> <p>This filter corresponds to the original libXft color filter. It provides high contrast output but can exhibit really bad color fringes if glyphs are not extremely well hinted to the pixel grid. In other words, it only works well if the TrueType bytecode interpreter is enabled <b>and</b> high-quality hinted fonts are used.</p> <p>This filter is only provided for comparison purposes, and might be disabled or stay unsupported in the future.</p> </td></tr> </table> </td></tr></table> <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>since</b></em></td></tr><tr><td> <p>2.3.0</p> </td></tr></table> </td></tr></table> <hr width="75%"> <table align=center width="75%"><tr><td><font size=-2>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td> <td><font size=-2>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> <table align=center width="75%"><tr><td> <h4><a name="FT_Library_SetLcdFilter">FT_Library_SetLcdFilter</a></h4> <table align=center width="87%"><tr><td> Defined in FT_LCD_FILTER_H (freetype/ftlcdfil.h). </td></tr></table><br> <table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre> FT_EXPORT( <a href="ft2-basic_types.html#FT_Error">FT_Error</a> ) <b>FT_Library_SetLcdFilter</b>( <a href="ft2-base_interface.html#FT_Library">FT_Library</a> library, <a href="ft2-lcd_filtering.html#FT_LcdFilter">FT_LcdFilter</a> filter ); </pre></table><br> <table align=center width="87%"><tr><td> <p>This function is used to apply color filtering to LCD decimated bitmaps, like the ones used when calling <a href="ft2-base_interface.html#FT_Render_Glyph">FT_Render_Glyph</a> with <a href="ft2-base_interface.html#FT_Render_Mode">FT_RENDER_MODE_LCD</a> or <a href="ft2-base_interface.html#FT_Render_Mode">FT_RENDER_MODE_LCD_V</a>.</p> </td></tr></table><br> <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td> <p></p> <table cellpadding=3 border=0> <tr valign=top><td><b>library</b></td><td> <p>A handle to the target library instance.</p> </td></tr> <tr valign=top><td><b>filter</b></td><td> <p>The filter type.</p> <p>You can use <a href="ft2-lcd_filtering.html#FT_LcdFilter">FT_LCD_FILTER_NONE</a> here to disable this feature, or <a href="ft2-lcd_filtering.html#FT_LcdFilter">FT_LCD_FILTER_DEFAULT</a> to use a default filter that should work well on most LCD screens.</p> </td></tr> </table> </td></tr></table> <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>return</b></em></td></tr><tr><td> <p>FreeType error code. 0&nbsp;means success.</p> </td></tr></table> <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>note</b></em></td></tr><tr><td> <p>This feature is always disabled by default. Clients must make an explicit call to this function with a &lsquo;filter&rsquo; value other than <a href="ft2-lcd_filtering.html#FT_LcdFilter">FT_LCD_FILTER_NONE</a> in order to enable it.</p> <p>Due to <b>PATENTS</b> covering subpixel rendering, this function doesn't do anything except returning &lsquo;FT_Err_Unimplemented_Feature&rsquo; if the configuration macro FT_CONFIG_OPTION_SUBPIXEL_RENDERING is not defined in your build of the library, which should correspond to all default builds of FreeType.</p> <p>The filter affects glyph bitmaps rendered through <a href="ft2-base_interface.html#FT_Render_Glyph">FT_Render_Glyph</a>, <a href="ft2-outline_processing.html#FT_Outline_Get_Bitmap">FT_Outline_Get_Bitmap</a>, <a href="ft2-base_interface.html#FT_Load_Glyph">FT_Load_Glyph</a>, and <a href="ft2-base_interface.html#FT_Load_Char">FT_Load_Char</a>.</p> <p>It does <i>not</i> affect the output of <a href="ft2-outline_processing.html#FT_Outline_Render">FT_Outline_Render</a> and <a href="ft2-outline_processing.html#FT_Outline_Get_Bitmap">FT_Outline_Get_Bitmap</a>.</p> <p>If this feature is activated, the dimensions of LCD glyph bitmaps are either larger or taller than the dimensions of the corresponding outline with regards to the pixel grid. For example, for <a href="ft2-base_interface.html#FT_Render_Mode">FT_RENDER_MODE_LCD</a>, the filter adds up to 3&nbsp;pixels to the left, and up to 3&nbsp;pixels to the right.</p> <p>The bitmap offset values are adjusted correctly, so clients shouldn't need to modify their layout and glyph positioning code when enabling the filter.</p> </td></tr></table> <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>since</b></em></td></tr><tr><td> <p>2.3.0</p> </td></tr></table> </td></tr></table> <hr width="75%"> <table align=center width="75%"><tr><td><font size=-2>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td> <td><font size=-2>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> <table align=center width="75%"><tr><td> <h4><a name="FT_Library_SetLcdFilterWeights">FT_Library_SetLcdFilterWeights</a></h4> <table align=center width="87%"><tr><td> Defined in FT_LCD_FILTER_H (freetype/ftlcdfil.h). </td></tr></table><br> <table align=center width="87%"><tr bgcolor="#D6E8FF"><td><pre> FT_EXPORT( <a href="ft2-basic_types.html#FT_Error">FT_Error</a> ) <b>FT_Library_SetLcdFilterWeights</b>( <a href="ft2-base_interface.html#FT_Library">FT_Library</a> library, <span class="keyword">unsigned</span> <span class="keyword">char</span> *weights ); </pre></table><br> <table align=center width="87%"><tr><td> <p>Use this function to override the filter weights selected by <a href="ft2-lcd_filtering.html#FT_Library_SetLcdFilter">FT_Library_SetLcdFilter</a>. By default, FreeType uses the quintuple (0x00, 0x55, 0x56, 0x55, 0x00) for FT_LCD_FILTER_LIGHT, and (0x10, 0x40, 0x70, 0x40, 0x10) for FT_LCD_FILTER_DEFAULT and FT_LCD_FILTER_LEGACY.</p> </td></tr></table><br> <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>input</b></em></td></tr><tr><td> <p></p> <table cellpadding=3 border=0> <tr valign=top><td><b>library</b></td><td> <p>A handle to the target library instance.</p> </td></tr> <tr valign=top><td><b>weights</b></td><td> <p>A pointer to an array; the function copies the first five bytes and uses them to specify the filter weights.</p> </td></tr> </table> </td></tr></table> <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>return</b></em></td></tr><tr><td> <p>FreeType error code. 0&nbsp;means success.</p> </td></tr></table> <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>note</b></em></td></tr><tr><td> <p>Due to <b>PATENTS</b> covering subpixel rendering, this function doesn't do anything except returning &lsquo;FT_Err_Unimplemented_Feature&rsquo; if the configuration macro FT_CONFIG_OPTION_SUBPIXEL_RENDERING is not defined in your build of the library, which should correspond to all default builds of FreeType.</p> <p>This function must be called after <a href="ft2-lcd_filtering.html#FT_Library_SetLcdFilter">FT_Library_SetLcdFilter</a> to have any effect.</p> </td></tr></table> <table align=center width="87%" cellpadding=5><tr bgcolor="#EEEEFF"><td><em><b>since</b></em></td></tr><tr><td> <p>2.4.0</p> </td></tr></table> </td></tr></table> <hr width="75%"> <table align=center width="75%"><tr><td><font size=-2>[<a href="ft2-index.html">Index</a>]</font></td> <td width="100%"></td> <td><font size=-2>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table> </body> </html>
GlenDC/StarEngine
libs/freetype-2.5.0.1/docs/reference/ft2-lcd_filtering.html
HTML
mit
13,164
/* Highcharts JS v8.2.2 (2020-10-22) (c) 2016-2019 Highsoft AS Authors: Jon Arild Nygard License: www.highcharts.com/license */ (function(b){"object"===typeof module&&module.exports?(b["default"]=b,module.exports=b):"function"===typeof define&&define.amd?define("highcharts/modules/sunburst",["highcharts"],function(q){b(q);b.Highcharts=q;return b}):b("undefined"!==typeof Highcharts?Highcharts:void 0)})(function(b){function q(b,d,p,D){b.hasOwnProperty(d)||(b[d]=D.apply(null,p))}b=b?b._modules:{};q(b,"Mixins/DrawPoint.js",[],function(){var b=function(b){return"function"===typeof b},d=function(p){var d,u=this,l=u.graphic,w=p.animatableAttribs, A=p.onComplete,g=p.css,k=p.renderer,V=null===(d=u.series)||void 0===d?void 0:d.options.animation;if(u.shouldDraw())l||(u.graphic=l=k[p.shapeType](p.shapeArgs).add(p.group)),l.css(g).attr(p.attribs).animate(w,p.isNew?!1:V,A);else if(l){var H=function(){u.graphic=l=l.destroy();b(A)&&A()};Object.keys(w).length?l.animate(w,void 0,function(){H()}):H()}};return{draw:d,drawPoint:function(b){(b.attribs=b.attribs||{})["class"]=this.getClassName();d.call(this,b)},isFn:b}});q(b,"Mixins/TreeSeries.js",[b["Core/Color/Color.js"], b["Core/Utilities.js"]],function(b,d){var p=d.extend,D=d.isArray,u=d.isNumber,l=d.isObject,w=d.merge,A=d.pick;return{getColor:function(g,k){var l=k.index,d=k.mapOptionsToLevel,p=k.parentColor,u=k.parentColorIndex,K=k.series,C=k.colors,I=k.siblings,r=K.points,w=K.chart.options.chart,B;if(g){r=r[g.i];g=d[g.level]||{};if(d=r&&g.colorByPoint){var D=r.index%(C?C.length:w.colorCount);var L=C&&C[D]}if(!K.chart.styledMode){C=r&&r.options.color;w=g&&g.color;if(B=p)B=(B=g&&g.colorVariation)&&"brightness"=== B.key?b.parse(p).brighten(l/I*B.to).get():p;B=A(C,w,L,B,K.color)}var q=A(r&&r.options.colorIndex,g&&g.colorIndex,D,u,k.colorIndex)}return{color:B,colorIndex:q}},getLevelOptions:function(b){var k=null;if(l(b)){k={};var d=u(b.from)?b.from:1;var g=b.levels;var A={};var q=l(b.defaults)?b.defaults:{};D(g)&&(A=g.reduce(function(b,k){if(l(k)&&u(k.level)){var g=w({},k);var r="boolean"===typeof g.levelIsConstant?g.levelIsConstant:q.levelIsConstant;delete g.levelIsConstant;delete g.level;k=k.level+(r?0:d-1); l(b[k])?p(b[k],g):b[k]=g}return b},{}));g=u(b.to)?b.to:1;for(b=0;b<=g;b++)k[b]=w({},q,l(A[b])?A[b]:{})}return k},setTreeValues:function H(b,d){var k=d.before,l=d.idRoot,u=d.mapIdToNode[l],C=d.points[b.i],w=C&&C.options||{},r=0,q=[];p(b,{levelDynamic:b.level-(("boolean"===typeof d.levelIsConstant?d.levelIsConstant:1)?0:u.level),name:A(C&&C.name,""),visible:l===b.id||("boolean"===typeof d.visible?d.visible:!1)});"function"===typeof k&&(b=k(b,d));b.children.forEach(function(k,l){var u=p({},d);p(u,{index:l, siblings:b.children.length,visible:b.visible});k=H(k,u);q.push(k);k.visible&&(r+=k.val)});b.visible=0<r||b.visible;k=A(w.value,r);p(b,{children:q,childrenTotal:r,isLeaf:b.visible&&!r,val:k});return b},updateRootId:function(b){if(l(b)){var d=l(b.options)?b.options:{};d=A(b.rootNode,d.rootId,"");l(b.userOptions)&&(b.userOptions.rootId=d);b.rootNode=d}return d}}});q(b,"Mixins/ColorMapSeries.js",[b["Core/Globals.js"],b["Core/Series/Point.js"],b["Core/Utilities.js"]],function(b,d,p){var q=p.defined;return{colorMapPointMixin:{dataLabelOnNull:!0, isValid:function(){return null!==this.value&&Infinity!==this.value&&-Infinity!==this.value},setState:function(b){d.prototype.setState.call(this,b);this.graphic&&this.graphic.attr({zIndex:"hover"===b?1:0})}},colorMapSeriesMixin:{pointArrayMap:["value"],axisTypes:["xAxis","yAxis","colorAxis"],trackerGroups:["group","markerGroup","dataLabelsGroup"],getSymbol:b.noop,parallelArrays:["x","y","value"],colorKey:"value",pointAttribs:b.seriesTypes.column.prototype.pointAttribs,colorAttribs:function(b){var d= {};q(b.color)&&(d[this.colorProp||"fill"]=b.color);return d}}}});q(b,"Series/TreemapSeries.js",[b["Core/Series/Series.js"],b["Core/Color/Color.js"],b["Mixins/ColorMapSeries.js"],b["Mixins/DrawPoint.js"],b["Core/Globals.js"],b["Mixins/LegendSymbol.js"],b["Core/Series/Point.js"],b["Mixins/TreeSeries.js"],b["Core/Utilities.js"]],function(b,d,p,q,u,l,w,A,g){var k=b.seriesTypes,D=d.parse,H=p.colorMapSeriesMixin;d=u.noop;var Q=A.getColor,N=A.getLevelOptions,K=A.updateRootId,C=g.addEvent,I=g.correctFloat, r=g.defined,R=g.error,B=g.extend,S=g.fireEvent,L=g.isArray,O=g.isNumber,P=g.isObject,M=g.isString,J=g.merge,T=g.objectEach,f=g.pick,h=g.stableSort,t=u.Series,y=function(a,c,e){e=e||this;T(a,function(b,m){c.call(e,b,m,a)})},E=function(a,c,e){e=e||this;a=c.call(e,a);!1!==a&&E(a,c,e)},n=!1;b.seriesType("treemap","scatter",{allowTraversingTree:!1,animationLimit:250,showInLegend:!1,marker:void 0,colorByPoint:!1,dataLabels:{defer:!1,enabled:!0,formatter:function(){var a=this&&this.point?this.point:{};return M(a.name)? a.name:""},inside:!0,verticalAlign:"middle"},tooltip:{headerFormat:"",pointFormat:"<b>{point.name}</b>: {point.value}<br/>"},ignoreHiddenPoint:!0,layoutAlgorithm:"sliceAndDice",layoutStartingDirection:"vertical",alternateStartingDirection:!1,levelIsConstant:!0,drillUpButton:{position:{align:"right",x:-10,y:10}},traverseUpButton:{position:{align:"right",x:-10,y:10}},borderColor:"#e6e6e6",borderWidth:1,colorKey:"colorValue",opacity:.15,states:{hover:{borderColor:"#999999",brightness:k.heatmap?0:.1, halo:!1,opacity:.75,shadow:!1}}},{pointArrayMap:["value"],directTouch:!0,optionalAxis:"colorAxis",getSymbol:d,parallelArrays:["x","y","value","colorValue"],colorKey:"colorValue",trackerGroups:["group","dataLabelsGroup"],getListOfParents:function(a,c){a=L(a)?a:[];var e=L(c)?c:[];c=a.reduce(function(a,c,e){c=f(c.parent,"");"undefined"===typeof a[c]&&(a[c]=[]);a[c].push(e);return a},{"":[]});y(c,function(a,c,b){""!==c&&-1===e.indexOf(c)&&(a.forEach(function(a){b[""].push(a)}),delete b[c])});return c}, getTree:function(){var a=this.data.map(function(a){return a.id});a=this.getListOfParents(this.data,a);this.nodeMap={};return this.buildNode("",-1,0,a)},hasData:function(){return!!this.processedXData.length},init:function(a,c){H&&(this.colorAttribs=H.colorAttribs);var e=C(this,"setOptions",function(a){a=a.userOptions;r(a.allowDrillToNode)&&!r(a.allowTraversingTree)&&(a.allowTraversingTree=a.allowDrillToNode,delete a.allowDrillToNode);r(a.drillUpButton)&&!r(a.traverseUpButton)&&(a.traverseUpButton= a.drillUpButton,delete a.drillUpButton)});t.prototype.init.call(this,a,c);delete this.opacity;this.eventsToUnbind.push(e);this.options.allowTraversingTree&&this.eventsToUnbind.push(C(this,"click",this.onClickDrillToNode))},buildNode:function(a,c,e,b,m){var f=this,x=[],h=f.points[c],d=0,F;(b[a]||[]).forEach(function(c){F=f.buildNode(f.points[c].id,c,e+1,b,a);d=Math.max(F.height+1,d);x.push(F)});c={id:a,i:c,children:x,height:d,level:e,parent:m,visible:!1};f.nodeMap[c.id]=c;h&&(h.node=c);return c},setTreeValues:function(a){var c= this,e=c.options,b=c.nodeMap[c.rootNode];e="boolean"===typeof e.levelIsConstant?e.levelIsConstant:!0;var m=0,U=[],v=c.points[a.i];a.children.forEach(function(a){a=c.setTreeValues(a);U.push(a);a.ignore||(m+=a.val)});h(U,function(a,c){return(a.sortIndex||0)-(c.sortIndex||0)});var d=f(v&&v.options.value,m);v&&(v.value=d);B(a,{children:U,childrenTotal:m,ignore:!(f(v&&v.visible,!0)&&0<d),isLeaf:a.visible&&!m,levelDynamic:a.level-(e?0:b.level),name:f(v&&v.name,""),sortIndex:f(v&&v.sortIndex,-d),val:d}); return a},calculateChildrenAreas:function(a,c){var e=this,b=e.options,m=e.mapOptionsToLevel[a.level+1],d=f(e[m&&m.layoutAlgorithm]&&m.layoutAlgorithm,b.layoutAlgorithm),v=b.alternateStartingDirection,h=[];a=a.children.filter(function(a){return!a.ignore});m&&m.layoutStartingDirection&&(c.direction="vertical"===m.layoutStartingDirection?0:1);h=e[d](c,a);a.forEach(function(a,b){b=h[b];a.values=J(b,{val:a.childrenTotal,direction:v?1-c.direction:c.direction});a.pointValues=J(b,{x:b.x/e.axisRatio,y:100- b.y-b.height,width:b.width/e.axisRatio});a.children.length&&e.calculateChildrenAreas(a,a.values)})},setPointValues:function(){var a=this,c=a.xAxis,e=a.yAxis,b=a.chart.styledMode;a.points.forEach(function(f){var m=f.node,x=m.pointValues;m=m.visible;if(x&&m){m=x.height;var d=x.width,h=x.x,t=x.y,n=b?0:(a.pointAttribs(f)["stroke-width"]||0)%2/2;x=Math.round(c.toPixels(h,!0))-n;d=Math.round(c.toPixels(h+d,!0))-n;h=Math.round(e.toPixels(t,!0))-n;m=Math.round(e.toPixels(t+m,!0))-n;f.shapeArgs={x:Math.min(x, d),y:Math.min(h,m),width:Math.abs(d-x),height:Math.abs(m-h)};f.plotX=f.shapeArgs.x+f.shapeArgs.width/2;f.plotY=f.shapeArgs.y+f.shapeArgs.height/2}else delete f.plotX,delete f.plotY})},setColorRecursive:function(a,c,e,b,f){var m=this,x=m&&m.chart;x=x&&x.options&&x.options.colors;if(a){var d=Q(a,{colors:x,index:b,mapOptionsToLevel:m.mapOptionsToLevel,parentColor:c,parentColorIndex:e,series:m,siblings:f});if(c=m.points[a.i])c.color=d.color,c.colorIndex=d.colorIndex;(a.children||[]).forEach(function(c, e){m.setColorRecursive(c,d.color,d.colorIndex,e,a.children.length)})}},algorithmGroup:function(a,c,e,b){this.height=a;this.width=c;this.plot=b;this.startDirection=this.direction=e;this.lH=this.nH=this.lW=this.nW=this.total=0;this.elArr=[];this.lP={total:0,lH:0,nH:0,lW:0,nW:0,nR:0,lR:0,aspectRatio:function(a,c){return Math.max(a/c,c/a)}};this.addElement=function(a){this.lP.total=this.elArr[this.elArr.length-1];this.total+=a;0===this.direction?(this.lW=this.nW,this.lP.lH=this.lP.total/this.lW,this.lP.lR= this.lP.aspectRatio(this.lW,this.lP.lH),this.nW=this.total/this.height,this.lP.nH=this.lP.total/this.nW,this.lP.nR=this.lP.aspectRatio(this.nW,this.lP.nH)):(this.lH=this.nH,this.lP.lW=this.lP.total/this.lH,this.lP.lR=this.lP.aspectRatio(this.lP.lW,this.lH),this.nH=this.total/this.width,this.lP.nW=this.lP.total/this.nH,this.lP.nR=this.lP.aspectRatio(this.lP.nW,this.nH));this.elArr.push(a)};this.reset=function(){this.lW=this.nW=0;this.elArr=[];this.total=0}},algorithmCalcPoints:function(a,c,e,b){var f, x,d,h,t=e.lW,n=e.lH,g=e.plot,k=0,y=e.elArr.length-1;if(c)t=e.nW,n=e.nH;else var G=e.elArr[e.elArr.length-1];e.elArr.forEach(function(a){if(c||k<y)0===e.direction?(f=g.x,x=g.y,d=t,h=a/d):(f=g.x,x=g.y,h=n,d=a/h),b.push({x:f,y:x,width:d,height:I(h)}),0===e.direction?g.y+=h:g.x+=d;k+=1});e.reset();0===e.direction?e.width-=t:e.height-=n;g.y=g.parent.y+(g.parent.height-e.height);g.x=g.parent.x+(g.parent.width-e.width);a&&(e.direction=1-e.direction);c||e.addElement(G)},algorithmLowAspectRatio:function(a, c,e){var b=[],f=this,d,h={x:c.x,y:c.y,parent:c},t=0,g=e.length-1,n=new this.algorithmGroup(c.height,c.width,c.direction,h);e.forEach(function(e){d=e.val/c.val*c.height*c.width;n.addElement(d);n.lP.nR>n.lP.lR&&f.algorithmCalcPoints(a,!1,n,b,h);t===g&&f.algorithmCalcPoints(a,!0,n,b,h);t+=1});return b},algorithmFill:function(a,c,e){var b=[],f,d=c.direction,h=c.x,t=c.y,n=c.width,g=c.height,k,y,l,G;e.forEach(function(e){f=e.val/c.val*c.height*c.width;k=h;y=t;0===d?(G=g,l=f/G,n-=l,h+=l):(l=n,G=f/l,g-=G, t+=G);b.push({x:k,y:y,width:l,height:G});a&&(d=1-d)});return b},strip:function(a,c){return this.algorithmLowAspectRatio(!1,a,c)},squarified:function(a,c){return this.algorithmLowAspectRatio(!0,a,c)},sliceAndDice:function(a,c){return this.algorithmFill(!0,a,c)},stripes:function(a,c){return this.algorithmFill(!1,a,c)},translate:function(){var a=this,c=a.options,e=K(a);t.prototype.translate.call(a);var b=a.tree=a.getTree();var f=a.nodeMap[e];a.renderTraverseUpButton(e);a.mapOptionsToLevel=N({from:f.level+ 1,levels:c.levels,to:b.height,defaults:{levelIsConstant:a.options.levelIsConstant,colorByPoint:c.colorByPoint}});""===e||f&&f.children.length||(a.setRootNode("",!1),e=a.rootNode,f=a.nodeMap[e]);E(a.nodeMap[a.rootNode],function(c){var e=!1,b=c.parent;c.visible=!0;if(b||""===b)e=a.nodeMap[b];return e});E(a.nodeMap[a.rootNode].children,function(a){var c=!1;a.forEach(function(a){a.visible=!0;a.children.length&&(c=(c||[]).concat(a.children))});return c});a.setTreeValues(b);a.axisRatio=a.xAxis.len/a.yAxis.len; a.nodeMap[""].pointValues=e={x:0,y:0,width:100,height:100};a.nodeMap[""].values=e=J(e,{width:e.width*a.axisRatio,direction:"vertical"===c.layoutStartingDirection?0:1,val:b.val});a.calculateChildrenAreas(b,e);a.colorAxis||c.colorByPoint||a.setColorRecursive(a.tree);c.allowTraversingTree&&(c=f.pointValues,a.xAxis.setExtremes(c.x,c.x+c.width,!1),a.yAxis.setExtremes(c.y,c.y+c.height,!1),a.xAxis.setScale(),a.yAxis.setScale());a.setPointValues()},drawDataLabels:function(){var a=this,c=a.mapOptionsToLevel, e,b;a.points.filter(function(a){return a.node.visible}).forEach(function(f){b=c[f.node.level];e={style:{}};f.node.isLeaf||(e.enabled=!1);b&&b.dataLabels&&(e=J(e,b.dataLabels),a._hasPointLabels=!0);f.shapeArgs&&(e.style.width=f.shapeArgs.width,f.dataLabel&&f.dataLabel.css({width:f.shapeArgs.width+"px"}));f.dlOptions=J(e,f.options.dataLabels)});t.prototype.drawDataLabels.call(this)},alignDataLabel:function(a,c,b){var e=b.style;!r(e.textOverflow)&&c.text&&c.getBBox().width>c.text.textWidth&&c.css({textOverflow:"ellipsis", width:e.width+="px"});k.column.prototype.alignDataLabel.apply(this,arguments);a.dataLabel&&a.dataLabel.attr({zIndex:(a.node.zIndex||0)+1})},pointAttribs:function(a,c){var b=P(this.mapOptionsToLevel)?this.mapOptionsToLevel:{},d=a&&b[a.node.level]||{};b=this.options;var h=c&&b.states[c]||{},t=a&&a.getClassName()||"";a={stroke:a&&a.borderColor||d.borderColor||h.borderColor||b.borderColor,"stroke-width":f(a&&a.borderWidth,d.borderWidth,h.borderWidth,b.borderWidth),dashstyle:a&&a.borderDashStyle||d.borderDashStyle|| h.borderDashStyle||b.borderDashStyle,fill:a&&a.color||this.color};-1!==t.indexOf("highcharts-above-level")?(a.fill="none",a["stroke-width"]=0):-1!==t.indexOf("highcharts-internal-node-interactive")?(c=f(h.opacity,b.opacity),a.fill=D(a.fill).setOpacity(c).get(),a.cursor="pointer"):-1!==t.indexOf("highcharts-internal-node")?a.fill="none":c&&(a.fill=D(a.fill).brighten(h.brightness).get());return a},drawPoints:function(){var a=this,c=a.chart,b=c.renderer,f=c.styledMode,d=a.options,h=f?{}:d.shadow,t=d.borderRadius, n=c.pointCount<d.animationLimit,g=d.allowTraversingTree;a.points.forEach(function(c){var e=c.node.levelDynamic,m={},x={},G={},k="level-group-"+c.node.level,l=!!c.graphic,y=n&&l,E=c.shapeArgs;c.shouldDraw()&&(t&&(x.r=t),J(!0,y?m:x,l?E:{},f?{}:a.pointAttribs(c,c.selected?"select":void 0)),a.colorAttribs&&f&&B(G,a.colorAttribs(c)),a[k]||(a[k]=b.g(k).attr({zIndex:1E3-(e||0)}).add(a.group),a[k].survive=!0));c.draw({animatableAttribs:m,attribs:x,css:G,group:a[k],renderer:b,shadow:h,shapeArgs:E,shapeType:"rect"}); g&&c.graphic&&(c.drillId=d.interactByLeaf?a.drillToByLeaf(c):a.drillToByGroup(c))})},onClickDrillToNode:function(a){var c=(a=a.point)&&a.drillId;M(c)&&(a.setState(""),this.setRootNode(c,!0,{trigger:"click"}))},drillToByGroup:function(a){var c=!1;1!==a.node.level-this.nodeMap[this.rootNode].level||a.node.isLeaf||(c=a.id);return c},drillToByLeaf:function(a){var c=!1;if(a.node.parent!==this.rootNode&&a.node.isLeaf)for(a=a.node;!c;)a=this.nodeMap[a.parent],a.parent===this.rootNode&&(c=a.id);return c}, drillUp:function(){var a=this.nodeMap[this.rootNode];a&&M(a.parent)&&this.setRootNode(a.parent,!0,{trigger:"traverseUpButton"})},drillToNode:function(a,c){R(32,!1,void 0,{"treemap.drillToNode":"use treemap.setRootNode"});this.setRootNode(a,c)},setRootNode:function(a,c,b){a=B({newRootId:a,previousRootId:this.rootNode,redraw:f(c,!0),series:this},b);S(this,"setRootNode",a,function(a){var c=a.series;c.idPreviousRoot=a.previousRootId;c.rootNode=a.newRootId;c.isDirty=!0;a.redraw&&c.chart.redraw()})},renderTraverseUpButton:function(a){var c= this,b=c.options.traverseUpButton,d=f(b.text,c.nodeMap[a].name,"\u25c1 Back");if(""===a||c.is("sunburst")&&1===c.tree.children.length&&a===c.tree.children[0].id)c.drillUpButton&&(c.drillUpButton=c.drillUpButton.destroy());else if(this.drillUpButton)this.drillUpButton.placed=!1,this.drillUpButton.attr({text:d}).align();else{var h=(a=b.theme)&&a.states;this.drillUpButton=this.chart.renderer.button(d,0,0,function(){c.drillUp()},a,h&&h.hover,h&&h.select).addClass("highcharts-drillup-button").attr({align:b.position.align, zIndex:7}).add().align(b.position,!1,b.relativeTo||"plotBox")}},buildKDTree:d,drawLegendSymbol:l.drawRectangle,getExtremes:function(){var a=t.prototype.getExtremes.call(this,this.colorValueData),c=a.dataMax;this.valueMin=a.dataMin;this.valueMax=c;return t.prototype.getExtremes.call(this)},getExtremesFromAll:!0,setState:function(a){this.options.inactiveOtherPoints=!0;t.prototype.setState.call(this,a,!1);this.options.inactiveOtherPoints=!1},utils:{recursive:E}},{draw:q.drawPoint,setVisible:k.pie.prototype.pointClass.prototype.setVisible, getClassName:function(){var a=w.prototype.getClassName.call(this),c=this.series,b=c.options;this.node.level<=c.nodeMap[c.rootNode].level?a+=" highcharts-above-level":this.node.isLeaf||f(b.interactByLeaf,!b.allowTraversingTree)?this.node.isLeaf||(a+=" highcharts-internal-node"):a+=" highcharts-internal-node-interactive";return a},isValid:function(){return!(!this.id&&!O(this.value))},setState:function(a){w.prototype.setState.call(this,a);this.graphic&&this.graphic.attr({zIndex:"hover"===a?1:0})},shouldDraw:function(){return O(this.plotY)&& null!==this.y}});C(u.Series,"afterBindAxes",function(){var a=this.xAxis,c=this.yAxis;if(a&&c)if(this.is("treemap")){var b={endOnTick:!1,gridLineWidth:0,lineWidth:0,min:0,dataMin:0,minPadding:0,max:100,dataMax:100,maxPadding:0,startOnTick:!1,title:null,tickPositions:[]};B(c.options,b);B(a.options,b);n=!0}else n&&(c.setOptions(c.userOptions),a.setOptions(a.userOptions),n=!1)});""});q(b,"Series/SunburstSeries.js",[b["Core/Series/Series.js"],b["Mixins/CenteredSeries.js"],b["Mixins/DrawPoint.js"],b["Core/Globals.js"], b["Mixins/TreeSeries.js"],b["Core/Utilities.js"]],function(b,d,p,q,u,l){var w=b.seriesTypes,A=d.getCenter,g=d.getStartAndEndRadians,k=u.getColor,D=u.getLevelOptions,H=u.setTreeValues,Q=u.updateRootId,N=l.correctFloat,K=l.error,C=l.extend,I=l.isNumber,r=l.isObject,R=l.isString,B=l.merge,S=l.splat,L=q.Series,O=180/Math.PI,P=function(b,d){var f=[];if(I(b)&&I(d)&&b<=d)for(;b<=d;b++)f.push(b);return f},M=function(b,d){d=r(d)?d:{};var f=0,h;if(r(b)){var g=B({},b);b=I(d.from)?d.from:0;var n=I(d.to)?d.to: 0;var a=P(b,n);b=Object.keys(g).filter(function(c){return-1===a.indexOf(+c)});var c=h=I(d.diffRadius)?d.diffRadius:0;a.forEach(function(a){a=g[a];var b=a.levelSize.unit,e=a.levelSize.value;"weight"===b?f+=e:"percentage"===b?(a.levelSize={unit:"pixels",value:e/100*c},h-=a.levelSize.value):"pixels"===b&&(h-=e)});a.forEach(function(a){var c=g[a];"weight"===c.levelSize.unit&&(c=c.levelSize.value,g[a].levelSize={unit:"pixels",value:c/f*h})});b.forEach(function(a){g[a].levelSize={value:0,unit:"pixels"}})}return g}, J=function(b){var f=b.level;return{from:0<f?f:1,to:f+b.height}},T=function(b,d){var f=d.mapIdToNode[b.parent],h=d.series,g=h.chart,n=h.points[b.i];f=k(b,{colors:h.options.colors||g&&g.options.colors,colorIndex:h.colorIndex,index:d.index,mapOptionsToLevel:d.mapOptionsToLevel,parentColor:f&&f.color,parentColorIndex:f&&f.colorIndex,series:d.series,siblings:d.siblings});b.color=f.color;b.colorIndex=f.colorIndex;n&&(n.color=b.color,n.colorIndex=b.colorIndex,b.sliced=b.id!==d.idRoot?n.sliced:!1);return b}; d={drawDataLabels:q.noop,drawPoints:function(){var b=this,d=b.mapOptionsToLevel,g=b.shapeRoot,k=b.group,l=b.hasRendered,n=b.rootNode,a=b.idPreviousRoot,c=b.nodeMap,e=c[a],x=e&&e.shapeArgs;e=b.points;var m=b.startAndEndRadians,p=b.chart,v=p&&p.options&&p.options.chart||{},u="boolean"===typeof v.animation?v.animation:!0,q=b.center[3]/2,A=b.chart.renderer,w=!1,D=!1;if(v=!!(u&&l&&n!==a&&b.dataLabelsGroup)){b.dataLabelsGroup.attr({opacity:0});var H=function(){w=!0;b.dataLabelsGroup&&b.dataLabelsGroup.animate({opacity:1, visibility:"visible"})}}e.forEach(function(e){var f=e.node,h=d[f.level];var t=e.shapeExisting||{};var y=f.shapeArgs||{},v=!(!f.visible||!f.shapeArgs);if(l&&u){var E={};var w={end:y.end,start:y.start,innerR:y.innerR,r:y.r,x:y.x,y:y.y};v?!e.graphic&&x&&(E=n===e.id?{start:m.start,end:m.end}:x.end<=y.start?{start:m.end,end:m.end}:{start:m.start,end:m.start},E.innerR=E.r=q):e.graphic&&(a===e.id?w={innerR:q,r:q}:g&&(w=g.end<=t.start?{innerR:q,r:q,start:m.end,end:m.end}:{innerR:q,r:q,start:m.start,end:m.start})); t=E}else w=y,t={};E=[y.plotX,y.plotY];if(!e.node.isLeaf)if(n===e.id){var z=c[n];z=z.parent}else z=e.id;C(e,{shapeExisting:y,tooltipPos:E,drillId:z,name:""+(e.name||e.id||e.index),plotX:y.plotX,plotY:y.plotY,value:f.val,isNull:!v});z=e.options;f=r(y)?y:{};z=r(z)?z.dataLabels:{};h=S(r(h)?h.dataLabels:{})[0];h=B({style:{}},h,z);z=h.rotationMode;if(!I(h.rotation)){if("auto"===z||"circular"===z)if(1>e.innerArcLength&&e.outerArcLength>f.radius){var F=0;e.dataLabelPath&&"circular"===z&&(h.textPath={enabled:!0})}else 1< e.innerArcLength&&e.outerArcLength>1.5*f.radius?"circular"===z?h.textPath={enabled:!0,attributes:{dy:5}}:z="parallel":(e.dataLabel&&e.dataLabel.textPathWrapper&&"circular"===z&&(h.textPath={enabled:!1}),z="perpendicular");"auto"!==z&&"circular"!==z&&(F=f.end-(f.end-f.start)/2);h.style.width="parallel"===z?Math.min(2.5*f.radius,(e.outerArcLength+e.innerArcLength)/2):f.radius;"perpendicular"===z&&e.series.chart.renderer.fontMetrics(h.style.fontSize).h>e.outerArcLength&&(h.style.width=1);h.style.width= Math.max(h.style.width-2*(h.padding||0),1);F=F*O%180;"parallel"===z&&(F-=90);90<F?F-=180:-90>F&&(F+=180);h.rotation=F}h.textPath&&(0===e.shapeExisting.innerR&&h.textPath.enabled?(h.rotation=0,h.textPath.enabled=!1,h.style.width=Math.max(2*e.shapeExisting.r-2*(h.padding||0),1)):e.dlOptions&&e.dlOptions.textPath&&!e.dlOptions.textPath.enabled&&"circular"===z&&(h.textPath.enabled=!0),h.textPath.enabled&&(h.rotation=0,h.style.width=Math.max((e.outerArcLength+e.innerArcLength)/2-2*(h.padding||0),1))); 0===h.rotation&&(h.rotation=.001);e.dlOptions=h;if(!D&&v){D=!0;var G=H}e.draw({animatableAttribs:w,attribs:C(t,!p.styledMode&&b.pointAttribs(e,e.selected&&"select")),onComplete:G,group:k,renderer:A,shapeType:"arc",shapeArgs:y})});v&&D?(b.hasRendered=!1,b.options.dataLabels.defer=!0,L.prototype.drawDataLabels.call(b),b.hasRendered=!0,w&&H()):L.prototype.drawDataLabels.call(b)},pointAttribs:w.column.prototype.pointAttribs,layoutAlgorithm:function(b,d,g){var f=b.start,h=b.end-f,n=b.val,a=b.x,c=b.y,e= g&&r(g.levelSize)&&I(g.levelSize.value)?g.levelSize.value:0,k=b.r,t=k+e,l=g&&I(g.slicedOffset)?g.slicedOffset:0;return(d||[]).reduce(function(b,d){var g=1/n*d.val*h,m=f+g/2,y=a+Math.cos(m)*l;m=c+Math.sin(m)*l;d={x:d.sliced?y:a,y:d.sliced?m:c,innerR:k,r:t,radius:e,start:f,end:f+g};b.push(d);f=d.end;return b},[])},setShapeArgs:function(b,d,g){var f=[],h=g[b.level+1];b=b.children.filter(function(b){return b.visible});f=this.layoutAlgorithm(d,b,h);b.forEach(function(b,a){a=f[a];var c=a.start+(a.end-a.start)/ 2,e=a.innerR+(a.r-a.innerR)/2,d=a.end-a.start;e=0===a.innerR&&6.28<d?{x:a.x,y:a.y}:{x:a.x+Math.cos(c)*e,y:a.y+Math.sin(c)*e};var h=b.val?b.childrenTotal>b.val?b.childrenTotal:b.val:b.childrenTotal;this.points[b.i]&&(this.points[b.i].innerArcLength=d*a.innerR,this.points[b.i].outerArcLength=d*a.r);b.shapeArgs=B(a,{plotX:e.x,plotY:e.y+4*Math.abs(Math.cos(c))});b.values=B(a,{val:h});b.children.length&&this.setShapeArgs(b,b.values,g)},this)},translate:function(){var b=this,d=b.options,k=b.center=A.call(b), l=b.startAndEndRadians=g(d.startAngle,d.endAngle),p=k[3]/2,n=k[2]/2-p,a=Q(b),c=b.nodeMap,e=c&&c[a],q={};b.shapeRoot=e&&e.shapeArgs;L.prototype.translate.call(b);var m=b.tree=b.getTree();b.renderTraverseUpButton(a);c=b.nodeMap;e=c[a];var r=R(e.parent)?e.parent:"";r=c[r];var v=J(e);var u=v.from,w=v.to;v=D({from:u,levels:b.options.levels,to:w,defaults:{colorByPoint:d.colorByPoint,dataLabels:d.dataLabels,levelIsConstant:d.levelIsConstant,levelSize:d.levelSize,slicedOffset:d.slicedOffset}});v=M(v,{diffRadius:n, from:u,to:w});H(m,{before:T,idRoot:a,levelIsConstant:d.levelIsConstant,mapOptionsToLevel:v,mapIdToNode:c,points:b.points,series:b});d=c[""].shapeArgs={end:l.end,r:p,start:l.start,val:e.val,x:k[0],y:k[1]};this.setShapeArgs(r,d,v);b.mapOptionsToLevel=v;b.data.forEach(function(a){q[a.id]&&K(31,!1,b.chart);q[a.id]=!0});q={}},alignDataLabel:function(b,d,g){if(!g.textPath||!g.textPath.enabled)return w.treemap.prototype.alignDataLabel.apply(this,arguments)},animate:function(b){var d=this.chart,f=[d.plotWidth/ 2,d.plotHeight/2],g=d.plotLeft,k=d.plotTop;d=this.group;b?(b={translateX:f[0]+g,translateY:f[1]+k,scaleX:.001,scaleY:.001,rotation:10,opacity:.01},d.attr(b)):(b={translateX:g,translateY:k,scaleX:1,scaleY:1,rotation:0,opacity:1},d.animate(b,this.options.animation))},utils:{calculateLevelSizes:M,getLevelFromAndTo:J,range:P}};p={draw:p.drawPoint,shouldDraw:function(){return!this.isNull},isValid:function(){return!0},getDataLabelPath:function(b){var d=this.series.chart.renderer,f=this.shapeExisting,g= f.start,k=f.end,l=g+(k-g)/2;l=0>l&&l>-Math.PI||l>Math.PI;var a=f.r+(b.options.distance||0);g===-Math.PI/2&&N(k)===N(1.5*Math.PI)&&(g=-Math.PI+Math.PI/360,k=-Math.PI/360,l=!0);if(k-g>Math.PI){l=!1;var c=!0}this.dataLabelPath&&(this.dataLabelPath=this.dataLabelPath.destroy());this.dataLabelPath=d.arc({open:!0,longArc:c?1:0}).add(b);this.dataLabelPath.attr({start:l?g:k,end:l?k:g,clockwise:+l,x:f.x,y:f.y,r:(a+f.innerR)/2});return this.dataLabelPath}};"";b.seriesType("sunburst","treemap",{center:["50%", "50%"],colorByPoint:!1,opacity:1,dataLabels:{allowOverlap:!0,defer:!0,rotationMode:"auto",style:{textOverflow:"ellipsis"}},rootId:void 0,levelIsConstant:!0,levelSize:{value:1,unit:"weight"},slicedOffset:10},d,p)});q(b,"masters/modules/sunburst.src.js",[],function(){})}); //# sourceMappingURL=sunburst.js.map
cdnjs/cdnjs
ajax/libs/highcharts/8.2.2/modules/sunburst.js
JavaScript
mit
25,544
import _extends from "@babel/runtime/helpers/esm/extends"; import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"; import * as React from 'react'; import PropTypes from 'prop-types'; import { Transition } from 'react-transition-group'; import useTheme from '../styles/useTheme'; import { reflow, getTransitionProps } from '../transitions/utils'; import useForkRef from '../utils/useForkRef'; function getScale(value) { return `scale(${value}, ${value ** 2})`; } const styles = { entering: { opacity: 1, transform: getScale(1) }, entered: { opacity: 1, transform: 'none' } }; /** * The Grow transition is used by the [Tooltip](/components/tooltips/) and * [Popover](/components/popover/) components. * It uses [react-transition-group](https://github.com/reactjs/react-transition-group) internally. */ const Grow = React.forwardRef(function Grow(props, ref) { const { children, in: inProp, onEnter, onExit, style, timeout = 'auto' } = props, other = _objectWithoutPropertiesLoose(props, ["children", "in", "onEnter", "onExit", "style", "timeout"]); const timer = React.useRef(); const autoTimeout = React.useRef(); const handleRef = useForkRef(children.ref, ref); const theme = useTheme(); const handleEnter = (node, isAppearing) => { reflow(node); // So the animation always start from the start. const { duration: transitionDuration, delay } = getTransitionProps({ style, timeout }, { mode: 'enter' }); let duration; if (timeout === 'auto') { duration = theme.transitions.getAutoHeightDuration(node.clientHeight); autoTimeout.current = duration; } else { duration = transitionDuration; } node.style.transition = [theme.transitions.create('opacity', { duration, delay }), theme.transitions.create('transform', { duration: duration * 0.666, delay })].join(','); if (onEnter) { onEnter(node, isAppearing); } }; const handleExit = node => { const { duration: transitionDuration, delay } = getTransitionProps({ style, timeout }, { mode: 'exit' }); let duration; if (timeout === 'auto') { duration = theme.transitions.getAutoHeightDuration(node.clientHeight); autoTimeout.current = duration; } else { duration = transitionDuration; } node.style.transition = [theme.transitions.create('opacity', { duration, delay }), theme.transitions.create('transform', { duration: duration * 0.666, delay: delay || duration * 0.333 })].join(','); node.style.opacity = '0'; node.style.transform = getScale(0.75); if (onExit) { onExit(node); } }; const addEndListener = (_, next) => { if (timeout === 'auto') { timer.current = setTimeout(next, autoTimeout.current || 0); } }; React.useEffect(() => { return () => { clearTimeout(timer.current); }; }, []); return /*#__PURE__*/React.createElement(Transition, _extends({ appear: true, in: inProp, onEnter: handleEnter, onExit: handleExit, addEndListener: addEndListener, timeout: timeout === 'auto' ? null : timeout }, other), (state, childProps) => { return React.cloneElement(children, _extends({ style: _extends({ opacity: 0, transform: getScale(0.75), visibility: state === 'exited' && !inProp ? 'hidden' : undefined }, styles[state], {}, style, {}, children.props.style), ref: handleRef }, childProps)); }); }); process.env.NODE_ENV !== "production" ? Grow.propTypes = { // ----------------------------- Warning -------------------------------- // | These PropTypes are generated from the TypeScript type definitions | // | To update them edit the d.ts file and run "yarn proptypes" | // ---------------------------------------------------------------------- /** * A single child content element. */ children: PropTypes.element, /** * If `true`, show the component; triggers the enter or exit animation. */ in: PropTypes.bool, /** * @ignore */ onEnter: PropTypes.func, /** * @ignore */ onExit: PropTypes.func, /** * @ignore */ style: PropTypes.object, /** * The duration for the transition, in milliseconds. * You may specify a single timeout for all transitions, or individually with an object. * * Set to 'auto' to automatically calculate transition time based on height. */ timeout: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number, PropTypes.shape({ appear: PropTypes.number, enter: PropTypes.number, exit: PropTypes.number })]) } : void 0; Grow.muiSupportAuto = true; export default Grow;
cdnjs/cdnjs
ajax/libs/material-ui/4.9.9/es/Grow/Grow.js
JavaScript
mit
4,874
import * as React from 'react'; declare class JqxGrid extends React.PureComponent<IGridProps, IState> { protected static getDerivedStateFromProps(props: IGridProps, state: IState): null | IState; private _jqx; private _id; private _componentSelector; constructor(props: IGridProps); componentDidMount(): void; componentDidUpdate(): void; render(): React.ReactNode; setOptions(options: IGridProps): void; getOptions(option: string): any; autoresizecolumns(type?: string): void; autoresizecolumn(dataField: string, type?: string): void; beginupdate(): void; clear(): void; createChart(type: string, dataSource?: any): void; destroy(): void; endupdate(): void; ensurerowvisible(rowBoundIndex: number): void; focus(): void; getcolumnindex(dataField: string): number; getcolumn(dataField: string): IGridGetColumn; getcolumnproperty(dataField: string, propertyName: string): any; getrowid(rowBoundIndex: number): string; getrowdata(rowBoundIndex: number): any; getrowdatabyid(rowID: string): any; getrowboundindexbyid(rowID: string): number; getrowboundindex(rowDisplayIndex: number): number; getrows(): any[]; getboundrows(): any[]; getdisplayrows(): any[]; getdatainformation(): IGridGetDataInformation; getsortinformation(): IGridGetSortInformation; getpaginginformation(): IGridGetPagingInformation; hidecolumn(dataField: string): void; hideloadelement(): void; hiderowdetails(rowBoundIndex: number): void; iscolumnvisible(dataField: string): boolean; iscolumnpinned(dataField: string): boolean; localizestrings(localizationobject: IGridLocalizationobject): void; pincolumn(dataField: string): void; refreshdata(): void; refresh(): void; renderWidget(): void; scrolloffset(top: number, left: number): void; scrollposition(): IGridScrollPosition; showloadelement(): void; showrowdetails(rowBoundIndex: number): void; setcolumnindex(dataField: string, index: number): void; setcolumnproperty(dataField: string, propertyName: any, propertyValue: any): void; showcolumn(dataField: string): void; unpincolumn(dataField: string): void; updatebounddata(type?: any): void; updating(): boolean; getsortcolumn(): string; removesort(): void; sortby(dataField: string, sortOrder: string): void; addgroup(dataField: string): void; cleargroups(): void; collapsegroup(group: number | string): void; collapseallgroups(): void; expandallgroups(): void; expandgroup(group: number | string): void; getrootgroupscount(): number; getgroup(groupIndex: number): IGridGetGroup; insertgroup(groupIndex: number, dataField: string): void; iscolumngroupable(): boolean; removegroupat(groupIndex: number): void; removegroup(dataField: string): void; addfilter(dataField: string, filterGroup: any, refreshGrid?: boolean): void; applyfilters(): void; clearfilters(): void; getfilterinformation(): any; getcolumnat(index: number): any; removefilter(dataField: string, refreshGrid: boolean): void; refreshfilterrow(): void; gotopage(pagenumber: number): void; gotoprevpage(): void; gotonextpage(): void; addrow(rowIds: any, data: any, rowPosition?: any): void; begincelledit(rowBoundIndex: number, dataField: string): void; beginrowedit(rowBoundIndex: number): void; closemenu(): void; deleterow(rowIds: string | number | Array<number | string>): void; endcelledit(rowBoundIndex: number, dataField: string, confirmChanges: boolean): void; endrowedit(rowBoundIndex: number, confirmChanges: boolean): void; getcell(rowBoundIndex: number, datafield: string): IGridGetCell; getcellatposition(left: number, top: number): IGridGetCell; getcelltext(rowBoundIndex: number, dataField: string): string; getcelltextbyid(rowID: string, dataField: string): string; getcellvaluebyid(rowID: string, dataField: string): any; getcellvalue(rowBoundIndex: number, dataField: string): any; isBindingCompleted(): boolean; openmenu(dataField: string): void; setcellvalue(rowBoundIndex: number, dataField: string, value: any): void; setcellvaluebyid(rowID: string, dataField: string, value: any): void; showvalidationpopup(rowBoundIndex: number, dataField: string, validationMessage: string): void; updaterow(rowIds: string | number | Array<number | string>, data: any): void; clearselection(): void; getselectedrowindex(): number; getselectedrowindexes(): number[]; getselectedcell(): IGridGetSelectedCell; getselectedcells(): IGridGetSelectedCell[]; selectcell(rowBoundIndex: number, dataField: string): void; selectallrows(): void; selectrow(rowBoundIndex: number): void; unselectrow(rowBoundIndex: number): void; unselectcell(rowBoundIndex: number, dataField: string): void; getcolumnaggregateddata(dataField: string, aggregates: any[]): string; refreshaggregates(): void; renderaggregates(): void; exportdata(dataType: string, fileName?: string, exportHeader?: boolean, rows?: number[], exportHiddenColumns?: boolean, serverURL?: string, charSet?: string): any; exportview(dataType: string, fileName?: string): any; openColumnChooser(columns?: any, header?: string): void; getstate(): IGridGetState; loadstate(stateobject: any): void; savestate(): IGridGetState; private _manageProps; private _wireEvents; } export default JqxGrid; export declare const jqx: any; export declare const JQXLite: any; interface IState { lastProps: object; } export interface IGridCharting { appendTo?: string; colorScheme?: string; dialog?: (width: number, height: number, header: string, position: any, enabled: boolean) => void; formatSettings?: any; ready?: any; } export interface IGridColumn { text?: string; datafield?: string; displayfield?: string; threestatecheckbox?: boolean; sortable?: boolean; filterable?: boolean; filter?: (cellValue?: any, rowData?: any, dataField?: string, filterGroup?: any, defaultFilterResult?: any) => any; buttonclick?: (row: number) => void; hideable?: boolean; hidden?: boolean; groupable?: boolean; menu?: boolean; exportable?: boolean; columngroup?: string; enabletooltips?: boolean; columntype?: 'number' | 'checkbox' | 'button' | 'numberinput' | 'dropdownlist' | 'combobox' | 'datetimeinput' | 'textbox' | 'rating' | 'progressbar' | 'template' | 'custom'; renderer?: (defaultText?: string, alignment?: string, height?: number) => string; rendered?: (columnHeaderElement?: any) => void; cellsrenderer?: (row?: number, columnfield?: string, value?: any, defaulthtml?: string, columnproperties?: any, rowdata?: any) => string; aggregatesrenderer?: (aggregates?: any, column?: any, element?: any, summaryData?: any) => string; validation?: (cell?: any, value?: number) => any; createwidget?: (row: any, column: any, value: string, cellElement: any) => void; initwidget?: (row: number, column: string, value: string, cellElement: any) => void; createfilterwidget?: (column: any, htmlElement: HTMLElement, editor: any) => void; createfilterpanel?: (datafield: string, filterPanel: any) => void; initeditor?: (row: number, cellvalue: any, editor: any, celltext: any, pressedChar: string, callback: any) => void; createeditor?: (row: number, cellvalue: any, editor: any, celltext: any, cellwidth: any, cellheight: any) => void; destroyeditor?: (row: number, callback: any) => void; geteditorvalue?: (row: number, cellvalue: any, editor: any) => any; cellbeginedit?: (row: number, datafield: string, columntype: string, value: any) => boolean; cellendedit?: (row: number, datafield: string, columntype: string, oldvalue: any, newvalue: any) => boolean; cellvaluechanging?: (row: number, datafield: string, columntype: string, oldvalue: any, newvalue: any) => string | void; createeverpresentrowwidget?: (datafield: string, htmlElement: HTMLElement, popup: any, addRowCallback: any) => any; initeverpresentrowwidget?: (datafield: string, htmlElement: HTMLElement, popup: any) => void; reseteverpresentrowwidgetvalue?: (datafield: string, htmlElement: HTMLElement) => void; geteverpresentrowwidgetvalue?: (datafield: string, htmlElement: HTMLElement) => any; destroyeverpresentrowwidget?: (htmlElement: HTMLElement) => void; validateeverpresentrowwidgetvalue?: (datafield: string, value: any, rowValues: any) => boolean | object; cellsformat?: string; cellclassname?: any; aggregates?: any; align?: 'left' | 'center' | 'right'; cellsalign?: 'left' | 'center' | 'right'; width?: number | string; minwidth?: any; maxwidth?: any; resizable?: boolean; draggable?: boolean; editable?: boolean; classname?: string; pinned?: boolean; nullable?: boolean; filteritems?: any; filterdelay?: number; filtertype?: 'textbox' | 'input' | 'checkedlist' | 'list' | 'number' | 'bool' | 'date' | 'range' | 'custom'; filtercondition?: 'EMPTY' | 'NOT_EMPTY' | 'CONTAINS' | 'CONTAINS_CASE_SENSITIVE' | 'DOES_NOT_CONTAIN' | 'DOES_NOT_CONTAIN_CASE_SENSITIVE' | 'STARTS_WITH' | 'STARTS_WITH_CASE_SENSITIVE' | 'ENDS_WITH' | 'ENDS_WITH_CASE_SENSITIVE' | 'EQUAL' | 'EQUAL_CASE_SENSITIVE' | 'NULL' | 'NOT_NULL' | 'EQUAL' | 'NOT_EQUAL' | 'LESS_THAN' | 'LESS_THAN_OR_EQUAL' | 'GREATER_THAN' | 'GREATER_THAN_OR_EQUAL' | 'NULL' | 'NOT_NULL'; } export interface IGridSourceDataFields { name?: string; type?: 'string' | 'date' | 'int' | 'float' | 'number' | 'bool'; format?: string; map?: string; id?: string; text?: string; source?: any[]; } export interface IGridSource { url?: string; data?: any; localdata?: any; datatype?: 'xml' | 'json' | 'jsonp' | 'tsv' | 'csv' | 'local' | 'array' | 'observablearray'; type?: 'GET' | 'POST'; id?: string; root?: string; record?: string; datafields?: IGridSourceDataFields[]; pagenum?: number; pagesize?: number; pager?: (pagenum?: number, pagesize?: number, oldpagenum?: number) => any; sortcolumn?: string; sortdirection?: 'asc' | 'desc'; sort?: (column?: any, direction?: any) => void; filter?: (filters?: any, recordsArray?: any) => void; addrow?: (rowid?: any, rowdata?: any, position?: any, commit?: boolean) => void; deleterow?: (rowid?: any, commit?: boolean) => void; updaterow?: (rowid?: any, newdata?: any, commit?: any) => void; processdata?: (data: any) => void; formatdata?: (data: any) => any; async?: boolean; totalrecords?: number; unboundmode?: boolean; } export interface IGridGetColumn { datafield?: string; displayfield?: string; text?: string; sortable?: boolean; filterable?: boolean; exportable?: boolean; editable?: boolean; groupable?: boolean; resizable?: boolean; draggable?: boolean; classname?: string; cellclassname?: any; width?: number | string; menu?: boolean; } export interface IGridGetDataInformation { rowscount?: string; sortinformation?: any; sortcolumn?: any; sortdirection?: any; paginginformation?: any; pagenum?: any; pagesize?: any; pagescount?: any; } export interface IGridGetSortInformation { sortcolumn?: string; sortdirection?: any; } export interface IGridGetPagingInformation { pagenum?: string; pagesize?: any; pagescount?: any; } export interface IGridDateNaming { names?: string[]; namesAbbr?: string[]; namesShort?: string[]; } export interface IGridLocalizationobject { filterstringcomparisonoperators?: any; filternumericcomparisonoperators?: any; filterdatecomparisonoperators?: any; filterbooleancomparisonoperators?: any; pagergotopagestring?: string; pagershowrowsstring?: string; pagerrangestring?: string; pagernextbuttonstring?: string; pagerpreviousbuttonstring?: string; sortascendingstring?: string; sortdescendingstring?: string; sortremovestring?: string; firstDay?: number; percentsymbol?: string; currencysymbol?: string; currencysymbolposition?: string; decimalseparator?: string; thousandsseparator?: string; days?: IGridDateNaming; months?: IGridDateNaming; addrowstring?: string; updaterowstring?: string; deleterowstring?: string; resetrowstring?: string; everpresentrowplaceholder?: string; emptydatastring?: string; } export interface IGridScrollPosition { top?: number; left?: number; } export interface IGridGetGroup { group?: number; level?: number; expanded?: number; subgroups?: number; subrows?: number; } export interface IGridGetCell { value?: number; row?: number; column?: number; } export interface IGridGetSelectedCell { rowindex?: number; datafield?: string; } export interface IGridGetStateColumns { width?: number | string; hidden?: boolean; index?: number; pinned?: boolean; groupable?: boolean; resizable?: boolean; draggable?: boolean; text?: string; align?: string; cellsalign?: string; } export interface IGridGetState { width?: number | string; height?: number | string; pagenum?: number; pagesize?: number; pagesizeoptions?: string[]; sortcolumn?: any; sortdirection?: any; filters?: any; groups?: any; columns?: IGridGetStateColumns; } export interface IGridColumnmenuopening { menu?: any; datafield?: any; height?: any; } export interface IGridColumnmenuclosing { menu?: any; datafield?: any; height?: any; } export interface IGridCellhover { cellhtmlElement?: any; x?: any; y?: any; } export interface IGridGroupsrenderer { text?: string; group?: number; expanded?: boolean; data?: object; } export interface IGridGroupcolumnrenderer { text?: any; } export interface IGridHandlekeyboardnavigation { event?: any; } export interface IGridScrollfeedback { row?: object; } export interface IGridFilter { cellValue?: any; rowData?: any; dataField?: string; filterGroup?: any; defaultFilterResult?: boolean; } export interface IGridRendertoolbar { toolbar?: any; } export interface IGridRenderstatusbar { statusbar?: any; } interface IGridOptions { altrows?: boolean; altstart?: number; altstep?: number; autoshowloadelement?: boolean; autoshowfiltericon?: boolean; autoshowcolumnsmenubutton?: boolean; showcolumnlines?: boolean; showrowlines?: boolean; showcolumnheaderlines?: boolean; adaptive?: boolean; adaptivewidth?: number; clipboard?: boolean; closeablegroups?: boolean; columnsmenuwidth?: number; columnmenuopening?: (menu?: IGridColumnmenuopening['menu'], datafield?: IGridColumnmenuopening['datafield'], height?: IGridColumnmenuopening['height']) => boolean | void; columnmenuclosing?: (menu?: IGridColumnmenuclosing['menu'], datafield?: IGridColumnmenuclosing['datafield'], height?: IGridColumnmenuclosing['height']) => boolean; cellhover?: (cellhtmlElement?: IGridCellhover['cellhtmlElement'], x?: IGridCellhover['x'], y?: IGridCellhover['y']) => void; enablekeyboarddelete?: boolean; enableellipsis?: boolean; enablemousewheel?: boolean; enableanimations?: boolean; enabletooltips?: boolean; enablehover?: boolean; enablebrowserselection?: boolean; everpresentrowposition?: 'top' | 'bottom' | 'topAboveFilterRow'; everpresentrowheight?: number; everpresentrowactions?: string; everpresentrowactionsmode?: 'popup' | 'columns'; filterrowheight?: number; filtermode?: 'default' | 'excel'; groupsrenderer?: (text?: IGridGroupsrenderer['text'], group?: IGridGroupsrenderer['group'], expanded?: IGridGroupsrenderer['expanded'], data?: IGridGroupsrenderer['data']) => string; groupcolumnrenderer?: (text?: IGridGroupcolumnrenderer['text']) => string; groupsexpandedbydefault?: boolean; handlekeyboardnavigation?: (event: IGridHandlekeyboardnavigation['event']) => boolean; pagerrenderer?: () => any[]; rtl?: boolean; showdefaultloadelement?: boolean; showfiltercolumnbackground?: boolean; showfiltermenuitems?: boolean; showpinnedcolumnbackground?: boolean; showsortcolumnbackground?: boolean; showsortmenuitems?: boolean; showgroupmenuitems?: boolean; showrowdetailscolumn?: boolean; showheader?: boolean; showgroupsheader?: boolean; showaggregates?: boolean; showgroupaggregates?: boolean; showeverpresentrow?: boolean; showfilterrow?: boolean; showemptyrow?: boolean; showstatusbar?: boolean; statusbarheight?: number; showtoolbar?: boolean; showfilterbar?: boolean; filterbarmode?: string; selectionmode?: 'none' | 'singlerow' | 'multiplerows' | 'multiplerowsextended' | 'singlecell' | 'multiplecells' | 'multiplecellsextended' | 'multiplecellsadvanced' | 'checkbox'; updatefilterconditions?: (type?: string, defaultconditions?: any) => any; updatefilterpanel?: (filtertypedropdown1?: any, filtertypedropdown2?: any, filteroperatordropdown?: any, filterinputfield1?: any, filterinputfield2?: any, filterbutton?: any, clearbutton?: any, columnfilter?: any, filtertype?: any, filterconditions?: any) => any; theme?: string; toolbarheight?: number; autoheight?: boolean; autorowheight?: boolean; columnsheight?: number; deferreddatafields?: string[]; groupsheaderheight?: number; groupindentwidth?: number; height?: number | string; pagerheight?: number | string; rowsheight?: number; scrollbarsize?: number | string; scrollmode?: 'default' | 'logical' | 'deferred'; scrollfeedback?: (row: IGridScrollfeedback['row']) => string; width?: string | number; autosavestate?: boolean; autoloadstate?: boolean; columns?: IGridColumn[]; enableSanitize?: boolean; cardview?: boolean; cardviewcolumns?: any; cardheight?: number; cardsize?: number; columngroups?: any[]; columnsmenu?: boolean; columnsresize?: boolean; columnsautoresize?: boolean; columnsreorder?: boolean; charting?: IGridCharting; disabled?: boolean; editable?: boolean; editmode?: 'click' | 'selectedcell' | 'selectedrow' | 'dblclick' | 'programmatic'; filter?: (cellValue?: IGridFilter['cellValue'], rowData?: IGridFilter['rowData'], dataField?: IGridFilter['dataField'], filterGroup?: IGridFilter['filterGroup'], defaultFilterResult?: IGridFilter['defaultFilterResult']) => any; filterable?: boolean; groupable?: boolean; groups?: string[]; horizontalscrollbarstep?: number; horizontalscrollbarlargestep?: number; initrowdetails?: (index?: number, parentElement?: any, gridElement?: any, datarecord?: any) => void; keyboardnavigation?: boolean; localization?: IGridLocalizationobject; pagesize?: number; pagesizeoptions?: Array<number | string>; pagermode?: 'simple' | 'default' | 'material'; pagerbuttonscount?: number; pageable?: boolean; autofill?: boolean; rowdetails?: boolean; rowdetailstemplate?: any; ready?: () => void; rendered?: (type: any) => void; renderstatusbar?: (statusbar?: IGridRenderstatusbar['statusbar']) => void; rendertoolbar?: (toolbar?: IGridRendertoolbar['toolbar']) => void; rendergridrows?: (params?: any) => any; sortable?: boolean; sortmode?: string; selectedrowindex?: number; selectedrowindexes?: number[]; source?: IGridSource; sorttogglestates?: '0' | '1' | '2'; updatedelay?: number; virtualmode?: boolean; verticalscrollbarstep?: number; verticalscrollbarlargestep?: number; } export interface IGridProps extends IGridOptions { className?: string; style?: React.CSSProperties; onBindingcomplete?: (e?: Event) => void; onColumnresized?: (e?: Event) => void; onColumnreordered?: (e?: Event) => void; onColumnclick?: (e?: Event) => void; onCellclick?: (e?: Event) => void; onCelldoubleclick?: (e?: Event) => void; onCellselect?: (e?: Event) => void; onCellunselect?: (e?: Event) => void; onCellvaluechanged?: (e?: Event) => void; onCellbeginedit?: (e?: Event) => void; onCellendedit?: (e?: Event) => void; onFilter?: (e?: Event) => void; onGroupschanged?: (e?: Event) => void; onGroupexpand?: (e?: Event) => void; onGroupcollapse?: (e?: Event) => void; onPagechanged?: (e?: Event) => void; onPagesizechanged?: (e?: Event) => void; onRowclick?: (e?: Event) => void; onRowdoubleclick?: (e?: Event) => void; onRowselect?: (e?: Event) => void; onRowunselect?: (e?: Event) => void; onRowexpand?: (e?: Event) => void; onRowcollapse?: (e?: Event) => void; onSort?: (e?: Event) => void; }
cdnjs/cdnjs
ajax/libs/jqwidgets/12.1.2/jqwidgets-react-tsx/jqxgrid/react_jqxgrid.d.ts
TypeScript
mit
21,567
"use strict"; exports.__esModule = true; exports.default = void 0; var React = _interopRequireWildcard(require("react")); var _createElement = _interopRequireDefault(require("../createElement")); var _css = _interopRequireDefault(require("../StyleSheet/css")); var _pick = _interopRequireDefault(require("../../modules/pick")); var _useElementLayout = _interopRequireDefault(require("../../hooks/useElementLayout")); var _useMergeRefs = _interopRequireDefault(require("../../modules/useMergeRefs")); var _usePlatformMethods = _interopRequireDefault(require("../../hooks/usePlatformMethods")); var _useResponderEvents = _interopRequireDefault(require("../../hooks/useResponderEvents")); var _StyleSheet = _interopRequireDefault(require("../StyleSheet")); var _TextAncestorContext = _interopRequireDefault(require("../Text/TextAncestorContext")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } /** * Copyright (c) Nicolas Gallagher. * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * */ var forwardPropsList = { accessibilityLabel: true, accessibilityLiveRegion: true, accessibilityRole: true, accessibilityState: true, accessibilityValue: true, accessible: true, children: true, classList: true, disabled: true, importantForAccessibility: true, nativeID: true, onBlur: true, onClick: true, onClickCapture: true, onContextMenu: true, onFocus: true, onKeyDown: true, onKeyUp: true, onTouchCancel: true, onTouchCancelCapture: true, onTouchEnd: true, onTouchEndCapture: true, onTouchMove: true, onTouchMoveCapture: true, onTouchStart: true, onTouchStartCapture: true, pointerEvents: true, ref: true, style: true, testID: true, // unstable dataSet: true, onMouseDown: true, onMouseEnter: true, onMouseLeave: true, onMouseMove: true, onMouseOver: true, onMouseOut: true, onMouseUp: true, onScroll: true, onWheel: true, href: true, rel: true, target: true }; var pickProps = function pickProps(props) { return (0, _pick.default)(props, forwardPropsList); }; var View = (0, React.forwardRef)(function (props, forwardedRef) { var onLayout = props.onLayout, onMoveShouldSetResponder = props.onMoveShouldSetResponder, onMoveShouldSetResponderCapture = props.onMoveShouldSetResponderCapture, onResponderEnd = props.onResponderEnd, onResponderGrant = props.onResponderGrant, onResponderMove = props.onResponderMove, onResponderReject = props.onResponderReject, onResponderRelease = props.onResponderRelease, onResponderStart = props.onResponderStart, onResponderTerminate = props.onResponderTerminate, onResponderTerminationRequest = props.onResponderTerminationRequest, onScrollShouldSetResponder = props.onScrollShouldSetResponder, onScrollShouldSetResponderCapture = props.onScrollShouldSetResponderCapture, onSelectionChangeShouldSetResponder = props.onSelectionChangeShouldSetResponder, onSelectionChangeShouldSetResponderCapture = props.onSelectionChangeShouldSetResponderCapture, onStartShouldSetResponder = props.onStartShouldSetResponder, onStartShouldSetResponderCapture = props.onStartShouldSetResponderCapture; if (process.env.NODE_ENV !== 'production') { React.Children.toArray(props.children).forEach(function (item) { if (typeof item === 'string') { console.error("Unexpected text node: " + item + ". A text node cannot be a child of a <View>."); } }); } var hasTextAncestor = (0, React.useContext)(_TextAncestorContext.default); var hostRef = (0, React.useRef)(null); var classList = [classes.view]; var style = _StyleSheet.default.compose(hasTextAncestor && styles.inline, props.style); (0, _useElementLayout.default)(hostRef, onLayout); (0, _useResponderEvents.default)(hostRef, { onMoveShouldSetResponder: onMoveShouldSetResponder, onMoveShouldSetResponderCapture: onMoveShouldSetResponderCapture, onResponderEnd: onResponderEnd, onResponderGrant: onResponderGrant, onResponderMove: onResponderMove, onResponderReject: onResponderReject, onResponderRelease: onResponderRelease, onResponderStart: onResponderStart, onResponderTerminate: onResponderTerminate, onResponderTerminationRequest: onResponderTerminationRequest, onScrollShouldSetResponder: onScrollShouldSetResponder, onScrollShouldSetResponderCapture: onScrollShouldSetResponderCapture, onSelectionChangeShouldSetResponder: onSelectionChangeShouldSetResponder, onSelectionChangeShouldSetResponderCapture: onSelectionChangeShouldSetResponderCapture, onStartShouldSetResponder: onStartShouldSetResponder, onStartShouldSetResponderCapture: onStartShouldSetResponderCapture }); var supportedProps = pickProps(props); supportedProps.classList = classList; supportedProps.style = style; var platformMethodsRef = (0, _usePlatformMethods.default)(hostRef, supportedProps); var setRef = (0, _useMergeRefs.default)(hostRef, platformMethodsRef, forwardedRef); supportedProps.ref = setRef; return (0, _createElement.default)('div', supportedProps); }); View.displayName = 'View'; var classes = _css.default.create({ view: { alignItems: 'stretch', border: '0 solid black', boxSizing: 'border-box', display: 'flex', flexBasis: 'auto', flexDirection: 'column', flexShrink: 0, margin: 0, minHeight: 0, minWidth: 0, padding: 0, position: 'relative', zIndex: 0 } }); var styles = _StyleSheet.default.create({ inline: { display: 'inline-flex' } }); var _default = View; exports.default = _default; module.exports = exports.default;
cdnjs/cdnjs
ajax/libs/react-native-web/0.0.0-e437e3f47/cjs/exports/View/index.js
JavaScript
mit
6,819
/******************************************************************************* * Copyright (c) 2011, 2020 Eurotech and/or its affiliates and others * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 * which is available at https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Eurotech ******************************************************************************/ package org.eclipse.kura.net; import java.util.Map; import org.osgi.annotation.versioning.ProviderType; import org.osgi.service.event.Event; /** * An event raised when a network interface has been removed from the system. * * @noextend This class is not intended to be subclassed by clients. */ @ProviderType public class NetInterfaceRemovedEvent extends Event { /** Topic of the NetworkInterfaceRemovedEvent */ public static final String NETWORK_EVENT_INTERFACE_REMOVED_TOPIC = "org/eclipse/kura/net/NetworkEvent/interface/REMOVED"; /** Name of the property to access the network interface name */ public static final String NETWORK_EVENT_INTERFACE_PROPERTY = "network.interface"; public NetInterfaceRemovedEvent(Map<String, ?> properties) { super(NETWORK_EVENT_INTERFACE_REMOVED_TOPIC, properties); } /** * Returns the name of the removed interface. * * @return */ public String getInterfaceName() { return (String) getProperty(NETWORK_EVENT_INTERFACE_PROPERTY); } }
ctron/kura
kura/org.eclipse.kura.api/src/main/java/org/eclipse/kura/net/NetInterfaceRemovedEvent.java
Java
epl-1.0
1,545
package invalid; public class TestInvalidFieldInitializer3 { private Object field= /*]*/foo()/*[*/; public Object foo() { return field; } }
maxeler/eclipse
eclipse.jdt.ui/org.eclipse.jdt.ui.tests.refactoring/resources/InlineMethodWorkspace/TestCases/invalid/TestInvalidFieldInitializer3.java
Java
epl-1.0
151
// Copyright (c) 2016 IBM Corporation. #ifndef LANGUAGE_EXTERN_H #define LANGUAGE_EXTERN_H #include "language-extern_sigs.h" #include <stdexcept> #include <fstream> #include <sstream> #include "termprinter.h" #include "termreader.h" template <typename a> tosca::StringTerm& PrintTerm(tosca::Context& ctx, tosca::StringTerm& category, a& term) { tosca::Term& t = dynamic_cast<tosca::Term&>(term); return newStringTerm(ctx, tosca::PrintToString(t, true)); } template <typename a> a& ParseResource(tosca::Context& ctx, tosca::StringTerm& category, tosca::StringTerm& filename) { // TODO: user-defined category std::fstream input(filename.Unbox().c_str(), std::ios_base::in); tosca::TermParser parser(&input); tosca::Term& term = parser.ParseTerm(ctx); a& result = dynamic_cast<a&>(term); category.Release(); filename.Release(); return result; } template <typename a, typename b> b& Save(tosca::Context& ctx, tosca::StringTerm& category, tosca::StringTerm& filename, a& term, tosca::MapTerm<tosca::StringTerm, tosca::StringTerm>& props, b& result) { // TODO: user-defined category. //const std::string& ucat = category.Unbox(); //if (ucat == "" || ucat == "term") { std::fstream output(filename.Unbox().c_str(), std::ios_base::out); tosca::Print(static_cast<tosca::Term&>(term), output, false); } category.Release(); filename.Release(); props.Release(); return result; } template <typename a> a& ParseText(tosca::Context& ctx, tosca::StringTerm& category, tosca::StringTerm& content) { std::stringstream input(content.Unbox().c_str(), std::ios_base::in); tosca::TermParser parser(&input); tosca::Term& term = parser.ParseTerm(ctx); a& result = dynamic_cast<a&>(term); category.Release(); content.Release(); return result; } #endif
TransScript/TransScript
targets/cpp/std/src/std/language-extern.h
C
epl-1.0
1,893
/* ********************************************************************** ** ** Copyright notice ** ** ** ** (c) 2005-2009 RSSOwl Development Team ** ** http://www.rssowl.org/ ** ** ** ** All rights reserved ** ** ** ** This program and the accompanying materials are made available under ** ** the terms of the Eclipse Public License v1.0 which accompanies this ** ** distribution, and is available at: ** ** http://www.rssowl.org/legal/epl-v10.html ** ** ** ** A copy is found in the file epl-v10.html and important notices to the ** ** license from the team is found in the textfile LICENSE.txt distributed ** ** in this package. ** ** ** ** This copyright notice MUST APPEAR in all copies of the file! ** ** ** ** Contributors: ** ** RSSOwl Development Team - initial API and implementation ** ** ** ** ********************************************************************** */ package org.rssowl.core.internal.persist.service; import org.rssowl.core.persist.IEntity; import org.rssowl.core.persist.event.ModelEvent; import org.rssowl.core.persist.event.runnable.EventRunnable; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.IdentityHashMap; import java.util.List; import java.util.Map; /** * A {@link Map} of {@link ModelEvent} pointing to {@link EventRunnable}. */ public class EventsMap { private static final EventsMap INSTANCE = new EventsMap(); private static class InternalMap extends HashMap<Class<? extends ModelEvent>, EventRunnable<? extends ModelEvent>> { InternalMap() { super(); } } private final ThreadLocal<InternalMap> fEvents = new ThreadLocal<InternalMap>(); private final ThreadLocal<Map<IEntity, ModelEvent>> fEventTemplatesMap = new ThreadLocal<Map<IEntity, ModelEvent>>(); private EventsMap() { // Enforce singleton pattern } public final static EventsMap getInstance() { return INSTANCE; } public final void putPersistEvent(ModelEvent event) { EventRunnable<? extends ModelEvent> eventRunnable = getEventRunnable(event); eventRunnable.addCheckedPersistEvent(event); } public final void putUpdateEvent(ModelEvent event) { EventRunnable<? extends ModelEvent> eventRunnable = getEventRunnable(event); eventRunnable.addCheckedUpdateEvent(event); } public final void putRemoveEvent(ModelEvent event) { EventRunnable<? extends ModelEvent> eventRunnable = getEventRunnable(event); eventRunnable.addCheckedRemoveEvent(event); } public final boolean containsPersistEvent(Class<? extends ModelEvent> eventClass, IEntity entity) { EventRunnable<? extends ModelEvent> eventRunnable = getEventRunnable(eventClass); return eventRunnable.getPersistEvents().contains(entity); } public final boolean containsUpdateEvent(Class<? extends ModelEvent> eventClass, IEntity entity) { EventRunnable<? extends ModelEvent> eventRunnable = getEventRunnable(eventClass); return eventRunnable.getUpdateEvents().contains(entity); } public final boolean containsRemoveEvent(Class<? extends ModelEvent> eventClass, IEntity entity) { EventRunnable<? extends ModelEvent> eventRunnable = getEventRunnable(eventClass); return eventRunnable.getRemoveEvents().contains(entity); } private EventRunnable<? extends ModelEvent> getEventRunnable(Class<? extends ModelEvent> eventClass) { InternalMap map = fEvents.get(); if (map == null) { map = new InternalMap(); fEvents.set(map); } EventRunnable<? extends ModelEvent> eventRunnable = map.get(eventClass); return eventRunnable; } private EventRunnable<? extends ModelEvent> getEventRunnable(ModelEvent event) { Class<? extends ModelEvent> eventClass = event.getClass(); EventRunnable<? extends ModelEvent> eventRunnable = getEventRunnable(eventClass); if (eventRunnable == null) { eventRunnable = event.createEventRunnable(); fEvents.get().put(eventClass, eventRunnable); } return eventRunnable; } public EventRunnable<? extends ModelEvent> removeEventRunnable(Class<? extends ModelEvent> klass) { InternalMap map = fEvents.get(); if (map == null) return null; EventRunnable<? extends ModelEvent> runnable = map.remove(klass); return runnable; } public List<EventRunnable<?>> getEventRunnables() { InternalMap map = fEvents.get(); if (map == null) return new ArrayList<EventRunnable<?>>(0); List<EventRunnable<?>> eventRunnables = new ArrayList<EventRunnable<?>>(map.size()); for (Map.Entry<Class<? extends ModelEvent>, EventRunnable<? extends ModelEvent>> entry : map.entrySet()) { eventRunnables.add(entry.getValue()); } return eventRunnables; } public List<EventRunnable<?>> removeEventRunnables() { InternalMap map = fEvents.get(); if (map == null) return new ArrayList<EventRunnable<?>>(0); List<EventRunnable<?>> eventRunnables = getEventRunnables(); map.clear(); return eventRunnables; } public void putEventTemplate(ModelEvent event) { Map<IEntity, ModelEvent> map = fEventTemplatesMap.get(); if (map == null) { map = new IdentityHashMap<IEntity, ModelEvent>(); fEventTemplatesMap.set(map); } map.put(event.getEntity(), event); } public final Map<IEntity, ModelEvent> getEventTemplatesMap() { Map<IEntity, ModelEvent> map = fEventTemplatesMap.get(); if (map == null) return Collections.emptyMap(); return Collections.unmodifiableMap(fEventTemplatesMap.get()); } public Map<IEntity, ModelEvent> removeEventTemplatesMap() { Map<IEntity, ModelEvent> map = fEventTemplatesMap.get(); fEventTemplatesMap.remove(); return map; } }
rssowl/RSSOwl
org.rssowl.core/src/org/rssowl/core/internal/persist/service/EventsMap.java
Java
epl-1.0
6,658
/******************************************************************************* * Copyright (c) 2011, 2020 Eurotech and/or its affiliates and others * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 * which is available at https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Eurotech *******************************************************************************/ package org.eclipse.kura.web.shared.model; import java.io.Serializable; import java.util.Date; import org.eclipse.kura.web.shared.DateUtils; public class GwtDeviceConfig extends GwtBaseModel implements Serializable { private static final long serialVersionUID = 1708831984640005284L; public GwtDeviceConfig() { } @Override @SuppressWarnings({ "unchecked" }) public <X> X get(String property) { if ("lastEventOnFormatted".equals(property)) { return (X) DateUtils.formatDateTime((Date) get("lastEventOn")); } else if ("uptimeFormatted".equals(property)) { if (getUptime() == -1) { return (X) "Unknown"; } else { return (X) String.valueOf(getUptime()); } } else { return super.get(property); } } public String getAccountName() { return get("accountName"); } public void setAccountName(String accountName) { set("accountName", accountName); } public String getClientId() { return (String) get("clientId"); } public void setClientId(String clientId) { set("clientId", clientId); } public Long getUptime() { return (Long) get("uptime"); } public String getUptimeFormatted() { return (String) get("uptimeFormatted"); } public void setUptime(Long uptime) { set("uptime", uptime); } public String getGwtDeviceStatus() { return (String) get("gwtDeviceStatus"); } public void setGwtDeviceStatus(String gwtDeviceStatus) { set("gwtDeviceStatus", gwtDeviceStatus); } public String getDisplayName() { return (String) get("displayName"); } public void setDisplayName(String displayName) { set("displayName", displayName); } public String getModelName() { return (String) get("modelName"); } public void setModelName(String modelName) { set("modelName", modelName); } public String getModelId() { return (String) get("modelId"); } public void setModelId(String modelId) { set("modelId", modelId); } public String getPartNumber() { return (String) get("partNumber"); } public void setPartNumber(String partNumber) { set("partNumber", partNumber); } public String getSerialNumber() { return (String) get("serialNumber"); } public void setSerialNumber(String serialNumber) { set("serialNumber", serialNumber); } public String getAvailableProcessors() { return (String) get("availableProcessors"); } public void setAvailableProcessors(String availableProcessors) { set("availableProcessors", availableProcessors); } public String getTotalMemory() { return (String) get("totalMemory"); } public void setTotalMemory(String totalMemory) { set("totalMemory", totalMemory); } public String getFirmwareVersion() { return (String) get("firmwareVersion"); } public void setFirmwareVersion(String firmwareVersion) { set("firmwareVersion", firmwareVersion); } public String getBiosVersion() { return (String) get("biosVersion"); } public void setBiosVersion(String biosVersion) { set("biosVersion", biosVersion); } public String getOs() { return (String) get("os"); } public void setOs(String os) { set("os", os); } public String getOsVersion() { return (String) get("osVersion"); } public void setOsVersion(String osVersion) { set("osVersion", osVersion); } public String getOsArch() { return (String) get("osArch"); } public void setOsArch(String osArch) { set("osArch", osArch); } public String getJvmName() { return (String) get("jvmName"); } public void setJvmName(String jvmName) { set("jvmName", jvmName); } public String getJvmVersion() { return (String) get("jvmVersion"); } public void setJvmVersion(String jvmVersion) { set("jvmVersion", jvmVersion); } public String getJvmProfile() { return (String) get("jvmProfile"); } public void setJvmProfile(String jvmProfile) { set("jvmProfile", jvmProfile); } public String getOsgiFramework() { return (String) get("osgiFramework"); } public void setOsgiFramework(String osgiFramework) { set("osgiFramework", osgiFramework); } public String getOsgiFrameworkVersion() { return (String) get("osgiFrameworkVersion"); } public void setOsgiFrameworkVersion(String osgiFrameworkVersion) { set("osgiFrameworkVersion", osgiFrameworkVersion); } public String getConnectionInterface() { return (String) get("connectionInterface"); } public void setConnectionInterface(String connectionInterface) { set("connectionInterface", connectionInterface); } public String getConnectionIp() { return (String) get("connectionIp"); } public void setConnectionIp(String connectionIp) { set("connectionIp", connectionIp); } public String getAcceptEncoding() { return (String) get("acceptEncoding"); } public void setAcceptEncoding(String acceptEncoding) { set("acceptEncoding", acceptEncoding); } public String getApplicationIdentifiers() { return (String) get("applicationIdentifiers"); } public void setApplicationIdentifiers(String applicationIdentifiers) { set("applicationIdentifiers", applicationIdentifiers); } public Double getGpsLatitude() { return (Double) get("gpsLatitude"); } public void setGpsLatitude(Double gpsLatitude) { set("gpsLatitude", gpsLatitude); } public Double getGpsLongitude() { return (Double) get("gpsLongitude"); } public void setGpsLongitude(Double gpsLongitude) { set("gpsLongitude", gpsLongitude); } public Double getGpsAltitude() { return (Double) get("gpsAltitude"); } public void setGpsAltitude(Double gpsAltitude) { set("gpsAltitude", gpsAltitude); } public String getGpsAddress() { return (String) get("gpsAddress"); } public void setGpsAddress(String gpsAddress) { set("gpsAddress", gpsAddress); } public Date getLastEventOn() { return (Date) get("lastEventOn"); } public String getLastEventOnFormatted() { return (String) get("lastEventOnFormatted"); } public void setLastEventOn(Date lastEventDate) { set("lastEventOn", lastEventDate); } public String getLastEventType() { return (String) get("lastEventType"); } public void setLastEventType(String lastEventType) { set("lastEventType", lastEventType); } public boolean isOnline() { return getGwtDeviceStatus().compareTo("CONNECTED") == 0; } }
ctron/kura
kura/org.eclipse.kura.web2/src/main/java/org/eclipse/kura/web/shared/model/GwtDeviceConfig.java
Java
epl-1.0
7,591
/* * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ package org.opendaylight.controller.sal.connector.remoterpc; import com.google.common.base.Optional; import junit.framework.Assert; import org.junit.*; import org.opendaylight.controller.sal.connector.api.RpcRouter; import org.opendaylight.controller.sal.connector.remoterpc.api.RoutingTable; import org.opendaylight.controller.sal.connector.remoterpc.utils.MessagingUtil; import org.opendaylight.controller.sal.core.api.Broker; import org.opendaylight.controller.sal.core.api.RpcRegistrationListener; import org.opendaylight.yangtools.yang.data.api.CompositeNode; import org.zeromq.ZMQ; import zmq.Ctx; import zmq.SocketBase; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.ThreadPoolExecutor; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; public class ServerImplTest { private static ZMQ.Context context; private ServerImpl server; private Broker.ProviderSession brokerSession; private RoutingTableProvider routingTableProvider; private RpcRegistrationListener listener; ExecutorService pool; //Server configuration private final int HANDLER_COUNT = 2; private final int HWM = 200; private final int port = 5554; //server address private final String SERVER_ADDRESS = "tcp://localhost:5554"; //@BeforeClass public static void init() { context = ZMQ.context(1); } //@AfterClass public static void destroy() { MessagingUtil.closeZmqContext(context); } @Before public void setup() throws InterruptedException { context = ZMQ.context(1); brokerSession = mock(Broker.ProviderSession.class); routingTableProvider = mock(RoutingTableProvider.class); listener = mock(RpcRegistrationListener.class); server = new ServerImpl(port); server.setBrokerSession(brokerSession); RoutingTable<RpcRouter.RouteIdentifier, String> mockRoutingTable = new MockRoutingTable<String, String>(); Optional<RoutingTable<RpcRouter.RouteIdentifier, String>> optionalRoutingTable = Optional.fromNullable(mockRoutingTable); when(routingTableProvider.getRoutingTable()).thenReturn(optionalRoutingTable); when(brokerSession.addRpcRegistrationListener(listener)).thenReturn(null); when(brokerSession.getSupportedRpcs()).thenReturn(Collections.EMPTY_SET); when(brokerSession.rpc(null, mock(CompositeNode.class))).thenReturn(null); server.start(); Thread.sleep(5000);//wait for server to start } @After public void tearDown() throws InterruptedException { if (pool != null) pool.shutdown(); if (server != null) server.stop(); MessagingUtil.closeZmqContext(context); Thread.sleep(5000);//wait for server to stop Assert.assertEquals(ServerImpl.State.STOPPED, server.getStatus()); } @Test public void getBrokerSession_Call_ShouldReturnBrokerSession() throws Exception { Optional<Broker.ProviderSession> mayBeBroker = server.getBrokerSession(); if (mayBeBroker.isPresent()) Assert.assertEquals(brokerSession, mayBeBroker.get()); else Assert.fail("Broker does not exist in Remote RPC Server"); } @Test public void start_Call_ShouldSetServerStatusToStarted() throws Exception { Assert.assertEquals(ServerImpl.State.STARTED, server.getStatus()); } @Test public void start_Call_ShouldCreateNZmqSockets() throws Exception { final int EXPECTED_COUNT = 2 + HANDLER_COUNT; //1 ROUTER + 1 DEALER + HANDLER_COUNT Optional<ZMQ.Context> mayBeContext = server.getZmqContext(); if (mayBeContext.isPresent()) Assert.assertEquals(EXPECTED_COUNT, findSocketCount(mayBeContext.get())); else Assert.fail("ZMQ Context does not exist in Remote RPC Server"); } @Test public void start_Call_ShouldCreate1ServerThread() { final String SERVER_THREAD_NAME = "remote-rpc-server"; final int EXPECTED_COUNT = 1; List<Thread> serverThreads = findThreadsWithName(SERVER_THREAD_NAME); Assert.assertEquals(EXPECTED_COUNT, serverThreads.size()); } @Test public void start_Call_ShouldCreateNHandlerThreads() { //final String WORKER_THREAD_NAME = "remote-rpc-worker"; final int EXPECTED_COUNT = HANDLER_COUNT; Optional<ServerRequestHandler> serverRequestHandlerOptional = server.getHandler(); if (serverRequestHandlerOptional.isPresent()){ ServerRequestHandler handler = serverRequestHandlerOptional.get(); ThreadPoolExecutor workerPool = handler.getWorkerPool(); Assert.assertEquals(EXPECTED_COUNT, workerPool.getPoolSize()); } else { Assert.fail("Server is in illegal state. ServerHandler does not exist"); } } @Test public void testStop() throws Exception { } @Test public void testOnRouteUpdated() throws Exception { } @Test public void testOnRouteDeleted() throws Exception { } private int findSocketCount(ZMQ.Context context) throws NoSuchFieldException, IllegalAccessException { Field ctxField = context.getClass().getDeclaredField("ctx"); ctxField.setAccessible(true); Ctx ctx = Ctx.class.cast(ctxField.get(context)); Field socketListField = ctx.getClass().getDeclaredField("sockets"); socketListField.setAccessible(true); List<SocketBase> sockets = List.class.cast(socketListField.get(ctx)); return sockets.size(); } private List<Thread> findThreadsWithName(String name) { Thread[] threads = new Thread[Thread.activeCount()]; Thread.enumerate(threads); List<Thread> foundThreads = new ArrayList(); for (Thread t : threads) { if (t.getName().startsWith(name)) foundThreads.add(t); } return foundThreads; } }
yuyf10/opendaylight-controller
opendaylight/md-sal/sal-remoterpc-connector/implementation/src/test/java/org/opendaylight/controller/sal/connector/remoterpc/ServerImplTest.java
Java
epl-1.0
6,052
/******************************************************************************* * Copyright (c) 2010 - 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation * Lars Vogel <lars.Vogel@gmail.com> - Bug 419770 *******************************************************************************/ package com.vogella.e4.appmodel.app.handlers; import org.eclipse.e4.core.di.annotations.Execute; import org.eclipse.e4.ui.workbench.IWorkbench; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.swt.widgets.Shell; public class QuitHandler { @Execute public void execute(IWorkbench workbench, Shell shell){ if (MessageDialog.openConfirm(shell, "Confirmation", "Do you want to exit?")) { workbench.close(); } } }
scela/EclipseCon2014
com.vogella.e4.appmodel.app/src/com/vogella/e4/appmodel/app/handlers/QuitHandler.java
Java
epl-1.0
1,040
/* * Copyright (c) 2012-2018 Red Hat, Inc. * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 * which is available at https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat, Inc. - initial API and implementation */ package org.eclipse.che.ide.ext.git.client.compare; import org.eclipse.che.ide.api.resources.Project; import org.eclipse.che.ide.ext.git.client.compare.FileStatus.Status; /** * Describes changed in any way project files. Supports adding and removing items dynamically. * * @author Mykola Morhun */ public class MutableAlteredFiles extends AlteredFiles { /** * Parses raw git diff string and creates advanced representation. * * @param project the project under diff operation * @param diff plain result of git diff operation */ public MutableAlteredFiles(Project project, String diff) { super(project, diff); } /** * Creates mutable altered files list based on changes from another project. * * @param project the project under diff operation * @param alteredFiles changes from another project */ public MutableAlteredFiles(Project project, AlteredFiles alteredFiles) { super(project, ""); this.alteredFilesStatuses.putAll(alteredFiles.alteredFilesStatuses); this.alteredFilesList.addAll(alteredFiles.alteredFilesList); } /** * Creates an empty list of altered files. * * @param project the project under diff operation */ public MutableAlteredFiles(Project project) { super(project, ""); } /** * Adds or updates a file in altered file list. If given file is already exists does nothing. * * @param file full path to file and its name relatively to project root * @param status git status of the file * @return true if file was added or updated and false if the file is already exists in this list */ public boolean addFile(String file, Status status) { if (status.equals(alteredFilesStatuses.get(file))) { return false; } if (alteredFilesStatuses.put(file, status) == null) { // it's not a status change, new file was added alteredFilesList.add(file); } return true; } /** * Removes given file from the altered files list. If given file isn't present does nothing. * * @param file full path to file and its name relatively to project root * @return true if the file was deleted and false otherwise */ public boolean removeFile(String file) { alteredFilesStatuses.remove(file); return alteredFilesList.remove(file); } }
akervern/che
plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/compare/MutableAlteredFiles.java
Java
epl-1.0
2,645
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (version 1.7.0_25) on Thu Sep 12 10:51:18 BST 2013 --> <meta http-equiv="Content-Type" content="text/html" charset="UTF-8"> <title>Uses of Interface com.hp.hpl.jena.rdf.model.ModelGraphInterface (Apache Jena)</title> <meta name="date" content="2013-09-12"> <link rel="stylesheet" type="text/css" href="../../../../../../../stylesheet.css" title="Style"> </head> <body> <script type="text/javascript"><!-- if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Interface com.hp.hpl.jena.rdf.model.ModelGraphInterface (Apache Jena)"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar_top"> <!-- --> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../../../com/hp/hpl/jena/rdf/model/ModelGraphInterface.html" title="interface in com.hp.hpl.jena.rdf.model">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../../../index-all.html">Index</a></li> <li><a href="../../../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../../../index.html?com/hp/hpl/jena/rdf/model/class-use/ModelGraphInterface.html" target="_top">Frames</a></li> <li><a href="ModelGraphInterface.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h2 title="Uses of Interface com.hp.hpl.jena.rdf.model.ModelGraphInterface" class="title">Uses of Interface<br>com.hp.hpl.jena.rdf.model.ModelGraphInterface</h2> </div> <div class="classUseContainer"> <ul class="blockList"> <li class="blockList"> <table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation"> <caption><span>Packages that use <a href="../../../../../../../com/hp/hpl/jena/rdf/model/ModelGraphInterface.html" title="interface in com.hp.hpl.jena.rdf.model">ModelGraphInterface</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Package</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><a href="#com.hp.hpl.jena.ontology">com.hp.hpl.jena.ontology</a></td> <td class="colLast"> <div class="block"> Provides a set of abstractions and convenience classes for accessing and manipluating ontologies represented in RDF.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="#com.hp.hpl.jena.rdf.model">com.hp.hpl.jena.rdf.model</a></td> <td class="colLast"> <div class="block">A package for creating and manipulating RDF graphs.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><a href="#com.hp.hpl.jena.rdf.model.impl">com.hp.hpl.jena.rdf.model.impl</a></td> <td class="colLast"> <div class="block">This package contains implementations of the interfaces defined in the .model package, eg ModelCom for Model, ResourceImpl for Resource, and so on.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="#com.hp.hpl.jena.util">com.hp.hpl.jena.util</a></td> <td class="colLast"> <div class="block"> Miscellaneous collection of utility classes.</div> </td> </tr> </tbody> </table> </li> <li class="blockList"> <ul class="blockList"> <li class="blockList"><a name="com.hp.hpl.jena.ontology"> <!-- --> </a> <h3>Uses of <a href="../../../../../../../com/hp/hpl/jena/rdf/model/ModelGraphInterface.html" title="interface in com.hp.hpl.jena.rdf.model">ModelGraphInterface</a> in <a href="../../../../../../../com/hp/hpl/jena/ontology/package-summary.html">com.hp.hpl.jena.ontology</a></h3> <table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing subinterfaces, and an explanation"> <caption><span>Subinterfaces of <a href="../../../../../../../com/hp/hpl/jena/rdf/model/ModelGraphInterface.html" title="interface in com.hp.hpl.jena.rdf.model">ModelGraphInterface</a> in <a href="../../../../../../../com/hp/hpl/jena/ontology/package-summary.html">com.hp.hpl.jena.ontology</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Interface and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>interface&nbsp;</code></td> <td class="colLast"><code><strong><a href="../../../../../../../com/hp/hpl/jena/ontology/OntModel.html" title="interface in com.hp.hpl.jena.ontology">OntModel</a></strong></code> <div class="block"> An enhanced view of a Jena model that is known to contain ontology data, under a given ontology <a href="../../../../../../../com/hp/hpl/jena/ontology/Profile.html" title="interface in com.hp.hpl.jena.ontology"><code>vocabulary</code></a> (such as OWL).</div> </td> </tr> </tbody> </table> </li> <li class="blockList"><a name="com.hp.hpl.jena.rdf.model"> <!-- --> </a> <h3>Uses of <a href="../../../../../../../com/hp/hpl/jena/rdf/model/ModelGraphInterface.html" title="interface in com.hp.hpl.jena.rdf.model">ModelGraphInterface</a> in <a href="../../../../../../../com/hp/hpl/jena/rdf/model/package-summary.html">com.hp.hpl.jena.rdf.model</a></h3> <table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing subinterfaces, and an explanation"> <caption><span>Subinterfaces of <a href="../../../../../../../com/hp/hpl/jena/rdf/model/ModelGraphInterface.html" title="interface in com.hp.hpl.jena.rdf.model">ModelGraphInterface</a> in <a href="../../../../../../../com/hp/hpl/jena/rdf/model/package-summary.html">com.hp.hpl.jena.rdf.model</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Interface and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>interface&nbsp;</code></td> <td class="colLast"><code><strong><a href="../../../../../../../com/hp/hpl/jena/rdf/model/InfModel.html" title="interface in com.hp.hpl.jena.rdf.model">InfModel</a></strong></code> <div class="block">An extension to the normal Model interface that supports access to any underlying inference capability.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>interface&nbsp;</code></td> <td class="colLast"><code><strong><a href="../../../../../../../com/hp/hpl/jena/rdf/model/Model.html" title="interface in com.hp.hpl.jena.rdf.model">Model</a></strong></code> <div class="block">An RDF Model.</div> </td> </tr> </tbody> </table> </li> <li class="blockList"><a name="com.hp.hpl.jena.rdf.model.impl"> <!-- --> </a> <h3>Uses of <a href="../../../../../../../com/hp/hpl/jena/rdf/model/ModelGraphInterface.html" title="interface in com.hp.hpl.jena.rdf.model">ModelGraphInterface</a> in com.hp.hpl.jena.rdf.model.impl</h3> <table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing classes, and an explanation"> <caption><span>Classes in com.hp.hpl.jena.rdf.model.impl that implement <a href="../../../../../../../com/hp/hpl/jena/rdf/model/ModelGraphInterface.html" title="interface in com.hp.hpl.jena.rdf.model">ModelGraphInterface</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Class and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><strong>com.hp.hpl.jena.rdf.model.impl.ModelCom</strong></code> <div class="block">Common methods for model implementations.</div> </td> </tr> </tbody> </table> </li> <li class="blockList"><a name="com.hp.hpl.jena.util"> <!-- --> </a> <h3>Uses of <a href="../../../../../../../com/hp/hpl/jena/rdf/model/ModelGraphInterface.html" title="interface in com.hp.hpl.jena.rdf.model">ModelGraphInterface</a> in <a href="../../../../../../../com/hp/hpl/jena/util/package-summary.html">com.hp.hpl.jena.util</a></h3> <table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing classes, and an explanation"> <caption><span>Classes in <a href="../../../../../../../com/hp/hpl/jena/util/package-summary.html">com.hp.hpl.jena.util</a> that implement <a href="../../../../../../../com/hp/hpl/jena/rdf/model/ModelGraphInterface.html" title="interface in com.hp.hpl.jena.rdf.model">ModelGraphInterface</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Class and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><strong><a href="../../../../../../../com/hp/hpl/jena/util/MonitorModel.html" title="class in com.hp.hpl.jena.util">MonitorModel</a></strong></code> <div class="block">Model wrapper which provides normal access to an underlying model but also maintains a snapshot of the triples it was last known to contain.</div> </td> </tr> </tbody> </table> </li> </ul> </li> </ul> </div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar_bottom"> <!-- --> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../../../com/hp/hpl/jena/rdf/model/ModelGraphInterface.html" title="interface in com.hp.hpl.jena.rdf.model">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../../../index-all.html">Index</a></li> <li><a href="../../../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../../../index.html?com/hp/hpl/jena/rdf/model/class-use/ModelGraphInterface.html" target="_top">Frames</a></li> <li><a href="ModelGraphInterface.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small>Licenced under the Apache License, Version 2.0</small></p> </body> </html>
vuk/Clojure-Movies
resources/apache-jena/javadoc-core/com/hp/hpl/jena/rdf/model/class-use/ModelGraphInterface.html
HTML
epl-1.0
11,830
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.transport.multicast; import java.net.SocketAddress; import java.nio.ByteBuffer; import org.apache.activemq.command.Command; import org.apache.activemq.command.Endpoint; import org.apache.activemq.transport.udp.DatagramEndpoint; import org.apache.activemq.transport.udp.DatagramHeaderMarshaller; /** * * */ public class MulticastDatagramHeaderMarshaller extends DatagramHeaderMarshaller { private final byte[] localUriAsBytes; public MulticastDatagramHeaderMarshaller(String localUri) { this.localUriAsBytes = localUri.getBytes(); } public Endpoint createEndpoint(ByteBuffer readBuffer, SocketAddress address) { int size = readBuffer.getInt(); byte[] data = new byte[size]; readBuffer.get(data); return new DatagramEndpoint(new String(data), address); } public void writeHeader(Command command, ByteBuffer writeBuffer) { writeBuffer.putInt(localUriAsBytes.length); writeBuffer.put(localUriAsBytes); super.writeHeader(command, writeBuffer); } }
Mark-Booth/daq-eclipse
uk.ac.diamond.org.apache.activemq/org/apache/activemq/transport/multicast/MulticastDatagramHeaderMarshaller.java
Java
epl-1.0
1,880
/******************************************************************************* * Copyright (c) 2010 Oak Ridge National Laboratory. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html ******************************************************************************/ package org.csstudio.trends.databrowser2.propsheet; import org.csstudio.swt.rtplot.undo.UndoableActionManager; import org.csstudio.trends.databrowser2.Activator; import org.csstudio.trends.databrowser2.Messages; import org.csstudio.trends.databrowser2.model.PVItem; import org.csstudio.trends.databrowser2.preferences.Preferences; import org.eclipse.jface.action.Action; /** Action that configures PVs to use default archive data sources. * @author Kay Kasemir */ public class UseDefaultArchivesAction extends Action { final private UndoableActionManager operations_manager; final private PVItem pvs[]; /** Initialize * @param shell Parent shell for dialog * @param pvs PVs that should use default archives */ public UseDefaultArchivesAction(final UndoableActionManager operations_manager, final PVItem pvs[]) { super(Messages.UseDefaultArchives, Activator.getDefault().getImageDescriptor("icons/archive.gif")); //$NON-NLS-1$ this.operations_manager = operations_manager; this.pvs = pvs; } @Override public void run() { new AddArchiveCommand(operations_manager, pvs, Preferences.getArchives(), true); } }
ControlSystemStudio/cs-studio
applications/databrowser/databrowser-plugins/org.csstudio.trends.databrowser2/src/org/csstudio/trends/databrowser2/propsheet/UseDefaultArchivesAction.java
Java
epl-1.0
1,688
/* * Debrief - the Open Source Maritime Analysis Application * http://debrief.info * * (C) 2000-2014, PlanetMayo Ltd * * This library is free software; you can redistribute it and/or * modify it under the terms of the Eclipse Public License v1.0 * (http://www.eclipse.org/legal/epl-v10.html) * * This library 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. */ package MWC.GUI.Properties.Swing; // Copyright MWC 1999, Debrief 3 Project // $RCSfile: SwingDatePropertyEditor.java,v $ // @author $Author: Ian.Mayo $ // @version $Revision: 1.3 $ // $Log: SwingDatePropertyEditor.java,v $ // Revision 1.3 2004/11/26 11:32:48 Ian.Mayo // Moving closer, supporting checking for time resolution // // Revision 1.2 2004/05/25 15:29:37 Ian.Mayo // Commit updates from home // // Revision 1.1.1.1 2004/03/04 20:31:20 ian // no message // // Revision 1.1.1.1 2003/07/17 10:07:26 Ian.Mayo // Initial import // // Revision 1.2 2002-05-28 09:25:47+01 ian_mayo // after switch to new system // // Revision 1.1 2002-05-28 09:14:33+01 ian_mayo // Initial revision // // Revision 1.1 2002-04-11 14:01:26+01 ian_mayo // Initial revision // // Revision 1.1 2001-08-31 10:36:55+01 administrator // Tidied up layout, so all data is displayed when editor panel is first opened // // Revision 1.0 2001-07-17 08:43:31+01 administrator // Initial revision // // Revision 1.4 2001-07-12 12:06:59+01 novatech // use tooltips to show the date format // // Revision 1.3 2001-01-21 21:38:23+00 novatech // handle focusGained = select all text // // Revision 1.2 2001-01-17 09:41:37+00 novatech // factor generic processing to parent class, and provide support for NULL values // // Revision 1.1 2001-01-03 13:42:39+00 novatech // Initial revision // // Revision 1.1.1.1 2000/12/12 21:45:37 ianmayo // initial version // // Revision 1.5 2000-10-09 13:35:47+01 ian_mayo // Switched stack traces to go to log file // // Revision 1.4 2000-04-03 10:48:57+01 ian_mayo // squeeze up the controls // // Revision 1.3 2000-02-02 14:25:07+00 ian_mayo // correct package naming // // Revision 1.2 1999-11-23 11:05:03+00 ian_mayo // further introduction of SWING components // // Revision 1.1 1999-11-16 16:07:19+00 ian_mayo // Initial revision // // Revision 1.1 1999-11-16 16:02:29+00 ian_mayo // Initial revision // // Revision 1.2 1999-11-11 18:16:09+00 ian_mayo // new class, now working // // Revision 1.1 1999-10-12 15:36:48+01 ian_mayo // Initial revision // // Revision 1.1 1999-08-26 10:05:48+01 administrator // Initial revision // import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.FocusEvent; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import MWC.GUI.Dialogs.DialogFactory; import MWC.GenericData.HiResDate; import MWC.Utilities.TextFormatting.DebriefFormatDateTime; public class SwingDatePropertyEditor extends MWC.GUI.Properties.DatePropertyEditor implements java.awt.event.FocusListener { ///////////////////////////////////////////////////////////// // member variables //////////////////////////////////////////////////////////// /** * field to edit the date */ JTextField _theDate; /** * field to edit the time */ JTextField _theTime; /** * label to show the microsecodns */ JLabel _theMicrosTxt; /** * panel to hold everything */ JPanel _theHolder; ///////////////////////////////////////////////////////////// // constructor //////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// // member functions //////////////////////////////////////////////////////////// /** * build the editor */ public java.awt.Component getCustomEditor() { _theHolder = new JPanel(); final java.awt.BorderLayout bl1 = new java.awt.BorderLayout(); bl1.setVgap(0); bl1.setHgap(0); final java.awt.BorderLayout bl2 = new java.awt.BorderLayout(); bl2.setVgap(0); bl2.setHgap(0); final JPanel lPanel = new JPanel(); lPanel.setLayout(bl1); final JPanel rPanel = new JPanel(); rPanel.setLayout(bl2); _theHolder.setLayout(new java.awt.GridLayout(0, 2)); _theDate = new JTextField(); _theDate.setToolTipText("Format: " + NULL_DATE); _theTime = new JTextField(); _theTime.setToolTipText("Format: " + NULL_TIME); lPanel.add("Center", new JLabel("Date:", JLabel.RIGHT)); lPanel.add("East", _theDate); rPanel.add("Center", new JLabel("Time:", JLabel.RIGHT)); rPanel.add("East", _theTime); _theHolder.add(lPanel); _theHolder.add(rPanel); // get the fields to select the full text when they're selected _theDate.addFocusListener(this); _theTime.addFocusListener(this); // right, just see if we are in hi-res DTG editing mode if (HiResDate.inHiResProcessingMode()) { // ok, add a button to allow the user to enter DTG data final JButton editMicros = new JButton("Micros"); editMicros.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { editMicrosPressed(); } }); // ok, we' _theMicrosTxt = new JLabel(".."); _theHolder.add(_theMicrosTxt); _theHolder.add(editMicros); } resetData(); return _theHolder; } /** * user wants to edit the microseconds. give him a popup */ void editMicrosPressed() { //To change body of created methods use File | Settings | File Templates. final Integer res = DialogFactory.getInteger("Edit microseconds", "Enter microseconds",(int) _theMicros); // did user enter anything? if(res != null) { // store the data _theMicros = res.intValue(); // and update the screen resetData(); } } /** * get the date text as a string */ protected String getDateText() { return _theDate.getText(); } /** * get the date text as a string */ protected String getTimeText() { return _theTime.getText(); } /** * set the date text in string form */ protected void setDateText(final String val) { if (_theHolder != null) { _theDate.setText(val); } } /** * set the time text in string form */ protected void setTimeText(final String val) { if (_theHolder != null) { _theTime.setText(val); } } /** * show the user how many microseconds there are * * @param val */ protected void setMicroText(final long val) { // output the number of microseconds _theMicrosTxt.setText(DebriefFormatDateTime.formatMicros(new HiResDate(0, val)) + " micros"); } ///////////////////////////// // focus listener support classes ///////////////////////////// /** * Invoked when a component gains the keyboard focus. */ public void focusGained(final FocusEvent e) { final java.awt.Component c = e.getComponent(); if (c instanceof JTextField) { final JTextField jt = (JTextField) c; jt.setSelectionStart(0); jt.setSelectionEnd(jt.getText().length()); } } /** * Invoked when a component loses the keyboard focus. */ public void focusLost(final FocusEvent e) { } }
alastrina123/debrief
org.mwc.cmap.legacy/src/MWC/GUI/Properties/Swing/SwingDatePropertyEditor.java
Java
epl-1.0
7,774
/* Copyright (c) 2007 Scott Lembcke * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /// @defgroup cpPinJoint cpPinJoint /// @{ const cpConstraintClass *cpPinJointGetClass(void); /// @private typedef struct cpPinJoint { cpConstraint constraint; cpVect anchr1, anchr2; cpFloat dist; cpVect r1, r2; cpVect n; cpFloat nMass; cpFloat jnAcc; cpFloat bias; } cpPinJoint; /// Allocate a pin joint. cpPinJoint* cpPinJointAlloc(void); /// Initialize a pin joint. cpPinJoint* cpPinJointInit(cpPinJoint *joint, cpBody *a, cpBody *b, cpVect anchr1, cpVect anchr2); /// Allocate and initialize a pin joint. cpConstraint* cpPinJointNew(cpBody *a, cpBody *b, cpVect anchr1, cpVect anchr2); CP_DefineConstraintProperty(cpPinJoint, cpVect, anchr1, Anchr1) CP_DefineConstraintProperty(cpPinJoint, cpVect, anchr2, Anchr2) CP_DefineConstraintProperty(cpPinJoint, cpFloat, dist, Dist) ///@}
soniyj/basement
src/Cocos2d-x/TestGame1/cocos2d/external/chipmunk/include/chipmunk/constraints/cpPinJoint.h
C
gpl-2.0
1,974
/* * Syscall interface to knfsd. * * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> */ #include <linux/slab.h> #include <linux/namei.h> #include <linux/ctype.h> #include <linux/sunrpc/svcsock.h> #include <linux/lockd/lockd.h> #include <linux/sunrpc/addr.h> #include <linux/sunrpc/gss_api.h> #include <linux/sunrpc/gss_krb5_enctypes.h> #include <linux/sunrpc/rpc_pipe_fs.h> #include <linux/module.h> #include "idmap.h" #include "nfsd.h" #include "cache.h" #include "state.h" #include "netns.h" /* * We have a single directory with several nodes in it. */ enum { NFSD_Root = 1, NFSD_List, NFSD_Export_features, NFSD_Fh, NFSD_FO_UnlockIP, NFSD_FO_UnlockFS, NFSD_Threads, NFSD_Pool_Threads, NFSD_Pool_Stats, NFSD_Reply_Cache_Stats, NFSD_Versions, NFSD_Ports, NFSD_MaxBlkSize, NFSD_SupportedEnctypes, /* * The below MUST come last. Otherwise we leave a hole in nfsd_files[] * with !CONFIG_NFSD_V4 and simple_fill_super() goes oops */ #ifdef CONFIG_NFSD_V4 NFSD_Leasetime, NFSD_Gracetime, NFSD_RecoveryDir, #endif }; /* * write() for these nodes. */ static ssize_t write_filehandle(struct file *file, char *buf, size_t size); static ssize_t write_unlock_ip(struct file *file, char *buf, size_t size); static ssize_t write_unlock_fs(struct file *file, char *buf, size_t size); static ssize_t write_threads(struct file *file, char *buf, size_t size); static ssize_t write_pool_threads(struct file *file, char *buf, size_t size); static ssize_t write_versions(struct file *file, char *buf, size_t size); static ssize_t write_ports(struct file *file, char *buf, size_t size); static ssize_t write_maxblksize(struct file *file, char *buf, size_t size); #ifdef CONFIG_NFSD_V4 static ssize_t write_leasetime(struct file *file, char *buf, size_t size); static ssize_t write_gracetime(struct file *file, char *buf, size_t size); static ssize_t write_recoverydir(struct file *file, char *buf, size_t size); #endif static ssize_t (*write_op[])(struct file *, char *, size_t) = { [NFSD_Fh] = write_filehandle, [NFSD_FO_UnlockIP] = write_unlock_ip, [NFSD_FO_UnlockFS] = write_unlock_fs, [NFSD_Threads] = write_threads, [NFSD_Pool_Threads] = write_pool_threads, [NFSD_Versions] = write_versions, [NFSD_Ports] = write_ports, [NFSD_MaxBlkSize] = write_maxblksize, #ifdef CONFIG_NFSD_V4 [NFSD_Leasetime] = write_leasetime, [NFSD_Gracetime] = write_gracetime, [NFSD_RecoveryDir] = write_recoverydir, #endif }; static ssize_t nfsctl_transaction_write(struct file *file, const char __user *buf, size_t size, loff_t *pos) { ino_t ino = file_inode(file)->i_ino; char *data; ssize_t rv; if (ino >= ARRAY_SIZE(write_op) || !write_op[ino]) return -EINVAL; data = simple_transaction_get(file, buf, size); if (IS_ERR(data)) return PTR_ERR(data); rv = write_op[ino](file, data, size); if (rv >= 0) { simple_transaction_set(file, rv); rv = size; } return rv; } static ssize_t nfsctl_transaction_read(struct file *file, char __user *buf, size_t size, loff_t *pos) { if (! file->private_data) { /* An attempt to read a transaction file without writing * causes a 0-byte write so that the file can return * state information */ ssize_t rv = nfsctl_transaction_write(file, buf, 0, pos); if (rv < 0) return rv; } return simple_transaction_read(file, buf, size, pos); } static const struct file_operations transaction_ops = { .write = nfsctl_transaction_write, .read = nfsctl_transaction_read, .release = simple_transaction_release, .llseek = default_llseek, }; static int exports_net_open(struct net *net, struct file *file) { int err; struct seq_file *seq; struct nfsd_net *nn = net_generic(net, nfsd_net_id); err = seq_open(file, &nfs_exports_op); if (err) return err; seq = file->private_data; seq->private = nn->svc_export_cache; return 0; } static int exports_proc_open(struct inode *inode, struct file *file) { return exports_net_open(current->nsproxy->net_ns, file); } static const struct file_operations exports_proc_operations = { .open = exports_proc_open, .read = seq_read, .llseek = seq_lseek, .release = seq_release, .owner = THIS_MODULE, }; static int exports_nfsd_open(struct inode *inode, struct file *file) { return exports_net_open(inode->i_sb->s_fs_info, file); } static const struct file_operations exports_nfsd_operations = { .open = exports_nfsd_open, .read = seq_read, .llseek = seq_lseek, .release = seq_release, .owner = THIS_MODULE, }; static int export_features_show(struct seq_file *m, void *v) { seq_printf(m, "0x%x 0x%x\n", NFSEXP_ALLFLAGS, NFSEXP_SECINFO_FLAGS); return 0; } static int export_features_open(struct inode *inode, struct file *file) { return single_open(file, export_features_show, NULL); } static const struct file_operations export_features_operations = { .open = export_features_open, .read = seq_read, .llseek = seq_lseek, .release = single_release, }; #if defined(CONFIG_SUNRPC_GSS) || defined(CONFIG_SUNRPC_GSS_MODULE) static int supported_enctypes_show(struct seq_file *m, void *v) { seq_printf(m, KRB5_SUPPORTED_ENCTYPES); return 0; } static int supported_enctypes_open(struct inode *inode, struct file *file) { return single_open(file, supported_enctypes_show, NULL); } static const struct file_operations supported_enctypes_ops = { .open = supported_enctypes_open, .read = seq_read, .llseek = seq_lseek, .release = single_release, }; #endif /* CONFIG_SUNRPC_GSS or CONFIG_SUNRPC_GSS_MODULE */ static const struct file_operations pool_stats_operations = { .open = nfsd_pool_stats_open, .read = seq_read, .llseek = seq_lseek, .release = nfsd_pool_stats_release, .owner = THIS_MODULE, }; static struct file_operations reply_cache_stats_operations = { .open = nfsd_reply_cache_stats_open, .read = seq_read, .llseek = seq_lseek, .release = single_release, }; /*----------------------------------------------------------------------------*/ /* * payload - write methods */ /** * write_unlock_ip - Release all locks used by a client * * Experimental. * * Input: * buf: '\n'-terminated C string containing a * presentation format IP address * size: length of C string in @buf * Output: * On success: returns zero if all specified locks were released; * returns one if one or more locks were not released * On error: return code is negative errno value */ static ssize_t write_unlock_ip(struct file *file, char *buf, size_t size) { struct sockaddr_storage address; struct sockaddr *sap = (struct sockaddr *)&address; size_t salen = sizeof(address); char *fo_path; struct net *net = file->f_dentry->d_sb->s_fs_info; /* sanity check */ if (size == 0) return -EINVAL; if (buf[size-1] != '\n') return -EINVAL; fo_path = buf; if (qword_get(&buf, fo_path, size) < 0) return -EINVAL; if (rpc_pton(net, fo_path, size, sap, salen) == 0) return -EINVAL; return nlmsvc_unlock_all_by_ip(sap); } /** * write_unlock_fs - Release all locks on a local file system * * Experimental. * * Input: * buf: '\n'-terminated C string containing the * absolute pathname of a local file system * size: length of C string in @buf * Output: * On success: returns zero if all specified locks were released; * returns one if one or more locks were not released * On error: return code is negative errno value */ static ssize_t write_unlock_fs(struct file *file, char *buf, size_t size) { struct path path; char *fo_path; int error; /* sanity check */ if (size == 0) return -EINVAL; if (buf[size-1] != '\n') return -EINVAL; fo_path = buf; if (qword_get(&buf, fo_path, size) < 0) return -EINVAL; error = kern_path(fo_path, 0, &path); if (error) return error; /* * XXX: Needs better sanity checking. Otherwise we could end up * releasing locks on the wrong file system. * * For example: * 1. Does the path refer to a directory? * 2. Is that directory a mount point, or * 3. Is that directory the root of an exported file system? */ error = nlmsvc_unlock_all_by_sb(path.dentry->d_sb); path_put(&path); return error; } /** * write_filehandle - Get a variable-length NFS file handle by path * * On input, the buffer contains a '\n'-terminated C string comprised of * three alphanumeric words separated by whitespace. The string may * contain escape sequences. * * Input: * buf: * domain: client domain name * path: export pathname * maxsize: numeric maximum size of * @buf * size: length of C string in @buf * Output: * On success: passed-in buffer filled with '\n'-terminated C * string containing a ASCII hex text version * of the NFS file handle; * return code is the size in bytes of the string * On error: return code is negative errno value */ static ssize_t write_filehandle(struct file *file, char *buf, size_t size) { char *dname, *path; int uninitialized_var(maxsize); char *mesg = buf; int len; struct auth_domain *dom; struct knfsd_fh fh; struct net *net = file->f_dentry->d_sb->s_fs_info; if (size == 0) return -EINVAL; if (buf[size-1] != '\n') return -EINVAL; buf[size-1] = 0; dname = mesg; len = qword_get(&mesg, dname, size); if (len <= 0) return -EINVAL; path = dname+len+1; len = qword_get(&mesg, path, size); if (len <= 0) return -EINVAL; len = get_int(&mesg, &maxsize); if (len) return len; if (maxsize < NFS_FHSIZE) return -EINVAL; if (maxsize > NFS3_FHSIZE) maxsize = NFS3_FHSIZE; if (qword_get(&mesg, mesg, size)>0) return -EINVAL; /* we have all the words, they are in buf.. */ dom = unix_domain_find(dname); if (!dom) return -ENOMEM; len = exp_rootfh(net, dom, path, &fh, maxsize); auth_domain_put(dom); if (len) return len; mesg = buf; len = SIMPLE_TRANSACTION_LIMIT; qword_addhex(&mesg, &len, (char*)&fh.fh_base, fh.fh_size); mesg[-1] = '\n'; return mesg - buf; } /** * write_threads - Start NFSD, or report the current number of running threads * * Input: * buf: ignored * size: zero * Output: * On success: passed-in buffer filled with '\n'-terminated C * string numeric value representing the number of * running NFSD threads; * return code is the size in bytes of the string * On error: return code is zero * * OR * * Input: * buf: C string containing an unsigned * integer value representing the * number of NFSD threads to start * size: non-zero length of C string in @buf * Output: * On success: NFS service is started; * passed-in buffer filled with '\n'-terminated C * string numeric value representing the number of * running NFSD threads; * return code is the size in bytes of the string * On error: return code is zero or a negative errno value */ static ssize_t write_threads(struct file *file, char *buf, size_t size) { char *mesg = buf; int rv; struct net *net = file->f_dentry->d_sb->s_fs_info; if (size > 0) { int newthreads; rv = get_int(&mesg, &newthreads); if (rv) return rv; if (newthreads < 0) return -EINVAL; rv = nfsd_svc(newthreads, net); if (rv < 0) return rv; } else rv = nfsd_nrthreads(net); return scnprintf(buf, SIMPLE_TRANSACTION_LIMIT, "%d\n", rv); } /** * write_pool_threads - Set or report the current number of threads per pool * * Input: * buf: ignored * size: zero * * OR * * Input: * buf: C string containing whitespace- * separated unsigned integer values * representing the number of NFSD * threads to start in each pool * size: non-zero length of C string in @buf * Output: * On success: passed-in buffer filled with '\n'-terminated C * string containing integer values representing the * number of NFSD threads in each pool; * return code is the size in bytes of the string * On error: return code is zero or a negative errno value */ static ssize_t write_pool_threads(struct file *file, char *buf, size_t size) { /* if size > 0, look for an array of number of threads per node * and apply them then write out number of threads per node as reply */ char *mesg = buf; int i; int rv; int len; int npools; int *nthreads; struct net *net = file->f_dentry->d_sb->s_fs_info; mutex_lock(&nfsd_mutex); npools = nfsd_nrpools(net); if (npools == 0) { /* * NFS is shut down. The admin can start it by * writing to the threads file but NOT the pool_threads * file, sorry. Report zero threads. */ mutex_unlock(&nfsd_mutex); strcpy(buf, "0\n"); return strlen(buf); } nthreads = kcalloc(npools, sizeof(int), GFP_KERNEL); rv = -ENOMEM; if (nthreads == NULL) goto out_free; if (size > 0) { for (i = 0; i < npools; i++) { rv = get_int(&mesg, &nthreads[i]); if (rv == -ENOENT) break; /* fewer numbers than pools */ if (rv) goto out_free; /* syntax error */ rv = -EINVAL; if (nthreads[i] < 0) goto out_free; } rv = nfsd_set_nrthreads(i, nthreads, net); if (rv) goto out_free; } rv = nfsd_get_nrthreads(npools, nthreads, net); if (rv) goto out_free; mesg = buf; size = SIMPLE_TRANSACTION_LIMIT; for (i = 0; i < npools && size > 0; i++) { snprintf(mesg, size, "%d%c", nthreads[i], (i == npools-1 ? '\n' : ' ')); len = strlen(mesg); size -= len; mesg += len; } rv = mesg - buf; out_free: kfree(nthreads); mutex_unlock(&nfsd_mutex); return rv; } static ssize_t __write_versions(struct file *file, char *buf, size_t size) { char *mesg = buf; char *vers, *minorp, sign; int len, num, remaining; unsigned minor; ssize_t tlen = 0; char *sep; struct net *net = file->f_dentry->d_sb->s_fs_info; struct nfsd_net *nn = net_generic(net, nfsd_net_id); if (size>0) { if (nn->nfsd_serv) /* Cannot change versions without updating * nn->nfsd_serv->sv_xdrsize, and reallocing * rq_argp and rq_resp */ return -EBUSY; if (buf[size-1] != '\n') return -EINVAL; buf[size-1] = 0; vers = mesg; len = qword_get(&mesg, vers, size); if (len <= 0) return -EINVAL; do { sign = *vers; if (sign == '+' || sign == '-') num = simple_strtol((vers+1), &minorp, 0); else num = simple_strtol(vers, &minorp, 0); if (*minorp == '.') { if (num != 4) return -EINVAL; minor = simple_strtoul(minorp+1, NULL, 0); if (minor == 0) return -EINVAL; if (nfsd_minorversion(minor, sign == '-' ? NFSD_CLEAR : NFSD_SET) < 0) return -EINVAL; goto next; } switch(num) { case 2: case 3: case 4: nfsd_vers(num, sign == '-' ? NFSD_CLEAR : NFSD_SET); break; default: return -EINVAL; } next: vers += len + 1; } while ((len = qword_get(&mesg, vers, size)) > 0); /* If all get turned off, turn them back on, as * having no versions is BAD */ nfsd_reset_versions(); } /* Now write current state into reply buffer */ len = 0; sep = ""; remaining = SIMPLE_TRANSACTION_LIMIT; for (num=2 ; num <= 4 ; num++) if (nfsd_vers(num, NFSD_AVAIL)) { len = snprintf(buf, remaining, "%s%c%d", sep, nfsd_vers(num, NFSD_TEST)?'+':'-', num); sep = " "; if (len > remaining) break; remaining -= len; buf += len; tlen += len; } if (nfsd_vers(4, NFSD_AVAIL)) for (minor = 1; minor <= NFSD_SUPPORTED_MINOR_VERSION; minor++) { len = snprintf(buf, remaining, " %c4.%u", (nfsd_vers(4, NFSD_TEST) && nfsd_minorversion(minor, NFSD_TEST)) ? '+' : '-', minor); if (len > remaining) break; remaining -= len; buf += len; tlen += len; } len = snprintf(buf, remaining, "\n"); if (len > remaining) return -EINVAL; return tlen + len; } /** * write_versions - Set or report the available NFS protocol versions * * Input: * buf: ignored * size: zero * Output: * On success: passed-in buffer filled with '\n'-terminated C * string containing positive or negative integer * values representing the current status of each * protocol version; * return code is the size in bytes of the string * On error: return code is zero or a negative errno value * * OR * * Input: * buf: C string containing whitespace- * separated positive or negative * integer values representing NFS * protocol versions to enable ("+n") * or disable ("-n") * size: non-zero length of C string in @buf * Output: * On success: status of zero or more protocol versions has * been updated; passed-in buffer filled with * '\n'-terminated C string containing positive * or negative integer values representing the * current status of each protocol version; * return code is the size in bytes of the string * On error: return code is zero or a negative errno value */ static ssize_t write_versions(struct file *file, char *buf, size_t size) { ssize_t rv; mutex_lock(&nfsd_mutex); rv = __write_versions(file, buf, size); mutex_unlock(&nfsd_mutex); return rv; } /* * Zero-length write. Return a list of NFSD's current listener * transports. */ static ssize_t __write_ports_names(char *buf, struct net *net) { struct nfsd_net *nn = net_generic(net, nfsd_net_id); if (nn->nfsd_serv == NULL) return 0; return svc_xprt_names(nn->nfsd_serv, buf, SIMPLE_TRANSACTION_LIMIT); } /* * A single 'fd' number was written, in which case it must be for * a socket of a supported family/protocol, and we use it as an * nfsd listener. */ static ssize_t __write_ports_addfd(char *buf, struct net *net) { char *mesg = buf; int fd, err; struct nfsd_net *nn = net_generic(net, nfsd_net_id); err = get_int(&mesg, &fd); if (err != 0 || fd < 0) return -EINVAL; err = nfsd_create_serv(net); if (err != 0) return err; err = svc_addsock(nn->nfsd_serv, fd, buf, SIMPLE_TRANSACTION_LIMIT); if (err < 0) { nfsd_destroy(net); return err; } /* Decrease the count, but don't shut down the service */ nn->nfsd_serv->sv_nrthreads--; return err; } /* * A transport listener is added by writing it's transport name and * a port number. */ static ssize_t __write_ports_addxprt(char *buf, struct net *net) { char transport[16]; struct svc_xprt *xprt; int port, err; struct nfsd_net *nn = net_generic(net, nfsd_net_id); if (sscanf(buf, "%15s %5u", transport, &port) != 2) return -EINVAL; if (port < 1 || port > USHRT_MAX) return -EINVAL; err = nfsd_create_serv(net); if (err != 0) return err; err = svc_create_xprt(nn->nfsd_serv, transport, net, PF_INET, port, SVC_SOCK_ANONYMOUS); if (err < 0) goto out_err; err = svc_create_xprt(nn->nfsd_serv, transport, net, PF_INET6, port, SVC_SOCK_ANONYMOUS); if (err < 0 && err != -EAFNOSUPPORT) goto out_close; /* Decrease the count, but don't shut down the service */ nn->nfsd_serv->sv_nrthreads--; return 0; out_close: xprt = svc_find_xprt(nn->nfsd_serv, transport, net, PF_INET, port); if (xprt != NULL) { svc_close_xprt(xprt); svc_xprt_put(xprt); } out_err: nfsd_destroy(net); return err; } static ssize_t __write_ports(struct file *file, char *buf, size_t size, struct net *net) { if (size == 0) return __write_ports_names(buf, net); if (isdigit(buf[0])) return __write_ports_addfd(buf, net); if (isalpha(buf[0])) return __write_ports_addxprt(buf, net); return -EINVAL; } /** * write_ports - Pass a socket file descriptor or transport name to listen on * * Input: * buf: ignored * size: zero * Output: * On success: passed-in buffer filled with a '\n'-terminated C * string containing a whitespace-separated list of * named NFSD listeners; * return code is the size in bytes of the string * On error: return code is zero or a negative errno value * * OR * * Input: * buf: C string containing an unsigned * integer value representing a bound * but unconnected socket that is to be * used as an NFSD listener; listen(3) * must be called for a SOCK_STREAM * socket, otherwise it is ignored * size: non-zero length of C string in @buf * Output: * On success: NFS service is started; * passed-in buffer filled with a '\n'-terminated C * string containing a unique alphanumeric name of * the listener; * return code is the size in bytes of the string * On error: return code is a negative errno value * * OR * * Input: * buf: C string containing a transport * name and an unsigned integer value * representing the port to listen on, * separated by whitespace * size: non-zero length of C string in @buf * Output: * On success: returns zero; NFS service is started * On error: return code is a negative errno value */ static ssize_t write_ports(struct file *file, char *buf, size_t size) { ssize_t rv; struct net *net = file->f_dentry->d_sb->s_fs_info; mutex_lock(&nfsd_mutex); rv = __write_ports(file, buf, size, net); mutex_unlock(&nfsd_mutex); return rv; } int nfsd_max_blksize; /** * write_maxblksize - Set or report the current NFS blksize * * Input: * buf: ignored * size: zero * * OR * * Input: * buf: C string containing an unsigned * integer value representing the new * NFS blksize * size: non-zero length of C string in @buf * Output: * On success: passed-in buffer filled with '\n'-terminated C string * containing numeric value of the current NFS blksize * setting; * return code is the size in bytes of the string * On error: return code is zero or a negative errno value */ static ssize_t write_maxblksize(struct file *file, char *buf, size_t size) { char *mesg = buf; struct net *net = file->f_dentry->d_sb->s_fs_info; struct nfsd_net *nn = net_generic(net, nfsd_net_id); if (size > 0) { int bsize; int rv = get_int(&mesg, &bsize); if (rv) return rv; /* force bsize into allowed range and * required alignment. */ if (bsize < 1024) bsize = 1024; if (bsize > NFSSVC_MAXBLKSIZE) bsize = NFSSVC_MAXBLKSIZE; bsize &= ~(1024-1); mutex_lock(&nfsd_mutex); if (nn->nfsd_serv) { mutex_unlock(&nfsd_mutex); return -EBUSY; } nfsd_max_blksize = bsize; mutex_unlock(&nfsd_mutex); } return scnprintf(buf, SIMPLE_TRANSACTION_LIMIT, "%d\n", nfsd_max_blksize); } #ifdef CONFIG_NFSD_V4 static ssize_t __nfsd4_write_time(struct file *file, char *buf, size_t size, time_t *time, struct nfsd_net *nn) { char *mesg = buf; int rv, i; if (size > 0) { if (nn->nfsd_serv) return -EBUSY; rv = get_int(&mesg, &i); if (rv) return rv; /* * Some sanity checking. We don't have a reason for * these particular numbers, but problems with the * extremes are: * - Too short: the briefest network outage may * cause clients to lose all their locks. Also, * the frequent polling may be wasteful. * - Too long: do you really want reboot recovery * to take more than an hour? Or to make other * clients wait an hour before being able to * revoke a dead client's locks? */ if (i < 10 || i > 3600) return -EINVAL; *time = i; } return scnprintf(buf, SIMPLE_TRANSACTION_LIMIT, "%ld\n", *time); } static ssize_t nfsd4_write_time(struct file *file, char *buf, size_t size, time_t *time, struct nfsd_net *nn) { ssize_t rv; mutex_lock(&nfsd_mutex); rv = __nfsd4_write_time(file, buf, size, time, nn); mutex_unlock(&nfsd_mutex); return rv; } /** * write_leasetime - Set or report the current NFSv4 lease time * * Input: * buf: ignored * size: zero * * OR * * Input: * buf: C string containing an unsigned * integer value representing the new * NFSv4 lease expiry time * size: non-zero length of C string in @buf * Output: * On success: passed-in buffer filled with '\n'-terminated C * string containing unsigned integer value of the * current lease expiry time; * return code is the size in bytes of the string * On error: return code is zero or a negative errno value */ static ssize_t write_leasetime(struct file *file, char *buf, size_t size) { struct net *net = file->f_dentry->d_sb->s_fs_info; struct nfsd_net *nn = net_generic(net, nfsd_net_id); return nfsd4_write_time(file, buf, size, &nn->nfsd4_lease, nn); } /** * write_gracetime - Set or report current NFSv4 grace period time * * As above, but sets the time of the NFSv4 grace period. * * Note this should never be set to less than the *previous* * lease-period time, but we don't try to enforce this. (In the common * case (a new boot), we don't know what the previous lease time was * anyway.) */ static ssize_t write_gracetime(struct file *file, char *buf, size_t size) { struct net *net = file->f_dentry->d_sb->s_fs_info; struct nfsd_net *nn = net_generic(net, nfsd_net_id); return nfsd4_write_time(file, buf, size, &nn->nfsd4_grace, nn); } static ssize_t __write_recoverydir(struct file *file, char *buf, size_t size, struct nfsd_net *nn) { char *mesg = buf; char *recdir; int len, status; if (size > 0) { if (nn->nfsd_serv) return -EBUSY; if (size > PATH_MAX || buf[size-1] != '\n') return -EINVAL; buf[size-1] = 0; recdir = mesg; len = qword_get(&mesg, recdir, size); if (len <= 0) return -EINVAL; status = nfs4_reset_recoverydir(recdir); if (status) return status; } return scnprintf(buf, SIMPLE_TRANSACTION_LIMIT, "%s\n", nfs4_recoverydir()); } /** * write_recoverydir - Set or report the pathname of the recovery directory * * Input: * buf: ignored * size: zero * * OR * * Input: * buf: C string containing the pathname * of the directory on a local file * system containing permanent NFSv4 * recovery data * size: non-zero length of C string in @buf * Output: * On success: passed-in buffer filled with '\n'-terminated C string * containing the current recovery pathname setting; * return code is the size in bytes of the string * On error: return code is zero or a negative errno value */ static ssize_t write_recoverydir(struct file *file, char *buf, size_t size) { ssize_t rv; struct net *net = file->f_dentry->d_sb->s_fs_info; struct nfsd_net *nn = net_generic(net, nfsd_net_id); mutex_lock(&nfsd_mutex); rv = __write_recoverydir(file, buf, size, nn); mutex_unlock(&nfsd_mutex); return rv; } #endif /*----------------------------------------------------------------------------*/ /* * populating the filesystem. */ static int nfsd_fill_super(struct super_block * sb, void * data, int silent) { static struct tree_descr nfsd_files[] = { [NFSD_List] = {"exports", &exports_nfsd_operations, S_IRUGO}, [NFSD_Export_features] = {"export_features", &export_features_operations, S_IRUGO}, [NFSD_FO_UnlockIP] = {"unlock_ip", &transaction_ops, S_IWUSR|S_IRUSR}, [NFSD_FO_UnlockFS] = {"unlock_filesystem", &transaction_ops, S_IWUSR|S_IRUSR}, [NFSD_Fh] = {"filehandle", &transaction_ops, S_IWUSR|S_IRUSR}, [NFSD_Threads] = {"threads", &transaction_ops, S_IWUSR|S_IRUSR}, [NFSD_Pool_Threads] = {"pool_threads", &transaction_ops, S_IWUSR|S_IRUSR}, [NFSD_Pool_Stats] = {"pool_stats", &pool_stats_operations, S_IRUGO}, [NFSD_Reply_Cache_Stats] = {"reply_cache_stats", &reply_cache_stats_operations, S_IRUGO}, [NFSD_Versions] = {"versions", &transaction_ops, S_IWUSR|S_IRUSR}, [NFSD_Ports] = {"portlist", &transaction_ops, S_IWUSR|S_IRUGO}, [NFSD_MaxBlkSize] = {"max_block_size", &transaction_ops, S_IWUSR|S_IRUGO}, #if defined(CONFIG_SUNRPC_GSS) || defined(CONFIG_SUNRPC_GSS_MODULE) [NFSD_SupportedEnctypes] = {"supported_krb5_enctypes", &supported_enctypes_ops, S_IRUGO}, #endif /* CONFIG_SUNRPC_GSS or CONFIG_SUNRPC_GSS_MODULE */ #ifdef CONFIG_NFSD_V4 [NFSD_Leasetime] = {"nfsv4leasetime", &transaction_ops, S_IWUSR|S_IRUSR}, [NFSD_Gracetime] = {"nfsv4gracetime", &transaction_ops, S_IWUSR|S_IRUSR}, [NFSD_RecoveryDir] = {"nfsv4recoverydir", &transaction_ops, S_IWUSR|S_IRUSR}, #endif /* last one */ {""} }; struct net *net = sb->s_ns; int ret; ret = simple_fill_super(sb, 0x6e667364, nfsd_files); if (ret) return ret; sb->s_fs_info = get_net(net); return 0; } static struct dentry *nfsd_mount(struct file_system_type *fs_type, int flags, const char *dev_name, void *data) { return mount_ns(fs_type, flags, NULL, current->nsproxy->net_ns, nfsd_fill_super); } static void nfsd_umount(struct super_block *sb) { struct net *net = sb->s_fs_info; kill_litter_super(sb); put_net(net); } static struct file_system_type nfsd_fs_type = { .owner = THIS_MODULE, .name = "nfsd", .mount = nfsd_mount, .kill_sb = nfsd_umount, .fs_flags = FS_VIRTUALIZED, }; MODULE_ALIAS_FS("nfsd"); #ifdef CONFIG_PROC_FS static int create_proc_exports_entry(void) { struct proc_dir_entry *entry; entry = proc_mkdir("fs/nfs", NULL); if (!entry) return -ENOMEM; entry = proc_create("exports", 0, entry, &exports_proc_operations); if (!entry) { remove_proc_entry("fs/nfs", NULL); return -ENOMEM; } return 0; } #else /* CONFIG_PROC_FS */ static int create_proc_exports_entry(void) { return 0; } #endif int nfsd_net_id; static __net_init int nfsd_init_net(struct net *net) { int retval; struct nfsd_net *nn = net_generic(net, nfsd_net_id); retval = nfsd_export_init(net); if (retval) goto out_export_error; retval = nfsd_idmap_init(net); if (retval) goto out_idmap_error; nn->nfsd4_lease = 90; /* default lease time */ nn->nfsd4_grace = 90; return 0; out_idmap_error: nfsd_export_shutdown(net); out_export_error: return retval; } static __net_exit void nfsd_exit_net(struct net *net) { nfsd_idmap_shutdown(net); nfsd_export_shutdown(net); } static struct pernet_operations nfsd_net_ops = { .init = nfsd_init_net, .exit = nfsd_exit_net, .id = &nfsd_net_id, .size = sizeof(struct nfsd_net), }; static int __init init_nfsd(void) { int retval; printk(KERN_INFO "Installing knfsd (copyright (C) 1996 okir@monad.swb.de).\n"); retval = register_cld_notifier(); if (retval) return retval; retval = register_pernet_subsys(&nfsd_net_ops); if (retval < 0) goto out_unregister_notifier; retval = nfsd4_init_slabs(); if (retval) goto out_unregister_pernet; nfs4_state_init(); retval = nfsd_fault_inject_init(); /* nfsd fault injection controls */ if (retval) goto out_free_slabs; nfsd_stat_init(); /* Statistics */ retval = nfsd_reply_cache_init(); if (retval) goto out_free_stat; nfsd_lockd_init(); /* lockd->nfsd callbacks */ retval = create_proc_exports_entry(); if (retval) goto out_free_lockd; retval = register_filesystem(&nfsd_fs_type); if (retval) goto out_free_all; return 0; out_free_all: remove_proc_entry("fs/nfs/exports", NULL); remove_proc_entry("fs/nfs", NULL); out_free_lockd: nfsd_lockd_shutdown(); nfsd_reply_cache_shutdown(); out_free_stat: nfsd_stat_shutdown(); nfsd_fault_inject_cleanup(); out_free_slabs: nfsd4_free_slabs(); out_unregister_pernet: unregister_pernet_subsys(&nfsd_net_ops); out_unregister_notifier: unregister_cld_notifier(); return retval; } static void __exit exit_nfsd(void) { nfsd_reply_cache_shutdown(); remove_proc_entry("fs/nfs/exports", NULL); remove_proc_entry("fs/nfs", NULL); nfsd_stat_shutdown(); nfsd_lockd_shutdown(); nfsd4_free_slabs(); nfsd_fault_inject_cleanup(); unregister_filesystem(&nfsd_fs_type); unregister_pernet_subsys(&nfsd_net_ops); unregister_cld_notifier(); } MODULE_AUTHOR("Olaf Kirch <okir@monad.swb.de>"); MODULE_LICENSE("GPL"); module_init(init_nfsd) module_exit(exit_nfsd)
zoobab/vzkernel
fs/nfsd/nfsctl.c
C
gpl-2.0
31,358
/* Copyright_License { XCSoar Glide Computer - http://www.xcsoar.org/ Copyright (C) 2000-2012 The XCSoar Project A detailed list of copyright holders can be found in the file "AUTHORS". 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. } */ #include "Polar/Polar.hpp" #include "Engine/GlideSolvers/PolarCoefficients.hpp" #include "Units/System.hpp" #include <stdlib.h> #include <cstdio> PolarCoefficients PolarInfo::CalculateCoefficients() const { return PolarCoefficients::From3VW(v1, v2, v3, w1, w2, w3); } bool PolarInfo::IsValid() const { return CalculateCoefficients().IsValid(); } void PolarInfo::GetString(TCHAR* line, size_t size, bool include_v_no) const { fixed V1, V2, V3; V1 = Units::ToUserUnit(v1, Unit::KILOMETER_PER_HOUR); V2 = Units::ToUserUnit(v2, Unit::KILOMETER_PER_HOUR); V3 = Units::ToUserUnit(v3, Unit::KILOMETER_PER_HOUR); if (include_v_no) _sntprintf(line, size, _T("%.0f,%.0f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f"), (double)reference_mass, (double)max_ballast, (double)V1, (double)w1, (double)V2, (double)w2, (double)V3, (double)w3, (double)wing_area, (double)v_no); else _sntprintf(line, size, _T("%.0f,%.0f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f,%.3f"), (double)reference_mass, (double)max_ballast, (double)V1, (double)w1, (double)V2, (double)w2, (double)V3, (double)w3, (double)wing_area); } bool PolarInfo::ReadString(const TCHAR *line) { PolarInfo polar; // Example: // *LS-3 WinPilot POLAR file: MassDryGross[kg], MaxWaterBallast[liters], Speed1[km/h], Sink1[m/s], Speed2, Sink2, Speed3, Sink3 // 403, 101, 115.03, -0.86, 174.04, -1.76, 212.72, -3.4 if (line[0] == _T('*')) /* a comment */ return false; TCHAR *p; polar.reference_mass = fixed(_tcstod(line, &p)); if (*p != _T(',')) return false; polar.max_ballast = fixed(_tcstod(p + 1, &p)); if (*p != _T(',')) return false; polar.v1 = Units::ToSysUnit(fixed(_tcstod(p + 1, &p)), Unit::KILOMETER_PER_HOUR); if (*p != _T(',')) return false; polar.w1 = fixed(_tcstod(p + 1, &p)); if (*p != _T(',')) return false; polar.v2 = Units::ToSysUnit(fixed(_tcstod(p + 1, &p)), Unit::KILOMETER_PER_HOUR); if (*p != _T(',')) return false; polar.w2 = fixed(_tcstod(p + 1, &p)); if (*p != _T(',')) return false; polar.v3 = Units::ToSysUnit(fixed(_tcstod(p + 1, &p)), Unit::KILOMETER_PER_HOUR); if (*p != _T(',')) return false; polar.w3 = fixed(_tcstod(p + 1, &p)); polar.wing_area = (*p != _T(',')) ? fixed_zero : fixed(_tcstod(p + 1, &p)); polar.v_no = (*p != _T(',')) ? fixed_zero : fixed(_tcstod(p + 1, &p)); *this = polar; return true; }
damianob/xcsoar_mess
src/Polar/Polar.cpp
C++
gpl-2.0
3,382
package io.mycat.backend.postgresql; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.nio.ByteBuffer; import java.nio.channels.NetworkChannel; import java.nio.channels.SocketChannel; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import io.mycat.backend.jdbc.ShowVariables; import io.mycat.backend.mysql.CharsetUtil; import io.mycat.backend.mysql.nio.MySQLConnectionHandler; import io.mycat.backend.mysql.nio.handler.ResponseHandler; import io.mycat.backend.postgresql.packet.Query; import io.mycat.backend.postgresql.packet.Terminate; import io.mycat.backend.postgresql.utils.PIOUtils; import io.mycat.backend.postgresql.utils.PacketUtils; import io.mycat.backend.postgresql.utils.PgSqlApaterUtils; import io.mycat.config.Isolations; import io.mycat.net.BackendAIOConnection; import io.mycat.route.RouteResultsetNode; import io.mycat.server.ServerConnection; import io.mycat.server.parser.ServerParse; import io.mycat.util.exception.UnknownTxIsolationException; /************************************************************* * PostgreSQL Native Connection impl * * @author Coollf * */ public class PostgreSQLBackendConnection extends BackendAIOConnection { public static enum BackendConnectionState { closed, connected, connecting } private static class StatusSync { private final Boolean autocommit; private final Integer charsetIndex; private final String schema; private final AtomicInteger synCmdCount; private final Integer txtIsolation; private final boolean xaStarted; public StatusSync(boolean xaStarted, String schema, Integer charsetIndex, Integer txtIsolation, Boolean autocommit, int synCount) { super(); this.xaStarted = xaStarted; this.schema = schema; this.charsetIndex = charsetIndex; this.txtIsolation = txtIsolation; this.autocommit = autocommit; this.synCmdCount = new AtomicInteger(synCount); } public boolean synAndExecuted(PostgreSQLBackendConnection conn) { int remains = synCmdCount.decrementAndGet(); if (remains == 0) {// syn command finished this.updateConnectionInfo(conn); conn.metaDataSyned = true; return false; } else if (remains < 0) { return true; } return false; } private void updateConnectionInfo(PostgreSQLBackendConnection conn) { conn.xaStatus = (xaStarted) ? 1 : 0; if (schema != null) { conn.schema = schema; conn.oldSchema = conn.schema; } if (charsetIndex != null) { conn.setCharset(CharsetUtil.getCharset(charsetIndex)); } if (txtIsolation != null) { conn.txIsolation = txtIsolation; } if (autocommit != null) { conn.autocommit = autocommit; } } } private static final Query _COMMIT = new Query("commit"); private static final Query _ROLLBACK = new Query("rollback"); private static void getCharsetCommand(StringBuilder sb, int clientCharIndex) { sb.append("SET names '").append(CharsetUtil.getCharset(clientCharIndex).toUpperCase()).append("';"); } /** * 获取 更改事物级别sql * * @param * @param txIsolation */ private static void getTxIsolationCommand(StringBuilder sb, int txIsolation) { switch (txIsolation) { case Isolations.READ_UNCOMMITTED: sb.append("SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;"); return; case Isolations.READ_COMMITTED: sb.append("SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;"); return; case Isolations.REPEATED_READ: sb.append("SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;"); return; case Isolations.SERIALIZABLE: sb.append("SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;"); return; default: throw new UnknownTxIsolationException("txIsolation:" + txIsolation); } } private Object attachment; private volatile boolean autocommit=true; private volatile boolean borrowed; protected volatile String charset = "utf8"; /*** * 当前事物ID */ private volatile String currentXaTxId; /** * 来自子接口 */ private volatile boolean fromSlaveDB; /**** * PG是否在事物中 */ private volatile boolean inTransaction = false; private AtomicBoolean isQuit = new AtomicBoolean(false); private volatile long lastTime; /** * 元数据同步 */ private volatile boolean metaDataSyned = true; private volatile boolean modifiedSQLExecuted = false; private volatile String oldSchema; /** * 密码 */ private volatile String password; /** * 数据源配置 */ private PostgreSQLDataSource pool; /*** * 响应handler */ private volatile ResponseHandler responseHandler; /*** * 对应数据库空间 */ private volatile String schema; // PostgreSQL服务端密码 private volatile int serverSecretKey; private volatile BackendConnectionState state = BackendConnectionState.connecting; private volatile StatusSync statusSync; private volatile int txIsolation; /*** * 用户名 */ private volatile String user; private volatile int xaStatus; public PostgreSQLBackendConnection(NetworkChannel channel, boolean fromSlaveDB) { super(channel); this.fromSlaveDB = fromSlaveDB; } @Override public void commit() { ByteBuffer buf = this.allocate(); _COMMIT.write(buf); this.write(buf); } @Override public void execute(RouteResultsetNode rrn, ServerConnection sc, boolean autocommit) throws IOException { int sqlType = rrn.getSqlType(); String orgin = rrn.getStatement(); if (LOGGER.isDebugEnabled()) { LOGGER.debug("{}查询任务。。。。{}", id, rrn.getStatement()); LOGGER.debug(orgin); } //FIX BUG https://github.com/MyCATApache/Mycat-Server/issues/1185 if (sqlType == ServerParse.SELECT || sqlType == ServerParse.SHOW) { if (sqlType == ServerParse.SHOW) { //此处进行部分SHOW 语法适配 String _newSql = PgSqlApaterUtils.apater(orgin); if(_newSql.trim().substring(0,4).equalsIgnoreCase("show")){//未能适配成功 ShowVariables.execute(sc, orgin, this); return; } } else if ("SELECT CONNECTION_ID()".equalsIgnoreCase(orgin)) { ShowVariables.justReturnValue(sc, String.valueOf(sc.getId()), this); return; } } if (!modifiedSQLExecuted && rrn.isModifySQL()) { modifiedSQLExecuted = true; } String xaTXID = sc.getSession2().getXaTXID(); synAndDoExecute(xaTXID, rrn, sc.getCharsetIndex(), sc.getTxIsolation(), autocommit); } @Override public Object getAttachment() { return attachment; } private void getAutocommitCommand(StringBuilder sb, boolean autoCommit) { if (autoCommit) { sb.append(/*"SET autocommit=1;"*/"");//Fix bug 由于 PG9.0 开始不支持此选项,默认是为自动提交逻辑。 } else { sb.append("begin transaction;"); } } @Override public long getLastTime() { return lastTime; } public String getPassword() { return password; } public PostgreSQLDataSource getPool() { return pool; } public ResponseHandler getResponseHandler() { return responseHandler; } @Override public String getSchema() { return this.schema; } public int getServerSecretKey() { return serverSecretKey; } public BackendConnectionState getState() { return state; } @Override public int getTxIsolation() { return txIsolation; } public String getUser() { return user; } @Override public boolean isAutocommit() { return autocommit; } @Override public boolean isBorrowed() { return borrowed; } @Override public boolean isClosedOrQuit() { return isClosed() || isQuit.get(); } @Override public boolean isFromSlaveDB() { return fromSlaveDB; } public boolean isInTransaction() { return inTransaction; } @Override public boolean isModifiedSQLExecuted() { return modifiedSQLExecuted; } @Override public void onConnectFailed(Throwable t) { if (handler instanceof MySQLConnectionHandler) { } } @Override public void onConnectfinish() { LOGGER.debug("连接后台真正完成"); try { SocketChannel chan = (SocketChannel) this.channel; ByteBuffer buf = PacketUtils.makeStartUpPacket(user, schema); buf.flip(); chan.write(buf); } catch (Exception e) { LOGGER.error("Connected PostgreSQL Send StartUpPacket ERROR", e); throw new RuntimeException(e); } } protected final int getPacketLength(ByteBuffer buffer, int offset) { // Pg 协议获取包长度的方法和mysql 不一样 return PIOUtils.redInteger4(buffer, offset + 1) + 1; } /********** * 此查询用于心跳检查和获取连接后的健康检查 */ @Override public void query(String query) throws UnsupportedEncodingException { RouteResultsetNode rrn = new RouteResultsetNode("default", ServerParse.SELECT, query); synAndDoExecute(null, rrn, this.charsetIndex, this.txIsolation, true); } @Override public void quit() { if (isQuit.compareAndSet(false, true) && !isClosed()) { if (state == BackendConnectionState.connected) {// 断开 与PostgreSQL连接 Terminate terminate = new Terminate(); ByteBuffer buf = this.allocate(); terminate.write(buf); write(buf); } else { close("normal"); } } } /******* * 记录sql执行信息 */ @Override public void recordSql(String host, String schema, String statement) { LOGGER.debug(String.format("executed sql: host=%s,schema=%s,statement=%s", host, schema, statement)); } @Override public void release() { if (!metaDataSyned) {/* * indicate connection not normalfinished ,and * we can't know it's syn status ,so close it */ LOGGER.warn("can't sure connection syn result,so close it " + this); this.responseHandler = null; this.close("syn status unkown "); return; } metaDataSyned = true; attachment = null; statusSync = null; modifiedSQLExecuted = false; setResponseHandler(null); pool.releaseChannel(this); } @Override public void rollback() { ByteBuffer buf = this.allocate(); _ROLLBACK.write(buf); this.write(buf); } @Override public void setAttachment(Object attachment) { this.attachment = attachment; } @Override public void setBorrowed(boolean borrowed) { this.borrowed = borrowed; } public void setInTransaction(boolean inTransaction) { this.inTransaction = inTransaction; } @Override public void setLastTime(long currentTimeMillis) { this.lastTime = currentTimeMillis; } public void setPassword(String password) { this.password = password; } public void setPool(PostgreSQLDataSource pool) { this.pool = pool; } @Override public boolean setResponseHandler(ResponseHandler commandHandler) { this.responseHandler = commandHandler; return true; } @Override public void setSchema(String newSchema) { String curSchema = schema; if (curSchema == null) { this.schema = newSchema; this.oldSchema = newSchema; } else { this.oldSchema = curSchema; this.schema = newSchema; } } public void setServerSecretKey(int serverSecretKey) { this.serverSecretKey = serverSecretKey; } public void setState(BackendConnectionState state) { this.state = state; } public void setUser(String user) { this.user = user; } private void synAndDoExecute(String xaTxID, RouteResultsetNode rrn, int clientCharSetIndex, int clientTxIsoLation, boolean clientAutoCommit) { String xaCmd = null; boolean conAutoComit = this.autocommit; String conSchema = this.schema; // never executed modify sql,so auto commit boolean expectAutocommit = !modifiedSQLExecuted || isFromSlaveDB() || clientAutoCommit; if (!expectAutocommit && xaTxID != null && xaStatus == 0) { clientTxIsoLation = Isolations.SERIALIZABLE; xaCmd = "XA START " + xaTxID + ';'; currentXaTxId = xaTxID; } int schemaSyn = conSchema.equals(oldSchema) ? 0 : 1; int charsetSyn = (this.charsetIndex == clientCharSetIndex) ? 0 : 1; int txIsoLationSyn = (txIsolation == clientTxIsoLation) ? 0 : 1; int autoCommitSyn = (conAutoComit == expectAutocommit) ? 0 : 1; int synCount = schemaSyn + charsetSyn + txIsoLationSyn + autoCommitSyn; if (synCount == 0) { String sql = rrn.getStatement(); Query query = new Query(PgSqlApaterUtils.apater(sql)); ByteBuffer buf = this.allocate();// XXX 此处处理问题 query.write(buf); this.write(buf); return; } // TODO COOLLF 此处大锅待实现. 相关 事物, 切换 库,自动提交等功能实现 StringBuilder sb = new StringBuilder(); if (charsetSyn == 1) { getCharsetCommand(sb, clientCharSetIndex); } if (txIsoLationSyn == 1) { getTxIsolationCommand(sb, clientTxIsoLation); } if (autoCommitSyn == 1) { getAutocommitCommand(sb, expectAutocommit); } if (xaCmd != null) { sb.append(xaCmd); } if (LOGGER.isDebugEnabled()) { LOGGER.debug("con need syn ,total syn cmd " + synCount + " commands " + sb.toString() + "schema change:" + ("" != null) + " con:" + this); } metaDataSyned = false; statusSync = new StatusSync(xaCmd != null, conSchema, clientCharSetIndex, clientTxIsoLation, expectAutocommit, synCount); String sql = sb.append(PgSqlApaterUtils.apater(rrn.getStatement())).toString(); if(LOGGER.isDebugEnabled()){ LOGGER.debug("con={}, SQL={}", this, sql); } Query query = new Query(sql); ByteBuffer buf = allocate();// 申请ByetBuffer query.write(buf); this.write(buf); metaDataSyned = true; } public void close(String reason) { if (!isClosed.get()) { isQuit.set(true); super.close(reason); pool.connectionClosed(this); if (this.responseHandler != null) { this.responseHandler.connectionClose(this, reason); responseHandler = null; } } } @Override public boolean syncAndExcute() { StatusSync sync = this.statusSync; if (sync != null) { boolean executed = sync.synAndExecuted(this); if (executed) { statusSync = null; } return executed; } return true; } @Override public String toString() { return "PostgreSQLBackendConnection [id=" + id + ", host=" + host + ", port=" + port + ", localPort=" + localPort + "]"; } }
inspur-iop/Mycat-Server
src/main/java/io/mycat/backend/postgresql/PostgreSQLBackendConnection.java
Java
gpl-2.0
14,050