text
stringlengths
2
1.04M
meta
dict
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/layout_chat_container" style="@style/MatchParent" tools:ignore="RtlHardcoded"> <androidx.recyclerview.widget.RecyclerView android:id="@+id/rv_chat_messages" style="@style/MatchParent" android:background="#F4F6F9" android:layout_above="@+id/tv_typing_status" android:listSelector="@android:color/transparent" /> <ProgressBar android:id="@+id/progress_chat" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true"/> <TextView android:id="@+id/tv_typing_status" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/ll_attachment_preview_container" android:textSize="13sp" android:textColor="@color/color_search_hint" android:paddingBottom="5dp" android:paddingLeft="16dp" android:paddingRight="16dp" android:background="@drawable/chat_typing_status_background" android:visibility="gone" tools:text="Alexparvus is typing..."/> <LinearLayout android:id="@+id/ll_attachment_preview_container" android:layout_width="match_parent" android:layout_height="96dp" android:layout_above="@+id/rl_chat_send_container" android:background="@color/text_color_white_alpha_06" android:orientation="vertical" android:visibility="gone" tools:visibility="visible"> <View android:id="@+id/divider_chat_attachments" style="@style/HorizontalDividerStyle" /> <com.quickblox.sample.chat.java.ui.views.AttachmentPreviewAdapterView android:id="@+id/adapter_attachment_preview" android:layout_width="match_parent" android:layout_height="wrap_content"/> </LinearLayout> <View android:id="@+id/divider_chat" android:layout_height="0.5dp" android:visibility="gone" android:layout_width="match_parent" android:background="@color/divider_color" android:layout_above="@+id/rl_chat_send_container" /> <RelativeLayout android:id="@+id/rl_chat_send_container" android:layout_width="match_parent" android:layout_height="44dp" android:visibility="gone" android:layout_alignParentBottom="true" android:background="@color/white" tools:visibility="visible"> <ImageView android:id="@+id/iv_chat_attachment" android:layout_width="wrap_content" android:layout_height="match_parent" android:paddingLeft="9dp" android:paddingRight="9dp" android:paddingTop="7dp" android:paddingBottom="7dp" android:layout_alignParentLeft="true" android:src="@drawable/ic_add_attachment" /> <EditText android:id="@+id/et_chat_message" android:layout_width="match_parent" android:layout_height="match_parent" android:hint="@string/chat_edit_text_hint" android:inputType="textShortMessage" android:textSize="15sp" android:textColor="#333333" android:background="@color/transparent" android:layout_toRightOf="@+id/iv_chat_attachment" android:layout_toLeftOf="@+id/iv_chat_send" android:textColorHint="@color/color_search_hint" android:maxLength="1000" /> <ImageView android:id="@+id/iv_chat_send" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_alignParentRight="true" android:paddingRight="10.5dp" android:paddingLeft="2.5dp" android:paddingTop="8dp" android:paddingBottom="8dp" android:src="@drawable/ic_send_message" android:tooltipText="@string/chat_send" android:onClick="onSendChatClick"/> </RelativeLayout> </RelativeLayout>
{ "content_hash": "832c4fc4d0ba552c46b1c14c78ca09a9", "timestamp": "", "source": "github", "line_count": 110, "max_line_length": 77, "avg_line_length": 38.70909090909091, "alnum_prop": 0.6258806951620479, "repo_name": "QuickBlox/quickblox-android-sdk", "id": "6ddfa5d4a0e2a997c71e1c156d9e32dcee9811a6", "size": "4258", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "sample-chat-java/app/src/main/res/layout/activity_chat.xml", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Java", "bytes": "1193698" }, { "name": "Kotlin", "bytes": "1014923" } ], "symlink_target": "" }
title: The Shell Script create-todo --- Now it is time to populate the database with some tasks. You could run the command line interface of your database and enter some MongoDB queries. But this is risky and not very handy. It becomes especially true when the complexity of your models increases. That's why you are going to create and use a *shell script* instead. ```sh foal generate script create-todo ``` A *shell script* is a piece of code intended to be called from the command line. It has access to all the components of your application, including your models. A shell script is divided in two parts: - a `schema` object which defines the specification of the command line arguments, - and a `main` function which gets these arguments as an object and executes some code. Open the new generated file in the `src/scripts` directory and update its content. ```typescript // 3p import { Config } from '@foal/core'; import { connect, disconnect } from 'mongoose'; // App import { Todo } from '../app/models'; export const schema = { properties: { text: { type: 'string' } }, required: [ 'text' ], type: 'object', }; export async function main(args: { text: string }) { // Create a new connection to the database. const uri = Config.getOrThrow('mongodb.uri', 'string'); connect(uri, { useNewUrlParser: true, useCreateIndex: true, useUnifiedTopology: true }); // Create a new task with the text given in the command line. const todo = new Todo(); todo.text = args.text; try { // Save the task in the database and then display it in the console. console.log( await todo.save() ); } catch (error) { console.log(error.message); } finally { // Close the connection to the database. disconnect(); } } ``` Build the script. ```sh npm run build:scripts ``` Then run the script to create tasks in the database. ```sh foal run create-todo text="Read the docs" foal run create-todo text="Create my first application" foal run create-todo text="Write tests" ``` > Note that if you try to create a new to-do without specifying the text argument, you'll get the error below. > > `Error: The command line arguments should have required property 'text'.`
{ "content_hash": "6822545eebfd1a582a837f98adc7ee00", "timestamp": "", "source": "github", "line_count": 77, "max_line_length": 200, "avg_line_length": 28.857142857142858, "alnum_prop": 0.711971197119712, "repo_name": "FoalTS/foal", "id": "fa1e0a0d9e2b2a90cb07065fd997eb23b2cae1c3", "size": "2226", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "docs/versioned_docs/version-1.x/tutorials/mongodb-todo-list/tuto-4-the-shell-script-create-todo.md", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "13340" }, { "name": "JavaScript", "bytes": "13176" }, { "name": "Shell", "bytes": "4470" }, { "name": "TypeScript", "bytes": "1843250" } ], "symlink_target": "" }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html lang="en-GB" xml:lang="en-GB" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>advmod:tmod</title> <link rel="root" href=""/> <!-- for JS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css"> <link rel="stylesheet" type="text/css" href="../../css/jquery-ui-redmond.css"/> <link rel="stylesheet" type="text/css" href="../../css/style.css"/> <link rel="stylesheet" type="text/css" href="../../css/style-vis.css"/> <link rel="stylesheet" type="text/css" href="../../css/hint.css"/> <script type="text/javascript" src="../../lib/ext/head.load.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/3.2.2/anchor.min.js"></script> <script>document.addEventListener("DOMContentLoaded", function(event) {anchors.add();});</script> <!-- Set up this custom Google search at https://cse.google.com/cse/business/settings?cx=001145188882102106025:dl1mehhcgbo --> <!-- DZ 2021-01-22: I am temporarily hiding the search field to find out whether it slows down loading of the title page. <script> (function() { var cx = '001145188882102106025:dl1mehhcgbo'; var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = true; gcse.src = 'https://cse.google.com/cse.js?cx=' + cx; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s); })(); </script> --> <!-- <link rel="shortcut icon" href="favicon.ico"/> --> </head> <body> <div id="main" class="center"> <div id="hp-header"> <table width="100%"><tr><td width="50%"> <span class="header-text"><a href="http://universaldependencies.org/#language-la">home</a></span> <span class="header-text"><a href="https://github.com/universaldependencies/docs/edit/pages-source/_la/dep/advmod-tmod.md" target="#">edit page</a></span> <span class="header-text"><a href="https://github.com/universaldependencies/docs/issues">issue tracker</a></span> </td><td> <gcse:search></gcse:search> </td></tr></table> </div> <hr/> <div class="v2complete"> This page pertains to UD version 2. </div> <div id="content"> <noscript> <div id="noscript"> It appears that you have Javascript disabled. Please consider enabling Javascript for this page to see the visualizations. </div> </noscript> <!-- The content may include scripts and styles, hence we must load the shared libraries before the content. --> <script type="text/javascript"> console.time('loading libraries'); var root = '../../'; // filled in by jekyll head.js( // External libraries // DZ: Copied from embedding.html. I don't know which one is needed for what, so I'm currently keeping them all. root + 'lib/ext/jquery.min.js', root + 'lib/ext/jquery.svg.min.js', root + 'lib/ext/jquery.svgdom.min.js', root + 'lib/ext/jquery.timeago.js', root + 'lib/ext/jquery-ui.min.js', root + 'lib/ext/waypoints.min.js', root + 'lib/ext/jquery.address.min.js' ); </script> <h2><code>advmod:tmod</code>: temporal adverbial modifier</h2> <p>This semantical subrelation is used to single out those <a href="la-dep/advmod">adverbial</a> modifiers that express a temporal reference, usually by means of a particular subclass of words which are marked with <a href="la-feat/AdvType"><code class="language-plaintext highlighter-rouge">AdvType=Tim</code></a> and conventionally annotated as <a href="la-pos/ADV"><code class="language-plaintext highlighter-rouge">ADV</code></a>s.</p> <p>The kinds of temporal relations expressed (duration, definiteness, and so on) are often readable from the morphological history of the adverbial element (e.g. <em>hodie</em> ‘today’ is a contraction of the ablative phrase <em>hoc die</em> ‘on this day’), but do not appear to be fully standardised (i.e. there is a variety of synchronically non-predictable forms, like <em>semper</em> ‘always’).</p> <p>The <code class="language-plaintext highlighter-rouge">tmod</code> subrelation is also used for <a href="la-dep/obl-tmod">oblique</a> arguments, which usually consist of nominal phrases: since, in Latin, this appears to be a purely formal distinction with regard to <em>adverbial</em> temporal (but also <a href="la-dep/advmod-lmod">locative</a>) expressions (often derived from nominal forms), the use of <code class="language-plaintext highlighter-rouge">tmod</code> aims to capture the fundamental unitarity of such constructions.</p> <pre><code class="language-sdparse">Huius iudicium omnem severitatem abhorret , et semper citra medium plectens , ultra medium premiando se figit . \n Of-him judgement all severity abhors , and always on-this-side mean punishing , beyond mean with-rewarding himself fixes . advcl:tmod(figit,semper) advcl:tmod(fixes,always) </code></pre> <p>‘His judgements abhor all severity, for he punishes <strong>ever</strong> on this side the mean, while in rewarding he aims ever beyond the mean.’ (<em>Letters</em>, UDante)</p> <!-- Interlanguage links updated Po lis 14 15:35:08 CET 2022 --> <!-- "in other languages" links --> <hr/> advmod:tmod in other languages: [<a href="../../apu/dep/advmod-tmod.html">apu</a>] [<a href="../../koi/dep/advmod-tmod.html">koi</a>] [<a href="../../kpv/dep/advmod-tmod.html">kpv</a>] [<a href="../../la/dep/advmod-tmod.html">la</a>] [<a href="../../mdf/dep/advmod-tmod.html">mdf</a>] [<a href="../../myv/dep/advmod-tmod.html">myv</a>] [<a href="../../ro/dep/advmod-tmod.html">ro</a>] [<a href="../../sms/dep/advmod-tmod.html">sms</a>] </div> <!-- support for embedded visualizations --> <script type="text/javascript"> var root = '../../'; // filled in by jekyll head.js( // We assume that external libraries such as jquery.min.js have already been loaded outside! // (See _layouts/base.html.) // brat helper modules root + 'lib/brat/configuration.js', root + 'lib/brat/util.js', root + 'lib/brat/annotation_log.js', root + 'lib/ext/webfont.js', // brat modules root + 'lib/brat/dispatcher.js', root + 'lib/brat/url_monitor.js', root + 'lib/brat/visualizer.js', // embedding configuration root + 'lib/local/config.js', // project-specific collection data root + 'lib/local/collections.js', // Annodoc root + 'lib/annodoc/annodoc.js', // NOTE: non-local libraries 'https://spyysalo.github.io/conllu.js/conllu.js' ); var webFontURLs = [ // root + 'static/fonts/Astloch-Bold.ttf', root + 'static/fonts/PT_Sans-Caption-Web-Regular.ttf', root + 'static/fonts/Liberation_Sans-Regular.ttf' ]; var setupTimeago = function() { jQuery("time.timeago").timeago(); }; head.ready(function() { setupTimeago(); // mark current collection (filled in by Jekyll) Collections.listing['_current'] = 'la'; // perform all embedding and support functions Annodoc.activate(Config.bratCollData, Collections.listing); }); </script> <!-- google analytics --> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-55233688-1', 'auto'); ga('send', 'pageview'); </script> <div id="footer"> <p class="footer-text">&copy; 2014–2021 <a href="http://universaldependencies.org/introduction.html#contributors" style="color:gray">Universal Dependencies contributors</a>. Site powered by <a href="http://spyysalo.github.io/annodoc" style="color:gray">Annodoc</a> and <a href="http://brat.nlplab.org/" style="color:gray">brat</a></p>. </div> </div> </body> </html>
{ "content_hash": "464484a5f7d61a88f6aae7492d51a785", "timestamp": "", "source": "github", "line_count": 193, "max_line_length": 540, "avg_line_length": 44.37823834196891, "alnum_prop": 0.6352597781669586, "repo_name": "UniversalDependencies/universaldependencies.github.io", "id": "c9f9ecfd77e2f42a09cdaa42acf70aa4e791024b", "size": "8583", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "la/dep/advmod-tmod.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "64420" }, { "name": "HTML", "bytes": "383191916" }, { "name": "JavaScript", "bytes": "687350" }, { "name": "Perl", "bytes": "7788" }, { "name": "Python", "bytes": "21203" }, { "name": "Shell", "bytes": "7253" } ], "symlink_target": "" }
/*! HTML5 Boilerplate v5.2.0 | MIT License | https://html5boilerplate.com/ */ /* * What follows is the result of much research on cross-browser styling. * Credit left inline and big thanks to Nicolas Gallagher, Jonathan Neal, * Kroc Camen, and the H5BP dev community and team. */ /* ========================================================================== Base styles: opinionated defaults ========================================================================== */ html { color: #222; font-size: 1em; line-height: 1.4; } /* * Remove text-shadow in selection highlight: * https://twitter.com/miketaylr/status/12228805301 * * These selection rule sets have to be separate. * Customize the background color to match your design. */ ::-moz-selection { background: #b3d4fc; text-shadow: none; } ::selection { background: #b3d4fc; text-shadow: none; } /* * A better looking default horizontal rule */ hr { display: block; height: 1px; border: 0; border-top: 1px solid #ccc; margin: 1em 0; padding: 0; } /* * Remove the gap between audio, canvas, iframes, * images, videos and the bottom of their containers: * https://github.com/h5bp/html5-boilerplate/issues/440 */ audio, canvas, iframe, img, svg, video { vertical-align: middle; } /* * Remove default fieldset styles. */ fieldset { border: 0; margin: 0; padding: 0; } /* * Allow only vertical resizing of textareas. */ textarea { resize: vertical; } /* ========================================================================== Browser Upgrade Prompt ========================================================================== */ .browserupgrade { margin: 0.2em 0; background: #ccc; color: #000; padding: 0.2em 0; } /* ========================================================================== Author's custom styles ========================================================================== */ /* ========================================================================== Helper classes ========================================================================== */ /* * Hide visually and from screen readers: */ .hidden { display: none !important; } /* * Hide only visually, but have it available for screen readers: * http://snook.ca/archives/html_and_css/hiding-content-for-accessibility */ .visuallyhidden { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; } /* * Extends the .visuallyhidden class to allow the element * to be focusable when navigated to via the keyboard: * https://www.drupal.org/node/897638 */ .visuallyhidden.focusable:active, .visuallyhidden.focusable:focus { clip: auto; height: auto; margin: 0; overflow: visible; position: static; width: auto; } /* * Hide visually and from screen readers, but maintain layout */ .invisible { visibility: hidden; } /* * Clearfix: contain floats * * For modern browsers * 1. The space content is one way to avoid an Opera bug when the * `contenteditable` attribute is included anywhere else in the document. * Otherwise it causes space to appear at the top and bottom of elements * that receive the `clearfix` class. * 2. The use of `table` rather than `block` is only necessary if using * `:before` to contain the top-margins of child elements. */ .clearfix:before, .clearfix:after { content: " "; /* 1 */ display: table; /* 2 */ } .clearfix:after { clear: both; } /* ========================================================================== EXAMPLE Media Queries for Responsive Design. These examples override the primary ('mobile first') styles. Modify as content requires. ========================================================================== */ @media only screen and (min-width: 35em) { /* Style adjustments for viewports that meet the condition */ } @media print, (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 1.25dppx), (min-resolution: 120dpi) { /* Style adjustments for high resolution devices */ } /* ========================================================================== Print styles. Inlined to avoid the additional HTTP request: http://www.phpied.com/delay-loading-your-print-css/ ========================================================================== */ @media print { *, *:before, *:after { background: transparent !important; color: #000 !important; /* Black prints faster: http://www.sanbeiji.com/archives/953 */ box-shadow: none !important; text-shadow: none !important; } a, a:visited { text-decoration: underline; } a[href]:after { content: " (" attr(href) ")"; } abbr[title]:after { content: " (" attr(title) ")"; } /* * Don't show links that are fragment identifiers, * or use the `javascript:` pseudo protocol */ a[href^="#"]:after, a[href^="javascript:"]:after { content: ""; } pre, blockquote { border: 1px solid #999; page-break-inside: avoid; } /* * Printing Tables: * http://css-discuss.incutio.com/wiki/Printing_Tables */ thead { display: table-header-group; } tr, img { page-break-inside: avoid; } img { max-width: 100% !important; } p, h2, h3 { orphans: 3; widows: 3; } h2, h3 { page-break-after: avoid; } }
{ "content_hash": "5ae081877e027ac5386a72553f30524a", "timestamp": "", "source": "github", "line_count": 272, "max_line_length": 80, "avg_line_length": 21.029411764705884, "alnum_prop": 0.5146853146853146, "repo_name": "wookelvin/Site-Rio-Mockup", "id": "7618f563ef530484f2de75c913ffe28b47b5e30b", "size": "5720", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "css/main.css", "mode": "33261", "license": "mit", "language": [ { "name": "CSS", "bytes": "51267" }, { "name": "HTML", "bytes": "13415" }, { "name": "JavaScript", "bytes": "977" } ], "symlink_target": "" }
class ExternalName < ActiveRecord::Base belongs_to :external_source belongs_to :taxon has_many :external_matches def self.exact_search(opts) quote_term = connection.quote(opts[:term]) ExternalName.find_by_sql( format( "SELECT DISTINCT en.* FROM external_names en, external_matches em, taxons t WHERE en.id = em.external_name_id AND t.id = en.taxon_id AND t.scientific_name = %s AND (en.name = %s or en.gene_name = %s)", connection.quote(opts[:scientific_name]), quote_term, quote_term) ) end def self.like_search(opts) escape_term = sanitize(opts[:term]).gsub(/^'(.+)'$/, '\1') escape_scientific_name = sanitize(opts[:scientific_name]) ExternalName.find_by_sql( format( "SELECT DISTINCT en.* FROM external_names en, external_matches em, taxons t WHERE en.id = em.external_name_id AND t.id = en.taxon_id AND t.scientific_name = %s AND (en.name LIKE '%%%s%%' or en.gene_name LIKE '%%%s%%' or en.functional_name LIKE '%%%s%%') LIMIT %s", escape_scientific_name, escape_term, escape_term, escape_term, opts[:limit].to_i ) ) end def transcripts result = Set.new external_matches.each do |em| result.add(em.transcript) end result end def table_items Seabase::Normalizer.new( Replicate.all, transcripts, ExternalName.connection.select_rows( "SELECT mc.mapping_count, mc.replicate_id, em.transcript_id FROM mapping_counts mc, external_matches em, external_names en WHERE em.transcript_id = mc.transcript_id AND em.external_name_id = en.id AND en.id = #{id}" ) ).table end end
{ "content_hash": "4cd89eaf4d6dc8b5b227a834d57bbb29", "timestamp": "", "source": "github", "line_count": 55, "max_line_length": 77, "avg_line_length": 31.454545454545453, "alnum_prop": 0.6242774566473989, "repo_name": "EOL/seabase", "id": "423499f37bbf56f8f0c3c2bfcec03b64ce1e0745", "size": "1802", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "models/external_name.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "5641" }, { "name": "HTML", "bytes": "203168" }, { "name": "Java", "bytes": "6120" }, { "name": "Perl", "bytes": "3952" }, { "name": "Ruby", "bytes": "75869" }, { "name": "Shell", "bytes": "1960" }, { "name": "TeX", "bytes": "1136" } ], "symlink_target": "" }
package com.aula.andre.drogaria.bean; import java.io.Serializable; import java.util.List; import javax.annotation.PostConstruct; import javax.faces.bean.ManagedBean; import javax.faces.bean.ViewScoped; import org.omnifaces.util.Messages; import com.aula.andre.drogaria.dao.ClienteDAO; import com.aula.andre.drogaria.domain.Cliente; @SuppressWarnings("serial") @ManagedBean @ViewScoped public class ClienteBean implements Serializable { private List<Cliente> clientes; public List<Cliente> getClientes() { return clientes; } public void setClientes(List<Cliente> clientes) { this.clientes = clientes; } @PostConstruct public void listar(){ try{ ClienteDAO clienteDAO = new ClienteDAO(); clientes = clienteDAO.listar("dataCadastro"); }catch(RuntimeException erro){ Messages.addGlobalError("Ocorreu um erro ao tentar listar clientes"); erro.printStackTrace(); } } }
{ "content_hash": "b387f3698ff32f281b22132f9b17176d", "timestamp": "", "source": "github", "line_count": 39, "max_line_length": 72, "avg_line_length": 23.128205128205128, "alnum_prop": 0.7682926829268293, "repo_name": "adrlgit/Drogaria", "id": "36fa7ce73f46c1c7f53cb12b93b6245c62a58eb0", "size": "902", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Drogaria/src/main/java/com/aula/andre/drogaria/bean/ClienteBean.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "24473" }, { "name": "Java", "bytes": "40761" } ], "symlink_target": "" }
// // QueryResultSet.cs // // Copyright (c) 2017 Couchbase, Inc All rights reserved. // // 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. // using System; using System.Collections; using System.Collections.Generic; using System.Linq; using Couchbase.Lite.Internal.Logging; using Couchbase.Lite.Query; using Couchbase.Lite.Support; using JetBrains.Annotations; using LiteCore.Interop; namespace Couchbase.Lite.Internal.Query { internal sealed unsafe class QueryResultSet : IResultSet { #region Constants private const string Tag = nameof(QueryResultSet); #endregion #region Variables private readonly C4QueryEnumerator* _c4Enum; [NotNull]private readonly QueryResultContext _context; private readonly QueryBase _query; [NotNull]private readonly ThreadSafety _threadSafety; private bool _disposed; private bool _enumeratorGenerated; #endregion #region Properties internal IDictionary<string, int> ColumnNames { get; } internal Database Database => _query?.Database; internal Collection Collection => _query?.Collection; internal Result this[int index] { get { _threadSafety.DoLockedBridge(err => { if (_disposed) { throw new ObjectDisposedException(nameof(QueryResultSet)); } return Native.c4queryenum_seek(_c4Enum, index, err); }); return new Result(this, _c4Enum, _context); } } #endregion #region Constructors internal QueryResultSet(QueryBase query, [NotNull]ThreadSafety threadSafety, C4QueryEnumerator* e, IDictionary<string, int> columnNames) { _query = query; _c4Enum = e; ColumnNames = columnNames; _threadSafety = threadSafety; _context = new QueryResultContext(query?.Database, e); } #endregion #region Public Methods public QueryResultSet Refresh() { var query = _query; if (query == null) { return null; } var newEnum = (C4QueryEnumerator*)_threadSafety.DoLockedBridge(err => { if (_disposed) { return null; } return Native.c4queryenum_refresh(_c4Enum, err); }); return newEnum != null ? new QueryResultSet(query, _threadSafety, newEnum, ColumnNames) : null; } #endregion #region Internal Methods internal void Release() { _threadSafety.DoLocked(() => { if (_disposed) { return; } _disposed = true; _context.Dispose(); }); } #endregion #region IEnumerable IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); #endregion #region IEnumerable<Result> public IEnumerator<Result> GetEnumerator() { _threadSafety.DoLocked(() => { if (_enumeratorGenerated) { throw new InvalidOperationException(CouchbaseLiteErrorMessage.ResultSetAlreadyEnumerated); } if (_disposed) { throw new ObjectDisposedException(nameof(QueryResultSet)); } _enumeratorGenerated = true; }); return new Enumerator(this); } #endregion #region IResultSet public List<Result> AllResults() => this.ToList(); #endregion #region Nested private sealed class Enumerator : IEnumerator<Result> { #region Variables private readonly C4QueryEnumerator* _enum; [NotNull]private readonly QueryResultSet _parent; #endregion #region Properties object IEnumerator.Current => Current; public Result Current { get { if (_parent._disposed) { throw new ObjectDisposedException(nameof(QueryResultSet)); } return new Result(_parent, _enum, _parent._context); } } #endregion #region Constructors public Enumerator([NotNull]QueryResultSet parent) { _parent = parent; _enum = _parent._c4Enum; WriteLog.To.Query.I(Tag, $"Beginning query enumeration ({(long) _enum:x})"); } #endregion #region IDisposable public void Dispose() { // No-op } #endregion #region IEnumerator public bool MoveNext() { return _parent._threadSafety.DoLocked(() => { if (_parent._disposed) { return false; } C4Error err; var moved = Native.c4queryenum_next(_enum, &err); if (moved) { return true; } if (err.code != 0) { WriteLog.To.Query.W(Tag, $"{this} error: {err.domain}/{err.code}"); } else { WriteLog.To.Query.I(Tag, $"End of query enumeration ({(long) _enum:x})"); } return false; }); } public void Reset() { } #endregion } #endregion } }
{ "content_hash": "715e24ee8e1eb474a1fa52cc0b920f72", "timestamp": "", "source": "github", "line_count": 251, "max_line_length": 110, "avg_line_length": 25.729083665338646, "alnum_prop": 0.5137813564571074, "repo_name": "couchbase/couchbase-lite-net", "id": "83fa0a600d730d5491c917148e90deb6659971f3", "size": "6460", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/Couchbase.Lite.Shared/Query/QueryResultSet.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "2853" }, { "name": "C#", "bytes": "2694002" }, { "name": "PowerShell", "bytes": "17354" }, { "name": "Python", "bytes": "26527" }, { "name": "Shell", "bytes": "2708" } ], "symlink_target": "" }
package com.ruleengine; /** * Created by pmandrek on 7/1/14. */ public interface Constraint<Type> { Boolean evaluate(Type value1, InEqualityOperator operator, Type value2); }
{ "content_hash": "e3a560477209d8e755b592b663a231ee", "timestamp": "", "source": "github", "line_count": 8, "max_line_length": 76, "avg_line_length": 22.75, "alnum_prop": 0.7307692307692307, "repo_name": "ratpik/rule-engine", "id": "ceb42d3ea5bcc8ed95e8fa70637ec841eae4a251", "size": "182", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/com/ruleengine/Constraint.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "6110" } ], "symlink_target": "" }
package engo const ( // AxisMax is the maximum value a joystick or keypress axis will reach AxisMax float32 = 1 // AxisMin is the value an axis returns if there has been to state change. AxisNeutral float32 = 0 // AxisMin is the minimum value a joystick or keypress axis will reach AxisMin float32 = -1 ) // NewInputManager holds onto anything input related for engo func NewInputManager() *InputManager { return &InputManager{ axes: make(map[string]Axis), buttons: make(map[string]Button), keys: NewKeyManager(), } } // InputManager contains information about all forms of input. type InputManager struct { // Mouse is InputManager's reference to the mouse. It is recommended to use the // Axis and Button system if at all possible. Mouse Mouse axes map[string]Axis buttons map[string]Button keys *KeyManager } func (im *InputManager) update() { im.keys.update() } // RegisterAxis registers a new axis which can be used to retrieve inputs which are spectrums. func (im *InputManager) RegisterAxis(name string, pairs ...AxisPair) { im.axes[name] = Axis{ Name: name, Pairs: pairs, } } // RegisterButton registers a new button input. func (im *InputManager) RegisterButton(name string, keys ...Key) { im.buttons[name] = Button{ Triggers: keys, Name: name, } } // Axis retrieves an Axis with a specified name. func (im *InputManager) Axis(name string) Axis { return im.axes[name] } // Button retrieves a Button with a specified name. func (im *InputManager) Button(name string) Button { return im.buttons[name] } type Mouse struct { X, Y float32 ScrollX, ScrollY float32 Action Action Button MouseButton Modifer Modifier }
{ "content_hash": "41d0484d032693fbfd4574eca9d56a9f", "timestamp": "", "source": "github", "line_count": 68, "max_line_length": 94, "avg_line_length": 25.41176470588235, "alnum_prop": 0.7118055555555556, "repo_name": "Newbrict/engo", "id": "35e7abd54d840f6950e210d619913dacaf9508d5", "size": "1728", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "input.go", "mode": "33188", "license": "mit", "language": [ { "name": "Go", "bytes": "204417" }, { "name": "Shell", "bytes": "1745" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Source: engine/events.js</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Source: engine/events.js</h1> <section> <article> <pre class="prettyprint source linenums"><code>/** * Event handler. * @mixin */ var EventTarget = { _listeners: {}, /** * @method * @param {string} type Type of event to be added. * @param {function} listener Function to be called when event is fired. */ addListener: function(type, listener){ if (!(type in this._listeners)) { this._listeners[type] = []; } this._listeners[type].push(listener); }, /** * @method * @param {string} type Type of event to be fired. * @param {Object} [event] Optional user-defined event object. This could contain, for example, mouse coordinates, or key codes. */ fire: function(type, event){ var e = {}; if (typeof event !== 'undefined'){ e = event; } e.event = type; e.target = this; var listeners = this._listeners[type]; if (typeof listeners !== 'undefined'){ for (var i = 0, len = listeners.length; i &lt; len; i++) { listeners[i].call(this, e); } } }, /** * @method * @param {string} type * @param {function} listener */ removeListener: function(type, listener){ var listeners = this._listeners[type]; for (var i = 0, len = listeners.length; i &lt; len; i++) { if (listeners[i] === listener) { listeners.splice(i, 1); } } } }; module.exports = EventTarget; </code></pre> </article> </section> </div> <nav> <h2><a href="index.html">Index</a></h2><h3>Classes</h3><ul><li><a href="Camera.html">Camera</a></li><li><a href="Face.html">Face</a></li><li><a href="Mesh.html">Mesh</a></li><li><a href="Scene.html">Scene</a></li></ul><h3>Mixins</h3><ul><li><a href="EventTarget.html">EventTarget</a></li></ul> </nav> <br clear="both"> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha5</a> on Wed Aug 20 2014 09:17:08 GMT-0400 (EDT) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>
{ "content_hash": "9f674612def96d4434ccb2820ebdff81", "timestamp": "", "source": "github", "line_count": 102, "max_line_length": 297, "avg_line_length": 27.627450980392158, "alnum_prop": 0.5631653655074521, "repo_name": "ebenpack/wireframe.js", "id": "902b24f6247a71fab57919cc3a500dda4d57fc54", "size": "2818", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "docs/events.js.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "8789" }, { "name": "JavaScript", "bytes": "408123" } ], "symlink_target": "" }
layout: post title: 18 years old teen blonde titleinfo: pornvd desc: Watch 18 years old teen blonde. Pornhub is the ultimate xxx porn and sex site. --- <iframe src="http://www.pornhub.com/embed/ph5682bbbfc8a7b" frameborder="0" width="630" height="338" scrolling="no"></iframe> <h2>18 years old teen blonde</h2> <h3>Watch 18 years old teen blonde. Pornhub is the ultimate xxx porn and sex site.</h3>
{ "content_hash": "00f54d7e04a9e350be683d00056c368d", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 124, "avg_line_length": 41.6, "alnum_prop": 0.7163461538461539, "repo_name": "pornvd/pornvd.github.io", "id": "222e2e6ee4b5260e6404082dce5c14d39d0f1f74", "size": "420", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "_posts/2016-01-23-18-years-old-teen-blonde.md", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "18073" }, { "name": "HTML", "bytes": "10043" }, { "name": "JavaScript", "bytes": "1581" }, { "name": "Python", "bytes": "2932" }, { "name": "Ruby", "bytes": "3287" }, { "name": "Shell", "bytes": "310" } ], "symlink_target": "" }
package com.google.cloud.dialogflow.v2.stub; import com.google.api.core.BetaApi; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcCallableFactory; import com.google.api.gax.grpc.GrpcStubCallableFactory; import com.google.api.gax.rpc.BatchingCallSettings; import com.google.api.gax.rpc.BidiStreamingCallable; import com.google.api.gax.rpc.ClientContext; import com.google.api.gax.rpc.ClientStreamingCallable; import com.google.api.gax.rpc.OperationCallSettings; import com.google.api.gax.rpc.OperationCallable; import com.google.api.gax.rpc.PagedCallSettings; import com.google.api.gax.rpc.ServerStreamingCallSettings; import com.google.api.gax.rpc.ServerStreamingCallable; import com.google.api.gax.rpc.StreamingCallSettings; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.api.gax.rpc.UnaryCallable; import com.google.longrunning.stub.OperationsStub; import javax.annotation.Generated; // AUTO-GENERATED DOCUMENTATION AND CLASS /** * gRPC callable factory implementation for Dialogflow API. * * <p>This class is for advanced usage. */ @Generated("by gapic-generator") @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public class GrpcIntentsCallableFactory implements GrpcStubCallableFactory { @Override public <RequestT, ResponseT> UnaryCallable<RequestT, ResponseT> createUnaryCallable( GrpcCallSettings<RequestT, ResponseT> grpcCallSettings, UnaryCallSettings<RequestT, ResponseT> callSettings, ClientContext clientContext) { return GrpcCallableFactory.createUnaryCallable(grpcCallSettings, callSettings, clientContext); } @Override public <RequestT, ResponseT, PagedListResponseT> UnaryCallable<RequestT, PagedListResponseT> createPagedCallable( GrpcCallSettings<RequestT, ResponseT> grpcCallSettings, PagedCallSettings<RequestT, ResponseT, PagedListResponseT> pagedCallSettings, ClientContext clientContext) { return GrpcCallableFactory.createPagedCallable( grpcCallSettings, pagedCallSettings, clientContext); } @Override public <RequestT, ResponseT> UnaryCallable<RequestT, ResponseT> createBatchingCallable( GrpcCallSettings<RequestT, ResponseT> grpcCallSettings, BatchingCallSettings<RequestT, ResponseT> batchingCallSettings, ClientContext clientContext) { return GrpcCallableFactory.createBatchingCallable( grpcCallSettings, batchingCallSettings, clientContext); } @BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") @Override public <RequestT, ResponseT, MetadataT> OperationCallable<RequestT, ResponseT, MetadataT> createOperationCallable( GrpcCallSettings<RequestT, com.google.longrunning.Operation> grpcCallSettings, OperationCallSettings<RequestT, ResponseT, MetadataT> operationCallSettings, ClientContext clientContext, OperationsStub operationsStub) { return GrpcCallableFactory.createOperationCallable( grpcCallSettings, operationCallSettings, clientContext, operationsStub); } @Override public <RequestT, ResponseT> BidiStreamingCallable<RequestT, ResponseT> createBidiStreamingCallable( GrpcCallSettings<RequestT, ResponseT> grpcCallSettings, StreamingCallSettings<RequestT, ResponseT> streamingCallSettings, ClientContext clientContext) { return GrpcCallableFactory.createBidiStreamingCallable( grpcCallSettings, streamingCallSettings, clientContext); } @Override public <RequestT, ResponseT> ServerStreamingCallable<RequestT, ResponseT> createServerStreamingCallable( GrpcCallSettings<RequestT, ResponseT> grpcCallSettings, ServerStreamingCallSettings<RequestT, ResponseT> streamingCallSettings, ClientContext clientContext) { return GrpcCallableFactory.createServerStreamingCallable( grpcCallSettings, streamingCallSettings, clientContext); } @Override public <RequestT, ResponseT> ClientStreamingCallable<RequestT, ResponseT> createClientStreamingCallable( GrpcCallSettings<RequestT, ResponseT> grpcCallSettings, StreamingCallSettings<RequestT, ResponseT> streamingCallSettings, ClientContext clientContext) { return GrpcCallableFactory.createClientStreamingCallable( grpcCallSettings, streamingCallSettings, clientContext); } }
{ "content_hash": "450999483c40e6a507d206a993a2d504", "timestamp": "", "source": "github", "line_count": 101, "max_line_length": 98, "avg_line_length": 44.28712871287129, "alnum_prop": 0.7856025039123631, "repo_name": "vam-google/google-cloud-java", "id": "a26d6f38bb9b2170de0270b0d3bbf511c7ea475f", "size": "5067", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "google-cloud-clients/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/stub/GrpcIntentsCallableFactory.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "128" }, { "name": "CSS", "bytes": "23036" }, { "name": "Dockerfile", "bytes": "127" }, { "name": "Go", "bytes": "9641" }, { "name": "HTML", "bytes": "16158" }, { "name": "Java", "bytes": "47356483" }, { "name": "JavaScript", "bytes": "989" }, { "name": "Python", "bytes": "110799" }, { "name": "Shell", "bytes": "9162" } ], "symlink_target": "" }
<?php class CCAsset extends \Core\CCAsset { /** * Add something to the packer * This method allows you to add stylesheets, javascript files etc. * to one single file. * * exmaple: * CCAsset::pack( 'jquery.js', 'footer', 'core' ); * * @param string |array $item An single or an array of assets * @param string $name The holders name like header / theme / footer * @param string $pack The package like core lib etc. * @return void */ public static function pack( $item, $name = null, $pack = 'pack' ) { if ( !is_array( $item ) ) { $items = array( $item => $name ); } $path = PUBLICPATH.static::holder( $name )->path; foreach( $items as $file => $holder ) { static::holder( $name )->assets['_packtacular'][$pack][CCStr::extension( $item )][] = $path.$file; } } /** * Get assets code by type from an holder * * @param string $extension * @param string $name */ public static function code( $extension = null, $name = null ) { $assets = static::get( $extension, $name ); // let packtacular handle css and less files if ( $extension == 'css' ) { foreach( static::holder( $name )->assets['_packtacular'] as $key => $pack ) { if ( !array_key_exists( 'less', $pack ) ) { $pack['less'] = array(); } if ( !array_key_exists( 'css', $pack ) ) { $pack['css'] = array(); } $files = array_merge( $pack['css'], $pack['less'] ); if ( !empty( $files ) ) { CCArr::push( Packtacular::handle( $files, basename( static::holder( $name )->path ).'/'.$name.'/', $key.'_{time}.css' ), $assets ); } } } // let packtacular handle js files elseif ( $extension == 'js' ) { foreach( static::holder( $name )->assets['_packtacular'] as $key => $pack ) { if ( !array_key_exists( 'js', $pack ) ) { $pack['js'] = array(); } if ( !empty( $pack['js'] ) ) { CCArr::push( Packtacular::handle( $pack['js'], basename( static::holder( $name )->path ).'/'.$name.'/', $key.'_{time}.js' ), $assets ); } } } $buffer = ""; foreach( $assets as $item ) { $buffer .= call_user_func( 'CCAsset::'.$extension, $item, $name ); } return $buffer; } /** * Get all stylesheets from an instance * * @param string $name * @return string */ public static function styles( $name = null ) { $assets = static::holder( $name )->assets['_packtacular']; foreach( $assets as $key => $pack ) { if ( !array_key_exists( 'less', $pack ) ) { $pack['less'] = array(); } if ( !array_key_exists( 'css', $pack ) ) { $pack['css'] = array(); } $files = array_merge( $pack['css'], $pack['less'] ); static::add( Packtacular::handle( $files, basename( static::holder( $name )->path ).'/'.$name.'/', $key.'_{time}.css' ), $name ); } return parent::styles( $name ); } /** * Get all scripts from an instance * * @param string $name * @return string */ public static function scripts( $name = null ) { $assets = static::holder( $name )->assets['_packtacular']; foreach( $assets as $key => $pack ) { if ( !array_key_exists( 'js', $pack ) ) { $pack['js'] = array(); } static::add( Packtacular::handle( $pack['js'], basename( static::holder( $name )->path ).'/'.$name.'/', $key.'_{time}.js' ), $name ); } return parent::scripts( $name ); } /* * Content */ public $assets = array( '_packtacular' => array(), ); }
{ "content_hash": "5a108ad581c92cae3059545cd61c5c1e", "timestamp": "", "source": "github", "line_count": 152, "max_line_length": 140, "avg_line_length": 23.092105263157894, "alnum_prop": 0.5424501424501424, "repo_name": "EarthCMS/Earth", "id": "8475b2b94636188f751789cd430a65610c3c8f41", "size": "3681", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "CCF/orbit/Packtacular/classes/CCAsset.php", "mode": "33261", "license": "mit", "language": [ { "name": "CSS", "bytes": "46191" }, { "name": "JavaScript", "bytes": "5299" }, { "name": "PHP", "bytes": "231677" } ], "symlink_target": "" }
PROGNAME=$(basename $0) TITLE="System Information Report For $HOSTNAME" CURRENT_TIME=$(date +"%x %r %Z") TIME_STAMP="Generated $CURRENT_TIME, by $USER" report_uptime () { cat << EOF <h2>System Uptime</h2> <pre>$(uptime)</pre> EOF return } report_disk_space () { cat << EOF <h2>Disk Space Utilization</h2> <pre>$(df -h)</pre> EOF return } report_home_space () { if [[ $(id -u) -eq 0 ]]; then #statements cat << EOF <h2>Home Space Utilization (All Users)</h2> <pre>$(du -sh /home/*)</pre> EOF else cat << EOF <h2>Home Space Utilization ($USER)</h2> <pre>$(du -sh $HOME)</pre> EOF fi return } usage () { echo "$PROGNAME: usage: $PROGNAME [-f file | -i]" return } write_html_page () { cat << EOF <html> <head> <title>$TITLE</title> </head> <body> <h1>$TITLE</h1> <p>$TIME_STAMP</p> $(report_uptime) $(report_disk_space) $(report_uptime) </body> </html> EOF return } # Process Command Line Options interactive= filename= while [[ -n $1 ]]; do #statements case $1 in -f | --file) shift $filename=$1 ;; -i | --interactive) interactive=1 ;; -h | --help) usage exit ;; *) usage >&2 exit 1 ;; esac shift done # interactive mode if [[ -n $interactive ]]; then #statements while true; do #statements read -p "Enter name of output file: " filename if [[ -e $filename ]]; then #statements read -p "'$filename' exists. Overwrite? [y/n/q] > " case $REPLY in Y|y) break ;; Q|q) echo "Program terminated." exit ;; *) continue ;; esac elif [[ -z $filename ]]; then continue else break fi done fi # --------------------------------------------------------------- # Process File # This tests the existance of a filename, if found then test if it is writable using 'touch'. # After being tested for being writable, it is test to see if it is a regular file. # These tests take care of the situations where an invalid pathname is given as input. # And if the file already exists. # --------------------------------------------------------------- # Test if pathname to file is correct if [[ -n $filename ]]; then # Does file exist and is file writeable? if touch $filename && [[ -f $filename ]]; then write_html_page > $filename else echo "$PROGNAME: Cannot write file '$filename'" >&2 fi else write_html_page fi
{ "content_hash": "7b044759c3455e97bde303c45b2af608", "timestamp": "", "source": "github", "line_count": 136, "max_line_length": 93, "avg_line_length": 23.91176470588235, "alnum_prop": 0.4237392373923739, "repo_name": "dank-developer/shell-scripts", "id": "c8a8c63cf6d7cdfea9d8612425e41f6cb5ef9aa0", "size": "3335", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "examples/sys-info-page/sys_info_page.sh", "mode": "33261", "license": "mit", "language": [ { "name": "HTML", "bytes": "22347" }, { "name": "Python", "bytes": "3686" }, { "name": "Shell", "bytes": "10448" } ], "symlink_target": "" }
module Reviewed class Author < Base end end
{ "content_hash": "5a7d501a190d3b3d1c2087245b6764ba", "timestamp": "", "source": "github", "line_count": 4, "max_line_length": 21, "avg_line_length": 12, "alnum_prop": 0.7291666666666666, "repo_name": "reviewed/reviewed-api-ruby", "id": "2779e4a2de1e5d3eba077df859a48ff6e92c7a32", "size": "48", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/reviewed/author.rb", "mode": "33188", "license": "mit", "language": [ { "name": "Ruby", "bytes": "45249" } ], "symlink_target": "" }
package org.openkilda.wfm.topology.portstate.spout; import static java.lang.String.format; import static org.openkilda.wfm.AbstractBolt.FIELD_ID_CONTEXT; import org.openkilda.messaging.command.CommandData; import org.openkilda.messaging.command.discovery.PortsCommandData; import org.openkilda.wfm.share.bolt.KafkaEncoder; import org.apache.storm.spout.SpoutOutputCollector; import org.apache.storm.task.TopologyContext; import org.apache.storm.topology.OutputFieldsDeclarer; import org.apache.storm.topology.base.BaseRichSpout; import org.apache.storm.tuple.Fields; import org.apache.storm.tuple.Values; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.Map; import java.util.UUID; public class SwitchPortsSpout extends BaseRichSpout { private static final Logger logger = LoggerFactory.getLogger(SwitchPortsSpout.class); private static final String CRON_TUPLE = "cron.tuple"; private static final int DEFAULT_FREQUENCY = 600; private static final String REQUESTER = SwitchPortsSpout.class.getSimpleName(); private final long frequency; private SpoutOutputCollector collector; private long lastTickTime = 0; public SwitchPortsSpout() { this(DEFAULT_FREQUENCY); } public SwitchPortsSpout(int frequency) { this.frequency = frequency * 1000L; } private static long now() { return System.currentTimeMillis(); } @Override public void open(Map map, TopologyContext context, SpoutOutputCollector collector) { this.collector = collector; } @Override public void nextTuple() { final long now = now(); if (now - lastTickTime > frequency) { CommandData data = new PortsCommandData(REQUESTER); logger.debug("emitting PortsCommandData: {}", data); String correlationId = format("SwitchPortsSpout-%s", UUID.randomUUID().toString()); collector.emit(new Values(correlationId, data, correlationId)); if (now - lastTickTime > frequency * 2) { logger.warn("long tick for PortsCommandData - {}ms", now - lastTickTime); } lastTickTime = now; } org.apache.storm.utils.Utils.sleep(1); } @Override public void declareOutputFields(OutputFieldsDeclarer declarer) { declarer.declare(new Fields(KafkaEncoder.FIELD_ID_KEY, KafkaEncoder.FIELD_ID_PAYLOAD, FIELD_ID_CONTEXT)); } }
{ "content_hash": "b4bfb139c42cdc7d79d559c0df88e088", "timestamp": "", "source": "github", "line_count": 74, "max_line_length": 113, "avg_line_length": 33.12162162162162, "alnum_prop": 0.7123623011015912, "repo_name": "telstra/open-kilda", "id": "ac8a75d339b6df82c4c65491f25174244c15dc5a", "size": "3068", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "src-java/portstate-topology/portstate-storm-topology/src/main/java/org/openkilda/wfm/topology/portstate/spout/SwitchPortsSpout.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C++", "bytes": "89798" }, { "name": "CMake", "bytes": "4314" }, { "name": "CSS", "bytes": "233390" }, { "name": "Dockerfile", "bytes": "30541" }, { "name": "Groovy", "bytes": "2234079" }, { "name": "HTML", "bytes": "362166" }, { "name": "Java", "bytes": "14631453" }, { "name": "JavaScript", "bytes": "369015" }, { "name": "Jinja", "bytes": "937" }, { "name": "Makefile", "bytes": "20500" }, { "name": "Python", "bytes": "367364" }, { "name": "Shell", "bytes": "62664" }, { "name": "TypeScript", "bytes": "867537" } ], "symlink_target": "" }
""" Title: Project: Author: Will Hardy Date: 2008 Usage: $Revision$ Description: """ from django.conf.urls.defaults import * from django_dms.apps.large_dms.views import document_view urlpatterns = patterns('', url(r'^', include(document_view.urls), name="document_view"), )
{ "content_hash": "4716339aa4cb25b77ade8545d5a79c29", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 67, "avg_line_length": 17.72222222222222, "alnum_prop": 0.6300940438871473, "repo_name": "f5inet/django-dms", "id": "ed03a42146013d8e4257ed9b25c46ca7f67866e4", "size": "365", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "django_dms/apps/large_dms/urls.py", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "CSS", "bytes": "8252" }, { "name": "HTML", "bytes": "8816" }, { "name": "JavaScript", "bytes": "33054" }, { "name": "Python", "bytes": "85025" } ], "symlink_target": "" }
package com.hazelcast.test; import com.hazelcast.internal.util.RuntimeAvailableProcessors; import com.hazelcast.test.annotation.ConfigureParallelRunnerWith; import org.junit.runner.notification.RunNotifier; import org.junit.runners.model.FrameworkMethod; import org.junit.runners.model.InitializationError; import org.junit.runners.model.Statement; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintStream; import java.io.PrintWriter; import java.io.Reader; import java.io.Writer; import java.lang.reflect.Constructor; import java.util.Collection; import java.util.Enumeration; import java.util.Map; import java.util.Properties; import java.util.Set; import java.util.concurrent.atomic.AtomicInteger; import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Runtime.getRuntime; import static java.lang.String.format; /** * Runs the test methods in parallel with multiple threads. */ public class HazelcastParallelClassRunner extends AbstractHazelcastClassRunner { private static final boolean SPAWN_MULTIPLE_THREADS = TestEnvironment.isMockNetwork(); private static final int DEFAULT_MAX_THREADS = getDefaultMaxThreads(); static { boolean multipleJVM = Boolean.getBoolean("multipleJVM"); if (multipleJVM) { // decrease the amount of resources used when running in multiple JVM RuntimeAvailableProcessors.overrideDefault(min(getRuntime().availableProcessors(), 8)); } } private static int getDefaultMaxThreads() { int cpuWorkers = max(getRuntime().availableProcessors(), 8); //the parallel profile can spawn multiple JVMs boolean multipleJVM = Boolean.getBoolean("multipleJVM"); if (multipleJVM) { // when running tests in multiple JVMs in parallel then we want to put a cap // on parallelism inside each JVM. otherwise it's easy to use too much resource // and the test duration is actually longer and not shorter. cpuWorkers = min(4, cpuWorkers); } return cpuWorkers; } private final AtomicInteger numThreads = new AtomicInteger(0); private final int maxThreads; public HazelcastParallelClassRunner(Class<?> clazz) throws InitializationError { super(clazz); maxThreads = getMaxThreads(clazz); } public HazelcastParallelClassRunner(Class<?> clazz, Object[] parameters, String name) throws InitializationError { super(clazz, parameters, name); maxThreads = getMaxThreads(clazz); } private int getMaxThreads(Class<?> clazz) throws InitializationError { if (!SPAWN_MULTIPLE_THREADS) { return 1; } ConfigureParallelRunnerWith annotation = clazz.getAnnotation(ConfigureParallelRunnerWith.class); if (annotation != null) { try { Class<? extends ParallelRunnerOptions> optionsClass = annotation.value(); Constructor constructor = optionsClass.getConstructor(); ParallelRunnerOptions parallelRunnerOptions = (ParallelRunnerOptions) constructor.newInstance(); return min(parallelRunnerOptions.maxParallelTests(), DEFAULT_MAX_THREADS); } catch (Exception e) { throw new InitializationError(e); } } else { return DEFAULT_MAX_THREADS; } } @Override protected void runChild(final FrameworkMethod method, final RunNotifier notifier) { while (numThreads.get() >= maxThreads) { try { Thread.sleep(25); } catch (InterruptedException e) { Thread.currentThread().interrupt(); return; } } numThreads.incrementAndGet(); new MultithreadedTestRunnerThread(new TestRunner(method, notifier)).start(); } @Override protected Statement childrenInvoker(final RunNotifier notifier) { return new Statement() { @Override public void evaluate() throws Throwable { // save the current system properties Properties currentSystemProperties = System.getProperties(); try { // use thread-local based system properties so parallel tests don't effect each other System.setProperties(new ThreadLocalProperties(currentSystemProperties)); HazelcastParallelClassRunner.super.childrenInvoker(notifier).evaluate(); // wait for all child threads (tests) to complete while (numThreads.get() > 0) { Thread.sleep(25); } } finally { // restore the system properties System.setProperties(currentSystemProperties); } } }; } private class TestRunner implements Runnable { private final FrameworkMethod method; private final RunNotifier notifier; TestRunner(final FrameworkMethod method, final RunNotifier notifier) { this.method = method; this.notifier = notifier; } @Override public void run() { String testName = testName(method); setThreadLocalTestMethodName(testName); try { long start = System.currentTimeMillis(); System.out.println("Started Running Test: " + testName); HazelcastParallelClassRunner.super.runChild(method, notifier); numThreads.decrementAndGet(); float took = (float) (System.currentTimeMillis() - start) / 1000; System.out.println(format("Finished Running Test: %s in %.3f seconds.", testName, took)); } finally { removeThreadLocalTestMethodName(); } } } @SuppressWarnings({"deprecation"}) private static final class ThreadLocalProperties extends Properties { private final Properties globalProperties; private final ThreadLocal<Properties> localProperties = new InheritableThreadLocal<Properties>(); private ThreadLocalProperties(Properties properties) { this.globalProperties = properties; } private Properties init(Properties properties) { for (Map.Entry entry : globalProperties.entrySet()) { properties.put(entry.getKey(), entry.getValue()); } return properties; } private Properties getThreadLocal() { Properties properties = localProperties.get(); if (properties == null) { properties = init(new Properties()); localProperties.set(properties); } return properties; } @Override public String getProperty(String key) { return getThreadLocal().getProperty(key); } @Override public Object setProperty(String key, String value) { return getThreadLocal().setProperty(key, value); } @Override public Enumeration<?> propertyNames() { return getThreadLocal().propertyNames(); } @Override public Set<String> stringPropertyNames() { return getThreadLocal().stringPropertyNames(); } @Override public int size() { return getThreadLocal().size(); } @Override public boolean isEmpty() { return getThreadLocal().isEmpty(); } @Override public Enumeration<Object> keys() { return getThreadLocal().keys(); } @Override public Enumeration<Object> elements() { return getThreadLocal().elements(); } @Override public boolean contains(Object value) { return getThreadLocal().contains(value); } @Override public boolean containsValue(Object value) { return getThreadLocal().containsValue(value); } @Override public boolean containsKey(Object key) { return getThreadLocal().containsKey(key); } @Override public Object get(Object key) { return getThreadLocal().get(key); } @Override public Object put(Object key, Object value) { return getThreadLocal().put(key, value); } @Override public Object remove(Object key) { return getThreadLocal().remove(key); } @Override public void putAll(Map<?, ?> t) { getThreadLocal().putAll(t); } @Override public void clear() { getThreadLocal().clear(); } @Override public Set<Object> keySet() { return getThreadLocal().keySet(); } @Override public Set<Map.Entry<Object, Object>> entrySet() { return getThreadLocal().entrySet(); } @Override public Collection<Object> values() { return getThreadLocal().values(); } @Override public void load(Reader reader) throws IOException { getThreadLocal().load(reader); } @Override public void load(InputStream inStream) throws IOException { getThreadLocal().load(inStream); } @Override public void save(OutputStream out, String comments) { getThreadLocal().save(out, comments); } @Override public void store(Writer writer, String comments) throws IOException { getThreadLocal().store(writer, comments); } @Override public void store(OutputStream out, String comments) throws IOException { getThreadLocal().store(out, comments); } @Override public void loadFromXML(InputStream in) throws IOException { getThreadLocal().loadFromXML(in); } @Override public void storeToXML(OutputStream os, String comment) throws IOException { getThreadLocal().storeToXML(os, comment); } @Override public void storeToXML(OutputStream os, String comment, String encoding) throws IOException { getThreadLocal().storeToXML(os, comment, encoding); } @Override public String getProperty(String key, String defaultValue) { return getThreadLocal().getProperty(key, defaultValue); } @Override public void list(PrintStream out) { getThreadLocal().list(out); } @Override public void list(PrintWriter out) { getThreadLocal().list(out); } } }
{ "content_hash": "b24f9832173d92bc1dd194ee929d5df7", "timestamp": "", "source": "github", "line_count": 335, "max_line_length": 118, "avg_line_length": 32.5910447761194, "alnum_prop": 0.6098186481040484, "repo_name": "mdogan/hazelcast", "id": "c76c29cd6e408c45a8d77f8602246d4e725502cf", "size": "11543", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "hazelcast/src/test/java/com/hazelcast/test/HazelcastParallelClassRunner.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "1862" }, { "name": "C", "bytes": "3721" }, { "name": "Java", "bytes": "45797218" }, { "name": "Shell", "bytes": "30002" } ], "symlink_target": "" }
<!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 (1.8.0_112) on Tue Jan 24 09:55:27 CST 2017 --> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Uses of Class play.ant.PlayConfigurationLoadTask (Play! API)</title> <meta name="date" content="2017-01-24"> <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="Uses of Class play.ant.PlayConfigurationLoadTask (Play! API)"; } } catch(err) { } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <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="../../../play/ant/PlayConfigurationLoadTask.html" title="class in play.ant">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?play/ant/class-use/PlayConfigurationLoadTask.html" target="_top">Frames</a></li> <li><a href="PlayConfigurationLoadTask.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../allclasses-noframe.html">All&nbsp;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 Class play.ant.PlayConfigurationLoadTask" class="title">Uses of Class<br>play.ant.PlayConfigurationLoadTask</h2> </div> <div class="classUseContainer">No usage of play.ant.PlayConfigurationLoadTask</div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <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="../../../play/ant/PlayConfigurationLoadTask.html" title="class in play.ant">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?play/ant/class-use/PlayConfigurationLoadTask.html" target="_top">Frames</a></li> <li><a href="PlayConfigurationLoadTask.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../allclasses-noframe.html">All&nbsp;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><a href=http://guillaume.bort.fr>Guillaume Bort</a> &amp; <a href=http://www.zenexity.fr>zenexity</a> - Distributed under <a href=http://www.apache.org/licenses/LICENSE-2.0.html>Apache 2 licence</a>, without any warrantly</small></p> </body> </html>
{ "content_hash": "e0d2504b8e867a3b781ddd6bb4504bd4", "timestamp": "", "source": "github", "line_count": 126, "max_line_length": 261, "avg_line_length": 37.45238095238095, "alnum_prop": 0.6160203432930705, "repo_name": "chvrga/outdoor-explorer", "id": "b231093bf4adc2616b52e54b4b87c9d85ed4528b", "size": "4719", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "java/play-1.4.4/documentation/api/play/ant/class-use/PlayConfigurationLoadTask.html", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "4720" }, { "name": "C", "bytes": "76128" }, { "name": "C++", "bytes": "31284" }, { "name": "CSS", "bytes": "107401" }, { "name": "HTML", "bytes": "1754737" }, { "name": "Java", "bytes": "2441299" }, { "name": "JavaScript", "bytes": "1405163" }, { "name": "PLpgSQL", "bytes": "1377" }, { "name": "Python", "bytes": "8991412" }, { "name": "Ruby", "bytes": "295601" }, { "name": "Shell", "bytes": "7499" }, { "name": "XQuery", "bytes": "544017" }, { "name": "XSLT", "bytes": "1099" } ], "symlink_target": "" }
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { InputStreamReader isr = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(isr); int n = Integer.parseInt(br.readLine()); for (int i = 1; i <= 10; i++) { System.out.println(i + " x " + n + " = " + (i*n)); } } }
{ "content_hash": "c759024a76a9c4a13aa61d8572c92db9", "timestamp": "", "source": "github", "line_count": 16, "max_line_length": 65, "avg_line_length": 29.8125, "alnum_prop": 0.59958071278826, "repo_name": "FlavioRo96/URI-Online-Judge", "id": "cff464d46ca9c53c7500d79efb4fc8a8fdd0f394", "size": "477", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "1078/Main.java", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "7378" }, { "name": "C#", "bytes": "195" }, { "name": "Java", "bytes": "53962" } ], "symlink_target": "" }
package main import ( "context" serviceusage "cloud.google.com/go/serviceusage/apiv1" serviceusagepb "google.golang.org/genproto/googleapis/api/serviceusage/v1" ) func main() { ctx := context.Background() c, err := serviceusage.NewClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &serviceusagepb.BatchGetServicesRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/google.golang.org/genproto/googleapis/api/serviceusage/v1#BatchGetServicesRequest. } resp, err := c.BatchGetServices(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } // [END serviceusage_v1_generated_ServiceUsage_BatchGetServices_sync]
{ "content_hash": "c338ff2d47d408715c11a17d170011a1", "timestamp": "", "source": "github", "line_count": 30, "max_line_length": 110, "avg_line_length": 23.566666666666666, "alnum_prop": 0.7142857142857143, "repo_name": "googleapis/google-cloud-go", "id": "6a6ad73fdd9269404b84498ddfdcf5064b531c00", "size": "1455", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "internal/generated/snippets/serviceusage/apiv1/Client/BatchGetServices/main.go", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Assembly", "bytes": "10349" }, { "name": "C", "bytes": "74" }, { "name": "Dockerfile", "bytes": "1841" }, { "name": "Go", "bytes": "7626642" }, { "name": "M4", "bytes": "43723" }, { "name": "Makefile", "bytes": "1455" }, { "name": "Python", "bytes": "718" }, { "name": "Shell", "bytes": "27309" } ], "symlink_target": "" }
<?hh // strict namespace FastRoute\DataGenerator; use FastRoute\Route; class GroupCountBased extends RegexBasedAbstract { protected function getApproxChunkSize(): int { return 10; } public function processChunk(array<string, Route> $regexToRoutesMap): array<string, mixed> { $routeMap = []; $regexes = []; $numGroups = 0; foreach ($regexToRoutesMap as $regex => $route) { $numVariables = count($route->variables); $numGroups = max($numGroups, $numVariables); $regexes[] = $regex . str_repeat('()', $numGroups - $numVariables); $routeMap[$numGroups + 1] = [$route->handler, $route->variables]; ++$numGroups; } $regex = '~^(?|' . implode('|', $regexes) . ')$~'; return ['regex' => $regex, 'routeMap' => $routeMap]; } }
{ "content_hash": "b58a919e6590bc537ba9d537e2af46d4", "timestamp": "", "source": "github", "line_count": 29, "max_line_length": 96, "avg_line_length": 29.79310344827586, "alnum_prop": 0.5682870370370371, "repo_name": "machee/HackFastRoute", "id": "58d9b00c1f5071d9fc24b66483967c3a3e296efa", "size": "864", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/DataGenerator/GroupCountBased.php", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Hack", "bytes": "45603" }, { "name": "PHP", "bytes": "3136" } ], "symlink_target": "" }
/* * NOTE: It is recommended that you read the processed HTML doxygen documentation * rather than this source. If you don't know doxygen, it's like javadoc for C++. * If you don't want to install doxygen you can find a copy of the processed * documentation at * * http://optionparser.sourceforge.net/ * */ /** * @file * * @brief This is the only file required to use The Lean Mean C++ Option Parser. * Just \#include it and you're set. * * The Lean Mean C++ Option Parser handles the program's command line arguments * (argc, argv). * It supports the short and long option formats of getopt(), getopt_long() * and getopt_long_only() but has a more convenient interface. * * @par Feedback: * Send questions, bug reports, feature requests etc. to: <tt><b>optionparser-feedback(a)lists.sourceforge.net</b></tt> * * @par Highlights: * <ul style="padding-left:1em;margin-left:0"> * <li> It is a header-only library. Just <code>\#include "optionparser.h"</code> and you're set. * <li> It is freestanding. There are no dependencies whatsoever, not even the * C or C++ standard library. * <li> It has a usage message formatter that supports column alignment and * line wrapping. This aids localization because it adapts to * translated strings that are shorter or longer (even if they contain * Asian wide characters). * <li> Unlike getopt() and derivatives it doesn't force you to loop through * options sequentially. Instead you can access options directly like this: * <ul style="margin-top:.5em"> * <li> Test for presence of a switch in the argument vector: * @code if ( options[QUIET] ) ... @endcode * <li> Evaluate --enable-foo/--disable-foo pair where the last one used wins: * @code if ( options[FOO].last()->type() == DISABLE ) ... @endcode * <li> Cumulative option (-v verbose, -vv more verbose, -vvv even more verbose): * @code int verbosity = options[VERBOSE].count(); @endcode * <li> Iterate over all --file=&lt;fname> arguments: * @code for (Option* opt = options[FILE]; opt; opt = opt->next()) * fname = opt->arg; ... @endcode * <li> If you really want to, you can still process all arguments in order: * @code * for (int i = 0; i < p.optionsCount(); ++i) { * Option& opt = buffer[i]; * switch(opt.index()) { * case HELP: ... * case VERBOSE: ... * case FILE: fname = opt.arg; ... * case UNKNOWN: ... * @endcode * </ul> * </ul> @n * Despite these features the code size remains tiny. * It is smaller than <a href="http://uclibc.org">uClibc</a>'s GNU getopt() and just a * couple 100 bytes larger than uClibc's SUSv3 getopt(). @n * (This does not include the usage formatter, of course. But you don't have to use that.) * * @par Download: * Tarball with examples and test programs: * <a style="font-size:larger;font-weight:bold" href="http://sourceforge.net/projects/optionparser/files/optionparser-1.7.tar.gz/download">optionparser-1.7.tar.gz</a> @n * Just the header (this is all you really need): * <a style="font-size:larger;font-weight:bold" href="http://optionparser.sourceforge.net/optionparser.h">optionparser.h</a> * * @par Changelog: * <b>Version 1.7:</b> Work on const-correctness. @n * <b>Version 1.6:</b> Fix for MSC compiler. @n * <b>Version 1.5:</b> Fixed 2 warnings about potentially uninitialized variables. @n * Added const version of Option::next(). @n * <b>Version 1.4:</b> Fixed 2 printUsage() bugs that messed up output with small COLUMNS values. @n * <b>Version 1.3:</b> Compatible with Microsoft Visual C++. @n * <b>Version 1.2:</b> Added @ref option::Option::namelen "Option::namelen" and removed the extraction * of short option characters into a special buffer. @n * Changed @ref option::Arg::Optional "Arg::Optional" to accept arguments if they are attached * rather than separate. This is what GNU getopt() does and how POSIX recommends * utilities should interpret their arguments.@n * <b>Version 1.1:</b> Optional mode with argument reordering as done by GNU getopt(), so that * options and non-options can be mixed. See * @ref option::Parser::parse() "Parser::parse()". * * * @par Example program: * (Note: @c option::* identifiers are links that take you to their documentation.) * @code * #error EXAMPLE SHORTENED FOR READABILITY. BETTER EXAMPLES ARE IN THE .TAR.GZ! * #include <iostream> * #include "optionparser.h" * * enum optionIndex { UNKNOWN, HELP, PLUS }; * const option::Descriptor usage[] = * { * {UNKNOWN, 0,"" , "" ,option::Arg::None, "USAGE: example [options]\n\n" * "Options:" }, * {HELP, 0,"" , "help",option::Arg::None, " --help \tPrint usage and exit." }, * {PLUS, 0,"p", "plus",option::Arg::None, " --plus, -p \tIncrement count." }, * {UNKNOWN, 0,"" , "" ,option::Arg::None, "\nExamples:\n" * " example --unknown -- --this_is_no_option\n" * " example -unk --plus -ppp file1 file2\n" }, * {0,0,0,0,0,0} * }; * * int main(int argc, char* argv[]) * { * argc-=(argc>0); argv+=(argc>0); // skip program name argv[0] if present * option::Stats stats(usage, argc, argv); * option::Option options[stats.options_max], buffer[stats.buffer_max]; * option::Parser parse(usage, argc, argv, options, buffer); * * if (parse.error()) * return 1; * * if (options[HELP] || argc == 0) { * option::printUsage(std::cout, usage); * return 0; * } * * std::cout << "--plus count: " << * options[PLUS].count() << "\n"; * * for (option::Option* opt = options[UNKNOWN]; opt; opt = opt->next()) * std::cout << "Unknown option: " << opt->name << "\n"; * * for (int i = 0; i < parse.nonOptionsCount(); ++i) * std::cout << "Non-option #" << i << ": " << parse.nonOption(i) << "\n"; * } * @endcode * * @par Option syntax: * @li The Lean Mean C++ Option Parser follows POSIX <code>getopt()</code> conventions and supports * GNU-style <code>getopt_long()</code> long options as well as Perl-style single-minus * long options (<code>getopt_long_only()</code>). * @li short options have the format @c -X where @c X is any character that fits in a char. * @li short options can be grouped, i.e. <code>-X -Y</code> is equivalent to @c -XY. * @li a short option may take an argument either separate (<code>-X foo</code>) or * attached (@c -Xfoo). You can make the parser accept the additional format @c -X=foo by * registering @c X as a long option (in addition to being a short option) and * enabling single-minus long options. * @li an argument-taking short option may be grouped if it is the last in the group, e.g. * @c -ABCXfoo or <code> -ABCX foo </code> (@c foo is the argument to the @c -X option). * @li a lone minus character @c '-' is not treated as an option. It is customarily used where * a file name is expected to refer to stdin or stdout. * @li long options have the format @c --option-name. * @li the option-name of a long option can be anything and include any characters. * Even @c = characters will work, but don't do that. * @li [optional] long options may be abbreviated as long as the abbreviation is unambiguous. * You can set a minimum length for abbreviations. * @li [optional] long options may begin with a single minus. The double minus form is always * accepted, too. * @li a long option may take an argument either separate (<code> --option arg </code>) or * attached (<code> --option=arg </code>). In the attached form the equals sign is mandatory. * @li an empty string can be passed as an attached long option argument: <code> --option-name= </code>. * Note the distinction between an empty string as argument and no argument at all. * @li an empty string is permitted as separate argument to both long and short options. * @li Arguments to both short and long options may start with a @c '-' character. E.g. * <code> -X-X </code>, <code>-X -X</code> or <code> --long-X=-X </code>. If @c -X * and @c --long-X take an argument, that argument will be @c "-X" in all 3 cases. * @li If using the built-in @ref option::Arg::Optional "Arg::Optional", optional arguments must * be attached. * @li the special option @c -- (i.e. without a name) terminates the list of * options. Everything that follows is a non-option argument, even if it starts with * a @c '-' character. The @c -- itself will not appear in the parse results. * @li the first argument that doesn't start with @c '-' or @c '--' and does not belong to * a preceding argument-taking option, will terminate the option list and is the * first non-option argument. All following command line arguments are treated as * non-option arguments, even if they start with @c '-' . @n * NOTE: This behaviour is mandated by POSIX, but GNU getopt() only honours this if it is * explicitly requested (e.g. by setting POSIXLY_CORRECT). @n * You can enable the GNU behaviour by passing @c true as first argument to * e.g. @ref option::Parser::parse() "Parser::parse()". * @li Arguments that look like options (i.e. @c '-' followed by at least 1 character) but * aren't, are NOT treated as non-option arguments. They are treated as unknown options and * are collected into a list of unknown options for error reporting. @n * This means that in order to pass a first non-option * argument beginning with the minus character it is required to use the * @c -- special option, e.g. * @code * program -x -- --strange-filename * @endcode * In this example, @c --strange-filename is a non-option argument. If the @c -- * were omitted, it would be treated as an unknown option. @n * See @ref option::Descriptor::longopt for information on how to collect unknown options. * */ #ifndef OPTIONPARSER_H_ #define OPTIONPARSER_H_ #ifdef _MSC_VER #include <intrin.h> #pragma intrinsic(_BitScanReverse) #endif /** @brief The namespace of The Lean Mean C++ Option Parser. */ namespace option { #ifdef _MSC_VER struct MSC_Builtin_CLZ { static int builtin_clz(unsigned x) { unsigned long index; _BitScanReverse(&index, x); return 32-index; // int is always 32bit on Windows, even for target x64 } }; #define __builtin_clz(x) MSC_Builtin_CLZ::builtin_clz(x) #endif class Option; /** * @brief Possible results when checking if an argument is valid for a certain option. * * In the case that no argument is provided for an option that takes an * optional argument, return codes @c ARG_OK and @c ARG_IGNORE are equivalent. */ enum ArgStatus { //! The option does not take an argument. ARG_NONE, //! The argument is acceptable for the option. ARG_OK, //! The argument is not acceptable but that's non-fatal because the option's argument is optional. ARG_IGNORE, //! The argument is not acceptable and that's fatal. ARG_ILLEGAL }; /** * @brief Signature of functions that check if an argument is valid for a certain type of option. * * Every Option has such a function assigned in its Descriptor. * @code * Descriptor usage[] = { {UNKNOWN, 0, "", "", Arg::None, ""}, ... }; * @endcode * * A CheckArg function has the following signature: * @code ArgStatus CheckArg(const Option& option, bool msg); @endcode * * It is used to check if a potential argument would be acceptable for the option. * It will even be called if there is no argument. In that case @c option.arg will be @c NULL. * * If @c msg is @c true and the function determines that an argument is not acceptable and * that this is a fatal error, it should output a message to the user before * returning @ref ARG_ILLEGAL. If @c msg is @c false the function should remain silent (or you * will get duplicate messages). * * See @ref ArgStatus for the meaning of the return values. * * While you can provide your own functions, * often the following pre-defined checks (which never return @ref ARG_ILLEGAL) will suffice: * * @li @c Arg::None @copybrief Arg::None * @li @c Arg::Optional @copybrief Arg::Optional * */ typedef ArgStatus (*CheckArg)(const Option& option, bool msg); /** * @brief Describes an option, its help text (usage) and how it should be parsed. * * The main input when constructing an option::Parser is an array of Descriptors. * @par Example: * @code * enum OptionIndex {CREATE, ...}; * enum OptionType {DISABLE, ENABLE, OTHER}; * * const option::Descriptor usage[] = { * { CREATE, // index * OTHER, // type * "c", // shortopt * "create", // longopt * Arg::None, // check_arg * "--create Tells the program to create something." // help * } * , ... * }; * @endcode */ struct Descriptor { /** * @brief Index of this option's linked list in the array filled in by the parser. * * Command line options whose Descriptors have the same index will end up in the same * linked list in the order in which they appear on the command line. If you have * multiple long option aliases that refer to the same option, give their descriptors * the same @c index. * * If you have options that mean exactly opposite things * (e.g. @c --enable-foo and @c --disable-foo ), you should also give them the same * @c index, but distinguish them through different values for @ref type. * That way they end up in the same list and you can just take the last element of the * list and use its type. This way you get the usual behaviour where switches later * on the command line override earlier ones without having to code it manually. * * @par Tip: * Use an enum rather than plain ints for better readability, as shown in the example * at Descriptor. */ const unsigned index; /** * @brief Used to distinguish between options with the same @ref index. * See @ref index for details. * * It is recommended that you use an enum rather than a plain int to make your * code more readable. */ const int type; /** * @brief Each char in this string will be accepted as a short option character. * * The string must not include the minus character @c '-' or you'll get undefined * behaviour. * * If this Descriptor should not have short option characters, use the empty * string "". NULL is not permitted here! * * See @ref longopt for more information. */ const char* const shortopt; /** * @brief The long option name (without the leading @c -- ). * * If this Descriptor should not have a long option name, use the empty * string "". NULL is not permitted here! * * While @ref shortopt allows multiple short option characters, each * Descriptor can have only a single long option name. If you have multiple * long option names referring to the same option use separate Descriptors * that have the same @ref index and @ref type. You may repeat * short option characters in such an alias Descriptor but there's no need to. * * @par Dummy Descriptors: * You can use dummy Descriptors with an * empty string for both @ref shortopt and @ref longopt to add text to * the usage that is not related to a specific option. See @ref help. * The first dummy Descriptor will be used for unknown options (see below). * * @par Unknown Option Descriptor: * The first dummy Descriptor in the list of Descriptors, * whose @ref shortopt and @ref longopt are both the empty string, will be used * as the Descriptor for unknown options. An unknown option is a string in * the argument vector that is not a lone minus @c '-' but starts with a minus * character and does not match any Descriptor's @ref shortopt or @ref longopt. @n * Note that the dummy descriptor's @ref check_arg function @e will be called and * its return value will be evaluated as usual. I.e. if it returns @ref ARG_ILLEGAL * the parsing will be aborted with <code>Parser::error()==true</code>. @n * if @c check_arg does not return @ref ARG_ILLEGAL the descriptor's * @ref index @e will be used to pick the linked list into which * to put the unknown option. @n * If there is no dummy descriptor, unknown options will be dropped silently. * */ const char* const longopt; /** * @brief For each option that matches @ref shortopt or @ref longopt this function * will be called to check a potential argument to the option. * * This function will be called even if there is no potential argument. In that case * it will be passed @c NULL as @c arg parameter. Do not confuse this with the empty * string. * * See @ref CheckArg for more information. */ const CheckArg check_arg; /** * @brief The usage text associated with the options in this Descriptor. * * You can use option::printUsage() to format your usage message based on * the @c help texts. You can use dummy Descriptors where * @ref shortopt and @ref longopt are both the empty string to add text to * the usage that is not related to a specific option. * * See option::printUsage() for special formatting characters you can use in * @c help to get a column layout. * * @attention * Must be UTF-8-encoded. If your compiler supports C++11 you can use the "u8" * prefix to make sure string literals are properly encoded. */ const char* help; }; /** * @brief A parsed option from the command line together with its argument if it has one. * * The Parser chains all parsed options with the same Descriptor::index together * to form a linked list. This allows you to easily implement all of the common ways * of handling repeated options and enable/disable pairs. * * @li Test for presence of a switch in the argument vector: * @code if ( options[QUIET] ) ... @endcode * @li Evaluate --enable-foo/--disable-foo pair where the last one used wins: * @code if ( options[FOO].last()->type() == DISABLE ) ... @endcode * @li Cumulative option (-v verbose, -vv more verbose, -vvv even more verbose): * @code int verbosity = options[VERBOSE].count(); @endcode * @li Iterate over all --file=&lt;fname> arguments: * @code for (Option* opt = options[FILE]; opt; opt = opt->next()) * fname = opt->arg; ... @endcode */ class Option { Option* next_; Option* prev_; public: /** * @brief Pointer to this Option's Descriptor. * * Remember that the first dummy descriptor (see @ref Descriptor::longopt) is used * for unknown options. * * @attention * @c desc==NULL signals that this Option is unused. This is the default state of * elements in the result array. You don't need to test @c desc explicitly. You * can simply write something like this: * @code * if (options[CREATE]) * { * ... * } * @endcode * This works because of <code> operator const Option*() </code>. */ const Descriptor* desc; /** * @brief The name of the option as used on the command line. * * The main purpose of this string is to be presented to the user in messages. * * In the case of a long option, this is the actual @c argv pointer, i.e. the first * character is a '-'. In the case of a short option this points to the option * character within the @c argv string. * * Note that in the case of a short option group or an attached option argument, this * string will contain additional characters following the actual name. Use @ref namelen * to filter out the actual option name only. * */ const char* name; /** * @brief Pointer to this Option's argument (if any). * * NULL if this option has no argument. Do not confuse this with the empty string which * is a valid argument. */ const char* arg; /** * @brief The length of the option @ref name. * * Because @ref name points into the actual @c argv string, the option name may be * followed by more characters (e.g. other short options in the same short option group). * This value is the number of bytes (not characters!) that are part of the actual name. * * For a short option, this length is always 1. For a long option this length is always * at least 2 if single minus long options are permitted and at least 3 if they are disabled. * * @note * In the pathological case of a minus within a short option group (e.g. @c -xf-z), this * length is incorrect, because this case will be misinterpreted as a long option and the * name will therefore extend to the string's 0-terminator or a following '=" character * if there is one. This is irrelevant for most uses of @ref name and @c namelen. If you * really need to distinguish the case of a long and a short option, compare @ref name to * the @c argv pointers. A long option's @c name is always identical to one of them, * whereas a short option's is never. */ int namelen; /** * @brief Returns Descriptor::type of this Option's Descriptor, or 0 if this Option * is invalid (unused). * * Because this method (and last(), too) can be used even on unused Options with desc==0, you can (provided * you arrange your types properly) switch on type() without testing validity first. * @code * enum OptionType { UNUSED=0, DISABLED=0, ENABLED=1 }; * enum OptionIndex { FOO }; * const Descriptor usage[] = { * { FOO, ENABLED, "", "enable-foo", Arg::None, 0 }, * { FOO, DISABLED, "", "disable-foo", Arg::None, 0 }, * { 0, 0, 0, 0, 0, 0 } }; * ... * switch(options[FOO].last()->type()) // no validity check required! * { * case ENABLED: ... * case DISABLED: ... // UNUSED==DISABLED ! * } * @endcode */ int type() const { return desc == 0 ? 0 : desc->type; } /** * @brief Returns Descriptor::index of this Option's Descriptor, or -1 if this Option * is invalid (unused). */ int index() const { return desc == 0 ? -1 : (int)desc->index; } /** * @brief Returns the number of times this Option (or others with the same Descriptor::index) * occurs in the argument vector. * * This corresponds to the number of elements in the linked list this Option is part of. * It doesn't matter on which element you call count(). The return value is always the same. * * Use this to implement cumulative options, such as -v, -vv, -vvv for * different verbosity levels. * * Returns 0 when called for an unused/invalid option. */ int count() const { int c = (desc == 0 ? 0 : 1); const Option* p = first(); while (!p->isLast()) { ++c; p = p->next_; }; return c; } /** * @brief Returns true iff this is the first element of the linked list. * * The first element in the linked list is the first option on the command line * that has the respective Descriptor::index value. * * Returns true for an unused/invalid option. */ bool isFirst() const { return isTagged(prev_); } /** * @brief Returns true iff this is the last element of the linked list. * * The last element in the linked list is the last option on the command line * that has the respective Descriptor::index value. * * Returns true for an unused/invalid option. */ bool isLast() const { return isTagged(next_); } /** * @brief Returns a pointer to the first element of the linked list. * * Use this when you want the first occurrence of an option on the command line to * take precedence. Note that this is not the way most programs handle options. * You should probably be using last() instead. * * @note * This method may be called on an unused/invalid option and will return a pointer to the * option itself. */ Option* first() { Option* p = this; while (!p->isFirst()) p = p->prev_; return p; } /** * const version of Option::first(). */ const Option* first() const { return const_cast<Option*>(this)->first(); } /** * @brief Returns a pointer to the last element of the linked list. * * Use this when you want the last occurrence of an option on the command line to * take precedence. This is the most common way of handling conflicting options. * * @note * This method may be called on an unused/invalid option and will return a pointer to the * option itself. * * @par Tip: * If you have options with opposite meanings (e.g. @c --enable-foo and @c --disable-foo), you * can assign them the same Descriptor::index to get them into the same list. Distinguish them by * Descriptor::type and all you have to do is check <code> last()->type() </code> to get * the state listed last on the command line. */ Option* last() { return first()->prevwrap(); } /** * const version of Option::last(). */ const Option* last() const { return first()->prevwrap(); } /** * @brief Returns a pointer to the previous element of the linked list or NULL if * called on first(). * * If called on first() this method returns NULL. Otherwise it will return the * option with the same Descriptor::index that precedes this option on the command * line. */ Option* prev() { return isFirst() ? 0 : prev_; } /** * @brief Returns a pointer to the previous element of the linked list with wrap-around from * first() to last(). * * If called on first() this method returns last(). Otherwise it will return the * option with the same Descriptor::index that precedes this option on the command * line. */ Option* prevwrap() { return untag(prev_); } /** * const version of Option::prevwrap(). */ const Option* prevwrap() const { return untag(prev_); } /** * @brief Returns a pointer to the next element of the linked list or NULL if called * on last(). * * If called on last() this method returns NULL. Otherwise it will return the * option with the same Descriptor::index that follows this option on the command * line. */ Option* next() { return isLast() ? 0 : next_; } /** * const version of Option::next(). */ const Option* next() const { return isLast() ? 0 : next_; } /** * @brief Returns a pointer to the next element of the linked list with wrap-around from * last() to first(). * * If called on last() this method returns first(). Otherwise it will return the * option with the same Descriptor::index that follows this option on the command * line. */ Option* nextwrap() { return untag(next_); } /** * @brief Makes @c new_last the new last() by chaining it into the list after last(). * * It doesn't matter which element you call append() on. The new element will always * be appended to last(). * * @attention * @c new_last must not yet be part of a list, or that list will become corrupted, because * this method does not unchain @c new_last from an existing list. */ void append(Option* new_last) { Option* p = last(); Option* f = first(); p->next_ = new_last; new_last->prev_ = p; new_last->next_ = tag(f); f->prev_ = tag(new_last); } /** * @brief Casts from Option to const Option* but only if this Option is valid. * * If this Option is valid (i.e. @c desc!=NULL), returns this. * Otherwise returns NULL. This allows testing an Option directly * in an if-clause to see if it is used: * @code * if (options[CREATE]) * { * ... * } * @endcode * It also allows you to write loops like this: * @code for (Option* opt = options[FILE]; opt; opt = opt->next()) * fname = opt->arg; ... @endcode */ operator const Option*() const { return desc ? this : 0; } /** * @brief Casts from Option to Option* but only if this Option is valid. * * If this Option is valid (i.e. @c desc!=NULL), returns this. * Otherwise returns NULL. This allows testing an Option directly * in an if-clause to see if it is used: * @code * if (options[CREATE]) * { * ... * } * @endcode * It also allows you to write loops like this: * @code for (Option* opt = options[FILE]; opt; opt = opt->next()) * fname = opt->arg; ... @endcode */ operator Option*() { return desc ? this : 0; } /** * @brief Creates a new Option that is a one-element linked list and has NULL * @ref desc, @ref name, @ref arg and @ref namelen. */ Option() : desc(0), name(0), arg(0), namelen(0) { prev_ = tag(this); next_ = tag(this); } /** * @brief Creates a new Option that is a one-element linked list and has the given * values for @ref desc, @ref name and @ref arg. * * If @c name_ points at a character other than '-' it will be assumed to refer to a * short option and @ref namelen will be set to 1. Otherwise the length will extend to * the first '=' character or the string's 0-terminator. */ Option(const Descriptor* desc_, const char* name_, const char* arg_) { init(desc_, name_, arg_); } /** * @brief Makes @c *this a copy of @c orig except for the linked list pointers. * * After this operation @c *this will be a one-element linked list. */ void operator=(const Option& orig) { init(orig.desc, orig.name, orig.arg); } /** * @brief Makes @c *this a copy of @c orig except for the linked list pointers. * * After this operation @c *this will be a one-element linked list. */ Option(const Option& orig) { init(orig.desc, orig.name, orig.arg); } private: /** * @internal * @brief Sets the fields of this Option to the given values (extracting @c name if necessary). * * If @c name_ points at a character other than '-' it will be assumed to refer to a * short option and @ref namelen will be set to 1. Otherwise the length will extend to * the first '=' character or the string's 0-terminator. */ void init(const Descriptor* desc_, const char* name_, const char* arg_) { desc = desc_; name = name_; arg = arg_; prev_ = tag(this); next_ = tag(this); namelen = 0; if (name == 0) return; namelen = 1; if (name[0] != '-') return; while (name[namelen] != 0 && name[namelen] != '=') ++namelen; } static Option* tag(Option* ptr) { return (Option*) ((unsigned long long) ptr | 1); } static Option* untag(Option* ptr) { return (Option*) ((unsigned long long) ptr & ~1ull); } static bool isTagged(Option* ptr) { return ((unsigned long long) ptr & 1); } }; /** * @brief Functions for checking the validity of option arguments. * * @copydetails CheckArg * * The following example code * can serve as starting place for writing your own more complex CheckArg functions: * @code * struct Arg: public option::Arg * { * static void printError(const char* msg1, const option::Option& opt, const char* msg2) * { * fprintf(stderr, "ERROR: %s", msg1); * fwrite(opt.name, opt.namelen, 1, stderr); * fprintf(stderr, "%s", msg2); * } * * static option::ArgStatus Unknown(const option::Option& option, bool msg) * { * if (msg) printError("Unknown option '", option, "'\n"); * return option::ARG_ILLEGAL; * } * * static option::ArgStatus Required(const option::Option& option, bool msg) * { * if (option.arg != 0) * return option::ARG_OK; * * if (msg) printError("Option '", option, "' requires an argument\n"); * return option::ARG_ILLEGAL; * } * * static option::ArgStatus NonEmpty(const option::Option& option, bool msg) * { * if (option.arg != 0 && option.arg[0] != 0) * return option::ARG_OK; * * if (msg) printError("Option '", option, "' requires a non-empty argument\n"); * return option::ARG_ILLEGAL; * } * * static option::ArgStatus Numeric(const option::Option& option, bool msg) * { * char* endptr = 0; * if (option.arg != 0 && strtol(option.arg, &endptr, 10)){}; * if (endptr != option.arg && *endptr == 0) * return option::ARG_OK; * * if (msg) printError("Option '", option, "' requires a numeric argument\n"); * return option::ARG_ILLEGAL; * } * }; * @endcode */ struct Arg { //! @brief For options that don't take an argument: Returns ARG_NONE. static ArgStatus None(const Option&, bool) { return ARG_NONE; } //! @brief Returns ARG_OK if the argument is attached and ARG_IGNORE otherwise. static ArgStatus Optional(const Option& option, bool) { if (option.arg && option.name[option.namelen] != 0) return ARG_OK; else return ARG_IGNORE; } }; /** * @brief Determines the minimum lengths of the buffer and options arrays used for Parser. * * Because Parser doesn't use dynamic memory its output arrays have to be pre-allocated. * If you don't want to use fixed size arrays (which may turn out too small, causing * command line arguments to be dropped), you can use Stats to determine the correct sizes. * Stats work cumulative. You can first pass in your default options and then the real * options and afterwards the counts will reflect the union. */ struct Stats { /** * @brief Number of elements needed for a @c buffer[] array to be used for * @ref Parser::parse() "parsing" the same argument vectors that were fed * into this Stats object. * * @note * This number is always 1 greater than the actual number needed, to give * you a sentinel element. */ unsigned buffer_max; /** * @brief Number of elements needed for an @c options[] array to be used for * @ref Parser::parse() "parsing" the same argument vectors that were fed * into this Stats object. * * @note * @li This number is always 1 greater than the actual number needed, to give * you a sentinel element. * @li This number depends only on the @c usage, not the argument vectors, because * the @c options array needs exactly one slot for each possible Descriptor::index. */ unsigned options_max; /** * @brief Creates a Stats object with counts set to 1 (for the sentinel element). */ Stats() : buffer_max(1), options_max(1) // 1 more than necessary as sentinel { } /** * @brief Creates a new Stats object and immediately updates it for the * given @c usage and argument vector. You may pass 0 for @c argc and/or @c argv, * if you just want to update @ref options_max. * * @note * The calls to Stats methods must match the later calls to Parser methods. * See Parser::parse() for the meaning of the arguments. */ Stats(bool gnu, const Descriptor usage[], int argc, const char** argv, int min_abbr_len = 0, // bool single_minus_longopt = false) : buffer_max(1), options_max(1) // 1 more than necessary as sentinel { add(gnu, usage, argc, argv, min_abbr_len, single_minus_longopt); } //! @brief Stats(...) with non-const argv. Stats(bool gnu, const Descriptor usage[], int argc, char** argv, int min_abbr_len = 0, // bool single_minus_longopt = false) : buffer_max(1), options_max(1) // 1 more than necessary as sentinel { add(gnu, usage, argc, (const char**) argv, min_abbr_len, single_minus_longopt); } //! @brief POSIX Stats(...) (gnu==false). Stats(const Descriptor usage[], int argc, const char** argv, int min_abbr_len = 0, // bool single_minus_longopt = false) : buffer_max(1), options_max(1) // 1 more than necessary as sentinel { add(false, usage, argc, argv, min_abbr_len, single_minus_longopt); } //! @brief POSIX Stats(...) (gnu==false) with non-const argv. Stats(const Descriptor usage[], int argc, char** argv, int min_abbr_len = 0, // bool single_minus_longopt = false) : buffer_max(1), options_max(1) // 1 more than necessary as sentinel { add(false, usage, argc, (const char**) argv, min_abbr_len, single_minus_longopt); } /** * @brief Updates this Stats object for the * given @c usage and argument vector. You may pass 0 for @c argc and/or @c argv, * if you just want to update @ref options_max. * * @note * The calls to Stats methods must match the later calls to Parser methods. * See Parser::parse() for the meaning of the arguments. */ void add(bool gnu, const Descriptor usage[], int argc, const char** argv, int min_abbr_len = 0, // bool single_minus_longopt = false); //! @brief add() with non-const argv. void add(bool gnu, const Descriptor usage[], int argc, char** argv, int min_abbr_len = 0, // bool single_minus_longopt = false) { add(gnu, usage, argc, (const char**) argv, min_abbr_len, single_minus_longopt); } //! @brief POSIX add() (gnu==false). void add(const Descriptor usage[], int argc, const char** argv, int min_abbr_len = 0, // bool single_minus_longopt = false) { add(false, usage, argc, argv, min_abbr_len, single_minus_longopt); } //! @brief POSIX add() (gnu==false) with non-const argv. void add(const Descriptor usage[], int argc, char** argv, int min_abbr_len = 0, // bool single_minus_longopt = false) { add(false, usage, argc, (const char**) argv, min_abbr_len, single_minus_longopt); } private: class CountOptionsAction; }; /** * @brief Checks argument vectors for validity and parses them into data * structures that are easier to work with. * * @par Example: * @code * int main(int argc, char* argv[]) * { * argc-=(argc>0); argv+=(argc>0); // skip program name argv[0] if present * option::Stats stats(usage, argc, argv); * option::Option options[stats.options_max], buffer[stats.buffer_max]; * option::Parser parse(usage, argc, argv, options, buffer); * * if (parse.error()) * return 1; * * if (options[HELP]) * ... * @endcode */ class Parser { int op_count; //!< @internal @brief see optionsCount() int nonop_count; //!< @internal @brief see nonOptionsCount() const char** nonop_args; //!< @internal @brief see nonOptions() bool err; //!< @internal @brief see error() public: /** * @brief Creates a new Parser. */ Parser() : op_count(0), nonop_count(0), nonop_args(0), err(false) { } /** * @brief Creates a new Parser and immediately parses the given argument vector. * @copydetails parse() */ Parser(bool gnu, const Descriptor usage[], int argc, const char** argv, Option options[], Option buffer[], int min_abbr_len = 0, bool single_minus_longopt = false, int bufmax = -1) : op_count(0), nonop_count(0), nonop_args(0), err(false) { parse(gnu, usage, argc, argv, options, buffer, min_abbr_len, single_minus_longopt, bufmax); } //! @brief Parser(...) with non-const argv. Parser(bool gnu, const Descriptor usage[], int argc, char** argv, Option options[], Option buffer[], int min_abbr_len = 0, bool single_minus_longopt = false, int bufmax = -1) : op_count(0), nonop_count(0), nonop_args(0), err(false) { parse(gnu, usage, argc, (const char**) argv, options, buffer, min_abbr_len, single_minus_longopt, bufmax); } //! @brief POSIX Parser(...) (gnu==false). Parser(const Descriptor usage[], int argc, const char** argv, Option options[], Option buffer[], int min_abbr_len = 0, bool single_minus_longopt = false, int bufmax = -1) : op_count(0), nonop_count(0), nonop_args(0), err(false) { parse(false, usage, argc, argv, options, buffer, min_abbr_len, single_minus_longopt, bufmax); } //! @brief POSIX Parser(...) (gnu==false) with non-const argv. Parser(const Descriptor usage[], int argc, char** argv, Option options[], Option buffer[], int min_abbr_len = 0, bool single_minus_longopt = false, int bufmax = -1) : op_count(0), nonop_count(0), nonop_args(0), err(false) { parse(false, usage, argc, (const char**) argv, options, buffer, min_abbr_len, single_minus_longopt, bufmax); } /** * @brief Parses the given argument vector. * * @param gnu if true, parse() will not stop at the first non-option argument. Instead it will * reorder arguments so that all non-options are at the end. This is the default behaviour * of GNU getopt() but is not conforming to POSIX. @n * Note, that once the argument vector has been reordered, the @c gnu flag will have * no further effect on this argument vector. So it is enough to pass @c gnu==true when * creating Stats. * @param usage Array of Descriptor objects that describe the options to support. The last entry * of this array must have 0 in all fields. * @param argc The number of elements from @c argv that are to be parsed. If you pass -1, the number * will be determined automatically. In that case the @c argv list must end with a NULL * pointer. * @param argv The arguments to be parsed. If you pass -1 as @c argc the last pointer in the @c argv * list must be NULL to mark the end. * @param options Each entry is the first element of a linked list of Options. Each new option * that is parsed will be appended to the list specified by that Option's * Descriptor::index. If an entry is not yet used (i.e. the Option is invalid), * it will be replaced rather than appended to. @n * The minimum length of this array is the greatest Descriptor::index value that * occurs in @c usage @e PLUS ONE. * @param buffer Each argument that is successfully parsed (including unknown arguments, if they * have a Descriptor whose CheckArg does not return @ref ARG_ILLEGAL) will be stored in this * array. parse() scans the array for the first invalid entry and begins writing at that * index. You can pass @c bufmax to limit the number of options stored. * @param min_abbr_len Passing a value <code> min_abbr_len > 0 </code> enables abbreviated long * options. The parser will match a prefix of a long option as if it was * the full long option (e.g. @c --foob=10 will be interpreted as if it was * @c --foobar=10 ), as long as the prefix has at least @c min_abbr_len characters * (not counting the @c -- ) and is unambiguous. * @n Be careful if combining @c min_abbr_len=1 with @c single_minus_longopt=true * because the ambiguity check does not consider short options and abbreviated * single minus long options will take precedence over short options. * @param single_minus_longopt Passing @c true for this option allows long options to begin with * a single minus. The double minus form will still be recognized. Note that * single minus long options take precedence over short options and short option * groups. E.g. @c -file would be interpreted as @c --file and not as * <code> -f -i -l -e </code> (assuming a long option named @c "file" exists). * @param bufmax The greatest index in the @c buffer[] array that parse() will write to is * @c bufmax-1. If there are more options, they will be processed (in particular * their CheckArg will be called) but not stored. @n * If you used Stats::buffer_max to dimension this array, you can pass * -1 (or not pass @c bufmax at all) which tells parse() that the buffer is * "large enough". * @attention * Remember that @c options and @c buffer store Option @e objects, not pointers. Therefore it * is not possible for the same object to be in both arrays. For those options that are found in * both @c buffer[] and @c options[] the respective objects are independent copies. And only the * objects in @c options[] are properly linked via Option::next() and Option::prev(). * You can iterate over @c buffer[] to * process all options in the order they appear in the argument vector, but if you want access to * the other Options with the same Descriptor::index, then you @e must access the linked list via * @c options[]. You can get the linked list in options from a buffer object via something like * @c options[buffer[i].index()]. */ void parse(bool gnu, const Descriptor usage[], int argc, const char** argv, Option options[], Option buffer[], int min_abbr_len = 0, bool single_minus_longopt = false, int bufmax = -1); //! @brief parse() with non-const argv. void parse(bool gnu, const Descriptor usage[], int argc, char** argv, Option options[], Option buffer[], int min_abbr_len = 0, bool single_minus_longopt = false, int bufmax = -1) { parse(gnu, usage, argc, (const char**) argv, options, buffer, min_abbr_len, single_minus_longopt, bufmax); } //! @brief POSIX parse() (gnu==false). void parse(const Descriptor usage[], int argc, const char** argv, Option options[], Option buffer[], int min_abbr_len = 0, bool single_minus_longopt = false, int bufmax = -1) { parse(false, usage, argc, argv, options, buffer, min_abbr_len, single_minus_longopt, bufmax); } //! @brief POSIX parse() (gnu==false) with non-const argv. void parse(const Descriptor usage[], int argc, char** argv, Option options[], Option buffer[], int min_abbr_len = 0, bool single_minus_longopt = false, int bufmax = -1) { parse(false, usage, argc, (const char**) argv, options, buffer, min_abbr_len, single_minus_longopt, bufmax); } /** * @brief Returns the number of valid Option objects in @c buffer[]. * * @note * @li The returned value always reflects the number of Options in the buffer[] array used for * the most recent call to parse(). * @li The count (and the buffer[]) includes unknown options if they are collected * (see Descriptor::longopt). */ int optionsCount() { return op_count; } /** * @brief Returns the number of non-option arguments that remained at the end of the * most recent parse() that actually encountered non-option arguments. * * @note * A parse() that does not encounter non-option arguments will leave this value * as well as nonOptions() undisturbed. This means you can feed the Parser a * default argument vector that contains non-option arguments (e.g. a default filename). * Then you feed it the actual arguments from the user. If the user has supplied at * least one non-option argument, all of the non-option arguments from the default * disappear and are replaced by the user's non-option arguments. However, if the * user does not supply any non-option arguments the defaults will still be in * effect. */ int nonOptionsCount() { return nonop_count; } /** * @brief Returns a pointer to an array of non-option arguments (only valid * if <code>nonOptionsCount() >0 </code>). * * @note * @li parse() does not copy arguments, so this pointer points into the actual argument * vector as passed to parse(). * @li As explained at nonOptionsCount() this pointer is only changed by parse() calls * that actually encounter non-option arguments. A parse() call that encounters only * options, will not change nonOptions(). */ const char** nonOptions() { return nonop_args; } /** * @brief Returns <b><code>nonOptions()[i]</code></b> (@e without checking if i is in range!). */ const char* nonOption(int i) { return nonOptions()[i]; } /** * @brief Returns @c true if an unrecoverable error occurred while parsing options. * * An illegal argument to an option (i.e. CheckArg returns @ref ARG_ILLEGAL) is an * unrecoverable error that aborts the parse. Unknown options are only an error if * their CheckArg function returns @ref ARG_ILLEGAL. Otherwise they are collected. * In that case if you want to exit the program if either an illegal argument * or an unknown option has been passed, use code like this * * @code * if (parser.error() || options[UNKNOWN]) * exit(1); * @endcode * */ bool error() { return err; } private: friend struct Stats; class StoreOptionAction; struct Action; /** * @internal * @brief This is the core function that does all the parsing. * @retval false iff an unrecoverable error occurred. */ static bool workhorse(bool gnu, const Descriptor usage[], int numargs, const char** args, Action& action, bool single_minus_longopt, bool print_errors, int min_abbr_len); /** * @internal * @brief Returns true iff @c st1 is a prefix of @c st2 and * in case @c st2 is longer than @c st1, then * the first additional character is '='. * * @par Examples: * @code * streq("foo", "foo=bar") == true * streq("foo", "foobar") == false * streq("foo", "foo") == true * streq("foo=bar", "foo") == false * @endcode */ static bool streq(const char* st1, const char* st2) { while (*st1 != 0) if (*st1++ != *st2++) return false; return (*st2 == 0 || *st2 == '='); } /** * @internal * @brief Like streq() but handles abbreviations. * * Returns true iff @c st1 and @c st2 have a common * prefix with the following properties: * @li (if min > 0) its length is at least @c min characters or the same length as @c st1 (whichever is smaller). * @li (if min <= 0) its length is the same as that of @c st1 * @li within @c st2 the character following the common prefix is either '=' or end-of-string. * * Examples: * @code * streqabbr("foo", "foo=bar",<anything>) == true * streqabbr("foo", "fo=bar" , 2) == true * streqabbr("foo", "fo" , 2) == true * streqabbr("foo", "fo" , 0) == false * streqabbr("foo", "f=bar" , 2) == false * streqabbr("foo", "f" , 2) == false * streqabbr("fo" , "foo=bar",<anything>) == false * streqabbr("foo", "foobar" ,<anything>) == false * streqabbr("foo", "fobar" ,<anything>) == false * streqabbr("foo", "foo" ,<anything>) == true * @endcode */ static bool streqabbr(const char* st1, const char* st2, long long min) { const char* st1start = st1; while (*st1 != 0 && (*st1 == *st2)) { ++st1; ++st2; } return (*st1 == 0 || (min > 0 && (st1 - st1start) >= min)) && (*st2 == 0 || *st2 == '='); } /** * @internal * @brief Returns true iff character @c ch is contained in the string @c st. * * Returns @c true for @c ch==0 . */ static bool instr(char ch, const char* st) { while (*st != 0 && *st != ch) ++st; return *st == ch; } /** * @internal * @brief Rotates <code>args[-count],...,args[-1],args[0]</code> to become * <code>args[0],args[-count],...,args[-1]</code>. */ static void shift(const char** args, int count) { for (int i = 0; i > -count; --i) { const char* temp = args[i]; args[i] = args[i - 1]; args[i - 1] = temp; } } }; /** * @internal * @brief Interface for actions Parser::workhorse() should perform for each Option it * parses. */ struct Parser::Action { /** * @brief Called by Parser::workhorse() for each Option that has been successfully * parsed (including unknown * options if they have a Descriptor whose Descriptor::check_arg does not return * @ref ARG_ILLEGAL. * * Returns @c false iff a fatal error has occured and the parse should be aborted. */ virtual bool perform(Option&) { return true; } /** * @brief Called by Parser::workhorse() after finishing the parse. * @param numargs the number of non-option arguments remaining * @param args pointer to the first remaining non-option argument (if numargs > 0). * * @return * @c false iff a fatal error has occurred. */ virtual bool finished(int numargs, const char** args) { (void) numargs; (void) args; return true; } }; /** * @internal * @brief An Action to pass to Parser::workhorse() that will increment a counter for * each parsed Option. */ class Stats::CountOptionsAction: public Parser::Action { unsigned* buffer_max; public: /** * Creates a new CountOptionsAction that will increase @c *buffer_max_ for each * parsed Option. */ CountOptionsAction(unsigned* buffer_max_) : buffer_max(buffer_max_) { } bool perform(Option&) { if (*buffer_max == 0x7fffffff) return false; // overflow protection: don't accept number of options that doesn't fit signed int ++*buffer_max; return true; } }; /** * @internal * @brief An Action to pass to Parser::workhorse() that will store each parsed Option in * appropriate arrays (see Parser::parse()). */ class Parser::StoreOptionAction: public Parser::Action { Parser& parser; Option* options; Option* buffer; int bufmax; //! Number of slots in @c buffer. @c -1 means "large enough". public: /** * @brief Creates a new StoreOption action. * @param parser_ the parser whose op_count should be updated. * @param options_ each Option @c o is chained into the linked list @c options_[o.desc->index] * @param buffer_ each Option is appended to this array as long as there's a free slot. * @param bufmax_ number of slots in @c buffer_. @c -1 means "large enough". */ StoreOptionAction(Parser& parser_, Option options_[], Option buffer_[], int bufmax_) : parser(parser_), options(options_), buffer(buffer_), bufmax(bufmax_) { // find first empty slot in buffer (if any) int bufidx = 0; while ((bufmax < 0 || bufidx < bufmax) && buffer[bufidx]) ++bufidx; // set parser's optionCount parser.op_count = bufidx; } bool perform(Option& option) { if (bufmax < 0 || parser.op_count < bufmax) { if (parser.op_count == 0x7fffffff) return false; // overflow protection: don't accept number of options that doesn't fit signed int buffer[parser.op_count] = option; int idx = buffer[parser.op_count].desc->index; if (options[idx]) options[idx].append(buffer[parser.op_count]); else options[idx] = buffer[parser.op_count]; ++parser.op_count; } return true; // NOTE: an option that is discarded because of a full buffer is not fatal } bool finished(int numargs, const char** args) { // only overwrite non-option argument list if there's at least 1 // new non-option argument. Otherwise we keep the old list. This // makes it easy to use default non-option arguments. if (numargs > 0) { parser.nonop_count = numargs; parser.nonop_args = args; } return true; } }; inline void Parser::parse(bool gnu, const Descriptor usage[], int argc, const char** argv, Option options[], Option buffer[], int min_abbr_len, bool single_minus_longopt, int bufmax) { StoreOptionAction action(*this, options, buffer, bufmax); err = !workhorse(gnu, usage, argc, argv, action, single_minus_longopt, true, min_abbr_len); } inline void Stats::add(bool gnu, const Descriptor usage[], int argc, const char** argv, int min_abbr_len, bool single_minus_longopt) { // determine size of options array. This is the greatest index used in the usage + 1 int i = 0; while (usage[i].shortopt != 0) { if (usage[i].index + 1 >= options_max) options_max = (usage[i].index + 1) + 1; // 1 more than necessary as sentinel ++i; } CountOptionsAction action(&buffer_max); Parser::workhorse(gnu, usage, argc, argv, action, single_minus_longopt, false, min_abbr_len); } inline bool Parser::workhorse(bool gnu, const Descriptor usage[], int numargs, const char** args, Action& action, bool single_minus_longopt, bool print_errors, int min_abbr_len) { // protect against NULL pointer if (args == 0) numargs = 0; int nonops = 0; while (numargs != 0 && *args != 0) { const char* param = *args; // param can be --long-option, -srto or non-option argument // in POSIX mode the first non-option argument terminates the option list // a lone minus character is a non-option argument if (param[0] != '-' || param[1] == 0) { if (gnu) { ++nonops; ++args; if (numargs > 0) --numargs; continue; } else break; } // -- terminates the option list. The -- itself is skipped. if (param[1] == '-' && param[2] == 0) { shift(args, nonops); ++args; if (numargs > 0) --numargs; break; } bool handle_short_options; const char* longopt_name; if (param[1] == '-') // if --long-option { handle_short_options = false; longopt_name = param + 2; } else { handle_short_options = true; longopt_name = param + 1; //for testing a potential -long-option } bool try_single_minus_longopt = single_minus_longopt; bool have_more_args = (numargs > 1 || numargs < 0); // is referencing argv[1] valid? do // loop over short options in group, for long options the body is executed only once { int idx = 0; const char* optarg = 0; /******************** long option **********************/ if (handle_short_options == false || try_single_minus_longopt) { idx = 0; while (usage[idx].longopt != 0 && !streq(usage[idx].longopt, longopt_name)) ++idx; if (usage[idx].longopt == 0 && min_abbr_len > 0) // if we should try to match abbreviated long options { int i1 = 0; while (usage[i1].longopt != 0 && !streqabbr(usage[i1].longopt, longopt_name, min_abbr_len)) ++i1; if (usage[i1].longopt != 0) { // now test if the match is unambiguous by checking for another match int i2 = i1 + 1; while (usage[i2].longopt != 0 && !streqabbr(usage[i2].longopt, longopt_name, min_abbr_len)) ++i2; if (usage[i2].longopt == 0) // if there was no second match it's unambiguous, so accept i1 as idx idx = i1; } } // if we found something, disable handle_short_options (only relevant if single_minus_longopt) if (usage[idx].longopt != 0) handle_short_options = false; try_single_minus_longopt = false; // prevent looking for longopt in the middle of shortopt group optarg = longopt_name; while (*optarg != 0 && *optarg != '=') ++optarg; if (*optarg == '=') // attached argument ++optarg; else // possibly detached argument optarg = (have_more_args ? args[1] : 0); } /************************ short option ***********************************/ if (handle_short_options) { if (*++param == 0) // point at the 1st/next option character break; // end of short option group idx = 0; while (usage[idx].shortopt != 0 && !instr(*param, usage[idx].shortopt)) ++idx; if (param[1] == 0) // if the potential argument is separate optarg = (have_more_args ? args[1] : 0); else // if the potential argument is attached optarg = param + 1; } const Descriptor* descriptor = &usage[idx]; if (descriptor->shortopt == 0) /************** unknown option ********************/ { // look for dummy entry (shortopt == "" and longopt == "") to use as Descriptor for unknown options idx = 0; while (usage[idx].shortopt != 0 && (usage[idx].shortopt[0] != 0 || usage[idx].longopt[0] != 0)) ++idx; descriptor = (usage[idx].shortopt == 0 ? 0 : &usage[idx]); } if (descriptor != 0) { Option option(descriptor, param, optarg); switch (descriptor->check_arg(option, print_errors)) { case ARG_ILLEGAL: return false; // fatal case ARG_OK: // skip one element of the argument vector, if it's a separated argument if (optarg != 0 && have_more_args && optarg == args[1]) { shift(args, nonops); if (numargs > 0) --numargs; ++args; } // No further short options are possible after an argument handle_short_options = false; break; case ARG_IGNORE: case ARG_NONE: option.arg = 0; break; } if (!action.perform(option)) return false; } } while (handle_short_options); shift(args, nonops); ++args; if (numargs > 0) --numargs; } // while if (numargs > 0 && *args == 0) // It's a bug in the caller if numargs is greater than the actual number numargs = 0; // of arguments, but as a service to the user we fix this if we spot it. if (numargs < 0) // if we don't know the number of remaining non-option arguments { // we need to count them numargs = 0; while (args[numargs] != 0) ++numargs; } return action.finished(numargs + nonops, args - nonops); } /** * @internal * @brief The implementation of option::printUsage(). */ struct PrintUsageImplementation { /** * @internal * @brief Interface for Functors that write (part of) a string somewhere. */ struct IStringWriter { /** * @brief Writes the given number of chars beginning at the given pointer somewhere. */ virtual void operator()(const char*, int) { } }; /** * @internal * @brief Encapsulates a function with signature <code>func(string, size)</code> where * string can be initialized with a const char* and size with an int. */ template<typename Function> struct FunctionWriter: public IStringWriter { Function* write; virtual void operator()(const char* str, int size) { (*write)(str, size); } FunctionWriter(Function* w) : write(w) { } }; /** * @internal * @brief Encapsulates a reference to an object with a <code>write(string, size)</code> * method like that of @c std::ostream. */ template<typename OStream> struct OStreamWriter: public IStringWriter { OStream& ostream; virtual void operator()(const char* str, int size) { ostream.write(str, size); } OStreamWriter(OStream& o) : ostream(o) { } }; /** * @internal * @brief Like OStreamWriter but encapsulates a @c const reference, which is * typically a temporary object of a user class. */ template<typename Temporary> struct TemporaryWriter: public IStringWriter { const Temporary& userstream; virtual void operator()(const char* str, int size) { userstream.write(str, size); } TemporaryWriter(const Temporary& u) : userstream(u) { } }; /** * @internal * @brief Encapsulates a function with the signature <code>func(fd, string, size)</code> (the * signature of the @c write() system call) * where fd can be initialized from an int, string from a const char* and size from an int. */ template<typename Syscall> struct SyscallWriter: public IStringWriter { Syscall* write; int fd; virtual void operator()(const char* str, int size) { (*write)(fd, str, size); } SyscallWriter(Syscall* w, int f) : write(w), fd(f) { } }; /** * @internal * @brief Encapsulates a function with the same signature as @c std::fwrite(). */ template<typename Function, typename Stream> struct StreamWriter: public IStringWriter { Function* fwrite; Stream* stream; virtual void operator()(const char* str, int size) { (*fwrite)(str, size, 1, stream); } StreamWriter(Function* w, Stream* s) : fwrite(w), stream(s) { } }; /** * @internal * @brief Sets <code> i1 = max(i1, i2) </code> */ static void upmax(int& i1, int i2) { i1 = (i1 >= i2 ? i1 : i2); } /** * @internal * @brief Moves the "cursor" to column @c want_x assuming it is currently at column @c x * and sets @c x=want_x . * If <code> x > want_x </code>, a line break is output before indenting. * * @param write Spaces and possibly a line break are written via this functor to get * the desired indentation @c want_x . * @param[in,out] x the current indentation. Set to @c want_x by this method. * @param want_x the desired indentation. */ static void indent(IStringWriter& write, int& x, int want_x) { int indent = want_x - x; if (indent < 0) { write("\n", 1); indent = want_x; } if (indent > 0) { char space = ' '; for (int i = 0; i < indent; ++i) write(&space, 1); x = want_x; } } /** * @brief Returns true if ch is the unicode code point of a wide character. * * @note * The following character ranges are treated as wide * @code * 1100..115F * 2329..232A (just 2 characters!) * 2E80..A4C6 except for 303F * A960..A97C * AC00..D7FB * F900..FAFF * FE10..FE6B * FF01..FF60 * FFE0..FFE6 * 1B000...... * @endcode */ static bool isWideChar(unsigned ch) { if (ch == 0x303F) return false; return ((0x1100 <= ch && ch <= 0x115F) || (0x2329 <= ch && ch <= 0x232A) || (0x2E80 <= ch && ch <= 0xA4C6) || (0xA960 <= ch && ch <= 0xA97C) || (0xAC00 <= ch && ch <= 0xD7FB) || (0xF900 <= ch && ch <= 0xFAFF) || (0xFE10 <= ch && ch <= 0xFE6B) || (0xFF01 <= ch && ch <= 0xFF60) || (0xFFE0 <= ch && ch <= 0xFFE6) || (0x1B000 <= ch)); } /** * @internal * @brief Splits a @c Descriptor[] array into tables, rows, lines and columns and * iterates over these components. * * The top-level organizational unit is the @e table. * A table begins at a Descriptor with @c help!=NULL and extends up to * a Descriptor with @c help==NULL. * * A table consists of @e rows. Due to line-wrapping and explicit breaks * a row may take multiple lines on screen. Rows within the table are separated * by \\n. They never cross Descriptor boundaries. This means a row ends either * at \\n or the 0 at the end of the help string. * * A row consists of columns/cells. Columns/cells within a row are separated by \\t. * Line breaks within a cell are marked by \\v. * * Rows in the same table need not have the same number of columns/cells. The * extreme case are interjections, which are rows that contain neither \\t nor \\v. * These are NOT treated specially by LinePartIterator, but they are treated * specially by printUsage(). * * LinePartIterator iterates through the usage at 3 levels: table, row and part. * Tables and rows are as described above. A @e part is a line within a cell. * LinePartIterator iterates through 1st parts of all cells, then through the 2nd * parts of all cells (if any),... @n * Example: The row <code> "1 \v 3 \t 2 \v 4" </code> has 2 cells/columns and 4 parts. * The parts will be returned in the order 1, 2, 3, 4. * * It is possible that some cells have fewer parts than others. In this case * LinePartIterator will "fill up" these cells with 0-length parts. IOW, LinePartIterator * always returns the same number of parts for each column. Note that this is different * from the way rows and columns are handled. LinePartIterator does @e not guarantee that * the same number of columns will be returned for each row. * */ class LinePartIterator { const Descriptor* tablestart; //!< The 1st descriptor of the current table. const Descriptor* rowdesc; //!< The Descriptor that contains the current row. const char* rowstart; //!< Ptr to 1st character of current row within rowdesc->help. const char* ptr; //!< Ptr to current part within the current row. int col; //!< Index of current column. int len; //!< Length of the current part (that ptr points at) in BYTES int screenlen; //!< Length of the current part in screen columns (taking narrow/wide chars into account). int max_line_in_block; //!< Greatest index of a line within the block. This is the number of \\v within the cell with the most \\vs. int line_in_block; //!< Line index within the current cell of the current part. int target_line_in_block; //!< Line index of the parts we should return to the user on this iteration. bool hit_target_line; //!< Flag whether we encountered a part with line index target_line_in_block in the current cell. /** * @brief Determines the byte and character lengths of the part at @ref ptr and * stores them in @ref len and @ref screenlen respectively. */ void update_length() { screenlen = 0; for (len = 0; ptr[len] != 0 && ptr[len] != '\v' && ptr[len] != '\t' && ptr[len] != '\n'; ++len) { ++screenlen; unsigned ch = (unsigned char) ptr[len]; if (ch > 0xC1) // everything <= 0xC1 (yes, even 0xC1 itself) is not a valid UTF-8 start byte { // int __builtin_clz (unsigned int x) // Returns the number of leading 0-bits in x, starting at the most significant bit unsigned mask = (unsigned) -1 >> __builtin_clz(ch ^ 0xff); ch = ch & mask; // mask out length bits, we don't verify their correctness while (((unsigned char) ptr[len + 1] ^ 0x80) <= 0x3F) // while next byte is continuation byte { ch = (ch << 6) ^ (unsigned char) ptr[len + 1] ^ 0x80; // add continuation to char code ++len; } // ch is the decoded unicode code point if (ch >= 0x1100 && isWideChar(ch)) // the test for 0x1100 is here to avoid the function call in the Latin case ++screenlen; } } } public: //! @brief Creates an iterator for @c usage. LinePartIterator(const Descriptor usage[]) : tablestart(usage), rowdesc(0), rowstart(0), ptr(0), col(-1), len(0), max_line_in_block(0), line_in_block(0), target_line_in_block(0), hit_target_line(true) { } /** * @brief Moves iteration to the next table (if any). Has to be called once on a new * LinePartIterator to move to the 1st table. * @retval false if moving to next table failed because no further table exists. */ bool nextTable() { // If this is NOT the first time nextTable() is called after the constructor, // then skip to the next table break (i.e. a Descriptor with help == 0) if (rowdesc != 0) { while (tablestart->help != 0 && tablestart->shortopt != 0) ++tablestart; } // Find the next table after the break (if any) while (tablestart->help == 0 && tablestart->shortopt != 0) ++tablestart; restartTable(); return rowstart != 0; } /** * @brief Reset iteration to the beginning of the current table. */ void restartTable() { rowdesc = tablestart; rowstart = tablestart->help; ptr = 0; } /** * @brief Moves iteration to the next row (if any). Has to be called once after each call to * @ref nextTable() to move to the 1st row of the table. * @retval false if moving to next row failed because no further row exists. */ bool nextRow() { if (ptr == 0) { restartRow(); return rowstart != 0; } while (*ptr != 0 && *ptr != '\n') ++ptr; if (*ptr == 0) { if ((rowdesc + 1)->help == 0) // table break return false; ++rowdesc; rowstart = rowdesc->help; } else // if (*ptr == '\n') { rowstart = ptr + 1; } restartRow(); return true; } /** * @brief Reset iteration to the beginning of the current row. */ void restartRow() { ptr = rowstart; col = -1; len = 0; screenlen = 0; max_line_in_block = 0; line_in_block = 0; target_line_in_block = 0; hit_target_line = true; } /** * @brief Moves iteration to the next part (if any). Has to be called once after each call to * @ref nextRow() to move to the 1st part of the row. * @retval false if moving to next part failed because no further part exists. * * See @ref LinePartIterator for details about the iteration. */ bool next() { if (ptr == 0) return false; if (col == -1) { col = 0; update_length(); return true; } ptr += len; while (true) { switch (*ptr) { case '\v': upmax(max_line_in_block, ++line_in_block); ++ptr; break; case '\t': if (!hit_target_line) // if previous column did not have the targetline { // then "insert" a 0-length part update_length(); hit_target_line = true; return true; } hit_target_line = false; line_in_block = 0; ++col; ++ptr; break; case 0: case '\n': if (!hit_target_line) // if previous column did not have the targetline { // then "insert" a 0-length part update_length(); hit_target_line = true; return true; } if (++target_line_in_block > max_line_in_block) { update_length(); return false; } hit_target_line = false; line_in_block = 0; col = 0; ptr = rowstart; continue; default: ++ptr; continue; } // switch if (line_in_block == target_line_in_block) { update_length(); hit_target_line = true; return true; } } // while } /** * @brief Returns the index (counting from 0) of the column in which * the part pointed to by @ref data() is located. */ int column() { return col; } /** * @brief Returns the index (counting from 0) of the line within the current column * this part belongs to. */ int line() { return target_line_in_block; // NOT line_in_block !!! It would be wrong if !hit_target_line } /** * @brief Returns the length of the part pointed to by @ref data() in raw chars (not UTF-8 characters). */ int length() { return len; } /** * @brief Returns the width in screen columns of the part pointed to by @ref data(). * Takes multi-byte UTF-8 sequences and wide characters into account. */ int screenLength() { return screenlen; } /** * @brief Returns the current part of the iteration. */ const char* data() { return ptr; } }; /** * @internal * @brief Takes input and line wraps it, writing out one line at a time so that * it can be interleaved with output from other columns. * * The LineWrapper is used to handle the last column of each table as well as interjections. * The LineWrapper is called once for each line of output. If the data given to it fits * into the designated width of the last column it is simply written out. If there * is too much data, an appropriate split point is located and only the data up to this * split point is written out. The rest of the data is queued for the next line. * That way the last column can be line wrapped and interleaved with data from * other columns. The following example makes this clearer: * @code * Column 1,1 Column 2,1 This is a long text * Column 1,2 Column 2,2 that does not fit into * a single line. * @endcode * * The difficulty in producing this output is that the whole string * "This is a long text that does not fit into a single line" is the * 1st and only part of column 3. In order to produce the above * output the string must be output piecemeal, interleaved with * the data from the other columns. */ class LineWrapper { static const int bufmask = 15; //!< Must be a power of 2 minus 1. /** * @brief Ring buffer for length component of pair (data, length). */ int lenbuf[bufmask + 1]; /** * @brief Ring buffer for data component of pair (data, length). */ const char* datbuf[bufmask + 1]; /** * @brief The indentation of the column to which the LineBuffer outputs. LineBuffer * assumes that the indentation has already been written when @ref process() * is called, so this value is only used when a buffer flush requires writing * additional lines of output. */ int x; /** * @brief The width of the column to line wrap. */ int width; int head; //!< @brief index for next write int tail; //!< @brief index for next read - 1 (i.e. increment tail BEFORE read) /** * @brief Multiple methods of LineWrapper may decide to flush part of the buffer to * free up space. The contract of process() says that only 1 line is output. So * this variable is used to track whether something has output a line. It is * reset at the beginning of process() and checked at the end to decide if * output has already occurred or is still needed. */ bool wrote_something; bool buf_empty() { return ((tail + 1) & bufmask) == head; } bool buf_full() { return tail == head; } void buf_store(const char* data, int len) { lenbuf[head] = len; datbuf[head] = data; head = (head + 1) & bufmask; } //! @brief Call BEFORE reading ...buf[tail]. void buf_next() { tail = (tail + 1) & bufmask; } /** * @brief Writes (data,len) into the ring buffer. If the buffer is full, a single line * is flushed out of the buffer into @c write. */ void output(IStringWriter& write, const char* data, int len) { if (buf_full()) write_one_line(write); buf_store(data, len); } /** * @brief Writes a single line of output from the buffer to @c write. */ void write_one_line(IStringWriter& write) { if (wrote_something) // if we already wrote something, we need to start a new line { write("\n", 1); int _ = 0; indent(write, _, x); } if (!buf_empty()) { buf_next(); write(datbuf[tail], lenbuf[tail]); } wrote_something = true; } public: /** * @brief Writes out all remaining data from the LineWrapper using @c write. * Unlike @ref process() this method indents all lines including the first and * will output a \\n at the end (but only if something has been written). */ void flush(IStringWriter& write) { if (buf_empty()) return; int _ = 0; indent(write, _, x); wrote_something = false; while (!buf_empty()) write_one_line(write); write("\n", 1); } /** * @brief Process, wrap and output the next piece of data. * * process() will output at least one line of output. This is not necessarily * the @c data passed in. It may be data queued from a prior call to process(). * If the internal buffer is full, more than 1 line will be output. * * process() assumes that the a proper amount of indentation has already been * output. It won't write any further indentation before the 1st line. If * more than 1 line is written due to buffer constraints, the lines following * the first will be indented by this method, though. * * No \\n is written by this method after the last line that is written. * * @param write where to write the data. * @param data the new chunk of data to write. * @param len the length of the chunk of data to write. */ void process(IStringWriter& write, const char* data, int len) { wrote_something = false; while (len > 0) { if (len <= width) // quick test that works because utf8width <= len (all wide chars have at least 2 bytes) { output(write, data, len); len = 0; } else // if (len > width) it's possible (but not guaranteed) that utf8len > width { int utf8width = 0; int maxi = 0; while (maxi < len && utf8width < width) { int charbytes = 1; unsigned ch = (unsigned char) data[maxi]; if (ch > 0xC1) // everything <= 0xC1 (yes, even 0xC1 itself) is not a valid UTF-8 start byte { // int __builtin_clz (unsigned int x) // Returns the number of leading 0-bits in x, starting at the most significant bit unsigned mask = (unsigned) -1 >> __builtin_clz(ch ^ 0xff); ch = ch & mask; // mask out length bits, we don't verify their correctness while ((maxi + charbytes < len) && // (((unsigned char) data[maxi + charbytes] ^ 0x80) <= 0x3F)) // while next byte is continuation byte { ch = (ch << 6) ^ (unsigned char) data[maxi + charbytes] ^ 0x80; // add continuation to char code ++charbytes; } // ch is the decoded unicode code point if (ch >= 0x1100 && isWideChar(ch)) // the test for 0x1100 is here to avoid the function call in the Latin case { if (utf8width + 2 > width) break; ++utf8width; } } ++utf8width; maxi += charbytes; } // data[maxi-1] is the last byte of the UTF-8 sequence of the last character that fits // onto the 1st line. If maxi == len, all characters fit on the line. if (maxi == len) { output(write, data, len); len = 0; } else // if (maxi < len) at least 1 character (data[maxi] that is) doesn't fit on the line { int i; for (i = maxi; i >= 0; --i) if (data[i] == ' ') break; if (i >= 0) { output(write, data, i); data += i + 1; len -= i + 1; } else // did not find a space to split at => split before data[maxi] { // data[maxi] is always the beginning of a character, never a continuation byte output(write, data, maxi); data += maxi; len -= maxi; } } } } if (!wrote_something) // if we didn't already write something to make space in the buffer write_one_line(write); // write at most one line of actual output } /** * @brief Constructs a LineWrapper that wraps its output to fit into * screen columns @c x1 (incl.) to @c x2 (excl.). * * @c x1 gives the indentation LineWrapper uses if it needs to indent. */ LineWrapper(int x1, int x2) : x(x1), width(x2 - x1), head(0), tail(bufmask) { if (width < 2) // because of wide characters we need at least width 2 or the code breaks width = 2; } }; /** * @internal * @brief This is the implementation that is shared between all printUsage() templates. * Because all printUsage() templates share this implementation, there is no template bloat. */ static void printUsage(IStringWriter& write, const Descriptor usage[], int width = 80, // int last_column_min_percent = 50, int last_column_own_line_max_percent = 75) { if (width < 1) // protect against nonsense values width = 80; if (width > 10000) // protect against overflow in the following computation width = 10000; int last_column_min_width = ((width * last_column_min_percent) + 50) / 100; int last_column_own_line_max_width = ((width * last_column_own_line_max_percent) + 50) / 100; if (last_column_own_line_max_width == 0) last_column_own_line_max_width = 1; LinePartIterator part(usage); while (part.nextTable()) { /***************** Determine column widths *******************************/ const int maxcolumns = 8; // 8 columns are enough for everyone int col_width[maxcolumns]; int lastcolumn; int leftwidth; int overlong_column_threshold = 10000; do { lastcolumn = 0; for (int i = 0; i < maxcolumns; ++i) col_width[i] = 0; part.restartTable(); while (part.nextRow()) { while (part.next()) { if (part.column() < maxcolumns) { upmax(lastcolumn, part.column()); if (part.screenLength() < overlong_column_threshold) // We don't let rows that don't use table separators (\t or \v) influence // the width of column 0. This allows the user to interject section headers // or explanatory paragraphs that do not participate in the table layout. if (part.column() > 0 || part.line() > 0 || part.data()[part.length()] == '\t' || part.data()[part.length()] == '\v') upmax(col_width[part.column()], part.screenLength()); } } } /* * If the last column doesn't fit on the same * line as the other columns, we can fix that by starting it on its own line. * However we can't do this for any of the columns 0..lastcolumn-1. * If their sum exceeds the maximum width we try to fix this by iteratively * ignoring the widest line parts in the width determination until * we arrive at a series of column widths that fit into one line. * The result is a layout where everything is nicely formatted * except for a few overlong fragments. * */ leftwidth = 0; overlong_column_threshold = 0; for (int i = 0; i < lastcolumn; ++i) { leftwidth += col_width[i]; upmax(overlong_column_threshold, col_width[i]); } } while (leftwidth > width); /**************** Determine tab stops and last column handling **********************/ int tabstop[maxcolumns]; tabstop[0] = 0; for (int i = 1; i < maxcolumns; ++i) tabstop[i] = tabstop[i - 1] + col_width[i - 1]; int rightwidth = width - tabstop[lastcolumn]; bool print_last_column_on_own_line = false; if (rightwidth < last_column_min_width && // if we don't have the minimum requested width for the last column ( col_width[lastcolumn] == 0 || // and all last columns are > overlong_column_threshold rightwidth < col_width[lastcolumn] // or there is at least one last column that requires more than the space available ) ) { print_last_column_on_own_line = true; rightwidth = last_column_own_line_max_width; } // If lastcolumn == 0 we must disable print_last_column_on_own_line because // otherwise 2 copies of the last (and only) column would be output. // Actually this is just defensive programming. It is currently not // possible that lastcolumn==0 and print_last_column_on_own_line==true // at the same time, because lastcolumn==0 => tabstop[lastcolumn] == 0 => // rightwidth==width => rightwidth>=last_column_min_width (unless someone passes // a bullshit value >100 for last_column_min_percent) => the above if condition // is false => print_last_column_on_own_line==false if (lastcolumn == 0) print_last_column_on_own_line = false; LineWrapper lastColumnLineWrapper(width - rightwidth, width); LineWrapper interjectionLineWrapper(0, width); part.restartTable(); /***************** Print out all rows of the table *************************************/ while (part.nextRow()) { int x = -1; while (part.next()) { if (part.column() > lastcolumn) continue; // drop excess columns (can happen if lastcolumn == maxcolumns-1) if (part.column() == 0) { if (x >= 0) write("\n", 1); x = 0; } indent(write, x, tabstop[part.column()]); if ((part.column() < lastcolumn) && (part.column() > 0 || part.line() > 0 || part.data()[part.length()] == '\t' || part.data()[part.length()] == '\v')) { write(part.data(), part.length()); x += part.screenLength(); } else // either part.column() == lastcolumn or we are in the special case of // an interjection that doesn't contain \v or \t { // NOTE: This code block is not necessarily executed for // each line, because some rows may have fewer columns. LineWrapper& lineWrapper = (part.column() == 0) ? interjectionLineWrapper : lastColumnLineWrapper; if (!print_last_column_on_own_line || part.column() != lastcolumn) lineWrapper.process(write, part.data(), part.length()); } } // while if (print_last_column_on_own_line) { part.restartRow(); while (part.next()) { if (part.column() == lastcolumn) { write("\n", 1); int _ = 0; indent(write, _, width - rightwidth); lastColumnLineWrapper.process(write, part.data(), part.length()); } } } write("\n", 1); lastColumnLineWrapper.flush(write); interjectionLineWrapper.flush(write); } } } } ; /** * @brief Outputs a nicely formatted usage string with support for multi-column formatting * and line-wrapping. * * printUsage() takes the @c help texts of a Descriptor[] array and formats them into * a usage message, wrapping lines to achieve the desired output width. * * <b>Table formatting:</b> * * Aside from plain strings which are simply line-wrapped, the usage may contain tables. Tables * are used to align elements in the output. * * @code * // Without a table. The explanatory texts are not aligned. * -c, --create |Creates something. * -k, --kill |Destroys something. * * // With table formatting. The explanatory texts are aligned. * -c, --create |Creates something. * -k, --kill |Destroys something. * @endcode * * Table formatting removes the need to pad help texts manually with spaces to achieve * alignment. To create a table, simply insert \\t (tab) characters to separate the cells * within a row. * * @code * const option::Descriptor usage[] = { * {..., "-c, --create \tCreates something." }, * {..., "-k, --kill \tDestroys something." }, ... * @endcode * * Note that you must include the minimum amount of space desired between cells yourself. * Table formatting will insert further spaces as needed to achieve alignment. * * You can insert line breaks within cells by using \\v (vertical tab). * * @code * const option::Descriptor usage[] = { * {..., "-c,\v--create \tCreates\vsomething." }, * {..., "-k,\v--kill \tDestroys\vsomething." }, ... * * // results in * * -c, Creates * --create something. * -k, Destroys * --kill something. * @endcode * * You can mix lines that do not use \\t or \\v with those that do. The plain * lines will not mess up the table layout. Alignment of the table columns will * be maintained even across these interjections. * * @code * const option::Descriptor usage[] = { * {..., "-c, --create \tCreates something." }, * {..., "----------------------------------" }, * {..., "-k, --kill \tDestroys something." }, ... * * // results in * * -c, --create Creates something. * ---------------------------------- * -k, --kill Destroys something. * @endcode * * You can have multiple tables within the same usage whose columns are * aligned independently. Simply insert a dummy Descriptor with @c help==0. * * @code * const option::Descriptor usage[] = { * {..., "Long options:" }, * {..., "--very-long-option \tDoes something long." }, * {..., "--ultra-super-mega-long-option \tTakes forever to complete." }, * {..., 0 }, // ---------- table break ----------- * {..., "Short options:" }, * {..., "-s \tShort." }, * {..., "-q \tQuick." }, ... * * // results in * * Long options: * --very-long-option Does something long. * --ultra-super-mega-long-option Takes forever to complete. * Short options: * -s Short. * -q Quick. * * // Without the table break it would be * * Long options: * --very-long-option Does something long. * --ultra-super-mega-long-option Takes forever to complete. * Short options: * -s Short. * -q Quick. * @endcode * * <b>Output methods:</b> * * Because TheLeanMeanC++Option parser is freestanding, you have to provide the means for * output in the first argument(s) to printUsage(). Because printUsage() is implemented as * a set of template functions, you have great flexibility in your choice of output * method. The following example demonstrates typical uses. Anything that's similar enough * will work. * * @code * #include <unistd.h> // write() * #include <iostream> // cout * #include <sstream> // ostringstream * #include <cstdio> // fwrite() * using namespace std; * * void my_write(const char* str, int size) { * fwrite(str, size, 1, stdout); * } * * struct MyWriter { * void write(const char* buf, size_t size) const { * fwrite(str, size, 1, stdout); * } * }; * * struct MyWriteFunctor { * void operator()(const char* buf, size_t size) { * fwrite(str, size, 1, stdout); * } * }; * ... * printUsage(my_write, usage); // custom write function * printUsage(MyWriter(), usage); // temporary of a custom class * MyWriter writer; * printUsage(writer, usage); // custom class object * MyWriteFunctor wfunctor; * printUsage(&wfunctor, usage); // custom functor * printUsage(write, 1, usage); // write() to file descriptor 1 * printUsage(cout, usage); // an ostream& * printUsage(fwrite, stdout, usage); // fwrite() to stdout * ostringstream sstr; * printUsage(sstr, usage); // an ostringstream& * * @endcode * * @par Notes: * @li the @c write() method of a class that is to be passed as a temporary * as @c MyWriter() is in the example, must be a @c const method, because * temporary objects are passed as const reference. This only applies to * temporary objects that are created and destroyed in the same statement. * If you create an object like @c writer in the example, this restriction * does not apply. * @li a functor like @c MyWriteFunctor in the example must be passed as a pointer. * This differs from the way functors are passed to e.g. the STL algorithms. * @li All printUsage() templates are tiny wrappers around a shared non-template implementation. * So there's no penalty for using different versions in the same program. * @li printUsage() always interprets Descriptor::help as UTF-8 and always produces UTF-8-encoded * output. If your system uses a different charset, you must do your own conversion. You * may also need to change the font of the console to see non-ASCII characters properly. * This is particularly true for Windows. * @li @b Security @b warning: Do not insert untrusted strings (such as user-supplied arguments) * into the usage. printUsage() has no protection against malicious UTF-8 sequences. * * @param prn The output method to use. See the examples above. * @param usage the Descriptor[] array whose @c help texts will be formatted. * @param width the maximum number of characters per output line. Note that this number is * in actual characters, not bytes. printUsage() supports UTF-8 in @c help and will * count multi-byte UTF-8 sequences properly. Asian wide characters are counted * as 2 characters. * @param last_column_min_percent (0-100) The minimum percentage of @c width that should be available * for the last column (which typically contains the textual explanation of an option). * If less space is available, the last column will be printed on its own line, indented * according to @c last_column_own_line_max_percent. * @param last_column_own_line_max_percent (0-100) If the last column is printed on its own line due to * less than @c last_column_min_percent of the width being available, then only * @c last_column_own_line_max_percent of the extra line(s) will be used for the * last column's text. This ensures an indentation. See example below. * * @code * // width=20, last_column_min_percent=50 (i.e. last col. min. width=10) * --3456789 1234567890 * 1234567890 * * // width=20, last_column_min_percent=75 (i.e. last col. min. width=15) * // last_column_own_line_max_percent=75 * --3456789 * 123456789012345 * 67890 * * // width=20, last_column_min_percent=75 (i.e. last col. min. width=15) * // last_column_own_line_max_percent=33 (i.e. max. 5) * --3456789 * 12345 * 67890 * 12345 * 67890 * @endcode */ template<typename OStream> void printUsage(OStream& prn, const Descriptor usage[], int width = 80, int last_column_min_percent = 50, int last_column_own_line_max_percent = 75) { PrintUsageImplementation::OStreamWriter<OStream> write(prn); PrintUsageImplementation::printUsage(write, usage, width, last_column_min_percent, last_column_own_line_max_percent); } template<typename Function> void printUsage(Function* prn, const Descriptor usage[], int width = 80, int last_column_min_percent = 50, int last_column_own_line_max_percent = 75) { PrintUsageImplementation::FunctionWriter<Function> write(prn); PrintUsageImplementation::printUsage(write, usage, width, last_column_min_percent, last_column_own_line_max_percent); } template<typename Temporary> void printUsage(const Temporary& prn, const Descriptor usage[], int width = 80, int last_column_min_percent = 50, int last_column_own_line_max_percent = 75) { PrintUsageImplementation::TemporaryWriter<Temporary> write(prn); PrintUsageImplementation::printUsage(write, usage, width, last_column_min_percent, last_column_own_line_max_percent); } template<typename Syscall> void printUsage(Syscall* prn, int fd, const Descriptor usage[], int width = 80, int last_column_min_percent = 50, int last_column_own_line_max_percent = 75) { PrintUsageImplementation::SyscallWriter<Syscall> write(prn, fd); PrintUsageImplementation::printUsage(write, usage, width, last_column_min_percent, last_column_own_line_max_percent); } template<typename Function, typename Stream> void printUsage(Function* prn, Stream* stream, const Descriptor usage[], int width = 80, int last_column_min_percent = 50, int last_column_own_line_max_percent = 75) { PrintUsageImplementation::StreamWriter<Function, Stream> write(prn, stream); PrintUsageImplementation::printUsage(write, usage, width, last_column_min_percent, last_column_own_line_max_percent); } } // namespace option #endif /* OPTIONPARSER_H_ */
{ "content_hash": "25a9c3fe8dcd84658536399f2069dde0", "timestamp": "", "source": "github", "line_count": 2831, "max_line_length": 169, "avg_line_length": 35.566937477923, "alnum_prop": 0.6156222067732645, "repo_name": "eProsima/Fast-RTPS", "id": "186d12d2198a6e85584c973ca8a47343dcb7f413", "size": "102124", "binary": false, "copies": "9", "ref": "refs/heads/master", "path": "tools/fds/optionparser.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "7924610" }, { "name": "C++", "bytes": "11331003" }, { "name": "CMake", "bytes": "256031" }, { "name": "CSS", "bytes": "28054" }, { "name": "HTML", "bytes": "2698" }, { "name": "M4", "bytes": "16089" }, { "name": "Makefile", "bytes": "59826" }, { "name": "NSIS", "bytes": "13213" }, { "name": "Python", "bytes": "44640" }, { "name": "Shell", "bytes": "3586" }, { "name": "Thrift", "bytes": "6041" } ], "symlink_target": "" }
package me.kkuai.kuailian.data; import java.util.ArrayList; import java.util.List; import me.kkuai.kuailian.bean.EnterRoomNewUser; import me.kkuai.kuailian.bean.Follow; import me.kkuai.kuailian.bean.OwnerPhotoBean; import me.kkuai.kuailian.bean.RoomLiveListBean; import me.kkuai.kuailian.bean.RoomMsg; import me.kkuai.kuailian.constant.HttpRequestTypeId; import me.kkuai.kuailian.db.FriendInfo; import me.kkuai.kuailian.http.response.LoginResponse; import me.kkuai.kuailian.log.Log; import me.kkuai.kuailian.log.LogFactory; import me.kkuai.kuailian.user.UserInfo; import me.kkuai.kuailian.user.UserManager; import me.kkuai.kuailian.utils.JsonUtil; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.util.JsonToken; import com.kkuai.libs.json.parser.J_JsonParser; import com.kkuai.libs.net.response.J_Response; public class JsonParser extends J_JsonParser { private Log log = LogFactory.getLog(JsonParser.class); @Override public Object parsJson(String jsonStr, int whitchRequest) throws Exception { switch (whitchRequest) { case HttpRequestTypeId.TASKID_LOGIN: return parseLoginInfo(jsonStr); case HttpRequestTypeId.TASKID_QUERY_USER_INFO: return parseUserInfo(jsonStr); case HttpRequestTypeId.TASKID_QUERY_OTHER_USER_INFO: return parseOtherUserInfo(jsonStr); case HttpRequestTypeId.TASKID_HOME_PAGE_DATA: return parseHomePageData(jsonStr); case HttpRequestTypeId.TASKID_LIVE_ROOM_DATA: return parseRoomLiveListData(jsonStr); case HttpRequestTypeId.TASKID_USER_PHOTO: return parseOwnerPhoto(jsonStr); case HttpRequestTypeId.TASKID_ENTER_ROOM_USER: return jsonStr; case HttpRequestTypeId.TASKID_SET_USER_ENTER_ROOM: return jsonStr; case HttpRequestTypeId.TASKID_SET_USER_LEAVE_ROOM: return jsonStr; case HttpRequestTypeId.TASKID_OWNER_LIFE_STREAM: return jsonStr; case HttpRequestTypeId.TASKID_EDIT_USER_INFO: return jsonStr; case HttpRequestTypeId.TASKID_ROOM_SIGN_UP_INFO: return parseRoomInfo(jsonStr); case HttpRequestTypeId.TASKID_CHAT_FRIEND_LIST: return parseFriendsList(jsonStr); case HttpRequestTypeId.TASKID_ROOM_SIGN_UP: return jsonStr; case HttpRequestTypeId.TASKID_OWNER_JOINED_KK_LIST: return jsonStr; case HttpRequestTypeId.TASKID_FOLLOW_LIST: return parseFollowList(jsonStr); case HttpRequestTypeId.TASKID_FOLLOWER_LIST: return jsonStr; case HttpRequestTypeId.TASKID_SEND_ROOM_MSG: return parseSendRoomMsg(jsonStr); case HttpRequestTypeId.TASKID_FOLLOW: return jsonStr; case HttpRequestTypeId.TASKID_CANCEL_FOLLOW: return jsonStr; case HttpRequestTypeId.TASKID_PULL_CURRENT_DAY_COIN: return parseKuaiCoin(jsonStr); case HttpRequestTypeId.TASKID_ROOM_USER_LIST: return jsonStr; case HttpRequestTypeId.TASKID_REGISTER: return jsonStr; case HttpRequestTypeId.TASKID_SEND_MOBILE_CAPTCHA: return jsonStr; case HttpRequestTypeId.TASKID_REGISTER_SECOND: return jsonStr; case HttpRequestTypeId.TASKID_SEND_CHAT_MSG: return jsonStr; case HttpRequestTypeId.TASKID_OFFLINE_CHAT_MSG_NUM: return jsonStr; case HttpRequestTypeId.TASKID_ADD_CHAT_MSG_FRIEND: return jsonStr; case HttpRequestTypeId.TASKID_GET_ACCOUNT_INFO: return jsonStr; case HttpRequestTypeId.TASKID_AFRESH_ROOM_SIGNUP: return jsonStr; case HttpRequestTypeId.TASKID_CHAT_MSG_LIST: return jsonStr; case HttpRequestTypeId.TASKID_ADD_LIFE_RECORD: return jsonStr; case HttpRequestTypeId.TASKID_CLIENT_UPDATE_CHECK: return jsonStr; case HttpRequestTypeId.TASKID_DELETE_PHOTOS: return jsonStr; case HttpRequestTypeId.TASKID_ROOM_CHAT_MSG: return jsonStr; default: break; } return null; } /** * parse login info * @param result * @return * @throws JSONException */ private J_Response parseLoginInfo(String result) throws JSONException { LoginResponse response = new LoginResponse(); JSONObject obj = new JSONObject(result); if (obj.has("status")) { String status = JsonUtil.getJsonString(obj, "status"); if ("1".equals(status)) { String uid = JsonUtil.getJsonString(obj, "uid"); String userStatus = JsonUtil.getJsonString(obj, "userStatus"); UserInfo userInfo = new UserInfo(); userInfo.setId(uid); userInfo.setUserStatus(userStatus); response.userInfo = userInfo; response.token = JsonUtil.getJsonString(obj, "token"); } } return response; } /** * parse current user info * @param result * @return * @throws JSONException */ private UserInfo parseUserInfo(String result) throws JSONException { UserInfo currentUser = UserManager.getInstance().getCurrentUser(); JSONObject obj = new JSONObject(result); if (obj.has("status") && "1".equals(JsonUtil.getJsonString(obj, "status"))) { JSONObject userinfo = JsonUtil.getJsonObject(obj, "userinfo"); currentUser.setNickName(JsonUtil.getJsonString(userinfo, "nickName")); currentUser.setSex(JsonUtil.getJsonString(userinfo, "sex")); currentUser.setBirth(JsonUtil.getJsonString(userinfo, "birth")); currentUser.setAvatar(JsonUtil.getJsonString(userinfo, "avatar")); currentUser.setBirth(JsonUtil.getJsonString(userinfo, "birth")); currentUser.setWeight(JsonUtil.getJsonString(userinfo, "weight")); currentUser.setHeight(JsonUtil.getJsonString(userinfo, "height")); currentUser.setEducation(JsonUtil.getJsonString(userinfo, "education")); currentUser.setCarType(JsonUtil.getJsonString(userinfo, "carType")); currentUser.setIncome(JsonUtil.getJsonString(userinfo, "income")); currentUser.setWorkTrade(JsonUtil.getJsonString(userinfo, "workTrade")); currentUser.setJob(JsonUtil.getJsonString(userinfo, "job")); currentUser.setMarriage(JsonUtil.getJsonString(userinfo, "marriage")); currentUser.setNode(JsonUtil.getJsonString(userinfo, "node")); currentUser.setRegistTime(JsonUtil.getJsonString(userinfo, "registTime")); currentUser.setSchool(JsonUtil.getJsonString(userinfo, "school")); currentUser.setWordType(JsonUtil.getJsonString(userinfo, "workTrade")); currentUser.setHousingType(JsonUtil.getJsonString(userinfo, "housingType")); currentUser.setCityId(JsonUtil.getJsonString(userinfo, "cityId")); currentUser.setNativeCityId(JsonUtil.getJsonString(userinfo, "nativeCityId")); currentUser.setNativeCityName(JsonUtil.getJsonString(userinfo, "nativeCityName")); currentUser.setNativeProvinceName(JsonUtil.getJsonString(userinfo, "nativeProvinceName")); currentUser.setRegistTime(JsonUtil.getJsonString(userinfo, "registTime")); currentUser.setNation(JsonUtil.getJsonString(userinfo, "nation")); currentUser.setBloodType(JsonUtil.getJsonString(userinfo, "blood")); currentUser.setConstellation(JsonUtil.getJsonString(userinfo, "constellation")); currentUser.setEducationRequirement(JsonUtil.getJsonString(userinfo, "s_education")); currentUser.setIncomeRequirement(JsonUtil.getJsonString(userinfo, "s_income")); currentUser.setAgeRange(JsonUtil.getJsonString(userinfo, "s_age")); currentUser.setHeightRange(JsonUtil.getJsonString(userinfo, "s_height")); currentUser.setAreaRange(JsonUtil.getJsonString(userinfo, "s_cityId")); } return currentUser; } /** * parse current user info * @param result * @return * @throws JSONException */ private UserInfo parseOtherUserInfo(String result) throws JSONException { UserInfo userInfo = new UserInfo(); JSONObject obj = new JSONObject(result); if (obj.has("status") && "1".equals(JsonUtil.getJsonString(obj, "status"))) { JSONObject userinfo = JsonUtil.getJsonObject(obj, "userinfo"); userInfo.setNickName(JsonUtil.getJsonString(userinfo, "nickName")); userInfo.setSex(JsonUtil.getJsonString(userinfo, "sex")); userInfo.setBirth(JsonUtil.getJsonString(userinfo, "birth")); userInfo.setAvatar(JsonUtil.getJsonString(userinfo, "avatar")); userInfo.setBirth(JsonUtil.getJsonString(userinfo, "birth")); userInfo.setWeight(JsonUtil.getJsonString(userinfo, "weight")); userInfo.setHeight(JsonUtil.getJsonString(userinfo, "height")); userInfo.setEducation(JsonUtil.getJsonString(userinfo, "education")); userInfo.setCarType(JsonUtil.getJsonString(userinfo, "carType")); userInfo.setIncome(JsonUtil.getJsonString(userinfo, "income")); userInfo.setWorkTrade(JsonUtil.getJsonString(userinfo, "workTrade")); userInfo.setJob(JsonUtil.getJsonString(userinfo, "job")); userInfo.setMarriage(JsonUtil.getJsonString(userinfo, "marriage")); userInfo.setNode(JsonUtil.getJsonString(userinfo, "node")); userInfo.setRegistTime(JsonUtil.getJsonString(userinfo, "registTime")); userInfo.setSchool(JsonUtil.getJsonString(userinfo, "school")); userInfo.setWordType(JsonUtil.getJsonString(userinfo, "workTrade")); userInfo.setHousingType(JsonUtil.getJsonString(userinfo, "housingType")); userInfo.setCityId(JsonUtil.getJsonString(userinfo, "cityId")); userInfo.setNativeCityId(JsonUtil.getJsonString(userinfo, "nativeCityId")); userInfo.setNativeCityName(JsonUtil.getJsonString(userinfo, "nativeCityName")); userInfo.setNativeProvinceName(JsonUtil.getJsonString(userinfo, "nativeProvinceName")); userInfo.setRegistTime(JsonUtil.getJsonString(userinfo, "registTime")); userInfo.setNation(JsonUtil.getJsonString(userinfo, "nation")); userInfo.setBloodType(JsonUtil.getJsonString(userinfo, "blood")); userInfo.setConstellation(JsonUtil.getJsonString(userinfo, "constellation")); userInfo.setEducationRequirement(JsonUtil.getJsonString(userinfo, "s_education")); userInfo.setIncomeRequirement(JsonUtil.getJsonString(userinfo, "s_income")); userInfo.setAgeRange(JsonUtil.getJsonString(userinfo, "s_age")); userInfo.setHeightRange(JsonUtil.getJsonString(userinfo, "s_height")); userInfo.setAreaRange(JsonUtil.getJsonString(userinfo, "s_cityId")); userInfo.setHasFollow(JsonUtil.getJsonBoolean(userinfo, "hasFollow")); } return userInfo; } /** * parse home page user data * @param result * @return * @throws JSONException */ private List<UserInfo> parseHomePageData(String result) throws JSONException { JSONObject obj = new JSONObject(result); List<UserInfo> userInfos = new ArrayList<UserInfo>(); String status = JsonUtil.getJsonString(obj, "status"); if ("1".equals(status)) { JSONArray userLists = JsonUtil.getJsonArrayObject(obj, "userList"); for (int i = 0; i < userLists.length(); i++) { UserInfo userInfo = new UserInfo(); JSONObject userList = JsonUtil.getJsonObject(userLists, i); userInfo.setId(JsonUtil.getJsonString(userList, "uid")); userInfo.setNickName(JsonUtil.getJsonString(userList, "nickName")); userInfo.setAvatar(JsonUtil.getJsonString(userList, "avatar")); userInfo.setAge(JsonUtil.getJsonInt(userList, "age")); userInfo.setHeight(JsonUtil.getJsonString(userList, "height")); userInfo.setCityId(JsonUtil.getJsonString(userList, "cityId")); userInfo.setCityName(JsonUtil.getJsonString(userList, "cityName")); userInfo.setIncome(JsonUtil.getJsonString(userList, "income")); userInfo.setConstellation(JsonUtil.getJsonString(userList, "constellation")); userInfo.setEducation(JsonUtil.getJsonString(userList, "education")); userInfo.setSex(JsonUtil.getJsonString(userList, "sex")); userInfo.setLoveExponent((int) (Math.random()*60) + 40 + ""); userInfos.add(userInfo); } } return userInfos; } /** * parse live room play data * @param result * @return * @throws JSONException */ private List<RoomLiveListBean> parseRoomLiveListData(String result) throws JSONException { List<RoomLiveListBean> roomLiveLists = new ArrayList<RoomLiveListBean>(); JSONObject obj = new JSONObject(result); String status = JsonUtil.getJsonString(obj, "status"); if (null != status && "1".equals(status)) { JSONArray datas = JsonUtil.getJsonArrayObject(obj, "data"); for (int i = 0; i < datas.length(); i++) { JSONObject data = JsonUtil.getJsonObject(datas, i); RoomLiveListBean liveListBean = new RoomLiveListBean(); liveListBean.setConstellation(JsonUtil.getJsonString(data, "constellation")); liveListBean.setWeight(JsonUtil.getJsonString(data, "weight")); liveListBean.setPlayContentAudioUrl(JsonUtil.getJsonString(data, "playContent")); liveListBean.setCityId(JsonUtil.getJsonString(data, "cityId")); liveListBean.setPlayAbidanceTime(JsonUtil.getJsonString(data, "playAbidanceTime")); liveListBean.setWillChange(JsonUtil.getJsonString(data, "willChange")); liveListBean.setPlayType(JsonUtil.getJsonString(data, "playType")); liveListBean.setPhotoAvatar(JsonUtil.getJsonString(data, "avatar")); liveListBean.setEducation(JsonUtil.getJsonString(data, "education")); liveListBean.setHasPlay(JsonUtil.getJsonString(data, "hasPlay")); liveListBean.setSignupId(JsonUtil.getJsonString(data, "signupId")); liveListBean.setHeight(JsonUtil.getJsonString(data, "height")); liveListBean.setPlayTime(JsonUtil.getJsonString(data, "playTime")); liveListBean.setHasPayTime(JsonUtil.getJsonInt(data, "hasPayTime")); liveListBean.setNickName(JsonUtil.getJsonString(data, "nickName")); liveListBean.setUserId(JsonUtil.getJsonString(data, "userId")); liveListBean.setAge(JsonUtil.getJsonString(data, "age")); roomLiveLists.add(liveListBean); } } return roomLiveLists; } /** * parse owner photo * @param result * @return * @throws JSONException */ private ArrayList<OwnerPhotoBean> parseOwnerPhoto(String result) throws JSONException { ArrayList<OwnerPhotoBean> photos = new ArrayList<OwnerPhotoBean>(); JSONObject obj = new JSONObject(result); JSONArray photolists = JsonUtil.getJsonArrayObject(obj, "photolist"); for (int i = 0; i < photolists.length(); i++) { JSONObject photolist = JsonUtil.getJsonObject(photolists, i); OwnerPhotoBean photoBean = new OwnerPhotoBean(); photoBean.setPid(JsonUtil.getJsonString(photolist, "pid")); photoBean.setPhotoUrl(JsonUtil.getJsonString(photolist, "url")); photos.add(photoBean); } return photos; } private List<Integer> parseRoomInfo(String result) throws JSONException { List<Integer> times = new ArrayList<Integer>(); JSONObject obj = new JSONObject(result); String status = JsonUtil.getJsonString(obj, "status"); if ("1".equals(status)) { JSONObject timesLotMap = JsonUtil.getJsonObject(obj, "timeslotmap"); for (int i = 0; i < 20; i++) { times.add(JsonUtil.getJsonInt(timesLotMap, "" + i)); } } return times; } private List<FriendInfo> parseFriendsList(String result) throws JSONException { JSONObject obj = new JSONObject(result); JSONObject data = JsonUtil.getJsonObject(obj, "data"); JSONArray friendLists = JsonUtil.getJsonArrayObject(data, "friendList"); List<FriendInfo> friends = new ArrayList<FriendInfo>(); for (int i = 0; i < friendLists.length(); i++) { FriendInfo friendInfo = new FriendInfo(); JSONObject friendList = JsonUtil.getJsonObject(friendLists, i); friendInfo.setNickName(JsonUtil.getJsonString(friendList, "nickName")); friendInfo.setAge(JsonUtil.getJsonString(friendList, "age")); friendInfo.setLastUpdateTime(JsonUtil.getJsonLong(friendList, "last_update_time")); friendInfo.setMemo(JsonUtil.getJsonString(friendList, "memo")); friendInfo.setRelationStatus(JsonUtil.getJsonString(friendList, "relation_status")); friendInfo.setCreatetTime(JsonUtil.getJsonLong(friendList, "createt_time")); friendInfo.setAvatar(JsonUtil.getJsonString(friendList, "avatar")); friendInfo.setUid(JsonUtil.getJsonString(friendList, "friend_uid")); friends.add(friendInfo); } return friends; } private List<Follow> parseFollowList(String result) throws JSONException { List<Follow> follows = new ArrayList<Follow>(); JSONObject obj = new JSONObject(result); String status = JsonUtil.getJsonString(obj, "status"); if ("1".equals(status)) { JSONArray followlists = JsonUtil.getJsonArrayObject(obj, "followlist"); for (int i = 0; i < followlists.length(); i++) { JSONObject followlist = JsonUtil.getJsonObject(followlists, i); Follow follow = new Follow(); follow.setFuid(JsonUtil.getJsonString(followlist, "fuid")); follow.setNickName(JsonUtil.getJsonString(followlist, "nickName")); follow.setAvatar(JsonUtil.getJsonString(followlist, "avatar")); follow.setSex(JsonUtil.getJsonString(followlist, "sex")); follow.setFollowTime(JsonUtil.getJsonString(followlist, "followTime")); follow.setAge(JsonUtil.getJsonString(followlist, "age")); follow.setCityId(JsonUtil.getJsonString(followlist, "cityId")); follow.setCityName(JsonUtil.getJsonString(followlist, "cityName")); follows.add(follow); } } return follows; } private RoomMsg parseSendRoomMsg(String result) throws JSONException { RoomMsg roomMsg = new RoomMsg(); JSONObject obj = new JSONObject(result); String status = JsonUtil.getJsonString(obj, "status"); if ("1".equals(status)) { JSONObject data = JsonUtil.getJsonObject(obj, "data"); String id = JsonUtil.getJsonString(data, "id"); long sendTime = JsonUtil.getJsonLong(data, "sendTime"); String msgId = JsonUtil.getJsonString(data, "msgId"); roomMsg.setId(id); roomMsg.setSendTime(sendTime); roomMsg.setMsgId(msgId); } return roomMsg; } private int parseKuaiCoin(String result) throws JSONException { int coin = 0; JSONObject obj = new JSONObject(result); String status = JsonUtil.getJsonString(obj, "status"); if ("1".equals(status)) { coin = JsonUtil.getJsonInt(obj, "coin"); } return coin; } }
{ "content_hash": "470d2743686a6857f141562bd95df70b", "timestamp": "", "source": "github", "line_count": 406, "max_line_length": 93, "avg_line_length": 43.27832512315271, "alnum_prop": 0.757782710147402, "repo_name": "pepoc/CustomViewGather", "id": "442d292b024a653216053d44b9d7706f1ab6b48e", "size": "17571", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "KuaiKuai/src/me/kkuai/kuailian/data/JsonParser.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "1855073" } ], "symlink_target": "" }
ACCEPTED #### According to Index Fungorum #### Published in Bull. trimest. Soc. mycol. Fr. 95(3): 237 (1980) #### Original name Clitocybe foetens Melot ### Remarks null
{ "content_hash": "640b8a02214992c0e7dcd55acfebfd77", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 48, "avg_line_length": 13.23076923076923, "alnum_prop": 0.686046511627907, "repo_name": "mdoering/backbone", "id": "7f007a6c0430773a62387f355418280324dc78cf", "size": "219", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Fungi/Basidiomycota/Agaricomycetes/Agaricales/Tricholomataceae/Clitocybe/Clitocybe foetens/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
<!DOCTYPE html> <html lang="es" ng-app="miApp"> <head> <base href="/"> <meta charset="utf-8"> <title>Rest API</title> <link rel="stylesheet" href="css/bootstrap.css"> <link rel="stylesheet" href="css/style.css"> </head> <body> <div id='main' class="container"> <nav class="navbar-fluid navbar-default navbar-fixed-top"> <div class="container"> <a class="navbar-brand" href="/"> Rest API </a> <p class="navbar-text"> Aprendiendo a realizar mi primer Api</p> <p class="navbar-right navbar-text" ng-hide="authenticated"><a href="/login">Login</a> or <a href="/registro">Register</a></p> <p class="navbar-right navbar-text" ng-show="authenticated"><a href="/" ng-click="signout()">Logout</a></p> <p class="navbar-right navbar-text" ng-show="authenticated">Signed in as {{current_user}}</p> </div> </nav> <div class="col-md-offset-2 col-md-8"> <div ng-view> </div> </div> </div> </body> <script type="text/javascript" src="js/angular.min.js"></script> <script type="text/javascript" src="js/angular-route.min.js"></script> <script type="text/javascript" src="js/angular-resource.min.js"></script> <script type="text/javascript" src="js/jquery-1.12.0.min.js"></script> <script type="text/javascript" src="js/bootstrap.min.js"></script> <script type="text/javascript" src="app.js"></script> </html>
{ "content_hash": "a64803ad71593eaba541f7f7eab29370", "timestamp": "", "source": "github", "line_count": 33, "max_line_length": 136, "avg_line_length": 44.18181818181818, "alnum_prop": 0.6111111111111112, "repo_name": "Gataro3Dev/Rest_API", "id": "d2aa29a3c6ec947abdf38f563233e0615d18a9ba", "size": "1458", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "public/index.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "478" }, { "name": "HTML", "bytes": "3096" }, { "name": "JavaScript", "bytes": "10532" } ], "symlink_target": "" }
<!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 (1.8.0_301) on Wed Aug 03 11:25:16 BST 2022 --> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Uses of Class com.github.rvesse.airline.types.DefaultTypeConverter (Airline - Library 2.9.0 API)</title> <meta name="date" content="2022-08-03"> <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="Uses of Class com.github.rvesse.airline.types.DefaultTypeConverter (Airline - Library 2.9.0 API)"; } } catch(err) { } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <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/github/rvesse/airline/types/DefaultTypeConverter.html" title="class in com.github.rvesse.airline.types">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/github/rvesse/airline/types/class-use/DefaultTypeConverter.html" target="_top">Frames</a></li> <li><a href="DefaultTypeConverter.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../../allclasses-noframe.html">All&nbsp;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 Class com.github.rvesse.airline.types.DefaultTypeConverter" class="title">Uses of Class<br>com.github.rvesse.airline.types.DefaultTypeConverter</h2> </div> <div class="classUseContainer">No usage of com.github.rvesse.airline.types.DefaultTypeConverter</div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <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/github/rvesse/airline/types/DefaultTypeConverter.html" title="class in com.github.rvesse.airline.types">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/github/rvesse/airline/types/class-use/DefaultTypeConverter.html" target="_top">Frames</a></li> <li><a href="DefaultTypeConverter.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../../allclasses-noframe.html">All&nbsp;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>Copyright &#169; 2012&#x2013;2022. All rights reserved.</small></p> </body> </html>
{ "content_hash": "9410c8fd84f0349a1bce70ae23371462", "timestamp": "", "source": "github", "line_count": 126, "max_line_length": 167, "avg_line_length": 38.13492063492063, "alnum_prop": 0.6193548387096774, "repo_name": "rvesse/airline", "id": "6aa7906ec0d5e94881de761d0342889593d7e079", "size": "4805", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "docs/javadoc/2.9.0/airline/com/github/rvesse/airline/types/class-use/DefaultTypeConverter.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "91" }, { "name": "Java", "bytes": "2176058" }, { "name": "Shell", "bytes": "4550" } ], "symlink_target": "" }
# Simple file uploader [![Latest Version](https://img.shields.io/github/release/azurre/php-simple-file-uploader.svg?style=flat-square)](https://github.com/azurre/php-simple-file-uploader/releases) Small, comfortable and powerful file uploader ## Features * No dependencies * Easy to use * Easy to validate * Easy to extend/customize * Upload by URL * Unified upload result * Cyrillic transliteration ## Installation Install composer in your project: ``` curl -s https://getcomposer.org/installer | php ``` Require the package with composer: ``` composer require azurre/php-simple-file-uploader ``` ## Usage ### Simple example ```php $loader = require_once __DIR__ . '/vendor/autoload.php'; use Azurre\Component\Http\Uploader; if (isset($_FILES['file'])) { try { $uploader = Uploader::create()->upload('file'); } catch (\Exception $e) { exit("Error: {$e->getMessage()}"); } echo $uploader->getFirstFile()->getFullPath(); } ?> <form method="POST" enctype="multipart/form-data"> <input type="file" name="file" /> <input type="submit" value="Upload File" /> </form> ``` Output ``` /var/www/Test_5cd31dbb246530.38121881.xlsx ``` ### Example ```php if (isset($_FILES['file'])) { try { $uploader = Uploader::create() ->setDestination('./') ->setOverwrite(false)// Overwrite existing files? ->setNameFormat(Uploader::NAME_FORMAT_ORIGINAL) ->setReplaceCyrillic(false)// Transliterate cyrillic names ->addValidator(Uploader::VALIDATOR_MIME, ['image/png', 'image/jpeg']) ->addValidator(Uploader::VALIDATOR_EXTENSION, ['png', 'jpg']) ->addValidator(Uploader::VALIDATOR_SIZE, '1M'); // After upload callback $uploader->afterUpload(function ($file) { //do something }); $customData = 'KEY'; // Custom name formatter. If you will use custom formatter setNameFormat() setReplaceCyrillic() will be ignored. $uploader->setNameFormatter(function ($file, $upl) use ($customData) { /** @var Uploader\File $file */ /** @var Uploader $upl */ $newName = str_replace(' ', '-', $file->getName()); $newName = Uploader::transliterate($newName); $newName .= uniqid("_{$customData}_", true) . ".{$file->getExtension()}"; return $newName; }); $uploader->upload('file'); echo '<pre>' . print_r($uploader->getFiles(), true) . '</pre>'; } catch (\Exception $e) { echo 'Error:' . $e->getMessage(); } } ?> <form method="POST" enctype="multipart/form-data"> <input type="file" name="file[]" /> <input type="file" name="file[]" /> <input type="submit" value="Upload File" /> </form> ``` Output ``` Array ( [0] => Azurre\Component\Http\Uploader\File Object ( [data:protected] => Array ( [name] => Новая Картинка [full_name] => Новая Картинка.jpg [new_name] => Novaya-Kartinka_KEY_5cd32798d81c15.93269375.jpg [full_path] => /var/www/pricer.local/public/Novaya-Kartinka_KEY_5cd32798d81c15.93269375.jpg [extension] => jpg [mime_type] => image/jpeg [tmp_name] => /tmp/phpd2DBTm [size] => 280012 [error_code] => 0 ) ) [1] => Azurre\Component\Http\Uploader\File Object ( [data:protected] => Array ( [name] => web-server-certificate [full_name] => web-server-certificate.png [new_name] => web-server-certificate_KEY_5cd32798d82f45.89296123.png [full_path] => /var/www/pricer.local/public/web-server-certificate_KEY_5cd32798d82f45.89296123.png [extension] => png [mime_type] => image/png [tmp_name] => /tmp/php93mYNo [size] => 70652 [error_code] => 0 ) ) ) ``` ### Example upload by URL ```php $url = 'https://img.shields.io/github/release/azurre/php-simple-file-uploader.svg?style=flat-square'; try { $uploader = Uploader::create()->uploadByUrl($url); echo '<pre>' . print_r($uploader->getFirstFile(), true) . '</pre>'; } catch (\Exception $e) { echo 'Error:' . $e->getMessage(); } ``` Output ``` Azurre\Component\Http\Uploader\File Object ( [data:protected] => Array ( [name] => php-simple-file-uploader [full_name] => php-simple-file-uploader.svg [new_name] => php-simple-file-uploader_5cd32cc8d0b301.55846637.svg [full_path] => /var/www/pricer.local/public/php-simple-file-uploader_5cd32cc8d0b301.55846637.svg [extension] => svg [mime_type] => image/svg [tmp_name] => /tmp/upload9wl2BK [size] => 952 [error_code] => 0 ) ) ``` ## License [MIT](https://choosealicense.com/licenses/mit/)
{ "content_hash": "7f19df577fdf23828d92a83dca413f6f", "timestamp": "", "source": "github", "line_count": 168, "max_line_length": 196, "avg_line_length": 30.422619047619047, "alnum_prop": 0.5627078849540207, "repo_name": "azurre/php-simple-file-uploader", "id": "9d649a4a9b08838001e7dec4be203b6c8cff69ba", "size": "5137", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "mit", "language": [ { "name": "PHP", "bytes": "27500" } ], "symlink_target": "" }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Karbon.Cms.Web.Embed { public abstract class AbstractEmbedProvider { /// <summary> /// Gets the markup. /// </summary> /// <param name="url">The URL.</param> /// <param name="parameters">The parameters.</param> /// <returns></returns> public abstract string GetMarkup(string url, IDictionary<string, string> parameters); } }
{ "content_hash": "1141fbfb7ebd8f66e0b395613f456381", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 93, "avg_line_length": 27.27777777777778, "alnum_prop": 0.6272912423625254, "repo_name": "the-outfield/karbon-cms", "id": "df9e1f737be3000bc62c864b941ef55b18c26107", "size": "493", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Src/Karbon.Cms.Web/Embed/AbstractEmbedProvider.cs", "mode": "33188", "license": "mit", "language": [ { "name": "ASP", "bytes": "103" }, { "name": "C#", "bytes": "272126" }, { "name": "CSS", "bytes": "1558" }, { "name": "Puppet", "bytes": "345" }, { "name": "Shell", "bytes": "82" } ], "symlink_target": "" }
<table class="table"><thead><tr><th></th> <th>Base</th> <th>Hover</th> <th>Active</th> <th>Disabled</th> <th>Naked</th> <th>Naked Active</th> </tr></thead><tbody><tr><td>Default</td> <td><button class="btn btn--outline">Button</button></td> <td><button class="btn btn--outline is-hovered">Button</button></td> <td><button class="btn btn--outline active">Button</button></td> <td><button disabled class="btn btn--outline is-disabled">Button</button></td> <td><button class="btn btn--outline btn--naked">Button</button></td> <td><button class="btn btn--outline btn--naked active">Button</button></td> </tr><tr><td>Primary</td> <td><button class="btn btn--outline btn--primary">Button</button></td> <td><button class="btn btn--outline btn--primary is-hovered">Button</button></td> <td><button class="btn btn--outline btn--primary active">Button</button></td> <td><button disabled class="btn btn--outline btn--primary is-disabled">Button</button></td> <td><button class="btn btn--outline btn--primary btn--naked">Button</button></td> <td><button class="btn btn--outline btn--primary btn--naked active">Button</button></td> </tr><tr><td>Success</td> <td><button class="btn btn--outline btn--success">Button</button></td> <td><button class="btn btn--outline btn--success is-hovered">Button</button></td> <td><button class="btn btn--outline btn--success active">Button</button></td> <td><button disabled class="btn btn--outline btn--success is-disabled">Button</button></td> <td><button class="btn btn--outline btn--success btn--naked">Button</button></td> <td><button class="btn btn--outline btn--success btn--naked active">Button</button></td> </tr><tr><td>Warning</td> <td><button class="btn btn--outline btn--warning">Button</button></td> <td><button class="btn btn--outline btn--warning is-hovered">Button</button></td> <td><button class="btn btn--outline btn--warning active">Button</button></td> <td><button disabled class="btn btn--outline btn--warning is-disabled">Button</button></td> <td><button class="btn btn--outline btn--warning btn--naked">Button</button></td> <td><button class="btn btn--outline btn--warning btn--naked active">Button</button></td> </tr><tr><td>Danger</td> <td><button class="btn btn--outline btn--danger">Button</button></td> <td><button class="btn btn--outline btn--danger is-hovered">Button</button></td> <td><button class="btn btn--outline btn--danger active">Button</button></td> <td><button disabled class="btn btn--outline btn--danger is-disabled">Button</button></td> <td><button class="btn btn--outline btn--danger btn--naked">Button</button></td> <td><button class="btn btn--outline btn--danger btn--naked active">Button</button></td> </tr><tr><td>Info</td> <td><button class="btn btn--outline btn--info">Button</button></td> <td><button class="btn btn--outline btn--info is-hovered">Button</button></td> <td><button class="btn btn--outline btn--info active">Button</button></td> <td><button disabled class="btn btn--outline btn--info is-disabled">Button</button></td> <td><button class="btn btn--outline btn--info btn--naked">Button</button></td> <td><button class="btn btn--outline btn--info btn--naked active">Button</button></td> </tr><tr><td>Inverse</td> <td><button class="btn btn--outline btn--inverse">Button</button></td> <td><button class="btn btn--outline btn--inverse is-hovered">Button</button></td> <td><button class="btn btn--outline btn--inverse active">Button</button></td> <td><button disabled class="btn btn--outline btn--inverse is-disabled">Button</button></td> <td><button class="btn btn--outline btn--inverse btn--naked">Button</button></td> <td><button class="btn btn--outline btn--inverse btn--naked active">Button</button></td> </tr></tbody></table>
{ "content_hash": "0d05e0e3f0ebc1e563a2edd9c0204bd4", "timestamp": "", "source": "github", "line_count": 57, "max_line_length": 95, "avg_line_length": 68.50877192982456, "alnum_prop": 0.6691421254801536, "repo_name": "jadu/pulsar", "id": "c3334cc21802abee0ed88326cc60198b61762ae5", "size": "3905", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "tests/unit/Jadu/Pulsar/Twig/Macro/Fixtures/visuals/button-states-outline.html", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "209874" }, { "name": "JavaScript", "bytes": "764279" }, { "name": "Makefile", "bytes": "2145" }, { "name": "PHP", "bytes": "44966" }, { "name": "SCSS", "bytes": "452598" }, { "name": "Twig", "bytes": "2448362" } ], "symlink_target": "" }
layout: post title: Cloud-init avec KVM tags: [Mermaid] mermaid: true --- ![cloud-init]({{ site.baseurl }}/images/cloud-init-1200.png){:class="img-responsive"} ## Prérequis - Avoir KVM de déployé sur votre machine - ```sudo apt-get install -y cloud-image-utils``` ## Création de l'image Téléchargement de la version cloud-init de Debian : ```bash Jugu@X220:~/Téléchargements$ wget https://cloud.debian.org/images/cloud/buster/20210621-680/debian-10-generic-amd64-20210621-680.qcow2 -O debian-10-cloud.qcow2 ``` Commit de l'image pour l'agrandir au passage et ne pas "casser" l'image de base : ```bash jugu@X220:~/Téléchargements$ qemu-img create -b debian-10-cloud.qcow2 -f qcow2 -F qcow2 snapshot-debian-10-20G.qcow2 20G ``` Verif des infos du snapshot : ```bash jugu@X220:~/Téléchargements$ qemu-img info snapshot-debian-10-20G.qcow2 image: snapshot-debian-10-20G.qcow2 file format: qcow2 virtual size: 20G (21474836480 bytes) disk size: 196K cluster_size: 65536 backing file: debian-10-cloud.qcow2 backing file format: qcow2 Format specific information: compat: 1.1 lazy refcounts: false refcount bits: 16 corrupt: false ``` ## (si ce n'est pas déjà fait) Générer une clé SSH ```bash ssh-keygen -t rsa -b 4096 -f id_rsa -C test1 -N "" -q ``` ## Création du fichier de config Dans un fichier `cloud_init.cfg` : ```yaml #cloud-config hostname: Node1 fqdn: Node1.kube.test manage_etc_hosts: true users: - name: kube sudo: ALL=(ALL) NOPASSWD:ALL groups: users, admin home: /home/kube shell: /bin/bash lock_passwd: false ssh-authorized-keys: - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDxZV0uayWSqDMmFp2s4Eg+mWO2efwQLNCnauNMGwK166DskcvHcarEpKLObxlnpZd/bBLfxsMp9a8DC2cI/Y77IVF1C2WWOeNHZFIVlkv6zX9CYEN9dBv8tyuu9kJ8CauQdgSGVtB40W9zK44tJHqH21sL3JoRI/OBV8ITBA7jDp4NXJWjhq8R/lkSd/CDNZ06EVl1obMyqfd0f8TP6JU4EBl3UEi2RVpVzEtg9qgEVUXWihlLss2kUtHuYLRsAqEQfJq41KXNQjwfaF3TF32c7lJqCBwGFl9l0YnSd4k0vGuRVEbif++algFS4FSolIiXZa60oT6TbGd6WcG5JV0E6uaeTCR8R6drHIiVd34tmhmztY9f+HuikJJIxaMTaOpOu1pOx1Erw3NF1fVNK+iAxcNFcKc9JomMssL6SVaL+nxZlc9IDW32UuymJk3FV7F/dUtDBs7GwY2vdmk4nhu4PCXHDhhKiOMaJGi8ruykVo76ch4neXhbxXgE5Iot9xc1DDUq0NMcDO5GGuE5HyQq8dbov794FRzTKDhmI1UCzQOPtn2YaAzDrrg4aCj7BSyZz6fA0tg0WXC/+KhGYCWSzwMybkpRgPZZi24LS9NEFMt0SE/8rrKh+QQBYBQEbACwwsmMTE8Es9V0whr4YNzUsPJVpr8DI3rHHMniS5igRQ== test1 # only cert auth via ssh (console access can still login) ssh_pwauth: false disable_root: false chpasswd: list: | kube:kube expire: False package_update: true packages: - qemu-guest-agent # written to /var/log/cloud-init-output.log final_message: "The system is finally up, after $UPTIME seconds" ``` ### Pour scripter le remplacement de la clé ssh : ```bash pubkey=$(cat id_rsa.pub) sed "s% - <sshPUBKEY>% - $pubkey%" cloud_init.cfg ``` ## Config du réseau Dans `network_config_static.cfg` : ```yaml version: 2 ethernets: ens2: dhcp4: false # default libvirt network addresses: [ 192.168.100.10/24 ] gateway4: 192.168.100.1 nameservers: addresses: [ 192.168.100.1,8.8.8.8 ] search: [ kube.test ] ``` > Mon reseau par défaut sous KVM est modifié, vérifiez le votre. ## Ajout des métadonnées dans une image de seed ```bash # Création de l'image jugu@X220:~/Téléchargements/cloud-init$ cloud-localds -v --network-config=network_config_static.cfg seed_test.img cloud_init.cfg wrote seed_test.img with filesystem=iso9660 and diskformat=raw # Affichage des infos de l'image jugu@X220:~/Téléchargements/cloud-init$ qemu-img info seed_test.img image: seed_test.img file format: raw virtual size: 368K (376832 bytes) disk size: 368K ``` ## Lancement de la VM avec virt-install ```bash virt-install --name Kube_Node1 \ --virt-type kvm --memory 2048 --vcpus 2 \ --boot hd,menu=on \ --disk path=seed_test.img,device=cdrom \ --disk path=snapshot-debian-10-20G.qcow2_node1,device=disk \ --graphics none \ --os-type Linux --os-variant debian9 \ --network network:new_default \ --console pty,target_type=serial ``` ### Même chose sans console (pour du script) ```bash virt-install --name Kube_Node1 \ --virt-type kvm --memory 2048 --vcpus 2 \ --boot hd,menu=on \ --disk path=seed_test.img,device=cdrom \ --disk path=snapshot-debian-10-20G_node1.qcow2,device=disk \ --graphics none \ --os-type Linux --os-variant debian9 \ --network network:new_default \ --noautoconsole ``` ### trouver le bon os-variant : ```bash sudo apt install libosinfo-bin osinfo-query os | grep [ton-OS] ``` ### pousser nos machines dans l'inventory ```bash [debian] 192.168.100.11 192.168.100.12 192.168.100.13 [debian:vars] ansible_ssh_user=kube ansible_ssh_private_key_file=/home/jugu/cloud-init/id_rsa ``` ## Gerer les VM avec virsh Pour couper une vm, lister les machines : ```bash jugu@X220:~/cloud-init$ virsh list --all Id Name State ---------------------------------------------------- 4 Kube_Node1 running 5 Kube_Node2 running 6 Kube_Node3 running - Kali shut off - Nixos shut off - ubuntu11.10 shut off - win10 shut off ``` Puis la couper avec un `shutdown`: ```bash jugu@X220:~/cloud-init$ virsh shutdown Kube_Node1 ``` > Note : Il faut couper les vm avant de les supprimer Supprimer une VM ```bash virsh undefine Kube_Node3 ``` ## Le projet Gitlab [ici](https://gitlab.com/P0pR0cK5/cloud-init) ## Sources [KVM: Testing cloud-init locally using KVM for an Ubuntu cloud image](https://fabianlee.org/2020/02/23/kvm-testing-cloud-init-locally-using-kvm-for-an-ubuntu-cloud-image/) [Introduction à Cloud-init](https://www.grottedubarbu.fr/introduction-cloud-init/) [QEMU:Documentation/CreateSnapshot](https://wiki.qemu.org/Documentation/CreateSnapshot) [An Introduction to Cloud-Config Scripting](https://www.digitalocean.com/community/tutorials/an-introduction-to-cloud-config-scripting) [Goffinet et ses scripts](https://github.com/goffinet/virt-scripts) ## Script de création auto ```bash #!/bin/bash nbVM=3 ram=512 CPU=2 HDD="20G" #create folder to store config echo "Create folder to store cloud-init stuff" if [ -d "cloud_init.d" ] then echo "Folder exist" else mkdir cloud_init.d if [ "$?" = "0" ] ; then echo "Folder OK !" else echo "Folder Fucked up ! BRUH" 1>&2 exit 1 fi fi # creating folder to store img files echo "Create folder to store IMG files" if [ -d "disks_images.d" ] then echo "Folder exist" else mkdir "disks_images.d" if [ "$?" = "0" ]; then echo "Folder OK !" else echo "Folder Fucked up ! BRUH" 1>&2 exit 1 fi fi for idVM in $(seq 1 $nbVM) do #Start of the loop echo "Building VM $idVM" #creating the image echo "Creating image.." cd disks_images.d qemu-img create -b ../debian-10-cloud.qcow2 -f qcow2 -F qcow2 snapshot-debian-10-20G_n0de$idVM.qcow2 $HDD if [ "$?" = "0" ]; then echo "Image done !" else echo "Cannot create image !" 1>&2 exit 1 fi #modify the cloud init vars echo "generating cloud-init files" #change hostname cd ../cloud_init.d sed "s/<HOSTNAME>/Node$idVM/g" ../cloud_init.cfg > cloud_init_Node$idVM.cfg if [ "$?" = "0" ]; then echo "setting Hostname OK !" else echo "Cannot set hostname !" 1>&2 exit 1 fi #set ip address sed "s/<ID>/1$idVM/g" ../network_config_static.cfg > network_config_static_Node$idVM.cfg if [ "$?" = "0" ]; then echo "setting IP OK !" else echo "Cannot set IP !" 1>&2 exit 1 fi cd .. # create cloud init image cloud-localds -v --network-config=cloud_init.d/network_config_static_Node$idVM.cfg disks_images.d/seed_test_Node$idVM.img cloud_init.d/cloud_init_Node$idVM.cfg if [ "$?" = "0" ]; then echo "Cloud init image DONE" else echo "Cloud init image failed ! Bruh !" 1>&2 exit 1 fi # Install the VM virt-install --name Kube_Node$idVM --virt-type kvm --memory $ram --vcpus $CPU --boot hd,menu=on --disk path=disks_images.d/seed_test_Node$idVM.img,device=cdrom --disk path=disks_images.d/snapshot-debian-10-20G_n0de$idVM.qcow2,device=disk --graphics none --os-type Linux --os-variant debian9 --network network:new_default --console pty,target_type=serial --noautoconsole if [ "$?" = "0" ]; then echo "VM created !" else echo "VM Fucked Up !" 1>&2 exit 1 fi done ```
{ "content_hash": "e025fa85eea6e69d2c170c76db7021b7", "timestamp": "", "source": "github", "line_count": 317, "max_line_length": 738, "avg_line_length": 27, "alnum_prop": 0.6825563734081084, "repo_name": "Jugulaire/Jugulaire.github.io", "id": "5ec1a50f8b9b1d20cf3ab9b28977df623bebfd82", "size": "8596", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "_posts/2022-02-20-Cloud-Init-kvm.md", "mode": "33261", "license": "mit", "language": [ { "name": "HTML", "bytes": "5581" }, { "name": "SCSS", "bytes": "63525" } ], "symlink_target": "" }
ACCEPTED #### According to The Catalogue of Life, 3rd January 2011 #### Published in Trans. Br. mycol. Soc. 82(4): 653 (1984) #### Original name Akenomyces G. Arnaud ex D. Hornby ### Remarks null
{ "content_hash": "e46b5be49cdec3b60b2e970debfd1d2e", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 40, "avg_line_length": 15.307692307692308, "alnum_prop": 0.6834170854271356, "repo_name": "mdoering/backbone", "id": "64db01b44c09fc6a4e09aff29785012598710465", "size": "254", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Fungi/Basidiomycota/Agaricomycetes/Akenomyces/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
""" gettext for openstack-common modules. Usual usage in an openstack.common module: from raksha.openstack.common.gettextutils import _ """ import gettext import os _localedir = os.environ.get('raksha'.upper() + '_LOCALEDIR') _t = gettext.translation('raksha', localedir=_localedir, fallback=True) def _(msg): return _t.ugettext(msg) def install(domain): """Install a _() function using the given translation domain. Given a translation domain, install a _() function using gettext's install() function. The main difference from gettext.install() is that we allow overriding the default localedir (e.g. /usr/share/locale) using a translation-domain-specific environment variable (e.g. NOVA_LOCALEDIR). """ gettext.install(domain, localedir=os.environ.get(domain.upper() + '_LOCALEDIR'), unicode=True)
{ "content_hash": "f1418b65d8d6aa36b387ed308a36c1df", "timestamp": "", "source": "github", "line_count": 33, "max_line_length": 76, "avg_line_length": 27.12121212121212, "alnum_prop": 0.6815642458100558, "repo_name": "DPaaS-Raksha/raksha", "id": "5dc38ec7466fd9ea8a3356f0ce2dd8c8457672bc", "size": "1569", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "raksha/openstack/common/gettextutils.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Python", "bytes": "1101651" } ], "symlink_target": "" }
'use strict'; var directives = angular.module('app.directives'); directives.directive('toCalendar', function(SiteData){ return{ restrict: 'E', scope:{ cal: '=', title: '=' }, templateUrl:"templates/directives/calendarForm.html", controller: function($scope){ } }; });
{ "content_hash": "d9f37c763e9438d781e27b128fdf85c2", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 56, "avg_line_length": 19.8, "alnum_prop": 0.6397306397306397, "repo_name": "kareemf/govsIsle", "id": "b3c409fa98be982eb4450ffdb5ed472a3082f7ac", "size": "297", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "public/js/directives/addToCalendar.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "273921" }, { "name": "JavaScript", "bytes": "190698" }, { "name": "Perl", "bytes": "48" } ], "symlink_target": "" }
<?php defined('COT_CODE') or die('Wrong URL');
{ "content_hash": "cac90703f208d373d9fe623dcfe20a6d", "timestamp": "", "source": "github", "line_count": 4, "max_line_length": 40, "avg_line_length": 12.25, "alnum_prop": 0.6122448979591837, "repo_name": "esclkm/hod", "id": "8d527ffa5cf6b28260c3e366e70733e6d90adadf", "size": "536", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "plugins/ckeditor_plus/ckeditor_plus.setup.php", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "ApacheConf", "bytes": "1300" }, { "name": "Batchfile", "bytes": "260" }, { "name": "CSS", "bytes": "1047934" }, { "name": "HTML", "bytes": "335521" }, { "name": "JavaScript", "bytes": "1974611" }, { "name": "Makefile", "bytes": "57" }, { "name": "PHP", "bytes": "5074304" }, { "name": "Ruby", "bytes": "161" }, { "name": "Shell", "bytes": "8517" }, { "name": "Smarty", "bytes": "845943" } ], "symlink_target": "" }
require 'omf-common/omfVersion' require 'net/http' require 'web/webServer' require 'config' require 'testbeds' require 'nodes' require 'uri' require 'omf-common/servicecall' require 'rexml/document' include REXML DEFAULT_PORT=5454 AM_ERROR="The AM reported an error executing this request." @@OMF_VERSION = "OMF Administration Interface v.#{OMF::Common::VERSION(__FILE__)}" puts @@OMF_VERSION @@dummy=false @@currentTB=nil #Jabber::debug = true @@config = AdminConfig.new OMF::ServiceCall.add_domain(:type => :xmpp, :uri => @@config.get[:communication][:xmppserver][:value], :user => "omf-admin", :password => "123") @@testbeds = Testbeds.new @@nodes = Nodes.new port = DEFAULT_PORT idx = ARGV.index("--port") port = ARGV[idx+1] if !idx.nil? && !ARGV[idx+1].nil? begin require 'web/helpers' OMF::Admin::Web::start(port, :DocumentRoot => ".", :TabDir => ["#{File.dirname(__FILE__)}/web/tab"], #:PublicHtml => OConfig[:ec_config][:repository][:path], :ResourceDir => @@config.get[:webinterface][:rdir][:value]) rescue Exception => ex puts "Cannot start webserver (#{ex})" end loop{ sleep 10 }
{ "content_hash": "e071e38097466507a833abe5c81de4a7", "timestamp": "", "source": "github", "line_count": 48, "max_line_length": 86, "avg_line_length": 25, "alnum_prop": 0.6366666666666667, "repo_name": "nathansamson/OMF", "id": "ad2e77462901810a41223f44c0ca1e8509cb5f09", "size": "2328", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "omf-admin/ruby/omf-admin/main.rb", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "657989" }, { "name": "C++", "bytes": "11324" }, { "name": "D", "bytes": "7480" }, { "name": "Elixir", "bytes": "6948" }, { "name": "JavaScript", "bytes": "1641704" }, { "name": "Objective-C", "bytes": "1874" }, { "name": "R", "bytes": "33118" }, { "name": "Ruby", "bytes": "1933501" }, { "name": "Shell", "bytes": "33789" } ], "symlink_target": "" }
<?php namespace AclModule; use Nette\Application\UI\Form; /** * Permission * */ class PermissionPresenter extends \BasePresenter { /** * Init method */ public function startup() { parent::startup(); $this->checkAccess(); } /****************** * Default ******************/ public function renderDefault() { // paginator $vp = new \VisualPaginator($this, 'vp'); $paginator = $vp->getPaginator(); $paginator->itemsPerPage = 20; $sql = \dibi::query('SELECT a.id, a.access, ro.name AS role, re.name AS resource, p.name AS privilege FROM ['.TABLE_ACL.'] AS a LEFT JOIN ['.TABLE_ROLES.'] AS ro ON a.role_id=ro.id LEFT JOIN ['.TABLE_RESOURCES.'] AS re ON a.resource_id=re.id LEFT JOIN ['.TABLE_PRIVILEGES.'] AS p ON a.privilege_id=p.id ORDER BY ro.name;'); $sql->setType('access', \dibi::BOOL); $paginator->itemCount = count($sql); $acl = $sql->fetchAll($paginator->offset, $paginator->itemsPerPage); $this->template->acl = $acl; } /****************** * Add and Edit ******************/ public function actionAdd($id) { $form = $this->getComponent('addEdit'); $this->template->form = $form; } public function actionEdit($id) { $sql = \dibi::query('SELECT * FROM ['.TABLE_ACL.'] WHERE id=%i;', $id); if (count($sql)) { $form = $this->getComponent('addEdit'); $sql->setType('access', \dibi::BOOL); $row = $sql->fetch(); $row->access = (int)$row->access; $form->setDefaults($row); $this->template->form = $form; } else { $this->flashMessage('This acces does not exist.'); $this->redirect('Permission:'); } } protected function createComponentAddEdit($name) { $form = new Form; $access = array(1 => 'Allow', 0 => 'Deny'); // roles $mroles = new \RolesModel(); $roles = $mroles->getTreeValues(); // resources $resources[0] = '- All resources -'; $mresources = new \ResourcesModel(); $rows = $mresources->getTreeValues(); foreach ($rows as $key => $row) { // function array_merge does't work correctly with integer indexes // manual array merge $resources[$key] = $row; } // privileges $privileges[0] = '- All privileges -'; $rows = \dibi::fetchAll('SELECT id, name FROM [gui_acl_privileges] ORDER BY name;'); foreach ($rows as $row) { // function array_merge does't work correctly with integer indexes // manual array merge $privileges[$row->id] = $row->name; } //$renderer = $form->getRenderer(); //$renderer->wrappers['label']['suffix'] = ':'; //$form->addGroup('Add'); $form->addMultiSelect('role_id', 'Role', $roles, 15) ->addRule(Form::FILLED, 'You have to fill roles.'); $form->addMultiSelect('resource_id', 'Resources', $resources, 15) ->addRule(Form::FILLED, 'You have to fill resources.'); $form->addMultiSelect('privilege_id', 'Privileges', $privileges, 15) ->addRule(Form::FILLED, 'You have to fill privileges.'); //$form->addSelect('access', 'Access', $access) $form->addRadioList('access', 'Access', $access) ->addRule(Form::FILLED, 'You have to fill access.'); $form->addSubmit('assign', 'Assign'); $form->onSuccess[] = callback($this, 'addEditOnFormSubmitted'); return $form; } public function addEditOnFormSubmitted($form) { // Permission form submitted $id = $this->getParam('id'); $values = $form->getValues(); // add if (!$id) { $error = FALSE; \dibi::begin(); try { foreach ($values['privilege_id'] as $privi) { foreach ($values['resource_id'] as $resou) { foreach ($values['role_id'] as $role) { if ($resou=='0') $resou = NULL; if ($privi=='0') $privi = NULL; \dibi::query('INSERT INTO ['.TABLE_ACL.'] (role_id, privilege_id, resource_id, access) VALUES (%i, %i, %i, %s);', $role, $privi, $resou, New \dibiVariable($values['access'], \dibi::BOOL)); } } } \dibi::commit(); $this->flashMessage('Permission was successfully assigned.', 'ok'); if (ACL_CACHING) { unset($this->cache['gui_acl']); // invalidate cache } $this->redirect('Permission:'); } catch (Exception $e) { $error = FALSE; $form->addError('Permission was not successfully assigned.'); throw $e; } if ($error) \dibi::rollback(); } else { // edit try { $value = array(); $value['access'] = New \dibiVariable($values['access'], \dibi::BOOL); $value["role_id"] = $values["role_id"]; $value["resource_id"] = $values["resource_id"]; $value["privilege_id"] = $values["privilege_id"]; \dibi::query('UPDATE ['.TABLE_ACL.'] SET %a WHERE id=%i', $value, $id); $this->flashMessage('Permission was successfully edited.', 'ok'); if (ACL_CACHING) { unset($this->cache['gui_acl']); // invalidate cache } $this->redirect('Permission:'); } catch (Exception $e) { $form->addError('Permission was not successfully edited.'); throw $e; } } } /****************** * Delete ******************/ public function actionDelete($id) { $sql = \dibi::query('SELECT a.id, a.access, ro.name AS role, re.name AS resource, p.name AS privilege FROM ['.TABLE_ACL.'] AS a LEFT JOIN ['.TABLE_ROLES.'] AS ro ON a.role_id=ro.id LEFT JOIN ['.TABLE_RESOURCES.'] AS re ON a.resource_id=re.id LEFT JOIN ['.TABLE_PRIVILEGES.'] AS p ON a.privilege_id=p.id WHERE a.id=%i;', $id); if (count($sql)) { $sql->setType('access', \dibi::BOOL); $acl = $sql->fetch(); $this->template->acl = $acl; } else { $this->flashMessage('This acces does not exist.'); $this->redirect('Permission:'); } } protected function createComponentDelete($name) { $form = new Form; $form->addSubmit('delete', 'Delete'); $form->addSubmit('cancel', 'Cancel'); $form->onSucces[] = callback($this, 'deleteOnFormSubmitted'); } public function deleteOnFormSubmitted(AppForm $form) { if ($form['delete']->isSubmittedBy()) { try { $id = $this->getParam('id'); \dibi::query('DELETE FROM ['.TABLE_ACL.'] WHERE id=%i;', $id); $this->flashMessage('The access has been deleted.', 'ok'); if (ACL_CACHING) { unset($this->cache['gui_acl']); // invalidate cache } $this->redirect('Permission:'); } catch (Exception $e) { $form->addError('The access has not been deleted.'); throw $e; } } else $this->redirect('Permission:'); } }
{ "content_hash": "0e73d9642469b68587af1ff488c0a4a5", "timestamp": "", "source": "github", "line_count": 202, "max_line_length": 216, "avg_line_length": 40.62376237623762, "alnum_prop": 0.4617353156227151, "repo_name": "iguana007/gui-for-ACL-NETTE-2.0", "id": "c9f313deafbc6e1c7600e8f06199959ff58ac893", "size": "8304", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/AclModule/presenters/PermissionPresenter.php", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
external help file: Microsoft.Azure.Commands.ResourceManager.Cmdlets.dll-Help.xml ms.assetid: D6FF6BDD-4515-438D-B39D-C0BFC3342F4E online version: schema: 2.0.0 --- # New-AzureRmResource ## SYNOPSIS Creates a resource. ## SYNTAX ### The resource Id. (Default) ``` New-AzureRmResource [-Location <String>] [-Kind <String>] [-Properties <PSObject>] [-Plan <Hashtable>] [-Sku <Hashtable>] [-Tag <Hashtable>] [-IsFullObject] -ResourceId <String> [-ODataQuery <String>] [-Force] [-ApiVersion <String>] [-Pre] [-WhatIf] [-Confirm] [<CommonParameters>] ``` ### Resource that resides at the subscription level. ``` New-AzureRmResource [-Location <String>] [-Kind <String>] [-Properties <PSObject>] [-Plan <Hashtable>] [-Sku <Hashtable>] [-Tag <Hashtable>] [-IsFullObject] -ResourceName <String> -ResourceType <String> [-ExtensionResourceName <String>] [-ExtensionResourceType <String>] [-ODataQuery <String>] [-ResourceGroupName <String>] [-Force] [-ApiVersion <String>] [-Pre] [-WhatIf] [-Confirm] [<CommonParameters>] ``` ### Resource that resides at the tenant level. ``` New-AzureRmResource [-Location <String>] [-Kind <String>] [-Properties <PSObject>] [-Plan <Hashtable>] [-Sku <Hashtable>] [-Tag <Hashtable>] [-IsFullObject] -ResourceName <String> -ResourceType <String> [-ExtensionResourceName <String>] [-ExtensionResourceType <String>] [-ODataQuery <String>] [-TenantLevel] [-Force] [-ApiVersion <String>] [-Pre] [-WhatIf] [-Confirm] [<CommonParameters>] ``` ## DESCRIPTION The **New-AzureRmResource** cmdlet creates an Azure resource, such as a website, Azure SQL Database server, or Azure SQL Database, in a resource group. ## EXAMPLES ### Example 1: Create a resource ``` PS C:\>New-AzureRmResource -Location "West US" -Properties @{"test"="test"} -ResourceName "TestSite06" -ResourceType "microsoft.web/sites" -ResourceGroupName "ResourceGroup11" -Force ``` This command creates a resource that is a website in ResourceGroup11. ## PARAMETERS ### -ApiVersion Specifies the version of the resource provider API to use. If you do not specify a version, this cmdlet uses the latest available version. ```yaml Type: String Parameter Sets: (All) Aliases: Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` ### -ExtensionResourceName Specifies the name of an extension resource for the resource. For instance, to specify a database, use the following format: server name`/`database name ```yaml Type: String Parameter Sets: Resource that resides at the subscription level., Resource that resides at the tenant level. Aliases: Required: False Position: Named Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` ### -ExtensionResourceType Specifies the resource type for an extension resource. For instance, if the extension resource is a database, specify the following type: `Microsoft.Sql/Servers/Databases` ```yaml Type: String Parameter Sets: Resource that resides at the subscription level., Resource that resides at the tenant level. Aliases: Required: False Position: Named Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` ### -Force Forces the command to run without asking for user confirmation. ```yaml Type: SwitchParameter Parameter Sets: (All) Aliases: Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` ### -IsFullObject Indicates that the object that the *Properties* parameter specifies is the full object. ```yaml Type: SwitchParameter Parameter Sets: (All) Aliases: Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` ### -Kind Specifies the resource kind for the resource. ```yaml Type: String Parameter Sets: (All) Aliases: Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` ### -Location Specifies the location of the resource. Specify data center location, such as Central US or Southeast Asia. You can place a resource in any location that supports resources of that type. Resource groups can contain resources from different locations. To determine which locations support each resource type, use the Get-AzureLocation cmdlet. ```yaml Type: String Parameter Sets: (All) Aliases: Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` ### -ODataQuery Specifies an Open Data Protocol (OData) style filter. This cmdlet appends this value to the request in addition to any other filters. ```yaml Type: String Parameter Sets: (All) Aliases: Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` ### -Plan A hash table that represents resource plan properties. ```yaml Type: Hashtable Parameter Sets: (All) Aliases: PlanObject Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` ### -Pre Indicates that this cmdlet considers pre-release API versions when it automatically determines which version to use. ```yaml Type: SwitchParameter Parameter Sets: (All) Aliases: Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` ### -Properties Specifies resource properties for the resource. Use this parameter to specify the values of properties that are specific to a resource type. ```yaml Type: PSObject Parameter Sets: (All) Aliases: PropertyObject Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` ### -ResourceGroupName Specifies the name of the resource group where this cmdlet creates the resource. ```yaml Type: String Parameter Sets: Resource that resides at the subscription level. Aliases: Required: False Position: Named Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` ### -ResourceId Specifies the fully qualified resource ID, including the subscription, as in the following example: `/subscriptions/`subscription ID`/providers/Microsoft.Sql/servers/ContosoServer/databases/ContosoDatabase` ```yaml Type: String Parameter Sets: The resource Id. Aliases: Id Required: True Position: Named Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` ### -ResourceName Specifies the name of the resource. For instance, to specify a database, use the following format: `ContosoServer/ContosoDatabase` ```yaml Type: String Parameter Sets: Resource that resides at the subscription level., Resource that resides at the tenant level. Aliases: Name Required: True Position: Named Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` ### -ResourceType Specifies the type of the resource. For instance, for a database, the resource type is as follows: `Microsoft.Sql/Servers/Databases` ```yaml Type: String Parameter Sets: Resource that resides at the subscription level., Resource that resides at the tenant level. Aliases: Required: True Position: Named Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` ### -Sku A hash table that represents sku properties. ```yaml Type: Hashtable Parameter Sets: (All) Aliases: SkuObject Required: False Position: Named Default value: None Accept pipeline input: True (ByPropertyName) Accept wildcard characters: False ``` ### -Tag Key-value pairs in the form of a hash table. For example: @{key0="value0";key1=$null;key2="value2"} ```yaml Type: Hashtable Parameter Sets: (All) Aliases: Tags Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` ### -TenantLevel Indicates that this cmdlet operates at the tenant level. ```yaml Type: SwitchParameter Parameter Sets: Resource that resides at the tenant level. Aliases: Required: True Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` ### -Confirm Prompts you for confirmation before running the cmdlet. ```yaml Type: SwitchParameter Parameter Sets: (All) Aliases: cf Required: False Position: Named Default value: False Accept pipeline input: False Accept wildcard characters: False ``` ### -WhatIf Shows what would happen if the cmdlet runs. The cmdlet is not run. ```yaml Type: SwitchParameter Parameter Sets: (All) Aliases: wi Required: False Position: Named Default value: False Accept pipeline input: False Accept wildcard characters: False ``` ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). ## INPUTS ## OUTPUTS ### System.Management.Automation.PSObject ## NOTES ## RELATED LINKS [Find-AzureRmResource](./Find-AzureRmResource.md) [Get-AzureRmResource](./Get-AzureRmResource.md) [Move-AzureRmResource](./Move-AzureRmResource.md) [Remove-AzureRmResource](./Remove-AzureRmResource.md) [Set-AzureRmResource](./Set-AzureRmResource.md)
{ "content_hash": "583cf264d6a58c3930991424576f1f5c", "timestamp": "", "source": "github", "line_count": 394, "max_line_length": 314, "avg_line_length": 23.9746192893401, "alnum_prop": 0.7674147787423248, "repo_name": "hungmai-msft/azure-powershell", "id": "874c5003bb953573d2afa398f473b92dc2c2a940", "size": "9450", "binary": false, "copies": "2", "ref": "refs/heads/preview", "path": "src/ResourceManager/Resources/Commands.Resources/help/New-AzureRmResource.md", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "16509" }, { "name": "C#", "bytes": "39328004" }, { "name": "HTML", "bytes": "209" }, { "name": "JavaScript", "bytes": "4979" }, { "name": "PHP", "bytes": "41" }, { "name": "PowerShell", "bytes": "3983165" }, { "name": "Ruby", "bytes": "265" }, { "name": "Shell", "bytes": "50" }, { "name": "XSLT", "bytes": "6114" } ], "symlink_target": "" }
type = "button", name = "My Button", tooltip = "Button's tooltip text.", func = function() end, width = "full", --or "half" (optional) disabled = function() return db.someBooleanSetting end, --or boolean (optional) icon = "icon\\path.dds", --(optional) warning = "Will need to reload the UI.", --(optional) reference = "MyAddonButton" --(optional) unique global reference to control } ]] local widgetVersion = 5 local LAM = LibStub("LibAddonMenu-2.0") if not LAM:RegisterWidget("button", widgetVersion) then return end local wm = WINDOW_MANAGER local cm = CALLBACK_MANAGER local tinsert = table.insert local function UpdateDisabled(control) local disable if type(control.data.disabled) == "function" then disable = control.data.disabled() else disable = control.data.disabled end control.button:SetEnabled(not disable) end --controlName is optional function LAMCreateControl.button(parent, buttonData, controlName) local control = wm:CreateTopLevelWindow(controlName or buttonData.reference) control:SetParent(parent.scroll or parent) local isHalfWidth = buttonData.width == "half" control:SetDimensions(isHalfWidth and 250 or 510, isHalfWidth and 55 or 28) control:SetMouseEnabled(true) if buttonData.icon then control.button = wm:CreateControl(nil, control, CT_BUTTON) control.button:SetDimensions(26, 26) control.button:SetNormalTexture(buttonData.icon) control.button:SetPressedOffset(2, 2) else --control.button = wm:CreateControlFromVirtual(controlName.."Button", control, "ZO_DefaultButton") control.button = wm:CreateControlFromVirtual(nil, control, "ZO_DefaultButton") control.button:SetWidth(isHalfWidth and 180 or 200) control.button:SetText(buttonData.name) end local button = control.button button:SetAnchor(isHalfWidth and CENTER or RIGHT) button:SetClickSound("Click") --button.tooltipText = buttonData.tooltip button.data = {tooltipText = buttonData.tooltip} button:SetHandler("OnMouseEnter", ZO_Options_OnMouseEnter) button:SetHandler("OnMouseExit", ZO_Options_OnMouseExit) button:SetHandler("OnClicked", function(self, ...) buttonData.func(self, ...) if control.panel.data.registerForRefresh then cm:FireCallbacks("LAM-RefreshPanel", control) end end) if buttonData.warning then control.warning = wm:CreateControlFromVirtual(nil, control, "ZO_Options_WarningIcon") control.warning:SetAnchor(RIGHT, button, LEFT, -5, 0) --control.warning.tooltipText = buttonData.warning control.warning.data = {tooltipText = buttonData.warning} end control.panel = parent.panel or parent --if this is in a submenu, panel is its parent control.data = buttonData if buttonData.disabled then control.UpdateDisabled = UpdateDisabled control:UpdateDisabled() --this is here because buttons don't have an UpdateValue method if control.panel.data.registerForRefresh then --if our parent window wants to refresh controls, then add this to the list tinsert(control.panel.controlsToRefresh, control) end end return control end
{ "content_hash": "221401deb00aa3ed34228fdd5ed972da", "timestamp": "", "source": "github", "line_count": 88, "max_line_length": 123, "avg_line_length": 34.46590909090909, "alnum_prop": 0.7619518628420705, "repo_name": "JordyMoos/JMGuildSaleHistoryTracker", "id": "187e90197be4c52c86cda6ccc6906bff7d9a8aea", "size": "3052", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Libs/LibAddonMenu-2.0/controls/button.lua", "mode": "33188", "license": "mit", "language": [ { "name": "Lua", "bytes": "84687" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="ProjectModuleManager"> <modules> <module fileurl="file://$PROJECT_DIR$/QQView_Parallax.iml" filepath="$PROJECT_DIR$/QQView_Parallax.iml" /> <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" /> </modules> </component> </project>
{ "content_hash": "b13f7d40acf73c01ebd85756c714e83c", "timestamp": "", "source": "github", "line_count": 9, "max_line_length": 112, "avg_line_length": 40.77777777777778, "alnum_prop": 0.6648501362397821, "repo_name": "mjd507/ParallaxListView", "id": "175c17bd27456a71feb25714623e1fee12b7fa6f", "size": "367", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": ".idea/modules.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "7724" } ], "symlink_target": "" }
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@color/colorHighlight" android:state_activated="true" /> </selector>
{ "content_hash": "69203ed109de35eb59f91b274adf5b32", "timestamp": "", "source": "github", "line_count": 4, "max_line_length": 84, "avg_line_length": 52, "alnum_prop": 0.7163461538461539, "repo_name": "weeniearms/jirareconciler", "id": "db549842f7e287352f6b18478db945be57e02937", "size": "208", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/src/main/res/drawable/background_activated.xml", "mode": "33261", "license": "mit", "language": [ { "name": "Java", "bytes": "95974" } ], "symlink_target": "" }
<?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (c) WSO2 Inc. (http://wso2.com) All Rights Reserved. ~ ~ 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. --> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <parent> <groupId>org.wso2.developerstudio</groupId> <artifactId>wso2-developer-studio-eclipse-brs-installed-distributions</artifactId> <version>4.0.0-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> <groupId>org.wso2.developerstudio</groupId> <artifactId>developer-studio-brs-eclipse-jee-luna-linux-gtk</artifactId> <modelVersion>4.0.0</modelVersion> <packaging>pom</packaging> <name>WSO2 Developer Studio Eclipse BRS distribution-linux-gtk</name> <url>http://wso2.org</url> <repositories> <repository> <id>wso2-maven2-repo</id> <name>WSO2 Maven2 Repo</name> <url>http://dist.wso2.org/maven2/</url> </repository> <repository> <releases> <enabled>true</enabled> <updatePolicy>daily</updatePolicy> <checksumPolicy>ignore</checksumPolicy> </releases> <id>DevS-Deps-p2-Repository</id> <url>http://builder1.us1.wso2.org/~developerstudio/developer-studio-kernel/4.0.0/kernel/releases/</url> <layout>p2</layout> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>wso2-maven2-repository</id> <url>http://dist.wso2.org/maven2</url> </pluginRepository> <pluginRepository> <id>wso2-maven2-snapshot-repository</id> <url>http://dist.wso2.org/snapshots/maven2</url> </pluginRepository> </pluginRepositories> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>2.0-alpha-4</version> <inherited>false</inherited> <executions> <execution> <id>1-unpack-p2-agent-distribution</id> <phase>test</phase> <goals> <goal>unpack</goal> </goals> <configuration> <artifactItems> <artifactItem> <groupId>org.eclipse</groupId> <artifactId>eclipse-jee-luna-linux-gtk</artifactId> <version>4.4.2</version> <type>tar.gz</type> <overWrite>true</overWrite> <outputDirectory>target</outputDirectory> </artifactItem> <artifactItem> <groupId>org.wso2.developerstudio</groupId> <artifactId>wso2-developer-studio-kernel-brs-composite-p2</artifactId> <version>4.0.0-SNAPSHOT</version> <type>zip</type> <overWrite>true</overWrite> <outputDirectory>target/p2-repo</outputDirectory> </artifactItem> </artifactItems> </configuration> </execution> </executions> </plugin> <plugin> <artifactId>maven-antrun-plugin</artifactId> <executions> <execution> <id>install-eclipse</id> <phase>package</phase> <goals> <goal>run</goal> </goals> <configuration> <tasks> <java classname="org.eclipse.equinox.launcher.Main" fork="true" spawn="false" failonerror="true" maxmemory="1024m"> <classpath> <fileset dir="${project.basedir}/target/eclipse/plugins" includes="org.eclipse.equinox.launcher*.jar" /> </classpath> <arg value="-nosplash" /> <arg value="-application" /> <arg value="org.eclipse.equinox.p2.director" /> <arg value="-repository" /> <arg value="file:${project.basedir}/target/p2-repo" /> <arg value="-destination" /> <arg value="${project.basedir}/target/eclipse" /> <arg value="-installIU" /> <arg value="Q:everything.select(x | x.properties ~= filter('(org.eclipse.equinox.p2.type.group=true)'))"/> </java> </tasks> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> <version>1.1</version> <executions> <execution> <phase>package</phase> <configuration> <tasks> <replace token="512m" value="1024m" dir="target/eclipse"> <include name="**/eclipse.ini"/> </replace> <replace token="40m" value="512m" dir="target/eclipse"> <include name="**/eclipse.ini"/> </replace> <replace token="256m" value="512m" dir="target/eclipse"> <include name="**/eclipse.ini"/> </replace> </tasks> </configuration> <goals> <goal>run</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <version>2.2-beta-2</version> <executions> <execution> <id>1-pre_dist</id> <phase>package</phase> <goals> <goal>attached</goal> </goals> <configuration> <descriptors> <descriptor>${basedir}/src/assembly/dist.xml</descriptor> </descriptors> </configuration> </execution> </executions> </plugin> </plugins> </build> </project>
{ "content_hash": "a540f521e6aece1b551f26a7af4648a1", "timestamp": "", "source": "github", "line_count": 180, "max_line_length": 115, "avg_line_length": 40.638888888888886, "alnum_prop": 0.5008885850991114, "repo_name": "nwnpallewela/developer-studio", "id": "e5f5ee4de554fbf78273eea68b41904585f20b24", "size": "7315", "binary": false, "copies": "1", "ref": "refs/heads/developer-studio-product-plugins", "path": "brs/installed-distribution/developer-studio-eclipse-jee-luna-linux-gtk/pom.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "53060" }, { "name": "GAP", "bytes": "14192" }, { "name": "HTML", "bytes": "721781" }, { "name": "Java", "bytes": "65506028" }, { "name": "JavaScript", "bytes": "83573" }, { "name": "Lex", "bytes": "286788" }, { "name": "PHP", "bytes": "4628968" }, { "name": "Shell", "bytes": "2352" }, { "name": "XSLT", "bytes": "991" } ], "symlink_target": "" }
#ifndef CONTINUATIONS_H #define CONTINUATIONS_H struct thread_info; struct inferior; /* To continue the execution commands when running gdb asynchronously. A continuation structure contains a pointer to a function to be called to finish the command, once the target has stopped. Such mechanism is used by the finish and until commands, and in the remote protocol when opening an extended-remote connection. */ /* Prototype of the continuation callback functions. ARG is the continuation argument registered in the corresponding add_*_continuation call. ERR is true when the command should be cancelled instead of finished normally. In that case, the continuation should clean up whatever state had been set up for the command in question (e.g., remove momentary breakpoints). This happens e.g., when an error was thrown while handling a target event, or when the inferior thread the command was being executed on exits. */ typedef void (continuation_ftype) (void *arg, int err); /* Prototype of the function responsible for releasing the argument passed to the continuation callback functions, either when the continuation is called, or discarded. */ typedef void (continuation_free_arg_ftype) (void *); /* Thread specific continuations. */ extern void add_continuation (struct thread_info *, continuation_ftype *, void *, continuation_free_arg_ftype *); extern void do_all_continuations (int err); extern void do_all_continuations_thread (struct thread_info *, int err); extern void discard_all_continuations (void); extern void discard_all_continuations_thread (struct thread_info *); extern void add_intermediate_continuation (struct thread_info *, continuation_ftype *, void *, continuation_free_arg_ftype *); extern void do_all_intermediate_continuations (int err); extern void do_all_intermediate_continuations_thread (struct thread_info *, int err); extern void discard_all_intermediate_continuations (void); extern void discard_all_intermediate_continuations_thread (struct thread_info *); /* Inferior specific (any thread) continuations. */ extern void add_inferior_continuation (continuation_ftype *, void *, continuation_free_arg_ftype *); extern void do_all_inferior_continuations (int err); extern void discard_all_inferior_continuations (struct inferior *inf); #endif
{ "content_hash": "8793c84ac656af6c0e821bb2581efcc7", "timestamp": "", "source": "github", "line_count": 57, "max_line_length": 85, "avg_line_length": 42.14035087719298, "alnum_prop": 0.7527060782681099, "repo_name": "execunix/vinos", "id": "29759b30d579183e203550780880c009687f934e", "size": "3181", "binary": false, "copies": "41", "ref": "refs/heads/master", "path": "external/gpl3/gdb/dist/gdb/continuations.h", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
/** @defgroup * @ingroup dnsdb * @brief * * * * @{ * *----------------------------------------------------------------------------*/ #ifndef _ZDB_LISTENER_H #define _ZDB_LISTENER_H #include <dnsdb/zdb_types.h> #include <dnscore/dnsname.h> #if ZDB_NSEC3_SUPPORT!=0 #include <dnsdb/nsec3_types.h> #endif #ifdef __cplusplus extern "C" { #endif typedef struct dnssec_listener dnssec_listener; typedef struct dnssec_listener zdb_listener; typedef void zdb_listener_on_remove_type_callback(zdb_listener* listener, const u8 *dnsname, zdb_rr_collection* recordssets, u16 type); typedef void zdb_listener_on_add_record_callback(zdb_listener* listener, dnslabel_vector_reference labels, s32 top, u16 type, zdb_ttlrdata* record); typedef void zdb_listener_on_remove_record_callback(zdb_listener* listener, const u8 *dnsname, u16 type, zdb_ttlrdata* record); #if ZDB_NSEC3_SUPPORT!=0 typedef void zdb_listener_on_add_nsec3_callback(zdb_listener* listener, nsec3_zone_item* nsec3_item, nsec3_zone* n3, u32 ttl); typedef void zdb_listener_on_remove_nsec3_callback(zdb_listener* listener, nsec3_zone_item* nsec3_item, nsec3_zone* n3, u32 ttl); typedef void zdb_listener_on_update_nsec3rrsig_callback(zdb_listener* listener, zdb_packed_ttlrdata* removed_rrsig_sll, zdb_packed_ttlrdata* added_rrsig_sll, nsec3_zone_item* item); #endif #if ZDB_DNSSEC_SUPPORT!=0 typedef void zdb_listener_on_update_rrsig_callback(zdb_listener* listener, zdb_packed_ttlrdata* removed_rrsig_sll, zdb_packed_ttlrdata* added_rrsig_sll, zdb_rr_label* label, dnsname_stack* name); #endif struct dnssec_listener { zdb_listener_on_remove_type_callback* on_remove_record_type; zdb_listener_on_add_record_callback* on_add_record; zdb_listener_on_remove_record_callback* on_remove_record; #if ZDB_NSEC3_SUPPORT!=0 zdb_listener_on_add_nsec3_callback* on_add_nsec3; zdb_listener_on_remove_nsec3_callback* on_remove_nsec3; zdb_listener_on_update_nsec3rrsig_callback* on_update_nsec3rrsig; #endif #if ZDB_DNSSEC_SUPPORT!=0 zdb_listener_on_update_rrsig_callback* on_update_rrsig; #endif zdb_listener* next; }; void zdb_listener_chain(zdb_listener* listener); void zdb_listener_unchain(zdb_listener* listener); void zdb_listener_notify_remove_type(const u8 *dnsname, zdb_rr_collection* recordssets, u16 type); void zdb_listener_notify_add_record(dnslabel_vector_reference labels, s32 top, u16 type, zdb_ttlrdata* record); void zdb_listener_notify_remove_record(const u8 *dnsname, u16 type, zdb_ttlrdata* record); #if ZDB_NSEC3_SUPPORT!=0 void zdb_listener_notify_add_nsec3(nsec3_zone_item* nsec3_item, nsec3_zone* n3, u32 ttl); void zdb_listener_notify_remove_nsec3(nsec3_zone_item* nsec3_item, nsec3_zone* n3, u32 ttl); void zdb_listener_notify_update_nsec3rrsig(zdb_packed_ttlrdata* removed_rrsig_sll, zdb_packed_ttlrdata* added_rrsig_sll, nsec3_zone_item* item); #endif #if ZDB_DNSSEC_SUPPORT!=0 void zdb_listener_notify_update_rrsig(zdb_packed_ttlrdata* removed_rrsig_sll, zdb_packed_ttlrdata* added_rrsig_sll, zdb_rr_label* label, dnsname_stack* name); #endif bool zdb_listener_notify_enabled(); #ifdef __cplusplus } #endif #endif /* _zdb_listener_H */ /** @} */ /*----------------------------------------------------------------------------*/
{ "content_hash": "adc2ad8c3861957ef703b45eba27e315", "timestamp": "", "source": "github", "line_count": 83, "max_line_length": 195, "avg_line_length": 39.25301204819277, "alnum_prop": 0.7188459177409454, "repo_name": "lye/yadifa", "id": "c08ca9713cbad17796ba8067424afdc70fbbab82", "size": "5104", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "lib/dnsdb/include/dnsdb/zdb_listener.h", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "C", "bytes": "3364225" }, { "name": "C++", "bytes": "17874" }, { "name": "Shell", "bytes": "4171402" } ], "symlink_target": "" }
import { createReducer } from 'typesafe-redux-helpers'; import { Reducer } from 'redux'; import moment from 'moment-timezone'; import { ApiErrors } from '../api'; import { GetHostingRules, SetHostingRules } from '../actions'; export type HostingRules = { readonly content: string; readonly modified: moment.Moment; readonly author: string; }; export type HostingRulesState = { readonly fetching: boolean; readonly error: string | null; readonly data: HostingRules | null; readonly backupData: HostingRules | null; readonly editing: boolean; }; const displayError = (err: Error): string => { if (err instanceof ApiErrors.BadDataError) { return err.message; } if (err instanceof ApiErrors.NotAuthenticatedError) { return 'You are not logged in'; } if (err instanceof ApiErrors.ForbiddenError) { return 'You do not have permissions to do this'; } return 'Unexpected response from the server'; }; export const reducer: Reducer<HostingRulesState> = createReducer<HostingRulesState>({ fetching: false, error: null, data: null, backupData: null, editing: false, }) .handleAction(GetHostingRules.started, state => ({ ...state, fetching: true, error: null, })) .handleAction(GetHostingRules.success, (state, action) => ({ ...state, fetching: false, error: null, data: action.payload.result, })) .handleAction(GetHostingRules.failure, (state, action) => ({ ...state, fetching: false, error: displayError(action.payload.error), })) .handleAction(SetHostingRules.started, (state, action) => ({ ...state, fetching: true, error: null, data: action.payload.result, backupData: state.data, })) .handleAction(SetHostingRules.success, state => ({ ...state, fetching: false, error: null, backupData: null, })) .handleAction(SetHostingRules.failure, (state, action) => ({ ...state, fetching: false, error: displayError(action.payload.error), data: state.backupData, backupData: null, })) .handleAction(SetHostingRules.openEditor, state => ({ ...state, editing: true, })) .handleAction(SetHostingRules.closeEditor, state => ({ ...state, editing: false, }));
{ "content_hash": "5a32aa1c7aa48b925c7bcd2b496ab864", "timestamp": "", "source": "github", "line_count": 88, "max_line_length": 85, "avg_line_length": 25.46590909090909, "alnum_prop": 0.6706827309236948, "repo_name": "Eluinhost/hosts.uhc.gg", "id": "fc53fcb56a77a67e6c40ae82136c9b5768677a54", "size": "2241", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "frontend/src/state/HostingRulesState.ts", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "5833" }, { "name": "JavaScript", "bytes": "5022" }, { "name": "SCSS", "bytes": "99" }, { "name": "Sass", "bytes": "8389" }, { "name": "Scala", "bytes": "128564" }, { "name": "Shell", "bytes": "18" }, { "name": "TypeScript", "bytes": "305803" } ], "symlink_target": "" }
layout: post date: '2016-03-09' title: "House of Wu Christina Wu Occasions Style 22554 Sleeveless Floor-Length Aline/Princess" category: House of Wu tags: [House of Wu,Aline/Princess ,Sweetheart,Floor-Length,Sleeveless] --- ### House of Wu Christina Wu Occasions Style 22554 Just **$429.99** ### Sleeveless Floor-Length Aline/Princess <table><tr><td>BRANDS</td><td>House of Wu</td></tr><tr><td>Silhouette</td><td>Aline/Princess </td></tr><tr><td>Neckline</td><td>Sweetheart</td></tr><tr><td>Hemline/Train</td><td>Floor-Length</td></tr><tr><td>Sleeve</td><td>Sleeveless</td></tr></table> <a href="https://www.readybrides.com/en/house-of-wu/18527-house-of-wu-christina-wu-occasions-style-22554.html"><img src="//static.msromantic.com/41809/house-of-wu-christina-wu-occasions-style-22554.jpg" alt="Christina Wu Occasions Style 22554" style="width:100%;" /></a> <!-- break --><a href="https://www.readybrides.com/en/house-of-wu/18527-house-of-wu-christina-wu-occasions-style-22554.html"><img src="//static.msromantic.com/41808/house-of-wu-christina-wu-occasions-style-22554.jpg" alt="Christina Wu Occasions Style 22554" style="width:100%;" /></a> Buy it: [https://www.readybrides.com/en/house-of-wu/18527-house-of-wu-christina-wu-occasions-style-22554.html](https://www.readybrides.com/en/house-of-wu/18527-house-of-wu-christina-wu-occasions-style-22554.html)
{ "content_hash": "20dc92e618d36674fc152bb89b2dda1d", "timestamp": "", "source": "github", "line_count": 14, "max_line_length": 284, "avg_line_length": 97.21428571428571, "alnum_prop": 0.7369581190301249, "repo_name": "variousweddingdress/variousweddingdress.github.io", "id": "5a369db9606557a7838255179d59f6fe42ca20ee", "size": "1365", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "_posts/2016-03-09-House-of-Wu-Christina-Wu-Occasions-Style-22554-Sleeveless-FloorLength-AlinePrincess.md", "mode": "33261", "license": "mit", "language": [ { "name": "CSS", "bytes": "83876" }, { "name": "HTML", "bytes": "14755" }, { "name": "Ruby", "bytes": "897" } ], "symlink_target": "" }
const userKeys = require('./userKeys.js'); const Twitter = require('twitter'); const client = new Twitter(userKeys.userInfo); function userTweet(stat) { client.post('statuses/update', { status: stat }, function(error, tweet, response) { if (error) { console.log(error); } }); } function userRetweet(tweetId) { client.post('statuses/retweet/' + tweetId, function(error, tweet, response) { if (error) { console.log(error); } }); } function userAnswerMentionReply(userName) { client.post('statuses/update', { status: `@${userName}` }, function(error, tweetReply, response) { if (error) { console.log(error); } }); } function tweetBasedOnLocation(botLocation, userLocation, username, text) { const regex = new RegExp(botLocation, 'gi'); if (userLocation.match(botLocation)) { client.post('favourites/create', { status: text }, function(error, tweet, response) { if (error) { console.log(error); } }); } else { return; } } function followUser(userID) { client.post('friendships/create', {screen_name: userID}, function(screen_name,id,follow) { }); } function stream(tag) { client.stream('statuses/filter', { track: tag }, function(stream) { stream.on('data', function(tweet) { followUser(tweet.user.screen_name); userRetweet(tweet.id_str); }); stream.on('error', function(error) { console.log(error); }); }); } function sendMessageToUser(screenName,textContent) { client.post('direct_messages/new',{screen_name: screenName,text: textContent},function(user,screen_name,id){ console.log(user,screen_name,id); }); } sendMessageToUser('emil_mladenov','This was sent by your bot :)'); //TODO - add response based on mentioning botname [x] //TODO - add follow function [x] //TODO - add send message to user function [x] //TODO - add listen for a follower function [-] //TODO - add location based response / retweets [-] //TODO - add user specific retweets / responses [] //TODO - add image upload support []
{ "content_hash": "b0c52a3d48b6f4e1d52e87d53dc5f266", "timestamp": "", "source": "github", "line_count": 78, "max_line_length": 110, "avg_line_length": 26.44871794871795, "alnum_prop": 0.6572952011633544, "repo_name": "moonclash/RoboTweet", "id": "d1cc6bda2ab584601330345138b9da430bd08bea", "size": "2063", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/bot.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "2063" } ], "symlink_target": "" }
module VoiceBase module V3 module Client include VoiceBase::V2::Client def self.extended(client, args = {}) client.api_host = client.args[:host] || ENV.fetch('VOICEBASE_V3_API_HOST', 'https://apis.voicebase.com') client.api_endpoint = client.args[:api_endpoint] || ENV.fetch('VOICEBASE_V3_API_ENDPOINT', '/v3') end def upload_media(args = {}, headers = {}) require_media_file_or_url!(args) r = ::VoiceBase::Request::MultipartBuilder.new(headers: default_headers(headers)) if args[:config] r.add(VoiceBase::Request::HashPart.new(name: "configuration", hash: args[:config])) end if args[:media_url] r.add(VoiceBase::Request::TextPart.new(name: "mediaUrl", body: args[:media_url])) end if args[:media_file] r.add(VoiceBase::Request::FilePart.new(name: "media", file: args[:media_file])) end #TODO: make metadata an object if args[:metadata] r.add(VoiceBase::Request::HashPart.new(name: "metadata", hash: args[:metadata])) end response = self.class.post( uri + '/media', headers: r.headers, body: r.body ) VoiceBase::Response.new(response, api_version) end private def require_media_file_or_url!(args = {}) if args[:media_url].nil? && args[:media_file].nil? raise ArgumentError, "Missing argument :media_url or :media_file" end end end end end
{ "content_hash": "2e04da810d575c13dc25992cd67f1479", "timestamp": "", "source": "github", "line_count": 49, "max_line_length": 116, "avg_line_length": 31.489795918367346, "alnum_prop": 0.5845755022683085, "repo_name": "usertesting/voicebase-client-ruby", "id": "4b1a0613f8dbbbf54a8496030e129e9e34d9e79d", "size": "1543", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/voicebase/v3/client.rb", "mode": "33188", "license": "mit", "language": [ { "name": "Ruby", "bytes": "42496" }, { "name": "Shell", "bytes": "131" } ], "symlink_target": "" }
#ifndef AudioScheduledSourceNode_h #define AudioScheduledSourceNode_h #include "modules/webaudio/AudioSourceNode.h" namespace blink { class AbstractAudioContext; class AudioBus; class AudioScheduledSourceHandler : public AudioHandler { public: // These are the possible states an AudioScheduledSourceNode can be in: // // UNSCHEDULED_STATE - Initial playback state. Created, but not yet scheduled. // SCHEDULED_STATE - Scheduled to play (via start()), but not yet playing. // PLAYING_STATE - Generating sound. // FINISHED_STATE - Finished generating sound. // // The state can only transition to the next state, except for the FINISHED_STATE which can // never be changed. enum PlaybackState { // These must be defined with the same names and values as in the .idl file. UNSCHEDULED_STATE = 0, SCHEDULED_STATE = 1, PLAYING_STATE = 2, FINISHED_STATE = 3 }; AudioScheduledSourceHandler(NodeType, AudioNode&, float sampleRate); // Scheduling. void start(double when, ExceptionState&); void stop(double when, ExceptionState&); PlaybackState playbackState() const { return static_cast<PlaybackState>(acquireLoad(&m_playbackState)); } void setPlaybackState(PlaybackState newState) { releaseStore(&m_playbackState, newState); } bool isPlayingOrScheduled() const { PlaybackState state = playbackState(); return state == PLAYING_STATE || state == SCHEDULED_STATE; } bool hasFinished() const { return playbackState() == FINISHED_STATE; } protected: // Get frame information for the current time quantum. // We handle the transition into PLAYING_STATE and FINISHED_STATE here, // zeroing out portions of the outputBus which are outside the range of startFrame and endFrame. // // Each frame time is relative to the context's currentSampleFrame(). // quantumFrameOffset : Offset frame in this time quantum to start rendering. // nonSilentFramesToProcess : Number of frames rendering non-silence (will be <= quantumFrameSize). void updateSchedulingInfo(size_t quantumFrameSize, AudioBus* outputBus, size_t& quantumFrameOffset, size_t& nonSilentFramesToProcess); // Called when we have no more sound to play or the stop() time has been reached. No onEnded // event is called. virtual void finishWithoutOnEnded(); // Like finishWithoutOnEnded(), but an onEnded (if specified) is called. virtual void finish(); void notifyEnded(); // This synchronizes with process() and any other method that needs to be synchronized like // setBuffer for AudioBufferSource. mutable Mutex m_processLock; // m_startTime is the time to start playing based on the context's timeline (0 or a time less than the context's current time means "now"). double m_startTime; // in seconds // m_endTime is the time to stop playing based on the context's timeline (0 or a time less than the context's current time means "now"). // If it hasn't been set explicitly, then the sound will not stop playing (if looping) or will stop when the end of the AudioBuffer // has been reached. double m_endTime; // in seconds static const double UnknownTime; private: // This is accessed by both the main thread and audio thread. Use the setter and getter to // protect the access to this! int m_playbackState; }; class AudioScheduledSourceNode : public AudioSourceNode { public: void start(ExceptionState&); void start(double when, ExceptionState&); void stop(ExceptionState&); void stop(double when, ExceptionState&); EventListener* onended(); void setOnended(PassRefPtrWillBeRawPtr<EventListener>); // ScriptWrappable bool hasPendingActivity() const final; protected: explicit AudioScheduledSourceNode(AbstractAudioContext&); AudioScheduledSourceHandler& audioScheduledSourceHandler() const; }; } // namespace blink #endif // AudioScheduledSourceNode_h
{ "content_hash": "7272806785ba5d3c49eb0c8d8f0e68e1", "timestamp": "", "source": "github", "line_count": 117, "max_line_length": 143, "avg_line_length": 34.73504273504273, "alnum_prop": 0.7116141732283464, "repo_name": "ds-hwang/chromium-crosswalk", "id": "ff5f9ef4f16bdcf302e66df6fdca0fffa27699d9", "size": "5631", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "third_party/WebKit/Source/modules/webaudio/AudioScheduledSourceNode.h", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <title>Struct template impl</title> <link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.76.1"> <link rel="home" href="../../../index.html" title="Chapter&#160;1.&#160;Boost.Proto"> <link rel="up" href="../unary_expr.html#idp95587472" title="Description"> <link rel="prev" href="../unary_expr.html" title="Struct template unary_expr"> <link rel="next" href="../binary_expr.html" title="Struct template binary_expr"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table cellpadding="2" width="100%"><tr> <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td> <td align="center"><a href="../../../../../../../index.html">Home</a></td> <td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td> <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> <td align="center"><a href="../../../../../../../more/index.htm">More</a></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="../unary_expr.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../unary_expr.html#idp95587472"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../binary_expr.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a> </div> <div class="refentry"> <a name="boost.proto.unary_expr.impl"></a><div class="titlepage"></div> <div class="refnamediv"> <h2><span class="refentrytitle">Struct template impl</span></h2> <p>boost::proto::unary_expr::impl</p> </div> <h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2> <div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../../header/boost/proto/traits_hpp.html" title="Header &lt;boost/proto/traits.hpp&gt;">boost/proto/traits.hpp</a>&gt; </span> <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <a class="link" href="../../../Expr.html" title="Concept Expr">Expr</a><span class="special">,</span> <span class="keyword">typename</span> State<span class="special">,</span> <span class="keyword">typename</span> Data<span class="special">&gt;</span> <span class="keyword">struct</span> <a class="link" href="impl.html" title="Struct template impl">impl</a> <span class="special">:</span> <span class="keyword"></span> <a class="link" href="../pass_through.html" title="Struct template pass_through">proto::pass_through</a>&lt;unary_expr&gt;::template impl&lt;Expr, State, Data&gt; <span class="special">{</span> <span class="special">}</span><span class="special">;</span></pre></div> </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> <td align="left"></td> <td align="right"><div class="copyright-footer">Copyright &#169; 2008 Eric Niebler<p> Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) </p> </div></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="../unary_expr.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../unary_expr.html#idp95587472"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../binary_expr.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a> </div> </body> </html>
{ "content_hash": "05deafadc263262846762c04ee76f470", "timestamp": "", "source": "github", "line_count": 54, "max_line_length": 466, "avg_line_length": 77.98148148148148, "alnum_prop": 0.631916409403942, "repo_name": "calvinfarias/IC2015-2", "id": "95cd94a62266d476a22b6d4cc9d6f67a3d0e2a32", "size": "4211", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "BOOST/boost_1_61_0/libs/proto/doc/html/boost/proto/unary_expr/impl.html", "mode": "33188", "license": "mit", "language": [ { "name": "Assembly", "bytes": "223360" }, { "name": "Batchfile", "bytes": "32233" }, { "name": "C", "bytes": "2977162" }, { "name": "C#", "bytes": "40804" }, { "name": "C++", "bytes": "184445796" }, { "name": "CMake", "bytes": "119765" }, { "name": "CSS", "bytes": "427923" }, { "name": "Cuda", "bytes": "111870" }, { "name": "DIGITAL Command Language", "bytes": "6246" }, { "name": "FORTRAN", "bytes": "5291" }, { "name": "Groff", "bytes": "5189" }, { "name": "HTML", "bytes": "234946752" }, { "name": "IDL", "bytes": "14" }, { "name": "JavaScript", "bytes": "682223" }, { "name": "Lex", "bytes": "1231" }, { "name": "M4", "bytes": "29689" }, { "name": "Makefile", "bytes": "1083443" }, { "name": "Max", "bytes": "36857" }, { "name": "Objective-C", "bytes": "11406" }, { "name": "Objective-C++", "bytes": "630" }, { "name": "PHP", "bytes": "59030" }, { "name": "Perl", "bytes": "39008" }, { "name": "Perl6", "bytes": "2053" }, { "name": "Python", "bytes": "1759984" }, { "name": "QML", "bytes": "593" }, { "name": "QMake", "bytes": "16692" }, { "name": "Rebol", "bytes": "354" }, { "name": "Ruby", "bytes": "5532" }, { "name": "Shell", "bytes": "355247" }, { "name": "Tcl", "bytes": "1172" }, { "name": "TeX", "bytes": "126042" }, { "name": "XSLT", "bytes": "552736" }, { "name": "Yacc", "bytes": "19623" } ], "symlink_target": "" }
<?php namespace App\Bundle\BackOfficeBundle\Controller; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response as HttpResponse; use Symfony\Component\Routing\Router; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\Security\Core\SecurityContext; use App\Bundle\BackOfficeBundle\Entity\Admin; class SecurityPointAccessController extends Controller { public function loginAction() { /*$enFactory = $this->get('security.encoder_factory'); $admin = new Admin(); $admin->setEmail("fayssal@gmail.com")->setNom("fayssal")->setPrenom("fayssal"); $admin->addRole('ROLE_ADMIN'); $encoder = $enFactory->getEncoder($admin); $admin->setPassword($encoder->encodePassword('fayssal',$admin->getSalt())); $em = $this->get("doctrine")->getEntityManager(); $em->persist($admin); $em->flush();*/ $request = $this->getRequest(); $session = $request->getSession(); // get the login error if there is one if ($request->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) { $errors = $request->attributes->get( SecurityContext::AUTHENTICATION_ERROR ); } else { $errors = $session->get(SecurityContext::AUTHENTICATION_ERROR); $session->remove(SecurityContext::AUTHENTICATION_ERROR); } return $this->render( 'AppBackOfficeBundle:SecurityPointAccess:login.html.twig', array( // last username entered by the user 'last_username' => $session->get(SecurityContext::LAST_USERNAME), 'errors' => $errors, ) ); } }
{ "content_hash": "9e256a78fedcd58edeb8ec12614bbf4e", "timestamp": "", "source": "github", "line_count": 64, "max_line_length": 81, "avg_line_length": 26.09375, "alnum_prop": 0.6988023952095809, "repo_name": "e-scolarite-team/e-scolarite", "id": "d35b3d945d65c351e8a0a67d6ab45f4317761e51", "size": "1670", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/App/Bundle/BackOfficeBundle/Controller/SecurityPointAccessController.php", "mode": "33261", "license": "mit", "language": [ { "name": "CSS", "bytes": "130493" }, { "name": "JavaScript", "bytes": "114239" }, { "name": "PHP", "bytes": "304955" }, { "name": "Perl", "bytes": "2647" }, { "name": "Shell", "bytes": "329" } ], "symlink_target": "" }
<html> <h2> Help: Browsing Top Level Comments </h2> <p> <h3> Sorting </h3> To sort the list of comments select the "Sort by:" drop-down menu. Here is a list of sorting functions to choose from and an explaination for what each of them does: <br /> <br /> <b>Default</b> <br /> The default sorting method for the comments. It displays the newest comments that are close to your location at the top of the list, while older comments that are farther away are displayed near the bottom. <br /> <b>Date</b> <br /> Displays the comments in the order that they were created, with newest comments at the top of the list and oldest at the bottom. <br /> <b>Picture</b> <br /> Displays comments that have pictures attached at the top of the list and comments that don't have pictures attached at the bottom. <br /> <b>My Location</b> <br /> Displays comments that are close to your current location determined by GPS at the top of the list and comments posted farthest from you at the bottom of the list. If you do not have GPS turned on it will be sorted by a default location of (0,0) or your last known location. <br /> <b>Other Location</b> <br /> Displays comments that are close to a custom location of your choosing at the top of the list and comments posted farthest from the custom location at the bottom of the list. <br /> <b>Faves</b> <br /> Displays comments with the most favorites at the top of the list and comments with the least favorites at the bottom. <br /> <h3> Browsing Top Level Comments </h3> Top level comments are comments that are not replies to any other comment. You can see all the top level comments on the app from this screen. If you want to view replies to a specific comment in the list, select it. You will be brought to a page where you can view the comment's replies, its picture if it has one, reply to the post, favorite the post, or follow the comments author. Additionally, if you are the author of the selected comment you can edit the comment through the action bar option on that page. <h3> <a href="https://rawgithub.com/CMPUT301W14T02/Comput301Project/master/Help%20Pages/help.html">Return to Help Page Index</a> </h3> </p> </html>
{ "content_hash": "6e4e412bd07bd5ececfa7a710526af0c", "timestamp": "", "source": "github", "line_count": 58, "max_line_length": 177, "avg_line_length": 39.189655172413794, "alnum_prop": 0.7201935767707875, "repo_name": "alexgfh/Comput301Project", "id": "0b45c3ed311f7709cc1f5db2508b19fb8cfb6902", "size": "2273", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "Help Pages/browse_top_level_comments.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "11139" }, { "name": "HTML", "bytes": "1032824" }, { "name": "Java", "bytes": "345449" } ], "symlink_target": "" }
var fs = require('fs'), FileSpecification = require('./FileSpecification'), _ = require('underscore'), path = require('flavored-path'); var DirectoryFileRepository = function(directory){ var root = path.normalize(directory); this.get = function(recursive){ return getFiles(root,recursive); }; function getFiles(directory,recursive){ var directory_items = fs.readdirSync(directory); var files = []; _.each(directory_items,function(directory_item){ directory_item = path.join(directory,directory_item); if(FileSpecification.isSatisfiedBy(directory_item)){ files.push(directory_item); }else if(recursive){ var subfolderFiles = getFiles(directory_item); files = files.concat(subfolderFiles); } }); return files; } }; module.exports = DirectoryFileRepository;
{ "content_hash": "2e05d0a3788c82f815d8c181f9869e0a", "timestamp": "", "source": "github", "line_count": 29, "max_line_length": 57, "avg_line_length": 27.724137931034484, "alnum_prop": 0.7189054726368159, "repo_name": "TeamSentinaught/sentinaught", "id": "143e297357b533fbf283e2f3b9e1add0ef63bcf3", "size": "804", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/DirectoryFileRepository.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "15064" } ], "symlink_target": "" }
import log import json import datetime import sqlite3 from os.path import isfile from collections import UserDict _logger = log.getChild('record') #_logger.setLevel(log.DEBUG) class DownloadRecord(dict): def __init__(self, url, local_file, description, download_time=None, raw=None, is_accompany=False, market=''): UserDict.__init__(self) if download_time is None: download_time = datetime.datetime.utcnow() timestr = download_time.isoformat() self['url'] = url self['local_file'] = local_file self['description'] = description self['time'] = timestr self['raw'] = raw self['is_accompany'] = is_accompany self['market'] = market null_record = DownloadRecord('', '', 'Null Record', datetime.datetime.utcfromtimestamp(0)) class DownloadRecordManager(dict): def __init__(self, name): dict.__init__(self) self.name = name self.clear() def save(self, f): json.dump(self, f) def load(self, f): self.clear() try: content = json.load(f) except: _logger.warning('error occurs when load json file', exc_info=1) return _logger.debug('json file loaded:\n%s', str(content)) for r in content.values(): try: exists = isfile(r['local_file']) except: _logger.debug('error occurs when detecting saved file', exc_info=1) exists = False if exists: self.add(r) else: _logger.debug('%s doesn\'t exist any more', r) _logger.debug('history %s loaded', self) def add(self, r): r = dict(r) if 'raw' in r: r.pop('raw') self[r['url']] = r def get_by_url(self, url, default_rec=null_record): return self.get(url, default_rec) default_manager = DownloadRecordManager('default') class SqlDatabaseRecordManager(DownloadRecordManager): LATEST_DB_VERSION = (4, 4, 2) DB_UPGRADE_SCRIPTS = { #from_ver: (to_ver, sql) (4, 4, 1): ((4, 4, 2), ''' ALTER TABLE [BingWallpaperRecords] ADD COLUMN Market TEXT(64) DEFAULT ""; CREATE TABLE [BingWallpaperCore] ([MajorVer] INTEGER, [MinorVer] INTEGER, [Build] INTEGER); INSERT INTO [BingWallpaperCore] (MajorVer, MinorVer, Build) VALUES (4, 4, 2);'''), } def add(self, r): self[r['url']] = r def save(self, f): _logger.info('trying to save history to %s', f) conn = sqlite3.connect(f) self.upgrade_db(conn) cur = conn.cursor() for k,v in self.items(): cur.execute(''' INSERT OR REPLACE INTO [BingWallpaperRecords] (Url, DownloadTime, LocalFilePath, Description, Image, IsAccompany, Market) VALUES (?, ?, ?, ?, ?, ?, ?) ''', (k, v['time'], v['local_file'], v['description'], v['raw'], v['is_accompany'], v['market'])) conn.commit() def load(self, f): raise NotImplementedError("sql database is write-only") def upgrade_db(self, conn): ver = self.judge_version(conn) _logger.debug('dealing with database created in %s', ver) if ver == (0, 0, 0): self.create_scheme(conn) return elif self.vercmp(ver, self.LATEST_DB_VERSION) > 0: raise Exception('''Can't deal with database created by higher program version %s'''%(ver,)) _logger.info('current db version %s needs upgrade to %s', ver, self.LATEST_DB_VERSION) while self.vercmp(ver, self.LATEST_DB_VERSION) < 0: next_ver, script = self.DB_UPGRADE_SCRIPTS[ver] _logger.debug('upgrading database from %s to %s, execute %s', ver, next_ver, script) cur = conn.cursor() try: cur.executescript(script) except Exception as err: _logger.fatal('error happened during database upgrade "%s"', script, exc_info=1) conn.rollback() raise err ver = next_ver _logger.info('upgrading script executed successfully, now db is %s', self.judge_version(conn)) def create_scheme(self, conn): cur = conn.cursor() cur.execute(''' CREATE TABLE [BingWallpaperRecords] ( [Url] CHAR(1024) NOT NULL ON CONFLICT FAIL, [DownloadTime] DATETIME NOT NULL ON CONFLICT FAIL, [LocalFilePath] CHAR(1024), [Description] TEXT(1024), [Market] TEXT(64) DEFAULT "", [Image] BLOB, [IsAccompany] BOOLEAN DEFAULT False, CONSTRAINT [sqlite_autoindex_BingWallpaperRecords_1] PRIMARY KEY ([Url])); ''') cur.execute(''' CREATE TABLE [BingWallpaperCore] ( [MajorVer] INTEGER, [MinorVer] INTEGER, [Build] INTEGER); ''') cur.execute(''' INSERT INTO [BingWallpaperCore] (MajorVer, MinorVer, Build) VALUES (?, ?, ?) ''', self.LATEST_DB_VERSION) conn.commit() _logger.debug('created db from prog version %s', self.judge_version(conn)) def vercmp(self, ver1, ver2): if ver1 == ver2: return 0 elif ver1[0] > ver2[0] or \ (ver1[0] == ver2[0] and ver1[1] > ver2[1]) or \ (ver1[0] == ver2[0] and ver1[1] == ver2[1] and ver1[2] > ver2[2]): return 1 return -1 def judge_version(self, conn): ver = None cur = conn.cursor() tables = cur.execute(''' SELECT lower(name) FROM [sqlite_master] WHERE type=='table'; ''').fetchall() _logger.debug('find tables %s in database', tables) if ('bingwallpaperrecords',) not in tables and ('bingwallpapercore',) not in tables: ver = (0, 0, 0) elif ('bingwallpaperrecords',) in tables and ('bingwallpapercore',) not in tables: ver = (4, 4, 1) elif ('bingwallpaperrecords',) in tables and ('bingwallpapercore',) in tables: ver = cur.execute(''' SELECT MajorVer, MinorVer, Build FROM [BingWallpaperCore]; ''').fetchone() if not ver: raise Exception('Corrupted database with tables %s', tables) return ver
{ "content_hash": "46203d144b935a161c0506f936626f13", "timestamp": "", "source": "github", "line_count": 184, "max_line_length": 109, "avg_line_length": 35.891304347826086, "alnum_prop": 0.5390672319806178, "repo_name": "simpletrain/pybingwallpaper", "id": "fd361de21a4a6ed6ae2b4d8cb09c619ffb53ba2a", "size": "6627", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/record.py", "mode": "33188", "license": "mit", "language": [ { "name": "NSIS", "bytes": "11437" }, { "name": "Python", "bytes": "149156" } ], "symlink_target": "" }
package com.evolveum.midpoint.model.common.expression.evaluator; import javax.xml.namespace.QName; import com.evolveum.midpoint.model.api.ModelService; import com.evolveum.midpoint.model.common.expression.ExpressionEvaluationContext; import com.evolveum.midpoint.prism.PrismContext; import com.evolveum.midpoint.prism.PrismReferenceDefinition; import com.evolveum.midpoint.prism.PrismReferenceValue; import com.evolveum.midpoint.prism.crypto.Protector; import com.evolveum.midpoint.schema.util.ObjectResolver; import com.evolveum.midpoint.security.api.SecurityEnforcer; import com.evolveum.midpoint.util.logging.Trace; import com.evolveum.midpoint.util.logging.TraceManager; import com.evolveum.midpoint.xml.ns._public.common.common_3.SearchObjectRefExpressionEvaluatorType; /** * @author Radovan Semancik */ public class ReferenceSearchExpressionEvaluator extends AbstractSearchExpressionEvaluator<PrismReferenceValue,PrismReferenceDefinition> { private static final Trace LOGGER = TraceManager.getTrace(ReferenceSearchExpressionEvaluator.class); public ReferenceSearchExpressionEvaluator(SearchObjectRefExpressionEvaluatorType expressionEvaluatorType, PrismReferenceDefinition outputDefinition, Protector protector, ObjectResolver objectResolver, ModelService modelService, PrismContext prismContext, SecurityEnforcer securityEnforcer) { super(expressionEvaluatorType, outputDefinition, protector, objectResolver, modelService, prismContext, securityEnforcer); } protected PrismReferenceValue createPrismValue(String oid, QName targetTypeQName, ExpressionEvaluationContext params) { PrismReferenceValue refVal = new PrismReferenceValue(); refVal.setOid(oid); refVal.setTargetType(targetTypeQName); refVal.setRelation(((SearchObjectRefExpressionEvaluatorType)getExpressionEvaluatorType()).getRelation()); return refVal; } /* (non-Javadoc) * @see com.evolveum.midpoint.common.expression.ExpressionEvaluator#shortDebugDump() */ @Override public String shortDebugDump() { return "referenceSearchExpression"; } }
{ "content_hash": "6d676770b3dbedd18917a7e5799b737f", "timestamp": "", "source": "github", "line_count": 50, "max_line_length": 124, "avg_line_length": 41.38, "alnum_prop": 0.8371193813436443, "repo_name": "rpudil/midpoint", "id": "cfd9a0eacf1a8167bc43fd7574cf77cbb1a2c2b3", "size": "2669", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "model/model-common/src/main/java/com/evolveum/midpoint/model/common/expression/evaluator/ReferenceSearchExpressionEvaluator.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "232572" }, { "name": "HTML", "bytes": "590602" }, { "name": "Java", "bytes": "22468226" }, { "name": "JavaScript", "bytes": "15908" }, { "name": "PLSQL", "bytes": "2171" }, { "name": "PLpgSQL", "bytes": "7936" }, { "name": "Shell", "bytes": "52" } ], "symlink_target": "" }
/** * Created by netanel on 09/01/15. */ angular.module('angularCesium').directive('acLabel', function() { return { restrict : 'E', require : '^acLabelsLayer', scope : { color : '&', text : '&', position : '&' }, link : function(scope, element, attrs, acLabelsLayerCtrl) { var labelDesc = {}; var position = scope.position(); labelDesc.position = Cesium.Cartesian3.fromDegrees(Number(position.longitude) || 0, Number(position.latitude) || 0, Number(position.altitude) || 0); var color = scope.color(); if (color) { labelDesc.color = color; } labelDesc.text = scope.text(); var label = acLabelsLayerCtrl.getLabelCollection().add(labelDesc); scope.$on('$destroy', function() { acLabelsLayerCtrl.getLabelCollection().remove(label); }); } } });
{ "content_hash": "f979b5b6ff54202309475c61a1721b7e", "timestamp": "", "source": "github", "line_count": 33, "max_line_length": 154, "avg_line_length": 26.363636363636363, "alnum_prop": 0.593103448275862, "repo_name": "bipolalam/angular-cesium", "id": "a62812af3773e30896beb1045fb3f7cd486dbe6f", "size": "870", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/map-components/label/label.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "16840" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>${groupId}</groupId> <artifactId>${artifactId}</artifactId> <version>${version}</version> <name>${artifactId} Share JAR Module</name> <description>Sample Share JAR Module (to be included in the share.war)</description> <packaging>jar</packaging> <properties> <!-- Alfresco Maven Plugin version to use --> <alfresco.sdk.version>@@alfresco.sdk.parent.version@@</alfresco.sdk.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <!-- Properties used in dependency declarations, you don't need to change these --> <alfresco.groupId>org.alfresco</alfresco.groupId> <alfresco.bomDependencyArtifactId>@@alfresco.bomDependency.artifactId@@</alfresco.bomDependencyArtifactId> <alfresco.platform.version>@@alfresco.platform.version@@</alfresco.platform.version> <alfresco.platform.docker.user>@@alfresco.platform.docker.user@@</alfresco.platform.docker.user> <alfresco.share.version>@@alfresco.share.version@@</alfresco.share.version> <alfresco.share.docker.version>@@alfresco.share.docker.version@@</alfresco.share.docker.version> <!-- Docker images --> <docker.acs.image>@@alfresco.platform.docker.image@@</docker.acs.image> <docker.share.image>@@alfresco.share.docker.image@@</docker.share.image> <keystore.settings>@@keystore.settings@@</keystore.settings> <!-- JRebel Hot reloading of classpath stuff and web resource stuff --> <jrebel.version>1.1.8</jrebel.version> <!-- Environment configuration properties --> <share.port>8180</share.port> <share.debug.port>9898</share.debug.port> <acs.host>${artifactId}-acs</acs.host> <acs.port>8080</acs.port> <postgres.port>5555</postgres.port> </properties> <!-- Libs used in Unit and Integration tests --> <!-- IMPORTANT - Test dependencies need to be here in the top parent POM as the Alfresco Maven IT Mojo runs as part of the parent project ... --> <dependencies> <dependency> <groupId>${alfresco.groupId}</groupId> <artifactId>share</artifactId> <classifier>classes</classifier> </dependency> </dependencies> <dependencyManagement> <dependencies> <!-- This will import the dependencyManagement for all artifacts in the selected Alfresco platform. NOTE: You still need to define dependencies in your POM, but you can omit version as it's enforced by this dependencyManagement. NOTE: It defaults to the latest version this SDK pom has been tested with, but alfresco version can/should be overridden in your project's pom --> <dependency> <groupId>${alfresco.groupId}</groupId> <artifactId>${alfresco.bomDependencyArtifactId}</artifactId> <version>${alfresco.platform.version}</version> <type>pom</type> <scope>import</scope> </dependency> <!-- Redefine the following Share dependencies as they have different version numbers than platform. They are defined in alfresco-platform-distribution... --> <dependency> <groupId>${alfresco.groupId}</groupId> <artifactId>share</artifactId> <version>${alfresco.share.version}</version> <type>war</type> <scope>provided</scope> </dependency> <dependency> <groupId>${alfresco.groupId}</groupId> <artifactId>share</artifactId> <version>${alfresco.share.version}</version> <classifier>classes</classifier> <scope>provided</scope> </dependency> <dependency> <groupId>${alfresco.groupId}</groupId> <artifactId>alfresco-web-framework-commons</artifactId> <version>${alfresco.share.version}</version> <classifier>classes</classifier> <scope>provided</scope> </dependency> </dependencies> </dependencyManagement> <build> <plugins> <!-- Build an AMP if 3rd party libs are needed by the extensions JARs are the default artifact produced in your modules, if you want to build an amp for each module you have to enable this plugin and inspect the src/main/assembly.xml file if you want to customize the layout of your AMP. The end result is that Maven will produce both a JAR file and an AMP with your module. --> <!-- <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <version>2.6</version> <executions> <execution> <id>build-amp-file</id> <phase>package</phase> <goals> <goal>single</goal> </goals> <configuration> <appendAssemblyId>false</appendAssemblyId> <descriptor>src/main/assembly/amp.xml</descriptor> </configuration> </execution> </executions> <dependencies> <dependency> <groupId>org.alfresco.maven.plugin</groupId> <artifactId>alfresco-maven-plugin</artifactId> <version>${alfresco.sdk.version}</version> </dependency> </dependencies> </plugin> --> <!-- Filter the test resource files in the AIO parent project, and do property substitutions. We need this config so this is done before the Alfresco Maven Plugin 'run' is executed. --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <version>3.1.0</version> <configuration> <encoding>UTF-8</encoding> <nonFilteredFileExtensions> <!-- jpg, jpeg, gif, bmp and png are added automatically --> <nonFilteredFileExtension>ftl</nonFilteredFileExtension> <nonFilteredFileExtension>acp</nonFilteredFileExtension> <nonFilteredFileExtension>svg</nonFilteredFileExtension> <nonFilteredFileExtension>pdf</nonFilteredFileExtension> <nonFilteredFileExtension>doc</nonFilteredFileExtension> <nonFilteredFileExtension>docx</nonFilteredFileExtension> <nonFilteredFileExtension>xls</nonFilteredFileExtension> <nonFilteredFileExtension>xlsx</nonFilteredFileExtension> <nonFilteredFileExtension>ppt</nonFilteredFileExtension> <nonFilteredFileExtension>pptx</nonFilteredFileExtension> <nonFilteredFileExtension>bin</nonFilteredFileExtension> <nonFilteredFileExtension>lic</nonFilteredFileExtension> <nonFilteredFileExtension>swf</nonFilteredFileExtension> <nonFilteredFileExtension>zip</nonFilteredFileExtension> <nonFilteredFileExtension>msg</nonFilteredFileExtension> <nonFilteredFileExtension>jar</nonFilteredFileExtension> <nonFilteredFileExtension>ttf</nonFilteredFileExtension> <nonFilteredFileExtension>eot</nonFilteredFileExtension> <nonFilteredFileExtension>woff</nonFilteredFileExtension> <nonFilteredFileExtension>woff2</nonFilteredFileExtension> <nonFilteredFileExtension>css</nonFilteredFileExtension> <nonFilteredFileExtension>ico</nonFilteredFileExtension> <nonFilteredFileExtension>psd</nonFilteredFileExtension> <nonFilteredFileExtension>js</nonFilteredFileExtension> </nonFilteredFileExtensions> </configuration> <executions> <execution> <id>copy-and-filter-docker-compose-resources</id> <phase>validate</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <outputDirectory>${project.build.outputDirectory}/docker</outputDirectory> <resources> <resource> <directory>docker</directory> <filtering>true</filtering> </resource> </resources> </configuration> </execution> <execution> <id>copy-and-filter-docker-resources</id> <phase>validate</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <outputDirectory>${project.build.directory}</outputDirectory> <resources> <resource> <directory>src/main/docker</directory> <filtering>true</filtering> </resource> </resources> </configuration> </execution> <execution> <id>copy-share-extension</id> <phase>package</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <outputDirectory>${project.build.directory}/extensions</outputDirectory> <resources> <resource> <directory>target</directory> <includes> <include>${project.build.finalName}.jar</include> </includes> <filtering>false</filtering> </resource> </resources> </configuration> </execution> </executions> </plugin> <!-- Compress JavaScript files and store as *-min.js --> <plugin> <groupId>net.alchim31.maven</groupId> <artifactId>yuicompressor-maven-plugin</artifactId> <version>1.5.1</version> <executions> <!-- Compress the JS files under the assembly folder --> <execution> <id>compress-assembly</id> <goals> <goal>compress</goal> </goals> <configuration> <sourceDirectory>${project.basedir}/src/main/assembly/web</sourceDirectory> <outputDirectory>${project.basedir}/src/main/assembly/web</outputDirectory> <excludes> <exclude>**/webscripts/**</exclude> <exclude>**/site-webscripts/**</exclude> <exclude>**/META-INF/**</exclude> <exclude>**/*.lib.js</exclude> <exclude>**/*.css</exclude> <exclude>**/*-min.js</exclude> <exclude>**/*-min.css</exclude> </excludes> <force>true</force> <jswarn>false</jswarn> </configuration> </execution> <!-- Compress the JS files under the resources folder --> <execution> <id>compress-resources</id> <goals> <goal>compress</goal> </goals> <configuration> <excludes> <exclude>**/webscripts/**</exclude> <exclude>**/site-webscripts/**</exclude> <exclude>**/*.lib.js</exclude> <exclude>**/*.css</exclude> <exclude>**/*-min.js</exclude> <exclude>**/*-min.css</exclude> </excludes> <force>true</force> <jswarn>false</jswarn> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>3.1.1</version> <executions> <!-- Collect extensions (JARs or AMPs) declared in this module to be deployed to docker --> <execution> <id>collect-extensions</id> <phase>package</phase> <goals> <goal>copy-dependencies</goal> </goals> <configuration> <outputDirectory>${project.build.directory}/extensions</outputDirectory> <includeScope>runtime</includeScope> <!-- IMPORTANT: if using amp dependencies only, add <includeTypes>amp</includeTypes> --> </configuration> </execution> </executions> </plugin> <!-- Hot reloading with JRebel --> <plugin> <groupId>org.zeroturnaround</groupId> <artifactId>jrebel-maven-plugin</artifactId> <version>${jrebel.version}</version> <executions> <execution> <id>generate-rebel-xml</id> <phase>process-resources</phase> <goals> <goal>generate</goal> </goals> </execution> </executions> <configuration> <!-- For more information about how to configure JRebel plugin see: http://manuals.zeroturnaround.com/jrebel/standalone/maven.html#maven-rebel-xml --> <classpath> <fallback>all</fallback> <resources> <resource> <directory>${project.build.outputDirectory}</directory> <directory>${project.build.testOutputDirectory}</directory> </resource> </resources> </classpath> <!-- alwaysGenerate - default is false If 'false' - rebel.xml is generated if timestamps of pom.xml and the current rebel.xml file are not equal. If 'true' - rebel.xml will always be generated --> <alwaysGenerate>true</alwaysGenerate> </configuration> </plugin> </plugins> <resources> <!-- Filter the resource files in this project and do property substitutions --> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> </resource> </resources> <testResources> <!-- Filter the test resource files in this project and do property substitutions --> <testResource> <directory>src/test/resources</directory> <filtering>true</filtering> </testResource> </testResources> </build> <profiles> <profile> <id>java8</id> <activation> <jdk>[1.8,11.0)</jdk> </activation> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.8.0</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> </plugins> </build> </profile> <profile> <id>java11</id> <activation> <jdk>[11.0,17)</jdk> </activation> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.8.0</version> <configuration> <release>11</release> </configuration> </plugin> </plugins> </build> </profile> <profile> <id>java17</id> <activation> <jdk>[17,)</jdk> </activation> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.8.0</version> <configuration> <release>17</release> </configuration> </plugin> </plugins> </build> </profile> </profiles> <!-- Alfresco Maven Repositories --> <repositories> <repository> <id>alfresco-public</id> <url>https://artifacts.alfresco.com/nexus/content/groups/public</url> </repository> <repository> <id>alfresco-public-snapshots</id> <url>https://artifacts.alfresco.com/nexus/content/groups/public-snapshots</url> <snapshots> <enabled>true</enabled> <updatePolicy>daily</updatePolicy> </snapshots> </repository> <!-- Alfresco Enterprise Edition Artifacts, put username/pwd for server in settings.xml --> <repository> <id>alfresco-private-repository</id> <url>https://artifacts.alfresco.com/nexus/content/groups/private</url> </repository> <repository> <id>alfresco-internal</id> <url>https://artifacts.alfresco.com/nexus/content/groups/internal</url> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>alfresco-plugin-public</id> <url>https://artifacts.alfresco.com/nexus/content/groups/public</url> </pluginRepository> <pluginRepository> <id>alfresco-plugin-public-snapshots</id> <url>https://artifacts.alfresco.com/nexus/content/groups/public-snapshots</url> <snapshots> <enabled>true</enabled> <updatePolicy>daily</updatePolicy> </snapshots> </pluginRepository> </pluginRepositories> </project>
{ "content_hash": "f79f273f8008c19799b7513a8da46e7d", "timestamp": "", "source": "github", "line_count": 447, "max_line_length": 134, "avg_line_length": 47.914988814317674, "alnum_prop": 0.4737603884583061, "repo_name": "abhinavmishra14/alfresco-sdk", "id": "fd7972e0e623255c59f89faf9d254ba5f8e7fd1f", "size": "21418", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "archetypes/alfresco-share-jar-archetype/src/main/resources/archetype-resources/pom.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "7149" }, { "name": "CSS", "bytes": "364" }, { "name": "Dockerfile", "bytes": "3339" }, { "name": "FreeMarker", "bytes": "2098" }, { "name": "Groovy", "bytes": "360" }, { "name": "HTML", "bytes": "114" }, { "name": "Java", "bytes": "180669" }, { "name": "JavaScript", "bytes": "3222" }, { "name": "Shell", "bytes": "6365" } ], "symlink_target": "" }
var http = require('http'); var urls = process.argv.slice(2); var bl = require('bl'); var async = require('async'); var resp = {}; async.map(urls, function(url, cb) { http.get(url, function(res) { res.pipe(bl(function(err, data) { cb(null, data.toString()); })); }); }, function(err, mappedUrls) { mappedUrls.forEach(function(url) { console.log(url); }); });
{ "content_hash": "c46eeb0824cb801b4292ea01fcc9e15f", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 37, "avg_line_length": 17.772727272727273, "alnum_prop": 0.5959079283887468, "repo_name": "brugnara/nodeschool-results", "id": "a35309a7a893098b98075fa0c2534f10acb21042", "size": "391", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "learnyounode/09-async.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "4101" } ], "symlink_target": "" }
using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using NBitcoin; using NBitcoin.Rules; using Stratis.Bitcoin.Base; using Stratis.Bitcoin.Builder; using Stratis.Bitcoin.Builder.Feature; using Stratis.Bitcoin.Configuration.Logging; using Stratis.Bitcoin.Connection; using Stratis.Bitcoin.Consensus; using Stratis.Bitcoin.Consensus.Rules; using Stratis.Bitcoin.Features.Consensus; using Stratis.Bitcoin.Features.Consensus.CoinViews; using Stratis.Bitcoin.Features.Consensus.Rules.CommonRules; using Stratis.Bitcoin.Features.Miner; using Stratis.Bitcoin.Features.PoA.BasePoAFeatureConsensusRules; using Stratis.Bitcoin.Features.PoA.Voting; using Stratis.Bitcoin.Features.PoA.Voting.ConsensusRules; using Stratis.Bitcoin.Interfaces; using Stratis.Bitcoin.P2P.Peer; using Stratis.Bitcoin.P2P.Protocol.Behaviors; using Stratis.Bitcoin.P2P.Protocol.Payloads; namespace Stratis.Bitcoin.Features.PoA { public class PoAFeature : FullNodeFeature { /// <summary>Manager of node's network connections.</summary> private readonly IConnectionManager connectionManager; /// <summary>Thread safe chain of block headers from genesis.</summary> private readonly ConcurrentChain chain; private readonly FederationManager federationManager; /// <summary>Provider of IBD state.</summary> private readonly IInitialBlockDownloadState initialBlockDownloadState; private readonly IConsensusManager consensusManager; /// <summary>A handler that can manage the lifetime of network peers.</summary> private readonly IPeerBanning peerBanning; /// <summary>Factory for creating loggers.</summary> private readonly ILoggerFactory loggerFactory; private readonly IPoAMiner miner; private readonly VotingManager votingManager; private readonly Network network; private readonly IWhitelistedHashesRepository whitelistedHashesRepository; public PoAFeature(FederationManager federationManager, PayloadProvider payloadProvider, IConnectionManager connectionManager, ConcurrentChain chain, IInitialBlockDownloadState initialBlockDownloadState, IConsensusManager consensusManager, IPeerBanning peerBanning, ILoggerFactory loggerFactory, IPoAMiner miner, VotingManager votingManager, Network network, IWhitelistedHashesRepository whitelistedHashesRepository) { this.federationManager = federationManager; this.connectionManager = connectionManager; this.chain = chain; this.initialBlockDownloadState = initialBlockDownloadState; this.consensusManager = consensusManager; this.peerBanning = peerBanning; this.loggerFactory = loggerFactory; this.miner = miner; this.votingManager = votingManager; this.whitelistedHashesRepository = whitelistedHashesRepository; this.network = network; payloadProvider.DiscoverPayloads(this.GetType().Assembly); } /// <inheritdoc /> public override Task InitializeAsync() { NetworkPeerConnectionParameters connectionParameters = this.connectionManager.Parameters; INetworkPeerBehavior defaultConsensusManagerBehavior = connectionParameters.TemplateBehaviors.FirstOrDefault(behavior => behavior is ConsensusManagerBehavior); if (defaultConsensusManagerBehavior == null) { throw new MissingServiceException(typeof(ConsensusManagerBehavior), "Missing expected ConsensusManagerBehavior."); } // Replace default ConsensusManagerBehavior with ProvenHeadersConsensusManagerBehavior connectionParameters.TemplateBehaviors.Remove(defaultConsensusManagerBehavior); connectionParameters.TemplateBehaviors.Add(new PoAConsensusManagerBehavior(this.chain, this.initialBlockDownloadState, this.consensusManager, this.peerBanning, this.loggerFactory)); this.federationManager.Initialize(); this.whitelistedHashesRepository.Initialize(); if (((PoAConsensusOptions)this.network.Consensus.Options).VotingEnabled) { this.votingManager.Initialize(); } this.miner.InitializeMining(); return Task.CompletedTask; } /// <inheritdoc /> public override void Dispose() { this.miner.Dispose(); this.votingManager.Dispose(); } } public class PoAConsensusRulesRegistration : IRuleRegistration { public void RegisterRules(IConsensus consensus) { consensus.HeaderValidationRules = new List<IHeaderValidationConsensusRule>() { new HeaderTimeChecksPoARule(), new StratisHeaderVersionRule(), new PoAHeaderDifficultyRule(), new PoAHeaderSignatureRule() }; consensus.IntegrityValidationRules = new List<IIntegrityValidationConsensusRule>() { new BlockMerkleRootRule(), new PoAIntegritySignatureRule() }; consensus.PartialValidationRules = new List<IPartialValidationConsensusRule>() { new SetActivationDeploymentsPartialValidationRule(), // rules that are inside the method ContextualCheckBlock new TransactionLocktimeActivationRule(), // implements BIP113 new CoinbaseHeightActivationRule(), // implements BIP34 new BlockSizeRule(), // rules that are inside the method CheckBlock new EnsureCoinbaseRule(), new CheckPowTransactionRule(), new CheckSigOpsRule(), new PoAVotingCoinbaseOutputFormatRule(), }; consensus.FullValidationRules = new List<IFullValidationConsensusRule>() { new SetActivationDeploymentsFullValidationRule(), // rules that require the store to be loaded (coinview) new LoadCoinviewRule(), new TransactionDuplicationActivationRule(), // implements BIP30 new PoACoinviewRule(), new SaveCoinviewRule() }; } } /// <summary> /// A class providing extension methods for <see cref="IFullNodeBuilder"/>. /// </summary> public static class FullNodeBuilderConsensusExtension { /// <summary>This is mandatory for all PoA networks.</summary> public static IFullNodeBuilder UsePoAConsensus(this IFullNodeBuilder fullNodeBuilder) { fullNodeBuilder.ConfigureFeature(features => { features .AddFeature<PoAFeature>() .DependOn<ConsensusFeature>() .FeatureServices(services => { services.AddSingleton<FederationManager>(); services.AddSingleton<PoABlockHeaderValidator>(); services.AddSingleton<IPoAMiner, PoAMiner>(); services.AddSingleton<MinerSettings>(); services.AddSingleton<PoAMinerSettings>(); services.AddSingleton<SlotsManager>(); services.AddSingleton<BlockDefinition, PoABlockDefinition>(); }); }); LoggingConfiguration.RegisterFeatureNamespace<ConsensusFeature>("consensus"); fullNodeBuilder.ConfigureFeature(features => { features .AddFeature<ConsensusFeature>() .FeatureServices(services => { services.AddSingleton<DBreezeCoinView>(); services.AddSingleton<ICoinView, CachedCoinView>(); services.AddSingleton<ConsensusController>(); services.AddSingleton<IConsensusRuleEngine, PoAConsensusRuleEngine>(); services.AddSingleton<IChainState, ChainState>(); services.AddSingleton<ConsensusQuery>() .AddSingleton<INetworkDifficulty, ConsensusQuery>(provider => provider.GetService<ConsensusQuery>()) .AddSingleton<IGetUnspentTransaction, ConsensusQuery>(provider => provider.GetService<ConsensusQuery>()); new PoAConsensusRulesRegistration().RegisterRules(fullNodeBuilder.Network.Consensus); // Voting. services.AddSingleton<VotingManager>(); services.AddSingleton<VotingController>(); services.AddSingleton<IPollResultExecutor, PollResultExecutor>(); services.AddSingleton<IWhitelistedHashesRepository, WhitelistedHashesRepository>(); }); }); return fullNodeBuilder; } } }
{ "content_hash": "4d477e00cfcdd04e64d62326db943508", "timestamp": "", "source": "github", "line_count": 216, "max_line_length": 193, "avg_line_length": 42.736111111111114, "alnum_prop": 0.6504170729065106, "repo_name": "bokobza/StratisBitcoinFullNode", "id": "41eab994d26d2d8b662f966eafb85a19331425f5", "size": "9233", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/Stratis.Bitcoin.Features.PoA/PoAFeature.cs", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "216" }, { "name": "C#", "bytes": "11672570" }, { "name": "CSS", "bytes": "162959" }, { "name": "Dockerfile", "bytes": "1636" }, { "name": "HTML", "bytes": "44120" }, { "name": "JavaScript", "bytes": "4289" }, { "name": "PowerShell", "bytes": "8508" }, { "name": "Shell", "bytes": "3446" } ], "symlink_target": "" }
import sys import os.path import gc import maya.OpenMaya as OpenMaya import maya.OpenMayaMPx as OpenMayaMPx import maya.cmds as mc import ns.py as npy import ns.py.Errors import ns.maya.msv.MayaScene as MayaScene import ns.maya.msv.MayaAgent as MayaAgent import ns.maya.msv.MayaSkin as MayaSkin import ns.bridge.data.Scene as Scene kName = "msvSceneImport" kFileFlag = "-f" kFileFlagLong = "-file" kLoadGeometryFlag = "-lg" kLoadGeometryFlagLong = "-loadGeometry" kSkinTypeFlag = "-skt" kSkinTypeFlagLong = "-skinType" kLoadSegmentsFlag = "-ls" kLoadSegmentsFlagLong = "-loadSegments" kLoadMaterialsFlag = "-lm" kLoadMaterialsFlagLong = "-loadMaterials" kMaterialTypeFlag = "-mt" kMaterialTypeFlagLong = "-materialType" kInstanceSegmentsFlag = "-is" kInstanceSegmentsFlagLong = "-instanceSegments" class MsvSceneImportCmd( OpenMayaMPx.MPxCommand ): def __init__(self): OpenMayaMPx.MPxCommand.__init__(self) def isUndoable( self ): return False def _parseArgs( self, argData ): options = {} if argData.isFlagSet(kFileFlag): options[kFileFlag] = argData.flagArgumentString( kFileFlag, 0 ) else: raise npy.Errors.BadArgumentError( "The -file/-f flag is required." ) if argData.isFlagSet(kLoadGeometryFlag): options[kLoadGeometryFlag] = argData.flagArgumentBool(kLoadGeometryFlag, 0) else: options[kLoadGeometryFlag] = True if argData.isFlagSet( kSkinTypeFlag ): str = argData.flagArgumentString( kSkinTypeFlag, 0 ) if (str == "smooth"): options[kSkinTypeFlag] = MayaSkin.eSkinType.smooth elif (str == "duplicate"): options[kSkinTypeFlag] = MayaSkin.eSkinType.duplicate elif (str == "instance"): options[kSkinTypeFlag] = MayaSkin.eSkinType.instance else: raise ns.py.Errors.BadArgumentError( 'Please choose either "smooth", "duplicate", or "instance" as the skinType' ) else: options[kSkinTypeFlag] = MayaSkin.eSkinType.smooth if argData.isFlagSet( kLoadSegmentsFlag ): options[kLoadSegmentsFlag] = argData.flagArgumentBool( kLoadSegmentsFlag, 0 ) else: options[kLoadSegmentsFlag] = False if argData.isFlagSet( kLoadMaterialsFlag ): options[kLoadMaterialsFlag] = argData.flagArgumentBool( kLoadMaterialsFlag, 0 ) else: options[kLoadMaterialsFlag] = True if argData.isFlagSet(kMaterialTypeFlag): options[kMaterialTypeFlag] = argData.flagArgumentString(kMaterialTypeFlag, 0) else: options[kMaterialTypeFlag] = "blinn" if argData.isFlagSet( kInstanceSegmentsFlag ): options[kInstanceSegmentsFlag] = argData.flagArgumentBool( kInstanceSegmentsFlag, 0 ) else: options[kInstanceSegmentsFlag] = True return options def doIt(self,argList): argData = OpenMaya.MArgDatabase( self.syntax(), argList ) options = self._parseArgs( argData ) undoQueue = mc.undoInfo( query=True, state=True ) try: try: mc.undoInfo( state=False ) scene = Scene.Scene() file = options[kFileFlag] ext = os.path.splitext(file)[1] if ext == ".mas": scene.setMas(file) elif ext == ".cdl": scene.addCdl(file) else: raise npy.Errors.BadArgumentError( "Please provide a Massive setup (.mas) or agent (.cdl) file." ) agentOptions = MayaAgent.Options() agentOptions.loadGeometry = options[kLoadGeometryFlag] agentOptions.loadPrimitives = options[kLoadSegmentsFlag] agentOptions.loadMaterials = options[kLoadMaterialsFlag] agentOptions.skinType = options[kSkinTypeFlag] agentOptions.instancePrimitives = options[kInstanceSegmentsFlag] agentOptions.materialType = options[kMaterialTypeFlag] mayaScene = MayaScene.MayaScene() mayaScene.build(scene, agentOptions) finally: mc.undoInfo( state=undoQueue ) except npy.Errors.AbortError: self.displayError("Import cancelled by user") except: raise def creator(): return OpenMayaMPx.asMPxPtr( MsvSceneImportCmd() ) def syntaxCreator(): syntax = OpenMaya.MSyntax() syntax.addFlag( kFileFlag, kFileFlagLong, OpenMaya.MSyntax.kString ) syntax.addFlag( kLoadGeometryFlag, kLoadGeometryFlagLong, OpenMaya.MSyntax.kBoolean ) syntax.addFlag( kSkinTypeFlag, kSkinTypeFlagLong, OpenMaya.MSyntax.kString ) syntax.addFlag( kLoadSegmentsFlag, kLoadSegmentsFlagLong, OpenMaya.MSyntax.kBoolean ) syntax.addFlag( kLoadMaterialsFlag, kLoadMaterialsFlagLong, OpenMaya.MSyntax.kBoolean ) syntax.addFlag( kMaterialTypeFlag, kMaterialTypeFlagLong, OpenMaya.MSyntax.kString ) syntax.addFlag( kInstanceSegmentsFlag, kInstanceSegmentsFlagLong, OpenMaya.MSyntax.kBoolean ) return syntax
{ "content_hash": "1aefefe95668076b12836e804b11aac7", "timestamp": "", "source": "github", "line_count": 147, "max_line_length": 118, "avg_line_length": 31.06122448979592, "alnum_prop": 0.7477003942181341, "repo_name": "redpawfx/massiveImporter", "id": "b5c0cff2b9f7755856fe71287fceb2f8b5ef48af", "size": "5682", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "python/ns/maya/msv/MsvSceneImportCmd.py", "mode": "33188", "license": "mit", "language": [ { "name": "Python", "bytes": "324293" } ], "symlink_target": "" }
<?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/item_node_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <TextView android:id="@+id/node_name" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="8dp" android:layout_weight="1" android:gravity="center_vertical" android:text="TextView" android:textSize="18sp" /> </android.support.v7.widget.CardView>
{ "content_hash": "1a55be4a1f6fd1a3ec7a7ac0260a9716", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 94, "avg_line_length": 36, "alnum_prop": 0.6697530864197531, "repo_name": "LittleInferno/flowchart", "id": "e5a33a327cf9adaafb824c740d461f844ea43e37", "size": "648", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "android/src/main/res/layout/item_node_layout.xml", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "185629" }, { "name": "JavaScript", "bytes": "21432" } ], "symlink_target": "" }
layout: article title: "Winter cap in the street" excerpt: "PaperFaces portrait of @TheMarcStone drawn with Paper by 53 on an iPad." image: feature: paperfaces-themarcstone-twitter-lg.jpg thumb: paperfaces-themarcstone-twitter-150.jpg category: paperfaces tags: [portrait, illustration, paper by 53, blend, beard] --- PaperFaces portrait commission for [@TheMarcStone](http://twitter.com/TheMarcStone). {% include paperfaces-boilerplate-4.html %} <figure> <a href="{{ site.url }}/images/paperfaces-themarcstone-process-1-lg.jpg"><img src="{{ site.url }}/images/paperfaces-themarcstone-process-1-750.jpg" alt="Work in process screenshot"></a> <figcaption>Pencil sketch to rough out the composition.</figcaption> </figure> <figure class="half"> <a href="{{ site.url }}/images/paperfaces-themarcstone-process-2-lg.jpg"><img src="{{ site.url }}/images/paperfaces-themarcstone-process-2-600.jpg" alt="Work in process screenshot"></a> <a href="{{ site.url }}/images/paperfaces-themarcstone-process-3-lg.jpg"><img src="{{ site.url }}/images/paperfaces-themarcstone-process-3-600.jpg" alt="Work in process screenshot"></a> <a href="{{ site.url }}/images/paperfaces-themarcstone-process-4-lg.jpg"><img src="{{ site.url }}/images/paperfaces-themarcstone-process-4-600.jpg" alt="Work in process screenshot"></a> <a href="{{ site.url }}/images/paperfaces-themarcstone-process-5-lg.jpg"><img src="{{ site.url }}/images/paperfaces-themarcstone-process-5-600.jpg" alt="Work in process screenshot"></a> <figcaption>Work in progress screenshots (Paper by 53).</figcaption> </figure>
{ "content_hash": "d36ebc53713a24f99d6e941726217d34", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 186, "avg_line_length": 60.80769230769231, "alnum_prop": 0.7400379506641366, "repo_name": "zhelezko/made-mistakes-jekyll", "id": "58304469d887ccca71960652406ecd6b5596ea42", "size": "1585", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "_posts/paperfaces/2013-12-23-themarcstone-portrait.md", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "23535" }, { "name": "CSS", "bytes": "73071" }, { "name": "HTML", "bytes": "47315" }, { "name": "JavaScript", "bytes": "76136" }, { "name": "Ruby", "bytes": "7273" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"><meta charset="utf-8" /> <title>Posts - Reflections</title> <meta name="description" content="Default Page Description" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <link rel="stylesheet" href="http://blog.shiv.me/css/latex.css" /> <link rel="stylesheet" href="http://blog.shiv.me/css/main.css" /> <script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script> <meta name="generator" content="Hugo 0.75.1" /><body> <header> <nav class="navbar"> <div class="nav"> <ul class="nav-links"> </ul> </div> </nav> <div class="intro-header"> <div class="container"> <div class="post-heading"> <h1>Posts</h1> </div> </div> </div> </header> <div id="content"> <div class="container" role="main"> <div class="posts-list"> <article class="post-preview"> <a href="http://blog.shiv.me/2005/04/19/adobe-and-macromedia-to-merge/"> <h2 class="post-title">Adobe and Macromedia to merge</h2> </a> <div class="postmeta"> <span class="meta-post"> <i class="fa fa-calendar-alt"></i>Apr 19, 2005 </span> </div> <div class="post-entry"> <p>Yup, been a very long time since I blogged!! but I am back again! **Thanks to my fellow util-seeker Sudhin for this bit of news ** Adobe Systems Incorporated (Nasdaq: ADBE) has announced a definitive agreement to acquire Macromedia (Nasdaq: MACR) in an all-stock transaction valued at approximately $3.4 billion. Under the terms of the agreement, which has been approved by both boards of directors, Macromedia stockholders will receive, at a fixed exchange ratio, 0.</p> <a href="http://blog.shiv.me/2005/04/19/adobe-and-macromedia-to-merge/" class="post-read-more">Read More</a> </div> </article> <article class="post-preview"> <a href="http://blog.shiv.me/2005/03/09/free-e-books-from-apache/"> <h2 class="post-title">Free e-books from Apache!</h2> </a> <div class="postmeta"> <span class="meta-post"> <i class="fa fa-calendar-alt"></i>Mar 9, 2005 </span> </div> <div class="post-entry"> </div> </article> <article class="post-preview"> <a href="http://blog.shiv.me/2005/03/07/journey-with-a-book/"> <h2 class="post-title">Journey with a book</h2> </a> <div class="postmeta"> <span class="meta-post"> <i class="fa fa-calendar-alt"></i>Mar 7, 2005 </span> </div> <div class="post-entry"> <p>Started reading &ldquo;Illusions&rdquo; by Richard Bach. Often, I feel, that a book comes in your life, when you are ready for it. It presents itself, in ways you never would have imagined. I have heard of this book for the last 10 years. There has been a sopy at my parent&rsquo;s place (where I stayed for the better part of the last 10 years) and it never occured to me, to pick that small book (of about 200 odd pages) and give it a read.</p> <a href="http://blog.shiv.me/2005/03/07/journey-with-a-book/" class="post-read-more">Read More</a> </div> </article> <article class="post-preview"> <a href="http://blog.shiv.me/2005/02/22/your-phone-might-catch-a-cold/"> <h2 class="post-title">Your phone might catch a cold</h2> </a> <div class="postmeta"> <span class="meta-post"> <i class="fa fa-calendar-alt"></i>Feb 22, 2005 </span> </div> <div class="post-entry"> <p>FIR of a virus on a phone! A very warm welcome to the world of computing! Soon we will need antiviral software running on our phones all the time and that would mean that your phones will get more processing power. If phones take the way PCs have, the day when we will have a phone with a huge Pentium or whatever processor and tons of RAM won&rsquo;t be too far away.</p> <a href="http://blog.shiv.me/2005/02/22/your-phone-might-catch-a-cold/" class="post-read-more">Read More</a> </div> </article> <article class="post-preview"> <a href="http://blog.shiv.me/2005/02/17/woes-with-airtel-services/"> <h2 class="post-title">Woes with airtel services</h2> </a> <div class="postmeta"> <span class="meta-post"> <i class="fa fa-calendar-alt"></i>Feb 17, 2005 </span> </div> <div class="post-entry"> <p>What a lousy feeling it is, when you hold shares of a company, whose customer you have been for more than 2 years and have paid everyone of the bills in time, and when you have an issue, you are brushed under the carpet!That&rsquo;s what happened to me today. I have been with Airtel (cell phone service provider in Chennai, India - for the uninitiated ;)) for the last two years.</p> <a href="http://blog.shiv.me/2005/02/17/woes-with-airtel-services/" class="post-read-more">Read More</a> </div> </article> </div> <ul class="pager"> <li class="previous"> <a href="http://blog.shiv.me/post/55/">&larr; Newer</a> </li> <li class="next"> <a href="http://blog.shiv.me/post/57/">Older &rarr;</a> </li> </ul> </div> </div><footer> <div class="container"> <p class="credits copyright"> <p class="credits theme-by"> Powered By <a href="https://gohugo.io">Hugo</a>&nbsp;/&nbsp;Theme&nbsp;<a href="https://github.com/7ma7X/HugoTeX">HugoTeX</a> <br> <a href="http://blog.shiv.me/about">Shiva Velmurugan</a> &copy; 2016 </p> </div> </footer></body> </html>
{ "content_hash": "3d4450d36a2154fc0d68dd5ed2e7f171", "timestamp": "", "source": "github", "line_count": 170, "max_line_length": 455, "avg_line_length": 33.57058823529412, "alnum_prop": 0.6285263711231821, "repo_name": "shiva/shiva.github.io", "id": "b8a7b10033cdfc2d1856b44113cedf1662cc797a", "size": "5707", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "post/page/56/index.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "24620" }, { "name": "HTML", "bytes": "1863844" }, { "name": "Shell", "bytes": "2974" } ], "symlink_target": "" }
.. _attributes: Attributes ========== | Attributes format follows the guidelines of old Chef 11.x based OpsWorks stack. | So all of them, need to be placed under ``node['deploy'][<application_shortname>]``. | Attributes (and whole logic of this cookbook) are divided to six sections. | Following convention is used: ``app == node['deploy'][<application_shortname>]`` | so for example ``app['framework']['adapter']`` actually means | ``node['deploy'][<application_shortname>]['framework']['adapter']``. Stack attributes ---------------- These attributes are used on Stack/Layer level globally to configure the opsworks_ruby cookbook itself. They should'nt be used under ``node['deploy'][<application_shortname>]`` (notice lack of the ``app[]`` convention). - ``node['applications']`` - An array of application shortnames which should be deployed to given layer. If set, only applications witch ``deploy`` flag set (on OpsWorks side) included in this list will be deployed. If not set, all ``deploy`` application will be supported. This parameter mostly matters during the setup phase, since all application in given stack are deployed to the given layer. Using this paramter you can narrow the list to application which you actually intend to use. **Important** thing is, that when you try to do a manual deploy from OpsWorks of an application, not included in this list - it will be skipped, as this list takes precedence over anything else. - ``node['ruby-ng']['ruby_version']`` - **Type:** string - **Default:** ``2.4`` - Sets the Ruby version used through the system. See `ruby-ng cookbook documentation`_ for more details Application attributes ---------------------- global ~~~~~~ Global parameters apply to the whole application, and can be used by any section (framework, appserver etc.). - ``app['global']['environment']`` - **Type:** string - **Default:** ``production`` - Sets the “deploy environment” for all the app-related (for example ``RAILS_ENV`` in Rails) actions in the project (server, worker, etc.) - ``app['global']['symlinks']`` - **Type:** key-value - **Default:** ``{ "system": "public/system", "assets": "public/assets", "cache": "tmp/cache", "pids": "tmp/pids", "log": "log" }`` - **Important Notice:** Any values for this parameter will be *merged* to the defaults - List of symlinks created to the ``shared`` directory. The format is ``{"shared_path": "release_path"}``. For example ``{"system", "public/system"}`` means: Link ``/src/www/app_name/current/public/system`` to ``/src/www/app_name/shared/system``. - ``app['global']['create_dirs_before_symlink']`` - **Type:** array - **Default:** ``["tmp", "public", "config", "../../shared/cache", "../../shared/assets"]`` - **Important Notice:** Any values for this parameter will be *appended* to the defaults - List of directories to be created before symlinking. Paths are relative to ``release_path``. For example ``tmp`` becomes ``/srv/www/app_name/current/tmp``. - ``app['global']['purge_before_symlink']`` - **Type:** array - **Default:** ``["log", "tmp/cache", "tmp/pids", "public/system", "public/assets"]`` - **Important Notice:** Any values for this parameter will be *appended* to the defaults - List of directories to be wiped out before symlinking. Paths are relative to ``release_path``. For example ``tmp`` becomes ``/srv/www/app_name/current/tmp``. - ``app['global']['rollback_on_error']`` - **Type:** boolean - **Default:** ``true`` - When set to true, any failed deploy will be removed from ``releases`` directory. - ``app['global']['logrotate_rotate']`` - **Type:** integer - **Default:** ``30`` - **Important Notice:** The parameter is in days database ~~~~~~~~ | Those parameters will be passed without any alteration to the ``database.yml`` | file. Keep in mind, that if you have RDS connected to your OpsWorks application, | you don’t need to use them. The chef will do all the job, and determine them | for you. - ``app['database']['adapter']`` - **Supported values:** ``mariadb``, ``mysql``, ``postgresql``, ``sqlite3`` - **Default:** ``sqlite3`` - ActiveRecord adapter which will be used for database connection. - ``app['database']['username']`` - Username used to authenticate to the DB - ``app['database']['password']`` - Password used to authenticate to the DB - ``app['database']['host']`` - Database host - ``app['database']['database']`` - Database name - ``app['database'][<any other>]`` - Any other key-value pair provided here, will be passed directly to the ``database.yml`` scm ~~~ | Those parameters can also be determined from OpsWorks application, and usually | you don’t need to provide them here. Currently only ``git`` is supported. - ``app['scm']['scm_provider']`` - **Supported values:** ``git`` - **Default:** ``git`` - SCM used by the cookbook to clone the repo. - ``app['scm']['remove_scm_files']`` - **Supported values:** ``true``, ``false`` - **Default:** ``true`` - If set to true, all SCM leftovers (like ``.git``) will be removed. - ``app['scm']['repository']`` - Repository URL - ``app['scm']['revision']`` - Branch name/SHA1 of commit which should be use as a base of the deployment. - ``app['scm']['ssh_key']`` - A private SSH deploy key (the key itself, not the file name), used when fetching repositories via SSH. - ``app['scm']['ssh_wrapper']`` - A wrapper script, which will be used by git when fetching repository via SSH. Essentially, a value of ``GIT_SSH`` environment variable. This cookbook provides one of those scripts for you, so you shouldn’t alter this variable unless you know what you’re doing. - ``app['scm']['enabled_submodules']`` - If set to ``true``, any submodules included in the repository, will also be fetched. framework ~~~~~~~~~ | Pre-optimalization for specific frameworks (like migrations, cache etc.). | Currently ``hanami.rb`` and ``Rails`` are supported. - ``app['framework']['adapter']`` - **Supported values:** ``null``, ``hanami``, ``padrino``, ``rails`` - **Default:** ``rails`` - Ruby framework used in project. - ``app['framework']['migrate']`` - **Supported values:** ``true``, ``false`` - **Default:** ``true`` - If set to ``true``, migrations will be launch during deployment. - ``app['framework']['migration_command']`` - A command which will be invoked to perform migration. This cookbook comes with predefined migration commands, well suited for the task, and usually you don’t have to change this parameter. - ``app['framework']['assets_precompile']`` - **Supported values:** ``true``, ``false`` - **Default:** ``true`` - ``app['framework']['assets_precompilation_command']`` - A command which will be invoked to precompile assets. padrino ^^^^^^^ | For Padrino, slight adjustments needs to be made. Since there are many database | adapters supported, instead of creating configuration for each one, the | ``DATABASE_URL`` environmental variable is provided. You need to parse it in your | ``config/database.rb`` file and properly pass to the configuration options. | For example, for ActiveRecord: .. code:: ruby database_url = ENV['DATABASE_URL'] && ActiveRecord::ConnectionAdapters::ConnectionSpecification::ConnectionUrlResolver.new(ENV['DATABASE_URL']).to_hash ActiveRecord::Base.configurations[:production] = database_url || { :adapter => 'sqlite3', :database => Padrino.root('db', 'dummy_app_production.db') } rails ^^^^^ - ``app['framework']['envs_in_console']`` - **Supported values:** ``true``, ``false`` - **Default:** ``false`` - If set to true, ``rails console`` will be invoked with all application-level environment variables set. - **WARNING!** This is highly unstable feature. If you experience any troubles with deployments, and have this feature enabled, consider disabling it as a first step in your debugging process. appserver ~~~~~~~~~ | Configuration parameters for the ruby application server. Currently ``Puma``, | ``Thin`` and ``Unicorn`` are supported. - ``app['appserver']['adapter']`` - **Default:** ``puma`` - **Supported values:** ``puma``, ``thin``, ``unicorn``, ``null`` - Server on the application side, which will receive requests from webserver in front. ``null`` means no appserver enabled. - ``app['appserver']['application_yml']`` - **Supported values:** ``true``, ``false`` - **Default:** ``false`` - Creates a ``config/application.yml`` file with all pre-configured environment variables. Useful for gems like `figaro`_ - ``app['appserver']['dot_env']`` - **Supported values:** ``true``, ``false`` - **Default:** ``false`` - Creates a ``.env`` file with all pre-configured environment variables. Useful for gems like `dotenv`_ - ``app['appserver']['preload_app']`` - **Supported values:** ``true``, ``false`` - **Default:** ``true`` - Enabling this preloads an application before forking worker processes. - ``app['appserver']['timeout']`` - **Default:** ``50`` - Sets the timeout of worker processes to seconds. - ``app['appserver']['worker_processes']|`` - **Default:** ``4`` - Sets the current number of worker processes. Each worker process will serve exactly one client at a time. unicorn ^^^^^^^ - |app['appserver']['backlog']|_ - **Default:** ``1024`` - |app['appserver']['delay']|_ - **Default:** ``0.5`` - |app['appserver']['tcp_nodelay']|_ - **Supported values:** ``true``, ``false`` - **Default:** ``true`` - |app['appserver']['tcp_nopush']|_ - **Supported values:** ``true``, ``false`` - **Default:** ``false`` - |app['appserver']['tries']|_ - **Default:** ``5`` puma ^^^^ - |app['appserver']['log_requests']|_ - **Supported values:** ``true``, ``false`` - **Default:** ``false`` - |app['appserver']['thread_max']|_ - **Default:** ``16`` - |app['appserver']['thread_min']|_ - **Default:** ``0`` thin ^^^^ - ``app['appserver']['max_connections']`` - **Default:** ``1024`` - ``app['appserver']['max_persistent_connections']`` - **Default:** ``512`` - ``app['appserver']['timeout']`` - **Default:** ``60`` - ``app['appserver']['worker_processes']`` - **Default:** ``4`` webserver ~~~~~~~~~ | Webserver configuration. Proxy passing to application is handled out-of-the-box. | Currently Apache2 and nginx is supported. - ``app['webserver']['adapter']`` - **Default:** ``nginx`` - **Supported values:** ``apache2``, ``nginx``, ``null`` - Webserver in front of the instance. It runs on port 80, and receives all requests from Load Balancer/Internet. ``null`` means no webserver enabled. - ``app['webserver']['dhparams']`` - If you wish to use custom generated DH primes, instead of common ones (which is a very good practice), put the contents (not file name) of the ``dhparams.pem`` file into this attribute. `Read more here.`_ - ``app['webserver']['keepalive_timeout']`` - **Default**: ``15`` - The number of seconds webserver will wait for a subsequent request before closing the connection. - ``app['webserver']['ssl_for_legacy_browsers']`` - **Supported values:** ``true``, ``false`` - **Default:** ``false`` - By default webserver is configured to follow strict SSL security standards, `covered in this article`_. However, old browsers (like IE < 9 or Android < 2.2) wouldn’t work with this configuration very well. If your application needs a support for those browsers, set this parameter to ``true``. apache ^^^^^^ - ``app['webserver']['extra_config']`` - Raw Apache2 configuration, which will be inserted into ``<Virtualhost *:80>`` section of the application. - ``app['webserver']['extra_config_ssl']`` - Raw Apache2 configuration, which will be inserted into ``<Virtualhost *:443>`` section of the application. If set to ``true``, the ``extra_config`` will be copied. - |app['webserver']['limit_request_body']|_ - **Default**: ``1048576`` - |app['webserver']['log_level']|_ - **Default**: ``info`` - ``app['webserver']['log_dir']`` - **Default**: ``/var/log/apache2`` (debian) or ``/var/log/httpd`` (rhel) - A place to store application-related Apache2 logs. - |app['webserver']['proxy_timeout']|_ - **Default**: ``60`` nginx ^^^^^ - ``app['webserver']['build_type']`` - **Supported values:** ``default`` or ``source`` - **Default:** ``default`` - The way the `chef_nginx`_ cookbook handles ``nginx`` installation. Check out `the corresponding docs`_ for more details. Never use ``node['nginx']['install_method']``, as it will be always overwritten by this attribute. - |app['webserver']['client_body_timeout']|_ - **Default:** ``12`` - |app['webserver']['client_header_timeout']|_ - **Default:** ``12`` - |app['webserver']['client_max_body_size']|_ - **Default:** ``10m`` - ``app['webserver']['extra_config']`` - Raw nginx configuration, which will be inserted into ``server`` section of the application for HTTP port. - ``app['webserver']['extra_config_ssl']`` - Raw nginx configuration, which will be inserted into ``server`` section of the application for HTTPS port. If set to ``true``, the ``extra_config`` will be copied. - ``app['webserver']['log_dir']`` - **Default**: ``/var/log/nginx`` - A place to store application-related nginx logs. - |app['webserver']['proxy_read_timeout']|_ - **Default**: ``60`` - |app['webserver']['proxy_send_timeout']|_ - **Default**: ``60`` - |app['webserver']['send_timeout']|_ - **Default**: ``10`` | Since this driver is basically a wrapper for `chef_nginx cookbook`_, | you can also configure `node['nginx'] attributes`_ | as well (notice that ``node['deploy'][<application_shortname>]`` logic | doesn't apply here.) worker ~~~~~~ sidekiq ^^^^^^^ - ``app['worker']['config']`` - Configuration parameters which will be directly passed to the worker. For example, for ``sidekiq`` they will be serialized to `sidekiq.yml config file`_. delayed\_job ^^^^^^^^^^^^ - ``app['worker']['queues']`` - Array of queues which should be processed by delayed\_job resque ^^^^^^ - ``app['worker']['workers']`` - **Default:** ``2`` - Number of resque workers - ``app['worker']['queues']`` - **Default:** ``*`` - Array of queues which should be processed by resque .. _ruby-ng cookbook documentation: https://supermarket.chef.io/cookbooks/ruby-ng .. _figaro: https://github.com/laserlemon/figaro .. _dotenv: https://github.com/bkeepers/dotenv .. |app['appserver']['backlog']| replace:: ``app['appserver']['backlog']`` .. _app['appserver']['backlog']: https://unicorn.bogomips.org/Unicorn/Configurator.html#method-i-listen .. |app['appserver']['delay']| replace:: ``app['appserver']['delay']`` .. _app['appserver']['delay']: https://unicorn.bogomips.org/Unicorn/Configurator.html#method-i-listen .. |app['appserver']['tcp_nodelay']| replace:: ``app['appserver']['tcp_nodelay']`` .. _app['appserver']['tcp_nodelay']: https://unicorn.bogomips.org/Unicorn/Configurator.html#method-i-listen .. |app['appserver']['tcp_nopush']| replace:: ``app['appserver']['tcp_nopush']`` .. _app['appserver']['tcp_nopush']: https://unicorn.bogomips.org/Unicorn/Configurator.html#method-i-listen .. |app['appserver']['tries']| replace:: ``app['appserver']['tries']`` .. _app['appserver']['tries']: https://unicorn.bogomips.org/Unicorn/Configurator.html#method-i-listen .. |app['appserver']['log_requests']| replace:: ``app['appserver']['log_requests']`` .. _app['appserver']['log_requests']: https://github.com/puma/puma/blob/c169853ff233dd3b5c4e8ed17e84e1a6d8cb565c/examples/config.rb#L56 .. |app['appserver']['thread_max']| replace:: ``app['appserver']['thread_max']`` .. _app['appserver']['thread_max']: https://github.com/puma/puma/blob/c169853ff233dd3b5c4e8ed17e84e1a6d8cb565c/examples/config.rb#L62 .. |app['appserver']['thread_min']| replace:: ``app['appserver']['thread_min']`` .. _app['appserver']['thread_min']: https://github.com/puma/puma/blob/c169853ff233dd3b5c4e8ed17e84e1a6d8cb565c/examples/config.rb#L62 .. _Read more here.: https://weakdh.org/sysadmin.html .. _covered in this article: https://cipherli.st/ .. |app['webserver']['limit_request_body']| replace:: ``app['webserver']['limit_request_body']`` .. _app['webserver']['limit_request_body']: https://httpd.apache.org/docs/2.4/mod/core.html#limitrequestbody .. |app['webserver']['log_level']| replace:: ``app['webserver']['log_level']`` .. _app['webserver']['log_level']: https://httpd.apache.org/docs/2.4/mod/core.html#loglevel .. |app['webserver']['proxy_timeout']| replace:: ``app['webserver']['proxy_timeout']`` .. _app['webserver']['proxy_timeout']: https://httpd.apache.org/docs/current/mod/mod_proxy.html#proxytimeout .. _chef_nginx: https://supermarket.chef.io/cookbooks/chef_nginx .. _the corresponding docs: https://github.com/miketheman/nginx/tree/2.7.x#recipes .. |app['webserver']['client_body_timeout']| replace:: ``app['webserver']['client_body_timeout']`` .. _app['webserver']['client_body_timeout']: http://nginx.org/en/docs/http/ngx_http_core_module.html#client_body_timeout .. |app['webserver']['client_header_timeout']| replace:: ``app['webserver']['client_header_timeout']`` .. _app['webserver']['client_header_timeout']: http://nginx.org/en/docs/http/ngx_http_core_module.html#client_header_timeout .. |app['webserver']['client_max_body_size']| replace:: ``app['webserver']['client_max_body_size']`` .. _app['webserver']['client_max_body_size']: http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size .. |app['webserver']['proxy_read_timeout']| replace:: ``app['webserver']['proxy_read_timeout']`` .. _app['webserver']['proxy_read_timeout']: http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_read_timeout .. |app['webserver']['proxy_send_timeout']| replace:: ``app['webserver']['proxy_send_timeout']`` .. _app['webserver']['proxy_send_timeout']: http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_send_timeout .. |app['webserver']['send_timeout']| replace:: ``app['webserver']['send_timeout']`` .. _app['webserver']['send_timeout']: http://nginx.org/en/docs/http/ngx_http_core_module.html#send_timeout .. _chef_nginx cookbook: https://github.com/chef-cookbooks/chef_nginx .. |node['nginx'] attributes| replace:: ``node['nginx']`` attributes .. _node['nginx'] attributes: https://github.com/miketheman/nginx/tree/2.7.x#attributes .. |sidekiq.yml config file| replace:: ``sidekiq.yml`` config file .. _sidekiq.yml config file: https://github.com/mperham/sidekiq/wiki/Advanced-Options#the-sidekiq-configuration-file
{ "content_hash": "56c481ee0427a7dd96dd59ebd1ec52e9", "timestamp": "", "source": "github", "line_count": 550, "max_line_length": 155, "avg_line_length": 34.53272727272727, "alnum_prop": 0.648449428736903, "repo_name": "inket/opsworks_ruby", "id": "d13644afc19a650fd5f5b53b07241c7f035d27a4", "size": "19009", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "docs/source/attributes.rst", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "22578" }, { "name": "Ruby", "bytes": "213041" }, { "name": "Shell", "bytes": "195" } ], "symlink_target": "" }
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Class: Cursor</title> <meta property="og:title" content="MongoDB Driver API for Node.js"/> <meta property="og:type" content="website"/> <meta property="og:image" content=""/> <meta property="og:url" content=""/> <script src="scripts/prettify/prettify.js"></script> <script src="scripts/prettify/lang-css.js"></script> <script src="scripts/jquery.min.js"></script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/bootstrap.min.css"> <link type="text/css" rel="stylesheet" href="styles/jaguar.css"> <script> var config = {"monospaceLinks":true,"cleverLinks":true,"default":{"outputSourceFiles":true},"applicationName":"Node.js MongoDB Driver API","googleAnalytics":"UA-7301842-14","openGraph":{"title":"MongoDB Driver API for Node.js","type":"website","image":"","site_name":"","url":""},"meta":{"title":"","description":"","keyword":""},"linenums":true}; </script> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', UA-7301842-14, 'auto'); ga('send', 'pageview'); </script> </head> <body> <div id="wrap" class="clearfix" style="width:100%;"> <table style="height:100%;width:100%"> <tr> <td valign='top' width="1px"> <div class="navigation"> <h3 class="applicationName"><a href="index.html">Node.js MongoDB Driver API</a></h3> <div class="search"> <input id="search" type="text" class="form-control input-sm" placeholder="Search Documentations"> </div> <ul class="list"> <li class="item" data-name="Admin"> <span class="title"> <a href="Admin.html">Admin</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> <span class="subtitle">Typedefs</span> <li data-name="Admin~resultCallback"><a href="Admin.html#~resultCallback">resultCallback</a></li> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="Admin#addUser"><a href="Admin.html#addUser">addUser</a></li> <li data-name="Admin#buildInfo"><a href="Admin.html#buildInfo">buildInfo</a></li> <li data-name="Admin#command"><a href="Admin.html#command">command</a></li> <li data-name="Admin#listDatabases"><a href="Admin.html#listDatabases">listDatabases</a></li> <li data-name="Admin#ping"><a href="Admin.html#ping">ping</a></li> <li data-name="Admin#removeUser"><a href="Admin.html#removeUser">removeUser</a></li> <li data-name="Admin#replSetGetStatus"><a href="Admin.html#replSetGetStatus">replSetGetStatus</a></li> <li data-name="Admin#serverInfo"><a href="Admin.html#serverInfo">serverInfo</a></li> <li data-name="Admin#serverStatus"><a href="Admin.html#serverStatus">serverStatus</a></li> <li data-name="Admin#validateCollection"><a href="Admin.html#validateCollection">validateCollection</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="AggregationCursor"> <span class="title"> <a href="AggregationCursor.html">AggregationCursor</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> <span class="subtitle">Typedefs</span> <li data-name="AggregationCursor~endCallback"><a href="AggregationCursor.html#~endCallback">endCallback</a></li> <li data-name="AggregationCursor~iteratorCallback"><a href="AggregationCursor.html#~iteratorCallback">iteratorCallback</a></li> <li data-name="AggregationCursor~resultCallback"><a href="AggregationCursor.html#~resultCallback">resultCallback</a></li> <li data-name="AggregationCursor~toArrayResultCallback"><a href="AggregationCursor.html#~toArrayResultCallback">toArrayResultCallback</a></li> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="AggregationCursor#batchSize"><a href="AggregationCursor.html#batchSize">batchSize</a></li> <li data-name="AggregationCursor#clone"><a href="AggregationCursor.html#clone">clone</a></li> <li data-name="AggregationCursor#close"><a href="AggregationCursor.html#close">close</a></li> <li data-name="AggregationCursor#each"><a href="AggregationCursor.html#each">each</a></li> <li data-name="AggregationCursor#explain"><a href="AggregationCursor.html#explain">explain</a></li> <li data-name="AggregationCursor#forEach"><a href="AggregationCursor.html#forEach">forEach</a></li> <li data-name="AggregationCursor#geoNear"><a href="AggregationCursor.html#geoNear">geoNear</a></li> <li data-name="AggregationCursor#group"><a href="AggregationCursor.html#group">group</a></li> <li data-name="AggregationCursor#hasNext"><a href="AggregationCursor.html#hasNext">hasNext</a></li> <li data-name="AggregationCursor#isClosed"><a href="AggregationCursor.html#isClosed">isClosed</a></li> <li data-name="AggregationCursor#limit"><a href="AggregationCursor.html#limit">limit</a></li> <li data-name="AggregationCursor#lookup"><a href="AggregationCursor.html#lookup">lookup</a></li> <li data-name="AggregationCursor#match"><a href="AggregationCursor.html#match">match</a></li> <li data-name="AggregationCursor#maxTimeMS"><a href="AggregationCursor.html#maxTimeMS">maxTimeMS</a></li> <li data-name="AggregationCursor#next"><a href="AggregationCursor.html#next">next</a></li> <li data-name="AggregationCursor#out"><a href="AggregationCursor.html#out">out</a></li> <li data-name="AggregationCursor#pause"><a href="AggregationCursor.html#pause">pause</a></li> <li data-name="AggregationCursor#pipe"><a href="AggregationCursor.html#pipe">pipe</a></li> <li data-name="AggregationCursor#project"><a href="AggregationCursor.html#project">project</a></li> <li data-name="AggregationCursor#read"><a href="AggregationCursor.html#read">read</a></li> <li data-name="AggregationCursor#redact"><a href="AggregationCursor.html#redact">redact</a></li> <li data-name="AggregationCursor#resume"><a href="AggregationCursor.html#resume">resume</a></li> <li data-name="AggregationCursor#rewind"><a href="AggregationCursor.html#rewind">rewind</a></li> <li data-name="AggregationCursor#setEncoding"><a href="AggregationCursor.html#setEncoding">setEncoding</a></li> <li data-name="AggregationCursor#skip"><a href="AggregationCursor.html#skip">skip</a></li> <li data-name="AggregationCursor#sort"><a href="AggregationCursor.html#sort">sort</a></li> <li data-name="AggregationCursor#toArray"><a href="AggregationCursor.html#toArray">toArray</a></li> <li data-name="AggregationCursor#unpipe"><a href="AggregationCursor.html#unpipe">unpipe</a></li> <li data-name="AggregationCursor#unshift"><a href="AggregationCursor.html#unshift">unshift</a></li> <li data-name="AggregationCursor#unwind"><a href="AggregationCursor.html#unwind">unwind</a></li> <li data-name="AggregationCursor#wrap"><a href="AggregationCursor.html#wrap">wrap</a></li> </ul> <ul class="events itemMembers"> <span class="subtitle">Events</span> <li data-name="AggregationCursor#event:close"><a href="AggregationCursor.html#event:close">close</a></li> <li data-name="AggregationCursor#event:data"><a href="AggregationCursor.html#event:data">data</a></li> <li data-name="AggregationCursor#event:end"><a href="AggregationCursor.html#event:end">end</a></li> <li data-name="AggregationCursor#event:readable"><a href="AggregationCursor.html#event:readable">readable</a></li> </ul> </li> <li class="item" data-name="AutoEncrypter"> <span class="title"> <a href="AutoEncrypter.html">AutoEncrypter</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="AutoEncrypter~logLevel"><a href="AutoEncrypter.html#~logLevel">logLevel</a></li> </ul> <ul class="typedefs itemMembers"> <span class="subtitle">Typedefs</span> <li data-name="AutoEncrypter~AutoEncryptionExtraOptions"><a href="AutoEncrypter.html#~AutoEncryptionExtraOptions">AutoEncryptionExtraOptions</a></li> <li data-name="AutoEncrypter~AutoEncryptionOptions"><a href="AutoEncrypter.html#~AutoEncryptionOptions">AutoEncryptionOptions</a></li> <li data-name="AutoEncrypter~logger"><a href="AutoEncrypter.html#~logger">logger</a></li> </ul> <ul class="methods itemMembers"> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="Binary"> <span class="title"> <a href="Binary.html">Binary</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="Binary.SUBTYPE_BYTE_ARRAY"><a href="Binary.html#.SUBTYPE_BYTE_ARRAY">SUBTYPE_BYTE_ARRAY</a></li> <li data-name="Binary.SUBTYPE_DEFAULT"><a href="Binary.html#.SUBTYPE_DEFAULT">SUBTYPE_DEFAULT</a></li> <li data-name="Binary.SUBTYPE_FUNCTION"><a href="Binary.html#.SUBTYPE_FUNCTION">SUBTYPE_FUNCTION</a></li> <li data-name="Binary.SUBTYPE_MD5"><a href="Binary.html#.SUBTYPE_MD5">SUBTYPE_MD5</a></li> <li data-name="Binary.SUBTYPE_USER_DEFINED"><a href="Binary.html#.SUBTYPE_USER_DEFINED">SUBTYPE_USER_DEFINED</a></li> <li data-name="Binary.SUBTYPE_UUID"><a href="Binary.html#.SUBTYPE_UUID">SUBTYPE_UUID</a></li> <li data-name="Binary.SUBTYPE_UUID_OLD"><a href="Binary.html#.SUBTYPE_UUID_OLD">SUBTYPE_UUID_OLD</a></li> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="Binary#length"><a href="Binary.html#length">length</a></li> <li data-name="Binary#put"><a href="Binary.html#put">put</a></li> <li data-name="Binary#read"><a href="Binary.html#read">read</a></li> <li data-name="Binary#value"><a href="Binary.html#value">value</a></li> <li data-name="Binary#write"><a href="Binary.html#write">write</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="BSONRegExp"> <span class="title"> <a href="BSONRegExp.html">BSONRegExp</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="BulkOperationBase"> <span class="title"> <a href="BulkOperationBase.html">BulkOperationBase</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> <span class="subtitle">Typedefs</span> <li data-name="BulkOperationBase~resultCallback"><a href="BulkOperationBase.html#~resultCallback">resultCallback</a></li> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="BulkOperationBase#execute"><a href="BulkOperationBase.html#execute">execute</a></li> <li data-name="BulkOperationBase#find"><a href="BulkOperationBase.html#find">find</a></li> <li data-name="BulkOperationBase#insert"><a href="BulkOperationBase.html#insert">insert</a></li> <li data-name="BulkOperationBase#raw"><a href="BulkOperationBase.html#raw">raw</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="BulkWriteError"> <span class="title"> <a href="BulkWriteError.html">BulkWriteError</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="BulkWriteError#deletedCount"><a href="BulkWriteError.html#deletedCount">deletedCount</a></li> <li data-name="BulkWriteError#errmsg"><a href="BulkWriteError.html#errmsg">errmsg</a></li> <li data-name="BulkWriteError#insertedCount"><a href="BulkWriteError.html#insertedCount">insertedCount</a></li> <li data-name="BulkWriteError#insertedIds"><a href="BulkWriteError.html#insertedIds">insertedIds</a></li> <li data-name="BulkWriteError#matchedCount"><a href="BulkWriteError.html#matchedCount">matchedCount</a></li> <li data-name="BulkWriteError#modifiedCount"><a href="BulkWriteError.html#modifiedCount">modifiedCount</a></li> <li data-name="BulkWriteError#upsertedCount"><a href="BulkWriteError.html#upsertedCount">upsertedCount</a></li> <li data-name="BulkWriteError#upsertedIds"><a href="BulkWriteError.html#upsertedIds">upsertedIds</a></li> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="BulkWriteError#hasErrorLabel"><a href="BulkWriteError.html#hasErrorLabel">hasErrorLabel</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="BulkWriteResult"> <span class="title"> <a href="BulkWriteResult.html">BulkWriteResult</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="BulkWriteResult#deletedCount"><a href="BulkWriteResult.html#deletedCount">deletedCount</a></li> <li data-name="BulkWriteResult#insertedCount"><a href="BulkWriteResult.html#insertedCount">insertedCount</a></li> <li data-name="BulkWriteResult#insertedIds"><a href="BulkWriteResult.html#insertedIds">insertedIds</a></li> <li data-name="BulkWriteResult#matchedCount"><a href="BulkWriteResult.html#matchedCount">matchedCount</a></li> <li data-name="BulkWriteResult#modifiedCount"><a href="BulkWriteResult.html#modifiedCount">modifiedCount</a></li> <li data-name="BulkWriteResult#n"><a href="BulkWriteResult.html#n">n</a></li> <li data-name="BulkWriteResult#nInserted"><a href="BulkWriteResult.html#nInserted">nInserted</a></li> <li data-name="BulkWriteResult#nMatched"><a href="BulkWriteResult.html#nMatched">nMatched</a></li> <li data-name="BulkWriteResult#nModified"><a href="BulkWriteResult.html#nModified">nModified</a></li> <li data-name="BulkWriteResult#nRemoved"><a href="BulkWriteResult.html#nRemoved">nRemoved</a></li> <li data-name="BulkWriteResult#nUpserted"><a href="BulkWriteResult.html#nUpserted">nUpserted</a></li> <li data-name="BulkWriteResult#ok"><a href="BulkWriteResult.html#ok">ok</a></li> <li data-name="BulkWriteResult#upsertedCount"><a href="BulkWriteResult.html#upsertedCount">upsertedCount</a></li> <li data-name="BulkWriteResult#upsertedIds"><a href="BulkWriteResult.html#upsertedIds">upsertedIds</a></li> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="BulkWriteResult#getInsertedIds"><a href="BulkWriteResult.html#getInsertedIds">getInsertedIds</a></li> <li data-name="BulkWriteResult#getLastOp"><a href="BulkWriteResult.html#getLastOp">getLastOp</a></li> <li data-name="BulkWriteResult#getRawResponse"><a href="BulkWriteResult.html#getRawResponse">getRawResponse</a></li> <li data-name="BulkWriteResult#getUpsertedIdAt"><a href="BulkWriteResult.html#getUpsertedIdAt">getUpsertedIdAt</a></li> <li data-name="BulkWriteResult#getUpsertedIds"><a href="BulkWriteResult.html#getUpsertedIds">getUpsertedIds</a></li> <li data-name="BulkWriteResult#getWriteConcernError"><a href="BulkWriteResult.html#getWriteConcernError">getWriteConcernError</a></li> <li data-name="BulkWriteResult#getWriteErrorAt"><a href="BulkWriteResult.html#getWriteErrorAt">getWriteErrorAt</a></li> <li data-name="BulkWriteResult#getWriteErrorCount"><a href="BulkWriteResult.html#getWriteErrorCount">getWriteErrorCount</a></li> <li data-name="BulkWriteResult#getWriteErrors"><a href="BulkWriteResult.html#getWriteErrors">getWriteErrors</a></li> <li data-name="BulkWriteResult#hasWriteErrors"><a href="BulkWriteResult.html#hasWriteErrors">hasWriteErrors</a></li> <li data-name="BulkWriteResult#isOk"><a href="BulkWriteResult.html#isOk">isOk</a></li> <li data-name="BulkWriteResult#toJSON"><a href="BulkWriteResult.html#toJSON">toJSON</a></li> <li data-name="BulkWriteResult#toString"><a href="BulkWriteResult.html#toString">toString</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="ChangeStream"> <span class="title"> <a href="ChangeStream.html">ChangeStream</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="ChangeStream#resumeToken"><a href="ChangeStream.html#resumeToken">resumeToken</a></li> </ul> <ul class="typedefs itemMembers"> <span class="subtitle">Typedefs</span> <li data-name="ChangeStream~resultCallback"><a href="ChangeStream.html#~resultCallback">resultCallback</a></li> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="ChangeStream#close"><a href="ChangeStream.html#close">close</a></li> <li data-name="ChangeStream#hasNext"><a href="ChangeStream.html#hasNext">hasNext</a></li> <li data-name="ChangeStream#isClosed"><a href="ChangeStream.html#isClosed">isClosed</a></li> <li data-name="ChangeStream#next"><a href="ChangeStream.html#next">next</a></li> <li data-name="ChangeStream#pause"><a href="ChangeStream.html#pause">pause</a></li> <li data-name="ChangeStream#pipe"><a href="ChangeStream.html#pipe">pipe</a></li> <li data-name="ChangeStream#resume"><a href="ChangeStream.html#resume">resume</a></li> <li data-name="ChangeStream#stream"><a href="ChangeStream.html#stream">stream</a></li> <li data-name="ChangeStream#unpipe"><a href="ChangeStream.html#unpipe">unpipe</a></li> </ul> <ul class="events itemMembers"> <span class="subtitle">Events</span> <li data-name="ChangeStream#event:change"><a href="ChangeStream.html#event:change">change</a></li> <li data-name="ChangeStream#event:close"><a href="ChangeStream.html#event:close">close</a></li> <li data-name="ChangeStream#event:end"><a href="ChangeStream.html#event:end">end</a></li> <li data-name="ChangeStream#event:error"><a href="ChangeStream.html#event:error">error</a></li> <li data-name="ChangeStream#event:resumeTokenChanged"><a href="ChangeStream.html#event:resumeTokenChanged">resumeTokenChanged</a></li> </ul> </li> <li class="item" data-name="ClientEncryption"> <span class="title"> <a href="ClientEncryption.html">ClientEncryption</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> <span class="subtitle">Typedefs</span> <li data-name="ClientEncryption~createDataKeyCallback"><a href="ClientEncryption.html#~createDataKeyCallback">createDataKeyCallback</a></li> <li data-name="ClientEncryption~dataKeyId"><a href="ClientEncryption.html#~dataKeyId">dataKeyId</a></li> <li data-name="ClientEncryption~decryptCallback"><a href="ClientEncryption.html#~decryptCallback">decryptCallback</a></li> <li data-name="ClientEncryption~encryptCallback"><a href="ClientEncryption.html#~encryptCallback">encryptCallback</a></li> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="ClientEncryption#createDataKey"><a href="ClientEncryption.html#createDataKey">createDataKey</a></li> <li data-name="ClientEncryption#decrypt"><a href="ClientEncryption.html#decrypt">decrypt</a></li> <li data-name="ClientEncryption#encrypt"><a href="ClientEncryption.html#encrypt">encrypt</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="ClientSession"> <span class="title"> <a href="ClientSession.html">ClientSession</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="ClientSession#id"><a href="ClientSession.html#id">id</a></li> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="ClientSession#abortTransaction"><a href="ClientSession.html#abortTransaction">abortTransaction</a></li> <li data-name="ClientSession#advanceOperationTime"><a href="ClientSession.html#advanceOperationTime">advanceOperationTime</a></li> <li data-name="ClientSession#commitTransaction"><a href="ClientSession.html#commitTransaction">commitTransaction</a></li> <li data-name="ClientSession#endSession"><a href="ClientSession.html#endSession">endSession</a></li> <li data-name="ClientSession#equals"><a href="ClientSession.html#equals">equals</a></li> <li data-name="ClientSession#incrementTransactionNumber"><a href="ClientSession.html#incrementTransactionNumber">incrementTransactionNumber</a></li> <li data-name="ClientSession#inTransaction"><a href="ClientSession.html#inTransaction">inTransaction</a></li> <li data-name="ClientSession#startTransaction"><a href="ClientSession.html#startTransaction">startTransaction</a></li> <li data-name="ClientSession#withTransaction"><a href="ClientSession.html#withTransaction">withTransaction</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="Code"> <span class="title"> <a href="Code.html">Code</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="Collection"> <span class="title"> <a href="Collection.html">Collection</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="Collection#collectionName"><a href="Collection.html#collectionName">collectionName</a></li> <li data-name="Collection#dbName"><a href="Collection.html#dbName">dbName</a></li> <li data-name="Collection#hint"><a href="Collection.html#hint">hint</a></li> <li data-name="Collection#namespace"><a href="Collection.html#namespace">namespace</a></li> <li data-name="Collection#readConcern"><a href="Collection.html#readConcern">readConcern</a></li> <li data-name="Collection#readPreference"><a href="Collection.html#readPreference">readPreference</a></li> <li data-name="Collection#writeConcern"><a href="Collection.html#writeConcern">writeConcern</a></li> </ul> <ul class="typedefs itemMembers"> <span class="subtitle">Typedefs</span> <li data-name="Collection~aggregationCallback"><a href="Collection.html#~aggregationCallback">aggregationCallback</a></li> <li data-name="Collection~bulkWriteOpCallback"><a href="Collection.html#~bulkWriteOpCallback">bulkWriteOpCallback</a></li> <li data-name="Collection~BulkWriteOpResult"><a href="Collection.html#~BulkWriteOpResult">BulkWriteOpResult</a></li> <li data-name="Collection~collectionResultCallback"><a href="Collection.html#~collectionResultCallback">collectionResultCallback</a></li> <li data-name="Collection~countCallback"><a href="Collection.html#~countCallback">countCallback</a></li> <li data-name="Collection~deleteWriteOpCallback"><a href="Collection.html#~deleteWriteOpCallback">deleteWriteOpCallback</a></li> <li data-name="Collection~deleteWriteOpResult"><a href="Collection.html#~deleteWriteOpResult">deleteWriteOpResult</a></li> <li data-name="Collection~findAndModifyCallback"><a href="Collection.html#~findAndModifyCallback">findAndModifyCallback</a></li> <li data-name="Collection~findAndModifyWriteOpResult"><a href="Collection.html#~findAndModifyWriteOpResult">findAndModifyWriteOpResult</a></li> <li data-name="Collection~IndexDefinition"><a href="Collection.html#~IndexDefinition">IndexDefinition</a></li> <li data-name="Collection~insertOneWriteOpCallback"><a href="Collection.html#~insertOneWriteOpCallback">insertOneWriteOpCallback</a></li> <li data-name="Collection~insertOneWriteOpResult"><a href="Collection.html#~insertOneWriteOpResult">insertOneWriteOpResult</a></li> <li data-name="Collection~insertWriteOpCallback"><a href="Collection.html#~insertWriteOpCallback">insertWriteOpCallback</a></li> <li data-name="Collection~insertWriteOpResult"><a href="Collection.html#~insertWriteOpResult">insertWriteOpResult</a></li> <li data-name="Collection~parallelCollectionScanCallback"><a href="Collection.html#~parallelCollectionScanCallback">parallelCollectionScanCallback</a></li> <li data-name="Collection~resultCallback"><a href="Collection.html#~resultCallback">resultCallback</a></li> <li data-name="Collection~updateWriteOpCallback"><a href="Collection.html#~updateWriteOpCallback">updateWriteOpCallback</a></li> <li data-name="Collection~updateWriteOpResult"><a href="Collection.html#~updateWriteOpResult">updateWriteOpResult</a></li> <li data-name="Collection~writeOpCallback"><a href="Collection.html#~writeOpCallback">writeOpCallback</a></li> <li data-name="Collection~WriteOpResult"><a href="Collection.html#~WriteOpResult">WriteOpResult</a></li> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="Collection#aggregate"><a href="Collection.html#aggregate">aggregate</a></li> <li data-name="Collection#bulkWrite"><a href="Collection.html#bulkWrite">bulkWrite</a></li> <li data-name="Collection#count"><a href="Collection.html#count">count</a></li> <li data-name="Collection#countDocuments"><a href="Collection.html#countDocuments">countDocuments</a></li> <li data-name="Collection#createIndex"><a href="Collection.html#createIndex">createIndex</a></li> <li data-name="Collection#createIndexes"><a href="Collection.html#createIndexes">createIndexes</a></li> <li data-name="Collection#deleteMany"><a href="Collection.html#deleteMany">deleteMany</a></li> <li data-name="Collection#deleteOne"><a href="Collection.html#deleteOne">deleteOne</a></li> <li data-name="Collection#distinct"><a href="Collection.html#distinct">distinct</a></li> <li data-name="Collection#drop"><a href="Collection.html#drop">drop</a></li> <li data-name="Collection#dropAllIndexes"><a href="Collection.html#dropAllIndexes">dropAllIndexes</a></li> <li data-name="Collection#dropIndex"><a href="Collection.html#dropIndex">dropIndex</a></li> <li data-name="Collection#dropIndexes"><a href="Collection.html#dropIndexes">dropIndexes</a></li> <li data-name="Collection#ensureIndex"><a href="Collection.html#ensureIndex">ensureIndex</a></li> <li data-name="Collection#estimatedDocumentCount"><a href="Collection.html#estimatedDocumentCount">estimatedDocumentCount</a></li> <li data-name="Collection#find"><a href="Collection.html#find">find</a></li> <li data-name="Collection#findAndModify"><a href="Collection.html#findAndModify">findAndModify</a></li> <li data-name="Collection#findAndRemove"><a href="Collection.html#findAndRemove">findAndRemove</a></li> <li data-name="Collection#findOne"><a href="Collection.html#findOne">findOne</a></li> <li data-name="Collection#findOneAndDelete"><a href="Collection.html#findOneAndDelete">findOneAndDelete</a></li> <li data-name="Collection#findOneAndReplace"><a href="Collection.html#findOneAndReplace">findOneAndReplace</a></li> <li data-name="Collection#findOneAndUpdate"><a href="Collection.html#findOneAndUpdate">findOneAndUpdate</a></li> <li data-name="Collection#geoHaystackSearch"><a href="Collection.html#geoHaystackSearch">geoHaystackSearch</a></li> <li data-name="Collection#group"><a href="Collection.html#group">group</a></li> <li data-name="Collection#indexes"><a href="Collection.html#indexes">indexes</a></li> <li data-name="Collection#indexExists"><a href="Collection.html#indexExists">indexExists</a></li> <li data-name="Collection#indexInformation"><a href="Collection.html#indexInformation">indexInformation</a></li> <li data-name="Collection#initializeOrderedBulkOp"><a href="Collection.html#initializeOrderedBulkOp">initializeOrderedBulkOp</a></li> <li data-name="Collection#initializeUnorderedBulkOp"><a href="Collection.html#initializeUnorderedBulkOp">initializeUnorderedBulkOp</a></li> <li data-name="Collection#insert"><a href="Collection.html#insert">insert</a></li> <li data-name="Collection#insertMany"><a href="Collection.html#insertMany">insertMany</a></li> <li data-name="Collection#insertOne"><a href="Collection.html#insertOne">insertOne</a></li> <li data-name="Collection#isCapped"><a href="Collection.html#isCapped">isCapped</a></li> <li data-name="Collection#listIndexes"><a href="Collection.html#listIndexes">listIndexes</a></li> <li data-name="Collection#mapReduce"><a href="Collection.html#mapReduce">mapReduce</a></li> <li data-name="Collection#options"><a href="Collection.html#options">options</a></li> <li data-name="Collection#parallelCollectionScan"><a href="Collection.html#parallelCollectionScan">parallelCollectionScan</a></li> <li data-name="Collection#reIndex"><a href="Collection.html#reIndex">reIndex</a></li> <li data-name="Collection#remove"><a href="Collection.html#remove">remove</a></li> <li data-name="Collection#rename"><a href="Collection.html#rename">rename</a></li> <li data-name="Collection#replaceOne"><a href="Collection.html#replaceOne">replaceOne</a></li> <li data-name="Collection#save"><a href="Collection.html#save">save</a></li> <li data-name="Collection#stats"><a href="Collection.html#stats">stats</a></li> <li data-name="Collection#update"><a href="Collection.html#update">update</a></li> <li data-name="Collection#updateMany"><a href="Collection.html#updateMany">updateMany</a></li> <li data-name="Collection#updateOne"><a href="Collection.html#updateOne">updateOne</a></li> <li data-name="Collection#watch"><a href="Collection.html#watch">watch</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="CommandCursor"> <span class="title"> <a href="CommandCursor.html">CommandCursor</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> <span class="subtitle">Typedefs</span> <li data-name="CommandCursor~endCallback"><a href="CommandCursor.html#~endCallback">endCallback</a></li> <li data-name="CommandCursor~iteratorCallback"><a href="CommandCursor.html#~iteratorCallback">iteratorCallback</a></li> <li data-name="CommandCursor~resultCallback"><a href="CommandCursor.html#~resultCallback">resultCallback</a></li> <li data-name="CommandCursor~toArrayResultCallback"><a href="CommandCursor.html#~toArrayResultCallback">toArrayResultCallback</a></li> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="CommandCursor#batchSize"><a href="CommandCursor.html#batchSize">batchSize</a></li> <li data-name="CommandCursor#clone"><a href="CommandCursor.html#clone">clone</a></li> <li data-name="CommandCursor#close"><a href="CommandCursor.html#close">close</a></li> <li data-name="CommandCursor#each"><a href="CommandCursor.html#each">each</a></li> <li data-name="CommandCursor#hasNext"><a href="CommandCursor.html#hasNext">hasNext</a></li> <li data-name="CommandCursor#isClosed"><a href="CommandCursor.html#isClosed">isClosed</a></li> <li data-name="CommandCursor#maxTimeMS"><a href="CommandCursor.html#maxTimeMS">maxTimeMS</a></li> <li data-name="CommandCursor#next"><a href="CommandCursor.html#next">next</a></li> <li data-name="CommandCursor#pause"><a href="CommandCursor.html#pause">pause</a></li> <li data-name="CommandCursor#pipe"><a href="CommandCursor.html#pipe">pipe</a></li> <li data-name="CommandCursor#read"><a href="CommandCursor.html#read">read</a></li> <li data-name="CommandCursor#resume"><a href="CommandCursor.html#resume">resume</a></li> <li data-name="CommandCursor#rewind"><a href="CommandCursor.html#rewind">rewind</a></li> <li data-name="CommandCursor#setEncoding"><a href="CommandCursor.html#setEncoding">setEncoding</a></li> <li data-name="CommandCursor#setReadPreference"><a href="CommandCursor.html#setReadPreference">setReadPreference</a></li> <li data-name="CommandCursor#toArray"><a href="CommandCursor.html#toArray">toArray</a></li> <li data-name="CommandCursor#unpipe"><a href="CommandCursor.html#unpipe">unpipe</a></li> <li data-name="CommandCursor#unshift"><a href="CommandCursor.html#unshift">unshift</a></li> <li data-name="CommandCursor#wrap"><a href="CommandCursor.html#wrap">wrap</a></li> </ul> <ul class="events itemMembers"> <span class="subtitle">Events</span> <li data-name="CommandCursor#event:close"><a href="CommandCursor.html#event:close">close</a></li> <li data-name="CommandCursor#event:data"><a href="CommandCursor.html#event:data">data</a></li> <li data-name="CommandCursor#event:end"><a href="CommandCursor.html#event:end">end</a></li> <li data-name="CommandCursor#event:readable"><a href="CommandCursor.html#event:readable">readable</a></li> </ul> </li> <li class="item" data-name="Cursor"> <span class="title"> <a href="Cursor.html">Cursor</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> <span class="subtitle">Typedefs</span> <li data-name="Cursor~countResultCallback"><a href="Cursor.html#~countResultCallback">countResultCallback</a></li> <li data-name="Cursor~endCallback"><a href="Cursor.html#~endCallback">endCallback</a></li> <li data-name="Cursor~iteratorCallback"><a href="Cursor.html#~iteratorCallback">iteratorCallback</a></li> <li data-name="Cursor~resultCallback"><a href="Cursor.html#~resultCallback">resultCallback</a></li> <li data-name="Cursor~toArrayResultCallback"><a href="Cursor.html#~toArrayResultCallback">toArrayResultCallback</a></li> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="Cursor#addCursorFlag"><a href="Cursor.html#addCursorFlag">addCursorFlag</a></li> <li data-name="Cursor#addQueryModifier"><a href="Cursor.html#addQueryModifier">addQueryModifier</a></li> <li data-name="Cursor#batchSize"><a href="Cursor.html#batchSize">batchSize</a></li> <li data-name="Cursor#clone"><a href="Cursor.html#clone">clone</a></li> <li data-name="Cursor#close"><a href="Cursor.html#close">close</a></li> <li data-name="Cursor#collation"><a href="Cursor.html#collation">collation</a></li> <li data-name="Cursor#comment"><a href="Cursor.html#comment">comment</a></li> <li data-name="Cursor#count"><a href="Cursor.html#count">count</a></li> <li data-name="Cursor#each"><a href="Cursor.html#each">each</a></li> <li data-name="Cursor#explain"><a href="Cursor.html#explain">explain</a></li> <li data-name="Cursor#filter"><a href="Cursor.html#filter">filter</a></li> <li data-name="Cursor#forEach"><a href="Cursor.html#forEach">forEach</a></li> <li data-name="Cursor#hasNext"><a href="Cursor.html#hasNext">hasNext</a></li> <li data-name="Cursor#hint"><a href="Cursor.html#hint">hint</a></li> <li data-name="Cursor#isClosed"><a href="Cursor.html#isClosed">isClosed</a></li> <li data-name="Cursor#limit"><a href="Cursor.html#limit">limit</a></li> <li data-name="Cursor#map"><a href="Cursor.html#map">map</a></li> <li data-name="Cursor#max"><a href="Cursor.html#max">max</a></li> <li data-name="Cursor#maxAwaitTimeMS"><a href="Cursor.html#maxAwaitTimeMS">maxAwaitTimeMS</a></li> <li data-name="Cursor#maxScan"><a href="Cursor.html#maxScan">maxScan</a></li> <li data-name="Cursor#maxTimeMS"><a href="Cursor.html#maxTimeMS">maxTimeMS</a></li> <li data-name="Cursor#min"><a href="Cursor.html#min">min</a></li> <li data-name="Cursor#next"><a href="Cursor.html#next">next</a></li> <li data-name="Cursor#pause"><a href="Cursor.html#pause">pause</a></li> <li data-name="Cursor#pipe"><a href="Cursor.html#pipe">pipe</a></li> <li data-name="Cursor#project"><a href="Cursor.html#project">project</a></li> <li data-name="Cursor#read"><a href="Cursor.html#read">read</a></li> <li data-name="Cursor#resume"><a href="Cursor.html#resume">resume</a></li> <li data-name="Cursor#returnKey"><a href="Cursor.html#returnKey">returnKey</a></li> <li data-name="Cursor#rewind"><a href="Cursor.html#rewind">rewind</a></li> <li data-name="Cursor#setCursorOption"><a href="Cursor.html#setCursorOption">setCursorOption</a></li> <li data-name="Cursor#setEncoding"><a href="Cursor.html#setEncoding">setEncoding</a></li> <li data-name="Cursor#setReadPreference"><a href="Cursor.html#setReadPreference">setReadPreference</a></li> <li data-name="Cursor#showRecordId"><a href="Cursor.html#showRecordId">showRecordId</a></li> <li data-name="Cursor#skip"><a href="Cursor.html#skip">skip</a></li> <li data-name="Cursor#snapshot"><a href="Cursor.html#snapshot">snapshot</a></li> <li data-name="Cursor#sort"><a href="Cursor.html#sort">sort</a></li> <li data-name="Cursor#stream"><a href="Cursor.html#stream">stream</a></li> <li data-name="Cursor#toArray"><a href="Cursor.html#toArray">toArray</a></li> <li data-name="Cursor#transformStream"><a href="Cursor.html#transformStream">transformStream</a></li> <li data-name="Cursor#unpipe"><a href="Cursor.html#unpipe">unpipe</a></li> <li data-name="Cursor#unshift"><a href="Cursor.html#unshift">unshift</a></li> <li data-name="Cursor#wrap"><a href="Cursor.html#wrap">wrap</a></li> </ul> <ul class="events itemMembers"> <span class="subtitle">Events</span> <li data-name="Cursor#event:close"><a href="Cursor.html#event:close">close</a></li> <li data-name="Cursor#event:data"><a href="Cursor.html#event:data">data</a></li> <li data-name="Cursor#event:end"><a href="Cursor.html#event:end">end</a></li> <li data-name="Cursor#event:readable"><a href="Cursor.html#event:readable">readable</a></li> </ul> </li> <li class="item" data-name="Db"> <span class="title"> <a href="Db.html">Db</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="Db#profilingInfo"><a href="Db.html#profilingInfo">profilingInfo</a></li> </ul> <ul class="typedefs itemMembers"> <span class="subtitle">Typedefs</span> <li data-name="Db~collectionResultCallback"><a href="Db.html#~collectionResultCallback">collectionResultCallback</a></li> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="Db#addUser"><a href="Db.html#addUser">addUser</a></li> <li data-name="Db#admin"><a href="Db.html#admin">admin</a></li> <li data-name="Db#aggregate"><a href="Db.html#aggregate">aggregate</a></li> <li data-name="Db#collection"><a href="Db.html#collection">collection</a></li> <li data-name="Db#collections"><a href="Db.html#collections">collections</a></li> <li data-name="Db#command"><a href="Db.html#command">command</a></li> <li data-name="Db#createCollection"><a href="Db.html#createCollection">createCollection</a></li> <li data-name="Db#createIndex"><a href="Db.html#createIndex">createIndex</a></li> <li data-name="Db#dropCollection"><a href="Db.html#dropCollection">dropCollection</a></li> <li data-name="Db#dropDatabase"><a href="Db.html#dropDatabase">dropDatabase</a></li> <li data-name="Db#ensureIndex"><a href="Db.html#ensureIndex">ensureIndex</a></li> <li data-name="Db#eval"><a href="Db.html#eval">eval</a></li> <li data-name="Db#executeDbAdminCommand"><a href="Db.html#executeDbAdminCommand">executeDbAdminCommand</a></li> <li data-name="Db#indexInformation"><a href="Db.html#indexInformation">indexInformation</a></li> <li data-name="Db#listCollections"><a href="Db.html#listCollections">listCollections</a></li> <li data-name="Db#profilingLevel"><a href="Db.html#profilingLevel">profilingLevel</a></li> <li data-name="Db#removeUser"><a href="Db.html#removeUser">removeUser</a></li> <li data-name="Db#renameCollection"><a href="Db.html#renameCollection">renameCollection</a></li> <li data-name="Db#setProfilingLevel"><a href="Db.html#setProfilingLevel">setProfilingLevel</a></li> <li data-name="Db#stats"><a href="Db.html#stats">stats</a></li> <li data-name="Db#unref"><a href="Db.html#unref">unref</a></li> <li data-name="Db#watch"><a href="Db.html#watch">watch</a></li> </ul> <ul class="events itemMembers"> <span class="subtitle">Events</span> <li data-name="Db#event:close"><a href="Db.html#event:close">close</a></li> <li data-name="Db#event:error"><a href="Db.html#event:error">error</a></li> <li data-name="Db#event:fullsetup"><a href="Db.html#event:fullsetup">fullsetup</a></li> <li data-name="Db#event:parseError"><a href="Db.html#event:parseError">parseError</a></li> <li data-name="Db#event:reconnect"><a href="Db.html#event:reconnect">reconnect</a></li> <li data-name="Db#event:timeout"><a href="Db.html#event:timeout">timeout</a></li> </ul> </li> <li class="item" data-name="DBRef"> <span class="title"> <a href="DBRef.html">DBRef</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="Decimal128"> <span class="title"> <a href="Decimal128.html">Decimal128</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="Decimal128#toString"><a href="Decimal128.html#toString">toString</a></li> <li data-name="Decimal128.fromString"><a href="Decimal128.html#.fromString">fromString</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="Double"> <span class="title"> <a href="Double.html">Double</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="Double#valueOf"><a href="Double.html#valueOf">valueOf</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="FindOperators"> <span class="title"> <a href="FindOperators.html">FindOperators</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="FindOperators#delete"><a href="FindOperators.html#delete">delete</a></li> <li data-name="FindOperators#deleteOne"><a href="FindOperators.html#deleteOne">deleteOne</a></li> <li data-name="FindOperators#remove"><a href="FindOperators.html#remove">remove</a></li> <li data-name="FindOperators#removeOne"><a href="FindOperators.html#removeOne">removeOne</a></li> <li data-name="FindOperators#replaceOne"><a href="FindOperators.html#replaceOne">replaceOne</a></li> <li data-name="FindOperators#update"><a href="FindOperators.html#update">update</a></li> <li data-name="FindOperators#updateOne"><a href="FindOperators.html#updateOne">updateOne</a></li> <li data-name="FindOperators#upsert"><a href="FindOperators.html#upsert">upsert</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="GridFSBucket"> <span class="title"> <a href="GridFSBucket.html">GridFSBucket</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> <span class="subtitle">Typedefs</span> <li data-name="GridFSBucket~errorCallback"><a href="GridFSBucket.html#~errorCallback">errorCallback</a></li> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="GridFSBucket#delete"><a href="GridFSBucket.html#delete">delete</a></li> <li data-name="GridFSBucket#drop"><a href="GridFSBucket.html#drop">drop</a></li> <li data-name="GridFSBucket#find"><a href="GridFSBucket.html#find">find</a></li> <li data-name="GridFSBucket#openDownloadStream"><a href="GridFSBucket.html#openDownloadStream">openDownloadStream</a></li> <li data-name="GridFSBucket#openDownloadStreamByName"><a href="GridFSBucket.html#openDownloadStreamByName">openDownloadStreamByName</a></li> <li data-name="GridFSBucket#openUploadStream"><a href="GridFSBucket.html#openUploadStream">openUploadStream</a></li> <li data-name="GridFSBucket#openUploadStreamWithId"><a href="GridFSBucket.html#openUploadStreamWithId">openUploadStreamWithId</a></li> <li data-name="GridFSBucket#rename"><a href="GridFSBucket.html#rename">rename</a></li> </ul> <ul class="events itemMembers"> <span class="subtitle">Events</span> <li data-name="GridFSBucket#event:index"><a href="GridFSBucket.html#event:index">index</a></li> </ul> </li> <li class="item" data-name="GridFSBucketReadStream"> <span class="title"> <a href="GridFSBucketReadStream.html">GridFSBucketReadStream</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="GridFSBucketReadStream#abort"><a href="GridFSBucketReadStream.html#abort">abort</a></li> <li data-name="GridFSBucketReadStream#end"><a href="GridFSBucketReadStream.html#end">end</a></li> <li data-name="GridFSBucketReadStream#pause"><a href="GridFSBucketReadStream.html#pause">pause</a></li> <li data-name="GridFSBucketReadStream#pipe"><a href="GridFSBucketReadStream.html#pipe">pipe</a></li> <li data-name="GridFSBucketReadStream#read"><a href="GridFSBucketReadStream.html#read">read</a></li> <li data-name="GridFSBucketReadStream#resume"><a href="GridFSBucketReadStream.html#resume">resume</a></li> <li data-name="GridFSBucketReadStream#setEncoding"><a href="GridFSBucketReadStream.html#setEncoding">setEncoding</a></li> <li data-name="GridFSBucketReadStream#start"><a href="GridFSBucketReadStream.html#start">start</a></li> <li data-name="GridFSBucketReadStream#unpipe"><a href="GridFSBucketReadStream.html#unpipe">unpipe</a></li> <li data-name="GridFSBucketReadStream#unshift"><a href="GridFSBucketReadStream.html#unshift">unshift</a></li> <li data-name="GridFSBucketReadStream#wrap"><a href="GridFSBucketReadStream.html#wrap">wrap</a></li> </ul> <ul class="events itemMembers"> <span class="subtitle">Events</span> <li data-name="GridFSBucketReadStream#event:close"><a href="GridFSBucketReadStream.html#event:close">close</a></li> <li data-name="GridFSBucketReadStream#event:data"><a href="GridFSBucketReadStream.html#event:data">data</a></li> <li data-name="GridFSBucketReadStream#event:end"><a href="GridFSBucketReadStream.html#event:end">end</a></li> <li data-name="GridFSBucketReadStream#event:error"><a href="GridFSBucketReadStream.html#event:error">error</a></li> <li data-name="GridFSBucketReadStream#event:file"><a href="GridFSBucketReadStream.html#event:file">file</a></li> </ul> </li> <li class="item" data-name="GridFSBucketWriteStream"> <span class="title"> <a href="GridFSBucketWriteStream.html">GridFSBucketWriteStream</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="GridFSBucketWriteStream#abort"><a href="GridFSBucketWriteStream.html#abort">abort</a></li> <li data-name="GridFSBucketWriteStream#end"><a href="GridFSBucketWriteStream.html#end">end</a></li> <li data-name="GridFSBucketWriteStream#write"><a href="GridFSBucketWriteStream.html#write">write</a></li> </ul> <ul class="events itemMembers"> <span class="subtitle">Events</span> <li data-name="GridFSBucketWriteStream#event:error"><a href="GridFSBucketWriteStream.html#event:error">error</a></li> <li data-name="GridFSBucketWriteStream#event:finish"><a href="GridFSBucketWriteStream.html#event:finish">finish</a></li> </ul> </li> <li class="item" data-name="GridStore"> <span class="title"> <a href="GridStore.html">GridStore</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="GridStore.DEFAULT_CONTENT_TYPE"><a href="GridStore.html#.DEFAULT_CONTENT_TYPE">DEFAULT_CONTENT_TYPE</a></li> <li data-name="GridStore.DEFAULT_ROOT_COLLECTION"><a href="GridStore.html#.DEFAULT_ROOT_COLLECTION">DEFAULT_ROOT_COLLECTION</a></li> <li data-name="GridStore.IO_SEEK_CUR"><a href="GridStore.html#.IO_SEEK_CUR">IO_SEEK_CUR</a></li> <li data-name="GridStore.IO_SEEK_END"><a href="GridStore.html#.IO_SEEK_END">IO_SEEK_END</a></li> <li data-name="GridStore.IO_SEEK_SET"><a href="GridStore.html#.IO_SEEK_SET">IO_SEEK_SET</a></li> </ul> <ul class="typedefs itemMembers"> <span class="subtitle">Typedefs</span> <li data-name="GridStore~collectionCallback"><a href="GridStore.html#~collectionCallback">collectionCallback</a></li> <li data-name="GridStore~gridStoreCallback"><a href="GridStore.html#~gridStoreCallback">gridStoreCallback</a></li> <li data-name="GridStore~openCallback"><a href="GridStore.html#~openCallback">openCallback</a></li> <li data-name="GridStore~readCallback"><a href="GridStore.html#~readCallback">readCallback</a></li> <li data-name="GridStore~readlinesCallback"><a href="GridStore.html#~readlinesCallback">readlinesCallback</a></li> <li data-name="GridStore~resultCallback"><a href="GridStore.html#~resultCallback">resultCallback</a></li> <li data-name="GridStore~tellCallback"><a href="GridStore.html#~tellCallback">tellCallback</a></li> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="GridStore.exist"><a href="GridStore.html#.exist">exist</a></li> <li data-name="GridStore.list"><a href="GridStore.html#.list">list</a></li> <li data-name="GridStore.read"><a href="GridStore.html#.read">read</a></li> <li data-name="GridStore.readlines"><a href="GridStore.html#.readlines">readlines</a></li> <li data-name="GridStore.unlink"><a href="GridStore.html#.unlink">unlink</a></li> <li data-name="GridStore#chunkCollection"><a href="GridStore.html#chunkCollection">chunkCollection</a></li> <li data-name="GridStore#close"><a href="GridStore.html#close">close</a></li> <li data-name="GridStore#collection"><a href="GridStore.html#collection">collection</a></li> <li data-name="GridStore#destroy"><a href="GridStore.html#destroy">destroy</a></li> <li data-name="GridStore#eof"><a href="GridStore.html#eof">eof</a></li> <li data-name="GridStore#getc"><a href="GridStore.html#getc">getc</a></li> <li data-name="GridStore#open"><a href="GridStore.html#open">open</a></li> <li data-name="GridStore#puts"><a href="GridStore.html#puts">puts</a></li> <li data-name="GridStore#read"><a href="GridStore.html#read">read</a></li> <li data-name="GridStore#readlines"><a href="GridStore.html#readlines">readlines</a></li> <li data-name="GridStore#rewind"><a href="GridStore.html#rewind">rewind</a></li> <li data-name="GridStore#seek"><a href="GridStore.html#seek">seek</a></li> <li data-name="GridStore#stream"><a href="GridStore.html#stream">stream</a></li> <li data-name="GridStore#tell"><a href="GridStore.html#tell">tell</a></li> <li data-name="GridStore#unlink"><a href="GridStore.html#unlink">unlink</a></li> <li data-name="GridStore#write"><a href="GridStore.html#write">write</a></li> <li data-name="GridStore#writeFile"><a href="GridStore.html#writeFile">writeFile</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="GridStoreStream"> <span class="title"> <a href="GridStoreStream.html">GridStoreStream</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="GridStoreStream#end"><a href="GridStoreStream.html#end">end</a></li> <li data-name="GridStoreStream#pause"><a href="GridStoreStream.html#pause">pause</a></li> <li data-name="GridStoreStream#pipe"><a href="GridStoreStream.html#pipe">pipe</a></li> <li data-name="GridStoreStream#read"><a href="GridStoreStream.html#read">read</a></li> <li data-name="GridStoreStream#resume"><a href="GridStoreStream.html#resume">resume</a></li> <li data-name="GridStoreStream#setEncoding"><a href="GridStoreStream.html#setEncoding">setEncoding</a></li> <li data-name="GridStoreStream#unpipe"><a href="GridStoreStream.html#unpipe">unpipe</a></li> <li data-name="GridStoreStream#unshift"><a href="GridStoreStream.html#unshift">unshift</a></li> <li data-name="GridStoreStream#wrap"><a href="GridStoreStream.html#wrap">wrap</a></li> <li data-name="GridStoreStream#write"><a href="GridStoreStream.html#write">write</a></li> </ul> <ul class="events itemMembers"> <span class="subtitle">Events</span> <li data-name="GridStoreStream#event:close"><a href="GridStoreStream.html#event:close">close</a></li> <li data-name="GridStoreStream#event:data"><a href="GridStoreStream.html#event:data">data</a></li> <li data-name="GridStoreStream#event:drain"><a href="GridStoreStream.html#event:drain">drain</a></li> <li data-name="GridStoreStream#event:end"><a href="GridStoreStream.html#event:end">end</a></li> <li data-name="GridStoreStream#event:error"><a href="GridStoreStream.html#event:error">error</a></li> <li data-name="GridStoreStream#event:finish"><a href="GridStoreStream.html#event:finish">finish</a></li> <li data-name="GridStoreStream#event:pipe"><a href="GridStoreStream.html#event:pipe">pipe</a></li> <li data-name="GridStoreStream#event:readable"><a href="GridStoreStream.html#event:readable">readable</a></li> <li data-name="GridStoreStream#event:unpipe"><a href="GridStoreStream.html#event:unpipe">unpipe</a></li> </ul> </li> <li class="item" data-name="Int32"> <span class="title"> <a href="Int32.html">Int32</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="Int32#valueOf"><a href="Int32.html#valueOf">valueOf</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="Logger"> <span class="title"> <a href="Logger.html">Logger</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> <span class="subtitle">Typedefs</span> <li data-name="Logger~loggerCallback"><a href="Logger.html#~loggerCallback">loggerCallback</a></li> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="Logger.currentLogger"><a href="Logger.html#.currentLogger">currentLogger</a></li> <li data-name="Logger.filter"><a href="Logger.html#.filter">filter</a></li> <li data-name="Logger.reset"><a href="Logger.html#.reset">reset</a></li> <li data-name="Logger.setCurrentLogger"><a href="Logger.html#.setCurrentLogger">setCurrentLogger</a></li> <li data-name="Logger.setLevel"><a href="Logger.html#.setLevel">setLevel</a></li> <li data-name="Logger#debug"><a href="Logger.html#debug">debug</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="Long"> <span class="title"> <a href="Long.html">Long</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="Long.MAX_VALUE"><a href="Long.html#.MAX_VALUE">MAX_VALUE</a></li> <li data-name="Long.MIN_VALUE"><a href="Long.html#.MIN_VALUE">MIN_VALUE</a></li> <li data-name="Long.NEG_ONE"><a href="Long.html#.NEG_ONE">NEG_ONE</a></li> <li data-name="Long.ONE"><a href="Long.html#.ONE">ONE</a></li> <li data-name="Long.ZERO"><a href="Long.html#.ZERO">ZERO</a></li> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="Long.fromBigInt"><a href="Long.html#.fromBigInt">fromBigInt</a></li> <li data-name="Long.fromBits"><a href="Long.html#.fromBits">fromBits</a></li> <li data-name="Long.fromInt"><a href="Long.html#.fromInt">fromInt</a></li> <li data-name="Long.fromNumber"><a href="Long.html#.fromNumber">fromNumber</a></li> <li data-name="Long.fromString"><a href="Long.html#.fromString">fromString</a></li> <li data-name="Long#add"><a href="Long.html#add">add</a></li> <li data-name="Long#and"><a href="Long.html#and">and</a></li> <li data-name="Long#compare"><a href="Long.html#compare">compare</a></li> <li data-name="Long#div"><a href="Long.html#div">div</a></li> <li data-name="Long#equals"><a href="Long.html#equals">equals</a></li> <li data-name="Long#getHighBits"><a href="Long.html#getHighBits">getHighBits</a></li> <li data-name="Long#getLowBits"><a href="Long.html#getLowBits">getLowBits</a></li> <li data-name="Long#getLowBitsUnsigned"><a href="Long.html#getLowBitsUnsigned">getLowBitsUnsigned</a></li> <li data-name="Long#getNumBitsAbs"><a href="Long.html#getNumBitsAbs">getNumBitsAbs</a></li> <li data-name="Long#greaterThan"><a href="Long.html#greaterThan">greaterThan</a></li> <li data-name="Long#greaterThanOrEqual"><a href="Long.html#greaterThanOrEqual">greaterThanOrEqual</a></li> <li data-name="Long#isNegative"><a href="Long.html#isNegative">isNegative</a></li> <li data-name="Long#isOdd"><a href="Long.html#isOdd">isOdd</a></li> <li data-name="Long#isZero"><a href="Long.html#isZero">isZero</a></li> <li data-name="Long#lessThan"><a href="Long.html#lessThan">lessThan</a></li> <li data-name="Long#lessThanOrEqual"><a href="Long.html#lessThanOrEqual">lessThanOrEqual</a></li> <li data-name="Long#modulo"><a href="Long.html#modulo">modulo</a></li> <li data-name="Long#multiply"><a href="Long.html#multiply">multiply</a></li> <li data-name="Long#negate"><a href="Long.html#negate">negate</a></li> <li data-name="Long#not"><a href="Long.html#not">not</a></li> <li data-name="Long#notEquals"><a href="Long.html#notEquals">notEquals</a></li> <li data-name="Long#or"><a href="Long.html#or">or</a></li> <li data-name="Long#shiftLeft"><a href="Long.html#shiftLeft">shiftLeft</a></li> <li data-name="Long#shiftRight"><a href="Long.html#shiftRight">shiftRight</a></li> <li data-name="Long#shiftRightUnsigned"><a href="Long.html#shiftRightUnsigned">shiftRightUnsigned</a></li> <li data-name="Long#subtract"><a href="Long.html#subtract">subtract</a></li> <li data-name="Long#toBigInt"><a href="Long.html#toBigInt">toBigInt</a></li> <li data-name="Long#toInt"><a href="Long.html#toInt">toInt</a></li> <li data-name="Long#toJSON"><a href="Long.html#toJSON">toJSON</a></li> <li data-name="Long#toNumber"><a href="Long.html#toNumber">toNumber</a></li> <li data-name="Long#toString"><a href="Long.html#toString">toString</a></li> <li data-name="Long#xor"><a href="Long.html#xor">xor</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="MaxKey"> <span class="title"> <a href="MaxKey.html">MaxKey</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="MinKey"> <span class="title"> <a href="MinKey.html">MinKey</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="MongoClient"> <span class="title"> <a href="MongoClient.html">MongoClient</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> <span class="subtitle">Typedefs</span> <li data-name="MongoClient~connectCallback"><a href="MongoClient.html#~connectCallback">connectCallback</a></li> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="MongoClient.connect"><a href="MongoClient.html#.connect">connect</a></li> <li data-name="MongoClient#close"><a href="MongoClient.html#close">close</a></li> <li data-name="MongoClient#connect"><a href="MongoClient.html#connect">connect</a></li> <li data-name="MongoClient#db"><a href="MongoClient.html#db">db</a></li> <li data-name="MongoClient#isConnected"><a href="MongoClient.html#isConnected">isConnected</a></li> <li data-name="MongoClient#startSession"><a href="MongoClient.html#startSession">startSession</a></li> <li data-name="MongoClient#watch"><a href="MongoClient.html#watch">watch</a></li> <li data-name="MongoClient#withSession"><a href="MongoClient.html#withSession">withSession</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="MongoCryptError"> <span class="title"> <a href="MongoCryptError.html">MongoCryptError</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="MongoError"> <span class="title"> <a href="MongoError.html">MongoError</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="MongoError#errmsg"><a href="MongoError.html#errmsg">errmsg</a></li> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="MongoError.create"><a href="MongoError.html#.create">create</a></li> <li data-name="MongoError#hasErrorLabel"><a href="MongoError.html#hasErrorLabel">hasErrorLabel</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="MongoNetworkError"> <span class="title"> <a href="MongoNetworkError.html">MongoNetworkError</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="MongoNetworkError#errmsg"><a href="MongoNetworkError.html#errmsg">errmsg</a></li> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="MongoNetworkError#hasErrorLabel"><a href="MongoNetworkError.html#hasErrorLabel">hasErrorLabel</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="MongoNetworkTimeoutError"> <span class="title"> <a href="MongoNetworkTimeoutError.html">MongoNetworkTimeoutError</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="MongoNetworkTimeoutError#errmsg"><a href="MongoNetworkTimeoutError.html#errmsg">errmsg</a></li> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="MongoNetworkTimeoutError#hasErrorLabel"><a href="MongoNetworkTimeoutError.html#hasErrorLabel">hasErrorLabel</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="MongoParseError"> <span class="title"> <a href="MongoParseError.html">MongoParseError</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="MongoParseError#errmsg"><a href="MongoParseError.html#errmsg">errmsg</a></li> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="MongoParseError#hasErrorLabel"><a href="MongoParseError.html#hasErrorLabel">hasErrorLabel</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="Mongos"> <span class="title"> <a href="Mongos.html">Mongos</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> </ul> <ul class="events itemMembers"> <span class="subtitle">Events</span> <li data-name="Mongos#event:close"><a href="Mongos.html#event:close">close</a></li> <li data-name="Mongos#event:commandFailed"><a href="Mongos.html#event:commandFailed">commandFailed</a></li> <li data-name="Mongos#event:commandStarted"><a href="Mongos.html#event:commandStarted">commandStarted</a></li> <li data-name="Mongos#event:commandSucceeded"><a href="Mongos.html#event:commandSucceeded">commandSucceeded</a></li> <li data-name="Mongos#event:connect"><a href="Mongos.html#event:connect">connect</a></li> <li data-name="Mongos#event:error"><a href="Mongos.html#event:error">error</a></li> <li data-name="Mongos#event:fullsetup"><a href="Mongos.html#event:fullsetup">fullsetup</a></li> <li data-name="Mongos#event:ha"><a href="Mongos.html#event:ha">ha</a></li> <li data-name="Mongos#event:joined"><a href="Mongos.html#event:joined">joined</a></li> <li data-name="Mongos#event:left"><a href="Mongos.html#event:left">left</a></li> <li data-name="Mongos#event:open"><a href="Mongos.html#event:open">open</a></li> <li data-name="Mongos#event:parseError"><a href="Mongos.html#event:parseError">parseError</a></li> <li data-name="Mongos#event:timeout"><a href="Mongos.html#event:timeout">timeout</a></li> </ul> </li> <li class="item" data-name="MongoServerSelectionError"> <span class="title"> <a href="MongoServerSelectionError.html">MongoServerSelectionError</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="MongoServerSelectionError#errmsg"><a href="MongoServerSelectionError.html#errmsg">errmsg</a></li> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="MongoServerSelectionError#hasErrorLabel"><a href="MongoServerSelectionError.html#hasErrorLabel">hasErrorLabel</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="MongoTimeoutError"> <span class="title"> <a href="MongoTimeoutError.html">MongoTimeoutError</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="MongoTimeoutError#errmsg"><a href="MongoTimeoutError.html#errmsg">errmsg</a></li> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="MongoTimeoutError#hasErrorLabel"><a href="MongoTimeoutError.html#hasErrorLabel">hasErrorLabel</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="MongoWriteConcernError"> <span class="title"> <a href="MongoWriteConcernError.html">MongoWriteConcernError</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="MongoWriteConcernError#errmsg"><a href="MongoWriteConcernError.html#errmsg">errmsg</a></li> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="MongoWriteConcernError#hasErrorLabel"><a href="MongoWriteConcernError.html#hasErrorLabel">hasErrorLabel</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="ObjectID"> <span class="title"> <a href="ObjectID.html">ObjectID</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="ObjectID.createFromHexString"><a href="ObjectID.html#.createFromHexString">createFromHexString</a></li> <li data-name="ObjectID.createFromTime"><a href="ObjectID.html#.createFromTime">createFromTime</a></li> <li data-name="ObjectID.isValid"><a href="ObjectID.html#.isValid">isValid</a></li> <li data-name="ObjectID#equals"><a href="ObjectID.html#equals">equals</a></li> <li data-name="ObjectID#generate"><a href="ObjectID.html#generate">generate</a></li> <li data-name="ObjectID#getTimestamp"><a href="ObjectID.html#getTimestamp">getTimestamp</a></li> <li data-name="ObjectID#toHexString"><a href="ObjectID.html#toHexString">toHexString</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="OrderedBulkOperation"> <span class="title"> <a href="OrderedBulkOperation.html">OrderedBulkOperation</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="OrderedBulkOperation#execute"><a href="OrderedBulkOperation.html#execute">execute</a></li> <li data-name="OrderedBulkOperation#find"><a href="OrderedBulkOperation.html#find">find</a></li> <li data-name="OrderedBulkOperation#insert"><a href="OrderedBulkOperation.html#insert">insert</a></li> <li data-name="OrderedBulkOperation#raw"><a href="OrderedBulkOperation.html#raw">raw</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="ReplSet"> <span class="title"> <a href="ReplSet.html">ReplSet</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> </ul> <ul class="events itemMembers"> <span class="subtitle">Events</span> <li data-name="ReplSet#event:close"><a href="ReplSet.html#event:close">close</a></li> <li data-name="ReplSet#event:commandFailed"><a href="ReplSet.html#event:commandFailed">commandFailed</a></li> <li data-name="ReplSet#event:commandStarted"><a href="ReplSet.html#event:commandStarted">commandStarted</a></li> <li data-name="ReplSet#event:commandSucceeded"><a href="ReplSet.html#event:commandSucceeded">commandSucceeded</a></li> <li data-name="ReplSet#event:connect"><a href="ReplSet.html#event:connect">connect</a></li> <li data-name="ReplSet#event:error"><a href="ReplSet.html#event:error">error</a></li> <li data-name="ReplSet#event:fullsetup"><a href="ReplSet.html#event:fullsetup">fullsetup</a></li> <li data-name="ReplSet#event:ha"><a href="ReplSet.html#event:ha">ha</a></li> <li data-name="ReplSet#event:joined"><a href="ReplSet.html#event:joined">joined</a></li> <li data-name="ReplSet#event:left"><a href="ReplSet.html#event:left">left</a></li> <li data-name="ReplSet#event:open"><a href="ReplSet.html#event:open">open</a></li> <li data-name="ReplSet#event:parseError"><a href="ReplSet.html#event:parseError">parseError</a></li> <li data-name="ReplSet#event:timeout"><a href="ReplSet.html#event:timeout">timeout</a></li> </ul> </li> <li class="item" data-name="Server"> <span class="title"> <a href="Server.html">Server</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> </ul> <ul class="events itemMembers"> <span class="subtitle">Events</span> <li data-name="Server#event:close"><a href="Server.html#event:close">close</a></li> <li data-name="Server#event:commandFailed"><a href="Server.html#event:commandFailed">commandFailed</a></li> <li data-name="Server#event:commandStarted"><a href="Server.html#event:commandStarted">commandStarted</a></li> <li data-name="Server#event:commandSucceeded"><a href="Server.html#event:commandSucceeded">commandSucceeded</a></li> <li data-name="Server#event:connect"><a href="Server.html#event:connect">connect</a></li> <li data-name="Server#event:error"><a href="Server.html#event:error">error</a></li> <li data-name="Server#event:parseError"><a href="Server.html#event:parseError">parseError</a></li> <li data-name="Server#event:reconnect"><a href="Server.html#event:reconnect">reconnect</a></li> <li data-name="Server#event:timeout"><a href="Server.html#event:timeout">timeout</a></li> </ul> </li> <li class="item" data-name="Symbol"> <span class="title"> <a href="Symbol.html">Symbol</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="Symbol#valueOf"><a href="Symbol.html#valueOf">valueOf</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="Timestamp"> <span class="title"> <a href="Timestamp.html">Timestamp</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="Timestamp.MAX_VALUE"><a href="Timestamp.html#.MAX_VALUE">MAX_VALUE</a></li> <li data-name="Timestamp.MIN_VALUE"><a href="Timestamp.html#.MIN_VALUE">MIN_VALUE</a></li> <li data-name="Timestamp.NEG_ONE"><a href="Timestamp.html#.NEG_ONE">NEG_ONE</a></li> <li data-name="Timestamp.ONE"><a href="Timestamp.html#.ONE">ONE</a></li> <li data-name="Timestamp.ZERO"><a href="Timestamp.html#.ZERO">ZERO</a></li> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="Timestamp.fromBits"><a href="Timestamp.html#.fromBits">fromBits</a></li> <li data-name="Timestamp.fromInt"><a href="Timestamp.html#.fromInt">fromInt</a></li> <li data-name="Timestamp.fromNumber"><a href="Timestamp.html#.fromNumber">fromNumber</a></li> <li data-name="Timestamp.fromString"><a href="Timestamp.html#.fromString">fromString</a></li> <li data-name="Timestamp#add"><a href="Timestamp.html#add">add</a></li> <li data-name="Timestamp#and"><a href="Timestamp.html#and">and</a></li> <li data-name="Timestamp#compare"><a href="Timestamp.html#compare">compare</a></li> <li data-name="Timestamp#div"><a href="Timestamp.html#div">div</a></li> <li data-name="Timestamp#equals"><a href="Timestamp.html#equals">equals</a></li> <li data-name="Timestamp#getHighBits"><a href="Timestamp.html#getHighBits">getHighBits</a></li> <li data-name="Timestamp#getLowBits"><a href="Timestamp.html#getLowBits">getLowBits</a></li> <li data-name="Timestamp#getLowBitsUnsigned"><a href="Timestamp.html#getLowBitsUnsigned">getLowBitsUnsigned</a></li> <li data-name="Timestamp#getNumBitsAbs"><a href="Timestamp.html#getNumBitsAbs">getNumBitsAbs</a></li> <li data-name="Timestamp#greaterThan"><a href="Timestamp.html#greaterThan">greaterThan</a></li> <li data-name="Timestamp#greaterThanOrEqual"><a href="Timestamp.html#greaterThanOrEqual">greaterThanOrEqual</a></li> <li data-name="Timestamp#isNegative"><a href="Timestamp.html#isNegative">isNegative</a></li> <li data-name="Timestamp#isOdd"><a href="Timestamp.html#isOdd">isOdd</a></li> <li data-name="Timestamp#isZero"><a href="Timestamp.html#isZero">isZero</a></li> <li data-name="Timestamp#lessThan"><a href="Timestamp.html#lessThan">lessThan</a></li> <li data-name="Timestamp#lessThanOrEqual"><a href="Timestamp.html#lessThanOrEqual">lessThanOrEqual</a></li> <li data-name="Timestamp#modulo"><a href="Timestamp.html#modulo">modulo</a></li> <li data-name="Timestamp#multiply"><a href="Timestamp.html#multiply">multiply</a></li> <li data-name="Timestamp#negate"><a href="Timestamp.html#negate">negate</a></li> <li data-name="Timestamp#not"><a href="Timestamp.html#not">not</a></li> <li data-name="Timestamp#notEquals"><a href="Timestamp.html#notEquals">notEquals</a></li> <li data-name="Timestamp#or"><a href="Timestamp.html#or">or</a></li> <li data-name="Timestamp#shiftLeft"><a href="Timestamp.html#shiftLeft">shiftLeft</a></li> <li data-name="Timestamp#shiftRight"><a href="Timestamp.html#shiftRight">shiftRight</a></li> <li data-name="Timestamp#shiftRightUnsigned"><a href="Timestamp.html#shiftRightUnsigned">shiftRightUnsigned</a></li> <li data-name="Timestamp#subtract"><a href="Timestamp.html#subtract">subtract</a></li> <li data-name="Timestamp#toInt"><a href="Timestamp.html#toInt">toInt</a></li> <li data-name="Timestamp#toJSON"><a href="Timestamp.html#toJSON">toJSON</a></li> <li data-name="Timestamp#toNumber"><a href="Timestamp.html#toNumber">toNumber</a></li> <li data-name="Timestamp#toString"><a href="Timestamp.html#toString">toString</a></li> <li data-name="Timestamp#xor"><a href="Timestamp.html#xor">xor</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="UnorderedBulkOperation"> <span class="title"> <a href="UnorderedBulkOperation.html">UnorderedBulkOperation</a> </span> <ul class="members itemMembers"> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="UnorderedBulkOperation#execute"><a href="UnorderedBulkOperation.html#execute">execute</a></li> <li data-name="UnorderedBulkOperation#find"><a href="UnorderedBulkOperation.html#find">find</a></li> <li data-name="UnorderedBulkOperation#insert"><a href="UnorderedBulkOperation.html#insert">insert</a></li> <li data-name="UnorderedBulkOperation#raw"><a href="UnorderedBulkOperation.html#raw">raw</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="WriteConcernError"> <span class="title"> <a href="WriteConcernError.html">WriteConcernError</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="WriteConcernError#code"><a href="WriteConcernError.html#code">code</a></li> <li data-name="WriteConcernError#errmsg"><a href="WriteConcernError.html#errmsg">errmsg</a></li> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="WriteConcernError#toJSON"><a href="WriteConcernError.html#toJSON">toJSON</a></li> <li data-name="WriteConcernError#toString"><a href="WriteConcernError.html#toString">toString</a></li> </ul> <ul class="events itemMembers"> </ul> </li> <li class="item" data-name="WriteError"> <span class="title"> <a href="WriteError.html">WriteError</a> </span> <ul class="members itemMembers"> <span class="subtitle">Members</span> <li data-name="WriteError#code"><a href="WriteError.html#code">code</a></li> <li data-name="WriteError#errmsg"><a href="WriteError.html#errmsg">errmsg</a></li> <li data-name="WriteError#index"><a href="WriteError.html#index">index</a></li> </ul> <ul class="typedefs itemMembers"> </ul> <ul class="methods itemMembers"> <span class="subtitle">Methods</span> <li data-name="WriteError#getOperation"><a href="WriteError.html#getOperation">getOperation</a></li> <li data-name="WriteError#toJSON"><a href="WriteError.html#toJSON">toJSON</a></li> <li data-name="WriteError#toString"><a href="WriteError.html#toString">toString</a></li> </ul> <ul class="events itemMembers"> </ul> </li> </ul> </div> </td> <td valign='top'> <div class="main"> <h1 class="page-title" data-filename="Cursor.html">Class: Cursor</h1> <section> <header> <h2> Cursor </h2> </header> <article> <div class="container-overview"> <dt> <div class="nameContainer"> <h4 class="name" id="Cursor"> new Cursor<span class="signature">()</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="Cursor.html">Cursor</a>}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line64">line 64</a> </div> </div> </dt> <dd> <div class="description"> <p>Creates a new Cursor instance (INTERNAL TYPE, do not instantiate directly)</p> </div> <dl class="details"> <h5 class="subsection-title">Properties:</h5> <dl> <table class="props"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>sortValue</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>Cursor query sort setting.</p></td> </tr> <tr> <td class="name"><code>timeout</code></td> <td class="type"> <span class="param-type">boolean</span> </td> <td class="description last"><p>Is Cursor able to time out.</p></td> </tr> <tr> <td class="name"><code>readPreference</code></td> <td class="type"> <span class="param-type">ReadPreference</span> </td> <td class="description last"><p>Get cursor ReadPreference.</p></td> </tr> </tbody> </table></dl> </dl> <h5>Fires:</h5> <ul> <li><a href="Cursor.html#event:data">Cursor#event:data</a></li> <li><a href="Cursor.html#event:end">Cursor#event:end</a></li> <li><a href="Cursor.html#event:close">Cursor#event:close</a></li> <li><a href="Cursor.html#event:readable">Cursor#event:readable</a></li> </ul> <h5>Returns:</h5> Cursor instance. <br /> <h5>Example</h5> <pre class="prettyprint"><code><p>Cursor cursor options.</p> <p>collection.find({}).project({a:1}) // Create a projection of field a<br> collection.find({}).skip(1).limit(10) // Skip 1 and limit 10<br> collection.find({}).batchSize(5) // Set batchSize on cursor to 5<br> collection.find({}).filter({a:1}) // Set query on the cursor<br> collection.find({}).comment('add a comment') // Add a comment to the query, allowing to correlate queries<br> collection.find({}).addCursorFlag('tailable', true) // Set cursor as tailable<br> collection.find({}).addCursorFlag('noCursorTimeout', true) // Set cursor as noCursorTimeout<br> collection.find({}).addCursorFlag('awaitData', true) // Set cursor as awaitData<br> collection.find({}).addCursorFlag('partial', true) // Set cursor as partial<br> collection.find({}).addQueryModifier('$orderby', {a:1}) // Set $orderby {a:1}<br> collection.find({}).max(10) // Set the cursor max<br> collection.find({}).maxTimeMS(1000) // Set the cursor maxTimeMS<br> collection.find({}).min(100) // Set the cursor min<br> collection.find({}).returnKey(true) // Set the cursor returnKey<br> collection.find({}).setReadPreference(ReadPreference.PRIMARY) // Set the cursor readPreference<br> collection.find({}).showRecordId(true) // Set the cursor showRecordId<br> collection.find({}).sort([['a', 1]]) // Sets the sort order of the cursor query<br> collection.find({}).hint('a_1') // Set the cursor hint</p> <p>All options are chainable, so one can do the following.</p> <p>collection.find({}).maxTimeMS(1000).maxScan(100).skip(1).toArray(..)</p></code></pre> </dd> </div> <h3 class="subsection-title">Extends</h3> <ul> <li><a href="external-CoreCursor.html">external:CoreCursor</a></li> <li><a href="external-Readable.html">external:Readable</a></li> </ul> <h3 class="subsection-title">Methods</h3> <dl> <dt> <div class="nameContainer"> <h4 class="name" id="addCursorFlag"> addCursorFlag<span class="signature">(flag, value)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="Cursor.html">Cursor</a>}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line416">line 416</a> </div> </div> </dt> <dd> <div class="description"> <p>Add a cursor flag to the cursor</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>flag</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"> <p>The flag to set, must be one of following ['tailable', 'oplogReplay', 'noCursorTimeout', 'awaitData', 'partial'].</p></td> </tr> <tr> <td class="name"><code>value</code></td> <td class="type"> <span class="param-type">boolean</span> </td> <td class="description last"> <p>The flag boolean value.</p></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Throws:</h5> <div class="param-desc"> <span class="param-type"><a href="MongoError.html">MongoError</a></span> </div> </dd> <dt> <div class="nameContainer"> <h4 class="name" id="addQueryModifier"> addQueryModifier<span class="signature">(name, value)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="Cursor.html">Cursor</a>}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line444">line 444</a> </div> </div> </dt> <dd> <div class="description"> <p>Add a query modifier to the cursor query</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>name</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"> <p>The query modifier (must start with $, such as $orderby etc)</p></td> </tr> <tr> <td class="name"><code>value</code></td> <td class="type"> <span class="param-type">string</span> | <span class="param-type">boolean</span> | <span class="param-type">number</span> </td> <td class="description last"> <p>The modifier value.</p></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Throws:</h5> <div class="param-desc"> <span class="param-type"><a href="MongoError.html">MongoError</a></span> </div> </dd> <dt> <div class="nameContainer"> <h4 class="name" id="batchSize"> batchSize<span class="signature">(value)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="Cursor.html">Cursor</a>}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line591">line 591</a> </div> </div> </dt> <dd> <div class="description"> <p>Set the batch size for the cursor.</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>value</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"> <p>The number of documents to return per batch. See <a href="https://docs.mongodb.com/manual/reference/command/find/">find command documentation</a>.</p></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Throws:</h5> <div class="param-desc"> <span class="param-type"><a href="MongoError.html">MongoError</a></span> </div> </dd> <dt> <div class="nameContainer inherited"> <h4 class="name" id="clone"> <span class="inherited"><a href="external-CoreCursor.html#clone">inherited</a></span> clone<span class="signature">()</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="Cursor.html">Cursor</a>}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line681">line 681</a> </div> </div> </dt> <dd> <div class="description"> <p>Clone the cursor</p> </div> <dl class="details"> </dl> </dd> <dt> <div class="nameContainer"> <h4 class="name" id="close"> close<span class="signature">(<span class="optional">options</span>, <span class="optional">callback</span>)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{Promise}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line926">line 926</a> </div> </div> </dt> <dd> <div class="description"> <p>Close the cursor, sending a KillCursor command and emitting close.</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>options</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last"> <span class="optional">optional</span> <p>Optional settings.</p> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>skipKillCursors</code></td> <td class="type"> <span class="param-type">boolean</span> </td> <td class="description last"> <span class="optional">optional</span> <p>Bypass calling killCursors when closing the cursor.</p></td> </tr> </tbody> </table> </td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> <span class="param-type"><a href="Cursor.html#~resultCallback">Cursor~resultCallback</a></span> </td> <td class="description last"> <span class="optional">optional</span> <p>The result callback.</p></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Returns:</h5> Promise if no callback passed <br /> </dd> <dt> <div class="nameContainer"> <h4 class="name" id="collation"> collation<span class="signature">(value)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="Cursor.html">Cursor</a>}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line619">line 619</a> </div> </div> </dt> <dd> <div class="description"> <p>Set the collation options for the cursor.</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>value</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last"> <p>The cursor collation options (MongoDB 3.4 or higher) settings for update operation (see 3.4 documentation for available fields).</p></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Throws:</h5> <div class="param-desc"> <span class="param-type"><a href="MongoError.html">MongoError</a></span> </div> </dd> <dt> <div class="nameContainer"> <h4 class="name" id="comment"> comment<span class="signature">(value)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="Cursor.html">Cursor</a>}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line469">line 469</a> </div> </div> </dt> <dd> <div class="description"> <p>Add a comment to the cursor query allowing for tracking the comment in the log.</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>value</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"> <p>The comment attached to this query.</p></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Throws:</h5> <div class="param-desc"> <span class="param-type"><a href="MongoError.html">MongoError</a></span> </div> </dd> <dt> <div class="nameContainer"> <h4 class="name" id="count"> count<span class="signature">(<span class="optional">applySkipLimit</span>, <span class="optional">options</span>, <span class="optional">callback</span>)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{Promise}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line895">line 895</a> </div> </div> </dt> <dd> <div class="description"> <p>Get the count of documents for this cursor</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>applySkipLimit</code></td> <td class="type"> <span class="param-type">boolean</span> </td> <td class="default"> true </td> <td class="description last"> <span class="optional">optional</span> <p>Should the count command apply limit and skip settings on the cursor or in the passed in options.</p></td> </tr> <tr> <td class="name"><code>options</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="default"> </td> <td class="description last"> <span class="optional">optional</span> <p>Optional settings.</p> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>skip</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"> <span class="optional">optional</span> <p>The number of documents to skip.</p></td> </tr> <tr> <td class="name"><code>limit</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"> <span class="optional">optional</span> <p>The maximum amounts to count before aborting.</p></td> </tr> <tr> <td class="name"><code>maxTimeMS</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"> <span class="optional">optional</span> <p>Number of milliseconds to wait before aborting the query.</p></td> </tr> <tr> <td class="name"><code>hint</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"> <span class="optional">optional</span> <p>An index name hint for the query.</p></td> </tr> <tr> <td class="name"><code>readPreference</code></td> <td class="type"> <span class="param-type">ReadPreference</span> | <span class="param-type">string</span> </td> <td class="description last"> <span class="optional">optional</span> <p>The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).</p></td> </tr> </tbody> </table> </td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> <span class="param-type"><a href="Cursor.html#~countResultCallback">Cursor~countResultCallback</a></span> </td> <td class="default"> </td> <td class="description last"> <span class="optional">optional</span> <p>The result callback.</p></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Returns:</h5> Promise if no callback passed <br /> </dd> <dt> <div class="nameContainer"> <h4 class="name" id="each"> each<span class="signature">(callback)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{null}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line706">line 706</a> </div> </div> </dt> <dd> <div class="description"> <p>Iterates over all the documents for this cursor. As with <strong>{cursor.toArray}</strong>,<br> not all of the elements will be iterated if this cursor had been previously accessed.<br> In that case, <strong>{cursor.rewind}</strong> can be used to reset the cursor. However, unlike<br> <strong>{cursor.toArray}</strong>, the cursor will only hold a maximum of batch size elements<br> at any given time if batch size is specified. Otherwise, the caller is responsible<br> for making sure that the entire result can fit the memory.</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>callback</code></td> <td class="type"> <span class="param-type"><a href="Cursor.html#~resultCallback">Cursor~resultCallback</a></span> </td> <td class="description last"> <p>The result callback.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="important tag-deprecated">Deprecated</dt><dd class="yes-def tag-deprecated"><ul class="dummy"><li>Yes</li></ul></dd> </dl> <h5>Throws:</h5> <div class="param-desc"> <span class="param-type"><a href="MongoError.html">MongoError</a></span> </div> </dd> <dt> <div class="nameContainer"> <h4 class="name" id="explain"> explain<span class="signature">(<span class="optional">verbosity</span>, <span class="optional">callback</span>)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{Promise}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line1028">line 1028</a> </div> </div> </dt> <dd> <div class="description"> <p>Execute the explain for the cursor</p> <p>For backwards compatibility, a verbosity of true is interpreted as &quot;allPlansExecution&quot;<br> and false as &quot;queryPlanner&quot;. Prior to server version 3.6, aggregate()<br> ignores the verbosity parameter and executes in &quot;queryPlanner&quot;.</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>verbosity</code></td> <td class="type"> <span class="param-type">'queryPlanner'</span> | <span class="param-type">'queryPlannerExtended'</span> | <span class="param-type">'executionStats'</span> | <span class="param-type">'allPlansExecution'</span> | <span class="param-type">boolean</span> </td> <td class="default"> true </td> <td class="description last"> <span class="optional">optional</span> <p>An optional mode in which to run the explain.</p></td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> <span class="param-type"><a href="Cursor.html#~resultCallback">Cursor~resultCallback</a></span> </td> <td class="default"> </td> <td class="description last"> <span class="optional">optional</span> <p>The result callback.</p></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Returns:</h5> Promise if no callback passed <br /> </dd> <dt> <div class="nameContainer"> <h4 class="name" id="filter"> filter<span class="signature">(filter)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="Cursor.html">Cursor</a>}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line267">line 267</a> </div> </div> </dt> <dd> <div class="description"> <p>Set the cursor query</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>filter</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last"> <p>The filter object used for the cursor.</p></td> </tr> </tbody> </table> <dl class="details"> </dl> </dd> <dt> <div class="nameContainer"> <h4 class="name" id="forEach"> forEach<span class="signature">(iterator, callback)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{Promise}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line735">line 735</a> </div> </div> </dt> <dd> <div class="description"> <p>Iterates over all the documents for this cursor using the iterator, callback pattern.</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>iterator</code></td> <td class="type"> <span class="param-type"><a href="Cursor.html#~iteratorCallback">Cursor~iteratorCallback</a></span> </td> <td class="description last"> <p>The iteration callback.</p></td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> <span class="param-type"><a href="Cursor.html#~endCallback">Cursor~endCallback</a></span> </td> <td class="description last"> <p>The end callback.</p></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Throws:</h5> <div class="param-desc"> <span class="param-type"><a href="MongoError.html">MongoError</a></span> </div> <h5>Returns:</h5> no callback supplied <br /> </dd> <dt> <div class="nameContainer"> <h4 class="name" id="hasNext"> hasNext<span class="signature">(<span class="optional">callback</span>)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{Promise}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line200">line 200</a> </div> </div> </dt> <dd> <div class="description"> <p>Check if there is any document still available in the cursor</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>callback</code></td> <td class="type"> <span class="param-type"><a href="Cursor.html#~resultCallback">Cursor~resultCallback</a></span> </td> <td class="description last"> <span class="optional">optional</span> <p>The result callback.</p></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Throws:</h5> <div class="param-desc"> <span class="param-type"><a href="MongoError.html">MongoError</a></span> </div> <h5>Returns:</h5> Promise if no callback passed <br /> </dd> <dt> <div class="nameContainer"> <h4 class="name" id="hint"> hint<span class="signature">(hint)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="Cursor.html">Cursor</a>}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line298">line 298</a> </div> </div> </dt> <dd> <div class="description"> <p>Set the cursor hint</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>hint</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last"> <p>If specified, then the query system will only consider plans using the hinted index.</p></td> </tr> </tbody> </table> <dl class="details"> </dl> </dd> <dt> <div class="nameContainer"> <h4 class="name" id="isClosed"> isClosed<span class="signature">()</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{boolean}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line968">line 968</a> </div> </div> </dt> <dd> <div class="description"> <p>Is the cursor closed</p> </div> <dl class="details"> </dl> </dd> <dt> <div class="nameContainer"> <h4 class="name" id="limit"> limit<span class="signature">(value)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="Cursor.html">Cursor</a>}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line631">line 631</a> </div> </div> </dt> <dd> <div class="description"> <p>Set the limit for the cursor.</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>value</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"> <p>The limit for the cursor query.</p></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Throws:</h5> <div class="param-desc"> <span class="param-type"><a href="MongoError.html">MongoError</a></span> </div> </dd> <dt> <div class="nameContainer"> <h4 class="name" id="map"> map<span class="signature">(<span class="optional">transform</span>)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="Cursor.html">Cursor</a>}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line950">line 950</a> </div> </div> </dt> <dd> <div class="description"> <p>Map all documents using the provided function</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>transform</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last"> <span class="optional">optional</span> <p>The mapping transformation method.</p></td> </tr> </tbody> </table> <dl class="details"> </dl> </dd> <dt> <div class="nameContainer"> <h4 class="name" id="max"> max<span class="signature">(max)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="Cursor.html">Cursor</a>}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line328">line 328</a> </div> </div> </dt> <dd> <div class="description"> <p>Set the cursor max</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>max</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last"> <p>Specify a $max value to specify the exclusive upper bound for a specific index in order to constrain the results of find(). The $max specifies the upper bound for all keys of a specific index in order.</p></td> </tr> </tbody> </table> <dl class="details"> </dl> </dd> <dt> <div class="nameContainer"> <h4 class="name" id="maxAwaitTimeMS"> maxAwaitTimeMS<span class="signature">(value)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="Cursor.html">Cursor</a>}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line485">line 485</a> </div> </div> </dt> <dd> <div class="description"> <p>Set a maxAwaitTimeMS on a tailing cursor query to allow to customize the timeout value for the option awaitData (Only supported on MongoDB 3.2 or higher, ignored otherwise)</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>value</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"> <p>Number of milliseconds to wait before aborting the tailed query.</p></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Throws:</h5> <div class="param-desc"> <span class="param-type"><a href="MongoError.html">MongoError</a></span> </div> </dd> <dt> <div class="nameContainer"> <h4 class="name" id="maxScan"> maxScan<span class="signature">(maxScan)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="Cursor.html">Cursor</a>}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line283">line 283</a> </div> </div> </dt> <dd> <div class="description"> <p>Set the cursor maxScan</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>maxScan</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last"> <p>Constrains the query to only scan the specified number of documents when fulfilling the query</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="important tag-deprecated">Deprecated</dt><dd><ul class="dummy"><li>as of MongoDB 4.0</li><ul></dd> </dl> </dd> <dt> <div class="nameContainer"> <h4 class="name" id="maxTimeMS"> maxTimeMS<span class="signature">(value)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="Cursor.html">Cursor</a>}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line505">line 505</a> </div> </div> </dt> <dd> <div class="description"> <p>Set a maxTimeMS on the cursor query, allowing for hard timeout limits on queries (Only supported on MongoDB 2.6 or higher)</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>value</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"> <p>Number of milliseconds to wait before aborting the query.</p></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Throws:</h5> <div class="param-desc"> <span class="param-type"><a href="MongoError.html">MongoError</a></span> </div> </dd> <dt> <div class="nameContainer"> <h4 class="name" id="min"> min<span class="signature">(min)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="Cursor.html">Cursor</a>}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line313">line 313</a> </div> </div> </dt> <dd> <div class="description"> <p>Set the cursor min</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>min</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last"> <p>Specify a $min value to specify the inclusive lower bound for a specific index in order to constrain the results of find(). The $min specifies the lower bound for all keys of a specific index in order.</p></td> </tr> </tbody> </table> <dl class="details"> </dl> </dd> <dt> <div class="nameContainer"> <h4 class="name" id="next"> next<span class="signature">(<span class="optional">callback</span>)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{Promise}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line237">line 237</a> </div> </div> </dt> <dd> <div class="description"> <p>Get the next available document from the cursor, returns null if no more documents are available.</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>callback</code></td> <td class="type"> <span class="param-type"><a href="Cursor.html#~resultCallback">Cursor~resultCallback</a></span> </td> <td class="description last"> <span class="optional">optional</span> <p>The result callback.</p></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Throws:</h5> <div class="param-desc"> <span class="param-type"><a href="MongoError.html">MongoError</a></span> </div> <h5>Returns:</h5> Promise if no callback passed <br /> </dd> <dt> <div class="nameContainer inherited"> <h4 class="name" id="pause"> <span class="inherited"><a href="external-Readable.html#pause">inherited</a></span> pause<span class="signature">()</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{null}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line1116">line 1116</a> </div> </div> </dt> <dd> <div class="description"> <p>This method will cause a stream in flowing-mode to stop emitting data events. Any data that becomes available will remain in the internal buffer.</p> </div> <dl class="details"> </dl> </dd> <dt> <div class="nameContainer inherited"> <h4 class="name" id="pipe"> <span class="inherited"><a href="external-Readable.html#pipe">inherited</a></span> pipe<span class="signature">(destination, <span class="optional">options</span>)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{null}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line1122">line 1122</a> </div> </div> </dt> <dd> <div class="description"> <p>This method pulls all the data out of a readable stream, and writes it to the supplied destination, automatically managing the flow so that the destination is not overwhelmed by a fast readable stream.</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>destination</code></td> <td class="type"> <span class="param-type">Writable</span> </td> <td class="description last"> <p>The destination for writing data</p></td> </tr> <tr> <td class="name"><code>options</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last"> <span class="optional">optional</span> <p>Pipe options</p></td> </tr> </tbody> </table> <dl class="details"> </dl> </dd> <dt> <div class="nameContainer"> <h4 class="name" id="project"> project<span class="signature">(value)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="Cursor.html">Cursor</a>}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line525">line 525</a> </div> </div> </dt> <dd> <div class="description"> <p>Sets a field projection for the query.</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>value</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last"> <p>The field projection object.</p></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Throws:</h5> <div class="param-desc"> <span class="param-type"><a href="MongoError.html">MongoError</a></span> </div> </dd> <dt> <div class="nameContainer inherited"> <h4 class="name" id="read"> <span class="inherited"><a href="external-Readable.html#read">inherited</a></span> read<span class="signature">(size)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{String|Buffer|null}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line1096">line 1096</a> </div> </div> </dt> <dd> <div class="description"> <p>The read() method pulls some data out of the internal buffer and returns it. If there is no data available, then it will return null.</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>size</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"> <p>Optional argument to specify how much data to read.</p></td> </tr> </tbody> </table> <dl class="details"> </dl> </dd> <dt> <div class="nameContainer inherited"> <h4 class="name" id="resume"> <span class="inherited"><a href="external-Readable.html#resume">inherited</a></span> resume<span class="signature">()</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{null}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line1110">line 1110</a> </div> </div> </dt> <dd> <div class="description"> <p>This method will cause the readable stream to resume emitting data events.</p> </div> <dl class="details"> </dl> </dd> <dt> <div class="nameContainer"> <h4 class="name" id="returnKey"> returnKey<span class="signature">(returnKey)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="Cursor.html">Cursor</a>}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line343">line 343</a> </div> </div> </dt> <dd> <div class="description"> <p>Set the cursor returnKey. If set to true, modifies the cursor to only return the index field or fields for the results of the query, rather than documents. If set to true and the query does not use an index to perform the read operation, the returned documents will not contain any fields.</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>returnKey</code></td> <td class="type"> <span class="param-type">bool</span> </td> <td class="description last"> <p>the returnKey value.</p></td> </tr> </tbody> </table> <dl class="details"> </dl> </dd> <dt> <div class="nameContainer inherited"> <h4 class="name" id="rewind"> <span class="inherited"><a href="external-CoreCursor.html#rewind">inherited</a></span> rewind<span class="signature">()</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{null}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line687">line 687</a> </div> </div> </dt> <dd> <div class="description"> <p>Resets the cursor</p> </div> <dl class="details"> </dl> </dd> <dt> <div class="nameContainer"> <h4 class="name" id="setCursorOption"> setCursorOption<span class="signature">(field, value)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="Cursor.html">Cursor</a>}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line391">line 391</a> </div> </div> </dt> <dd> <div class="description"> <p>Set a node.js specific cursor option</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>field</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"> <p>The cursor option to set ['numberOfRetries', 'tailableRetryInterval'].</p></td> </tr> <tr> <td class="name"><code>value</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last"> <p>The field value.</p></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Throws:</h5> <div class="param-desc"> <span class="param-type"><a href="MongoError.html">MongoError</a></span> </div> </dd> <dt> <div class="nameContainer inherited"> <h4 class="name" id="setEncoding"> <span class="inherited"><a href="external-Readable.html#setEncoding">inherited</a></span> setEncoding<span class="signature">(encoding)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{null}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line1103">line 1103</a> </div> </div> </dt> <dd> <div class="description"> <p>Call this function to cause the stream to return strings of the specified encoding instead of Buffer objects.</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>encoding</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"> <p>The encoding to use.</p></td> </tr> </tbody> </table> <dl class="details"> </dl> </dd> <dt> <div class="nameContainer"> <h4 class="name" id="setReadPreference"> setReadPreference<span class="signature">(readPreference)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="Cursor.html">Cursor</a>}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line794">line 794</a> </div> </div> </dt> <dd> <div class="description"> <p>Set the ReadPreference for the cursor.</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>readPreference</code></td> <td class="type"> <span class="param-type">string</span> | <span class="param-type">ReadPreference</span> </td> <td class="description last"> <p>The new read preference for the cursor.</p></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Throws:</h5> <div class="param-desc"> <span class="param-type"><a href="MongoError.html">MongoError</a></span> </div> </dd> <dt> <div class="nameContainer"> <h4 class="name" id="showRecordId"> showRecordId<span class="signature">(showRecordId)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="Cursor.html">Cursor</a>}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line358">line 358</a> </div> </div> </dt> <dd> <div class="description"> <p>Set the cursor showRecordId</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>showRecordId</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last"> <p>The $showDiskLoc option has now been deprecated and replaced with the showRecordId field. $showDiskLoc will still be accepted for OP_QUERY stye find.</p></td> </tr> </tbody> </table> <dl class="details"> </dl> </dd> <dt> <div class="nameContainer"> <h4 class="name" id="skip"> skip<span class="signature">(value)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="Cursor.html">Cursor</a>}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line656">line 656</a> </div> </div> </dt> <dd> <div class="description"> <p>Set the skip for the cursor.</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>value</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"> <p>The skip for the cursor query.</p></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Throws:</h5> <div class="param-desc"> <span class="param-type"><a href="MongoError.html">MongoError</a></span> </div> </dd> <dt> <div class="nameContainer"> <h4 class="name" id="snapshot"> snapshot<span class="signature">(snapshot)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="Cursor.html">Cursor</a>}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line374">line 374</a> </div> </div> </dt> <dd> <div class="description"> <p>Set the cursor snapshot</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>snapshot</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last"> <p>The $snapshot operator prevents the cursor from returning a document more than once because an intervening write operation results in a move of the document.</p></td> </tr> </tbody> </table> <dl class="details"> <dt class="important tag-deprecated">Deprecated</dt><dd><ul class="dummy"><li>as of MongoDB 4.0</li><ul></dd> </dl> </dd> <dt> <div class="nameContainer"> <h4 class="name" id="sort"> sort<span class="signature">(keyOrList, <span class="optional">direction</span>)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="Cursor.html">Cursor</a>}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line542">line 542</a> </div> </div> </dt> <dd> <div class="description"> <p>Sets the sort order of the cursor query.</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>keyOrList</code></td> <td class="type"> <span class="param-type">string</span> | <span class="param-type">array</span> | <span class="param-type">object</span> </td> <td class="description last"> <p>The key or keys set for the sort.</p></td> </tr> <tr> <td class="name"><code>direction</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"> <span class="optional">optional</span> <p>The direction of the sorting (1 or -1).</p></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Throws:</h5> <div class="param-desc"> <span class="param-type"><a href="MongoError.html">MongoError</a></span> </div> </dd> <dt> <div class="nameContainer"> <h4 class="name" id="stream"> stream<span class="signature">(<span class="optional">options</span>)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{<a href="Cursor.html">Cursor</a>}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line986">line 986</a> </div> </div> </dt> <dd> <div class="description"> <p>Return a modified Readable stream including a possible transform method.</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>options</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last"> <span class="optional">optional</span> <p>Optional settings.</p> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>transform</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last"> <span class="optional">optional</span> <p>A transformation method applied to each document emitted by the stream.</p></td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Returns:</h5> replace this method with transformStream in next major release <br /> </dd> <dt> <div class="nameContainer"> <h4 class="name" id="toArray"> toArray<span class="signature">(<span class="optional">callback</span>)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{Promise}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line830">line 830</a> </div> </div> </dt> <dd> <div class="description"> <p>Returns an array of documents. The caller is responsible for making sure that there<br> is enough memory to store the results. Note that the array only contains partial<br> results when this cursor had been previously accessed. In that case,<br> cursor.rewind() can be used to reset the cursor.</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>callback</code></td> <td class="type"> <span class="param-type"><a href="Cursor.html#~toArrayResultCallback">Cursor~toArrayResultCallback</a></span> </td> <td class="description last"> <span class="optional">optional</span> <p>The result callback.</p></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Throws:</h5> <div class="param-desc"> <span class="param-type"><a href="MongoError.html">MongoError</a></span> </div> <h5>Returns:</h5> Promise if no callback passed <br /> </dd> <dt> <div class="nameContainer"> <h4 class="name" id="transformStream"> transformStream<span class="signature">(<span class="optional">options</span>)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{stream}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line999">line 999</a> </div> </div> </dt> <dd> <div class="description"> <p>Return a modified Readable stream that applies a given transform function, if supplied. If none supplied,<br> returns a stream of unmodified docs.</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>options</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last"> <span class="optional">optional</span> <p>Optional settings.</p> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>transform</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last"> <span class="optional">optional</span> <p>A transformation method applied to each document emitted by the stream.</p></td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <dl class="details"> </dl> </dd> <dt> <div class="nameContainer inherited"> <h4 class="name" id="unpipe"> <span class="inherited"><a href="external-Readable.html#unpipe">inherited</a></span> unpipe<span class="signature">(<span class="optional">destination</span>)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{null}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line1130">line 1130</a> </div> </div> </dt> <dd> <div class="description"> <p>This method will remove the hooks set up for a previous pipe() call.</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>destination</code></td> <td class="type"> <span class="param-type">Writable</span> </td> <td class="description last"> <span class="optional">optional</span> <p>The destination for writing data</p></td> </tr> </tbody> </table> <dl class="details"> </dl> </dd> <dt> <div class="nameContainer inherited"> <h4 class="name" id="unshift"> <span class="inherited"><a href="external-Readable.html#unshift">inherited</a></span> unshift<span class="signature">(chunk)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{null}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line1137">line 1137</a> </div> </div> </dt> <dd> <div class="description"> <p>This is useful in certain cases where a stream is being consumed by a parser, which needs to &quot;un-consume&quot; some data that it has optimistically pulled out of the source, so that the stream can be passed on to some other party.</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>chunk</code></td> <td class="type"> <span class="param-type">Buffer</span> | <span class="param-type">string</span> </td> <td class="description last"> <p>Chunk of data to unshift onto the read queue.</p></td> </tr> </tbody> </table> <dl class="details"> </dl> </dd> <dt> <div class="nameContainer inherited"> <h4 class="name" id="wrap"> <span class="inherited"><a href="external-Readable.html#wrap">inherited</a></span> wrap<span class="signature">(stream)</span><span class="glyphicon glyphicon-circle-arrow-right"></span><span class="type-signature returnType">{null}</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line1144">line 1144</a> </div> </div> </dt> <dd> <div class="description"> <p>Versions of Node prior to v0.10 had streams that did not implement the entire Streams API as it is today. (See &quot;Compatibility&quot; below for more information.)</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>stream</code></td> <td class="type"> <span class="param-type">Stream</span> </td> <td class="description last"> <p>An &quot;old style&quot; readable stream.</p></td> </tr> </tbody> </table> <dl class="details"> </dl> </dd> </dl> <h3 class="subsection-title">Type Definitions</h3> <dl> <dt> <div class="nameContainer"> <h4 class="name" id="~countResultCallback"> countResultCallback<span class="signature">(error, count)</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line875">line 875</a> </div> </div> </dt> <dd> <div class="description"> <p>The callback format for results</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>error</code></td> <td class="type"> <span class="param-type"><a href="MongoError.html">MongoError</a></span> </td> <td class="description last"> <p>An error instance representing the error during the execution.</p></td> </tr> <tr> <td class="name"><code>count</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"> <p>The count of documents.</p></td> </tr> </tbody> </table> <dl class="details"> </dl> </dd> <dt> <div class="nameContainer"> <h4 class="name" id="~endCallback"> endCallback<span class="signature">(error)</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line721">line 721</a> </div> </div> </dt> <dd> <div class="description"> <p>The callback error format for the forEach iterator method</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>error</code></td> <td class="type"> <span class="param-type"><a href="MongoError.html">MongoError</a></span> </td> <td class="description last"> <p>An error instance representing the error during the execution.</p></td> </tr> </tbody> </table> <dl class="details"> </dl> </dd> <dt> <div class="nameContainer"> <h4 class="name" id="~iteratorCallback"> iteratorCallback<span class="signature">(doc)</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line715">line 715</a> </div> </div> </dt> <dd> <div class="description"> <p>The callback format for the forEach iterator method</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>doc</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last"> <p>An emitted document for the iterator</p></td> </tr> </tbody> </table> <dl class="details"> </dl> </dd> <dt> <div class="nameContainer"> <h4 class="name" id="~resultCallback"> resultCallback<span class="signature">(error, result)</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line674">line 674</a> </div> </div> </dt> <dd> <div class="description"> <p>The callback format for results</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>error</code></td> <td class="type"> <span class="param-type"><a href="MongoError.html">MongoError</a></span> </td> <td class="description last"> <p>An error instance representing the error during the execution.</p></td> </tr> <tr> <td class="name"><code>result</code></td> <td class="type"> <span class="param-type">object</span> | <span class="param-type">null</span> | <span class="param-type">boolean</span> </td> <td class="description last"> <p>The result object if the command was executed successfully.</p></td> </tr> </tbody> </table> <dl class="details"> </dl> </dd> <dt> <div class="nameContainer"> <h4 class="name" id="~toArrayResultCallback"> toArrayResultCallback<span class="signature">(error, documents)</span> </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line813">line 813</a> </div> </div> </dt> <dd> <div class="description"> <p>The callback format for results</p> </div> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>error</code></td> <td class="type"> <span class="param-type"><a href="MongoError.html">MongoError</a></span> </td> <td class="description last"> <p>An error instance representing the error during the execution.</p></td> </tr> <tr> <td class="name"><code>documents</code></td> <td class="type"> <span class="param-type">Array.&lt;object></span> </td> <td class="description last"> <p>All the documents the satisfy the cursor.</p></td> </tr> </tbody> </table> <dl class="details"> </dl> </dd> </dl> <h3 class="subsection-title">Events</h3> <dl> <dt> <div class="nameContainer"> <h4 class="name" id="event:close"> close </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line1067">line 1067</a> </div> </div> </dt> <dd> <div class="description"> <p>Cursor stream close event</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type">null</span> </li> </ul> <dl class="details"> </dl> </dd> <dt> <div class="nameContainer"> <h4 class="name" id="event:data"> data </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line1053">line 1053</a> </div> </div> </dt> <dd> <div class="description"> <p>Cursor stream data event, fired for each document in the cursor.</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type">object</span> </li> </ul> <dl class="details"> </dl> </dd> <dt> <div class="nameContainer"> <h4 class="name" id="event:end"> end </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line1060">line 1060</a> </div> </div> </dt> <dd> <div class="description"> <p>Cursor stream end event</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type">null</span> </li> </ul> <dl class="details"> </dl> </dd> <dt> <div class="nameContainer"> <h4 class="name" id="event:readable"> readable </h4> <div class="tag-source"> <a href="lib_cursor.js.html">lib/cursor.js</a>, <a href="lib_cursor.js.html#line1074">line 1074</a> </div> </div> </dt> <dd> <div class="description"> <p>Cursor stream readable event</p> </div> <h5>Type:</h5> <ul> <li> <span class="param-type">null</span> </li> </ul> <dl class="details"> </dl> </dd> </dl> </article> </section> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.7</a> on Tue Aug 31 2021 17:52:43 GMT-0400 (Eastern Daylight Time) </footer> </div> </td> </tr> </table> </div> <script>prettyPrint();</script> <script src="scripts/linenumber.js"></script> <script src="scripts/main.js"></script> </body> </html>
{ "content_hash": "d3bff31a5b283d877aa4e0f36f03d307", "timestamp": "", "source": "github", "line_count": 9685, "max_line_length": 351, "avg_line_length": 21.640681466184823, "alnum_prop": 0.4567154921513431, "repo_name": "mongodb/node-mongodb-native", "id": "b3ce654e531c2c9631ce37c903080206ccaffbf9", "size": "209590", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "docs/3.7/api/Cursor.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "JavaScript", "bytes": "1702456" }, { "name": "Makefile", "bytes": "1590" }, { "name": "Python", "bytes": "15715" }, { "name": "Shell", "bytes": "34026" }, { "name": "TypeScript", "bytes": "2117734" } ], "symlink_target": "" }
/* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). * Version 4.0.2 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. * ----------------------------------------------------------------------------- */ package org.opensim.modeling; /** * A class implementing a Slider joint. The underlying implementation in Simbody<br> * is a SimTK::MobilizedBody::Slider. The Slider provides a single coordinate<br> * along the common X-axis of the parent and child joint frames.<br> * <br> * <img src=sliderJoint.gif/><br> * <br> * @author Ajay Seth */ public class SliderJoint extends Joint { private transient long swigCPtr; public SliderJoint(long cPtr, boolean cMemoryOwn) { super(opensimSimulationJNI.SliderJoint_SWIGUpcast(cPtr), cMemoryOwn); swigCPtr = cPtr; } public static long getCPtr(SliderJoint obj) { return (obj == null) ? 0 : obj.swigCPtr; } @SuppressWarnings("deprecation") protected void finalize() { delete(); } public synchronized void delete() { if (swigCPtr != 0) { if (swigCMemOwn) { swigCMemOwn = false; opensimSimulationJNI.delete_SliderJoint(swigCPtr); } swigCPtr = 0; } super.delete(); } public static SliderJoint safeDownCast(OpenSimObject obj) { long cPtr = opensimSimulationJNI.SliderJoint_safeDownCast(OpenSimObject.getCPtr(obj), obj); return (cPtr == 0) ? null : new SliderJoint(cPtr, false); } public void assign(OpenSimObject aObject) { opensimSimulationJNI.SliderJoint_assign(swigCPtr, this, OpenSimObject.getCPtr(aObject), aObject); } public static String getClassName() { return opensimSimulationJNI.SliderJoint_getClassName(); } public OpenSimObject clone() { long cPtr = opensimSimulationJNI.SliderJoint_clone(swigCPtr, this); return (cPtr == 0) ? null : new SliderJoint(cPtr, true); } public String getConcreteClassName() { return opensimSimulationJNI.SliderJoint_getConcreteClassName(swigCPtr, this); } /** * Convenience method to get a const reference to the Coordinate associated<br> * with a single-degree-of-freedom Joint. If the Joint has more than one<br> * Coordinate, you must use get_coordinates() or provide the appropriate<br> * argument to the getCoordinate() method defined in the derived class. */ public Coordinate getCoordinate() { return new Coordinate(opensimSimulationJNI.SliderJoint_getCoordinate__SWIG_0_0(swigCPtr, this), false); } /** * Convenience method to get a writable reference to the Coordinate<br> * associated with a single-degree-of-freedom Joint. If the Joint has more<br> * than one Coordinate, you must use upd_coordinates() or provide the<br> * appropriate argument to the updCoordinate() method defined in the<br> * derived class. */ public Coordinate updCoordinate() { return new Coordinate(opensimSimulationJNI.SliderJoint_updCoordinate__SWIG_0_0(swigCPtr, this), false); } /** * Get a const reference to the Coordinate associated with this Joint.<br> * @see Coord */ public Coordinate getCoordinate(SliderJoint.Coord idx) { return new Coordinate(opensimSimulationJNI.SliderJoint_getCoordinate__SWIG_1(swigCPtr, this, idx.swigValue()), false); } /** * Get a writable reference to the Coordinate associated with this Joint.<br> * @see Coord */ public Coordinate updCoordinate(SliderJoint.Coord idx) { return new Coordinate(opensimSimulationJNI.SliderJoint_updCoordinate__SWIG_1(swigCPtr, this, idx.swigValue()), false); } public SliderJoint() { this(opensimSimulationJNI.new_SliderJoint__SWIG_0(), true); } public SliderJoint(String name, PhysicalFrame parent, PhysicalFrame child) { this(opensimSimulationJNI.new_SliderJoint__SWIG_1(name, PhysicalFrame.getCPtr(parent), parent, PhysicalFrame.getCPtr(child), child), true); } public SliderJoint(String name, PhysicalFrame parent, Vec3 locationInParent, Vec3 orientationInParent, PhysicalFrame child, Vec3 locationInChild, Vec3 orientationInChild) { this(opensimSimulationJNI.new_SliderJoint__SWIG_2(name, PhysicalFrame.getCPtr(parent), parent, Vec3.getCPtr(locationInParent), locationInParent, Vec3.getCPtr(orientationInParent), orientationInParent, PhysicalFrame.getCPtr(child), child, Vec3.getCPtr(locationInChild), locationInChild, Vec3.getCPtr(orientationInChild), orientationInChild), true); } /** * Index of Coordinate for use as an argument to getCoordinate() and<br> * updCoordinate().<br> * <br> * <b>C++ example</b><br> * {@code const auto& tx = mySliderJoint. getCoordinate(SliderJoint::Coord::TranslationX); }<br> * <br> * <b>Python example</b><br> * {@code import opensim tx = mySliderJoint.getCoordinate(opensim.SliderJoint.Coord_TranslationX) }<br> * <br> * <b>Java example</b><br> * {@code tx = mySliderJoint.getCoordinate(SliderJoint.Coord.TranslationX); }<br> * <br> * <b>MATLAB example</b><br> * {@code tx = mySliderJoint.get_coordinates(0); } */ public final static class Coord { /** * 0 */ public final static SliderJoint.Coord TranslationX = new SliderJoint.Coord("TranslationX", opensimSimulationJNI.SliderJoint_Coord_TranslationX_get()); public final int swigValue() { return swigValue; } public String toString() { return swigName; } public static Coord swigToEnum(int swigValue) { if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue) return swigValues[swigValue]; for (int i = 0; i < swigValues.length; i++) if (swigValues[i].swigValue == swigValue) return swigValues[i]; throw new IllegalArgumentException("No enum " + Coord.class + " with value " + swigValue); } private Coord(String swigName) { this.swigName = swigName; this.swigValue = swigNext++; } private Coord(String swigName, int swigValue) { this.swigName = swigName; this.swigValue = swigValue; swigNext = swigValue+1; } private Coord(String swigName, Coord swigEnum) { this.swigName = swigName; this.swigValue = swigEnum.swigValue; swigNext = this.swigValue+1; } private static Coord[] swigValues = { TranslationX }; private static int swigNext = 0; private final int swigValue; private final String swigName; } }
{ "content_hash": "a08195cbf5ee86c86f04420dc52e50e8", "timestamp": "", "source": "github", "line_count": 191, "max_line_length": 351, "avg_line_length": 35.7434554973822, "alnum_prop": 0.6594404570089352, "repo_name": "opensim-org/opensim-gui", "id": "e086dc3745e0109aa9be20f7d1cf36bf87b6c28f", "size": "6827", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Gui/opensim/modeling/src/org/opensim/modeling/SliderJoint.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CMake", "bytes": "9442" }, { "name": "HTML", "bytes": "7977" }, { "name": "Java", "bytes": "19665077" }, { "name": "NSIS", "bytes": "315777" }, { "name": "Python", "bytes": "79885" }, { "name": "Shell", "bytes": "2973" } ], "symlink_target": "" }
<?php defined('BASEPATH') OR exit('No direct script access allowed'); /** * Router Class * * Parses URIs and determines routing * * @package CodeIgniter * @subpackage Libraries * @category Libraries * @author EllisLab Dev Team * @link http://codeigniter.com/user_guide/general/routing.html */ class CI_Router { /** * CI_Config class object * * @var object */ public $config; /** * List of routes * * @var array */ public $routes = array(); /** * Current class name * * @var string */ public $class = ''; /** * Current method name * * @var string */ public $method = 'index'; /** * Sub-directory that contains the requested controller class * * @var string */ public $directory; /** * Default controller (and method if specific) * * @var string */ public $default_controller; /** * Translate URI dashes * * Determines whether dashes in controller & method segments * should be automatically replaced by underscores. * * @var bool */ public $translate_uri_dashes = FALSE; /** * Enable query strings flag * * Determines whether to use GET parameters or segment URIs * * @var bool */ public $enable_query_strings = FALSE; // -------------------------------------------------------------------- /** * Class constructor * * Runs the route mapping function. * * @return void */ // Modified by Ivan Tcholakov, 15-APR-2014. //public function __construct($routing = NULL) public function __construct() // { // Removed by Ivan Tcholakov, 14-JAN-2014. //global $routing; // $this->config =& load_class('Config', 'core'); $this->uri =& load_class('URI', 'core'); $this->enable_query_strings = ( ! is_cli() && $this->config->item('enable_query_strings') === TRUE); // Removed by Ivan Tcholakov, 14-JAN-2014. //// If a directory override is configured, it has to be set before any dynamic routing logic //is_array($routing) && isset($routing['directory']) && $this->set_directory($routing['directory']); //$this->_set_routing(); // //// Set any routing overrides that may exist in the main index file //if (isset($routing) && is_array($routing)) //{ // empty($routing['controller']) OR $this->set_class($routing['controller']); // empty($routing['function']) OR $this->set_method($routing['function']); //} // log_message('info', 'Router Class Initialized'); } // -------------------------------------------------------------------- /** * Set route mapping * * Determines what should be served based on the URI request, * as well as any "routes" that have been set in the routing config file. * * @return void */ // Modified by Ivan Tcholakov, 25-JUL-2013. //protected function _set_routing() public function _set_routing() // { // Are query strings enabled in the config file? Normally CI doesn't utilize query strings // since URI segments are more search-engine friendly, but they can optionally be used. // If this feature is enabled, we will gather the directory/class/method a little differently // Added by Ivan Tcholakov, 19-JAN-2014. // TODO: This is for supporting HMVC library, remove at first chance. $segments = array(); // if ($this->enable_query_strings) { // If the directory is set at this time, it means an override exists, so skip the checks if ( ! isset($this->directory)) { $_d = $this->config->item('directory_trigger'); $_d = isset($_GET[$_d]) ? trim($_GET[$_d], " \t\n\r\0\x0B/") : ''; if ($_d !== '') { $this->uri->filter_uri($_d); $this->set_directory($_d); } } $_c = trim($this->config->item('controller_trigger')); if ( ! empty($_GET[$_c])) { $this->uri->filter_uri($_GET[$_c]); $this->set_class($_GET[$_c]); $_f = trim($this->config->item('function_trigger')); if ( ! empty($_GET[$_f])) { $this->uri->filter_uri($_GET[$_f]); $this->set_method($_GET[$_f]); } $this->uri->rsegments = array( 1 => $this->class, 2 => $this->method ); } else { $this->_set_default_controller(); } // Routing rules don't apply to query strings and we don't need to detect // directories, so we're done here return; } // Load the routes.php file. if (file_exists(APPPATH.'config/routes.php')) { include(APPPATH.'config/routes.php'); } if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/routes.php')) { include(APPPATH.'config/'.ENVIRONMENT.'/routes.php'); } // Validate & get reserved routes if (isset($route) && is_array($route)) { isset($route['default_controller']) && $this->default_controller = $route['default_controller']; isset($route['translate_uri_dashes']) && $this->translate_uri_dashes = $route['translate_uri_dashes']; unset($route['default_controller'], $route['translate_uri_dashes']); $this->routes = $route; } // Is there anything to parse? // Modified by Ivan Tcholakov, 19-JAN-2014. // TODO: This is for supporting HMVC library, resolve at first chance. //if ($this->uri->uri_string !== '') //{ // $this->_parse_routes(); //} //else //{ // $this->_set_default_controller(); //} if (count($segments) > 0) { $this->_validate_request($segments); } // Fetch the complete URI string // If it's a CLI request, ignore the configuration if (is_cli()) { // Modified by Ivan Tcholakov, 19-FEB-2015. //$uri = $this->_parse_argv(); $uri = $this->uri->_parse_argv(); // } else { $protocol = strtoupper($this->uri->config->item('uri_protocol')); empty($protocol) && $protocol = 'REQUEST_URI'; switch ($protocol) { case 'AUTO': // For BC purposes only case 'REQUEST_URI': $uri = $this->uri->_parse_request_uri(); break; case 'QUERY_STRING': $uri = $this->uri->_parse_query_string(); break; case 'PATH_INFO': default: $uri = isset($_SERVER[$protocol]) ? $_SERVER[$protocol] : $this->uri->_parse_request_uri(); break; } } $this->uri->_set_uri_string($uri); // Is there a URI string? If not, the default controller specified in the "routes" file will be shown. if ($this->uri->uri_string == '') { $this->_set_default_controller(); } // Remove the URL suffix $suffix = (string) $this->uri->config->item('url_suffix'); if ($suffix !== '') { $slen = strlen($suffix); if (substr($this->uri->uri_string, -$slen) === $suffix) { $this->uri->uri_string = substr($this->uri->uri_string, 0, -$slen); } } // Compile the segments into an array foreach (explode('/', preg_replace('|/*(.+?)/*$|', '\\1', $this->uri->uri_string)) as $val) { // Filter segments for security $val = trim($val); $this->uri->filter_uri($val); if ($val !== '') { $this->uri->segments[] = $val; } } $this->_parse_routes(); // Parse any custom routing that may exist // Re-index the segment array so that it starts with 1 rather than 0 array_unshift($this->uri->segments, NULL); array_unshift($this->uri->rsegments, NULL); unset($this->uri->segments[0]); unset($this->uri->rsegments[0]); // } // -------------------------------------------------------------------- /** * Set request route * * Takes an array of URI segments as input and sets the class/method * to be called. * * @used-by CI_Router::_parse_routes() * @param array $segments URI segments * @return void */ protected function _set_request($segments = array()) { $segments = $this->_validate_request($segments); // If we don't have any segments left - try the default controller; // WARNING: Directories get shifted out of the segments array! if (empty($segments)) { $this->_set_default_controller(); return; } if ($this->translate_uri_dashes === TRUE) { $segments[0] = str_replace('-', '_', $segments[0]); if (isset($segments[1])) { $segments[1] = str_replace('-', '_', $segments[1]); } } $this->set_class($segments[0]); if (isset($segments[1])) { $this->set_method($segments[1]); } else { $segments[1] = 'index'; } array_unshift($segments, NULL); unset($segments[0]); $this->uri->rsegments = $segments; } // -------------------------------------------------------------------- /** * Set default controller * * @return void */ protected function _set_default_controller() { if (empty($this->default_controller)) { show_error('Unable to determine what should be displayed. A default route has not been specified in the routing file.'); } // Is the method being specified? if (sscanf($this->default_controller, '%[^/]/%s', $class, $method) !== 2) { $method = 'index'; } // Modified by Ivan Tcholakov, 19-JAN-2014. // TODO: This is for supporting HMVC library, resolve at first chance. //if ( ! file_exists(APPPATH.'controllers/'.$this->directory.ucfirst($class).'.php')) //{ // // This will trigger 404 later // return; //} // //$this->set_class($class); //$this->set_method($method); $this->_set_request(array($class, $method)); // // Assign routed segments, index starting from 1 $this->uri->rsegments = array( 1 => $class, 2 => $method ); log_message('debug', 'No URI present. Default controller set.'); } // -------------------------------------------------------------------- /** * Validate request * * Attempts validate the URI request and determine the controller path. * * @used-by CI_Router::_set_request() * @param array $segments URI segments * @return mixed URI segments */ protected function _validate_request($segments) { $c = count($segments); $directory_override = isset($this->directory); // Loop through our segments and return as soon as a controller // is found or when such a directory doesn't exist while ($c-- > 0) { $test = $this->directory .ucfirst($this->translate_uri_dashes === TRUE ? str_replace('-', '_', $segments[0]) : $segments[0]); if ( ! file_exists(APPPATH.'controllers/'.$test.'.php') && $directory_override === FALSE && is_dir(APPPATH.'controllers/'.$this->directory.$segments[0]) ) { $this->set_directory(array_shift($segments), TRUE); continue; } return $segments; } // This means that all segments were actually directories return $segments; } // -------------------------------------------------------------------- /** * Parse Routes * * Matches any routes that may exist in the config/routes.php file * against the URI to determine if the class/method need to be remapped. * * @return void */ protected function _parse_routes() { // Turn the segment array into a URI string $uri = implode('/', $this->uri->segments); // Get HTTP verb $http_verb = isset($_SERVER['REQUEST_METHOD']) ? strtolower($_SERVER['REQUEST_METHOD']) : 'cli'; // Is there a literal match? If so we're done if (isset($this->routes[$uri])) { // Is it an HTTP verb-based route? if (is_array($this->routes[$uri])) { $route = array_change_key_case($this->routes[$uri], CASE_LOWER); if (isset($route[$http_verb])) { $this->_set_request(explode('/', $route[$http_verb])); return; } } else { $this->_set_request(explode('/', $this->routes[$uri])); return; } } // Loop through the route array looking for wildcards foreach ($this->routes as $key => $val) { // Check if route format is using HTTP verbs if (is_array($val)) { $val = array_change_key_case($val, CASE_LOWER); if (isset($val[$http_verb])) { $val = $val[$http_verb]; } else { continue; } } // Convert wildcards to RegEx $key = str_replace(array(':any', ':num'), array('[^/]+', '[0-9]+'), $key); // Does the RegEx match? if (preg_match('#^'.$key.'$#', $uri, $matches)) { // Are we using callbacks to process back-references? if ( ! is_string($val) && is_callable($val)) { // Remove the original string from the matches array. array_shift($matches); // Execute the callback using the values in matches as its parameters. $val = call_user_func_array($val, $matches); } // Are we using the default routing method for back-references? elseif (strpos($val, '$') !== FALSE && strpos($key, '(') !== FALSE) { $val = preg_replace('#^'.$key.'$#', $val, $uri); } $this->_set_request(explode('/', $val)); return; } } // If we got this far it means we didn't encounter a // matching route so we'll set the site default route $this->_set_request(array_values($this->uri->segments)); } // -------------------------------------------------------------------- /** * Set class name * * @param string $class Class name * @return void */ public function set_class($class) { $this->class = str_replace(array('/', '.'), '', $class); } // -------------------------------------------------------------------- /** * Fetch the current class * * @deprecated 3.0.0 Read the 'class' property instead * @return string */ public function fetch_class() { return $this->class; } // -------------------------------------------------------------------- /** * Set method name * * @param string $method Method name * @return void */ public function set_method($method) { $this->method = $method; } // -------------------------------------------------------------------- /** * Fetch the current method * * @deprecated 3.0.0 Read the 'method' property instead * @return string */ public function fetch_method() { return $this->method; } // -------------------------------------------------------------------- /** * Set directory name * * @param string $dir Directory name * @param bool $append Whether we're appending rather than setting the full value * @return void */ public function set_directory($dir, $append = FALSE) { if ($append !== TRUE OR empty($this->directory)) { $this->directory = str_replace('.', '', trim($dir, '/')).'/'; } else { $this->directory .= str_replace('.', '', trim($dir, '/')).'/'; } } // -------------------------------------------------------------------- /** * Fetch directory * * Feches the sub-directory (if any) that contains the requested * controller class. * * @deprecated 3.0.0 Read the 'directory' property instead * @return string */ public function fetch_directory() { return $this->directory; } }
{ "content_hash": "ad24d477da6228a6d5e7216e5b99d9a0", "timestamp": "", "source": "github", "line_count": 598, "max_line_length": 123, "avg_line_length": 24.331103678929765, "alnum_prop": 0.5682474226804124, "repo_name": "iridion9/starter-public-edition-3", "id": "69f6a70dd069d59bb417ef5a5736a4edbce651e8", "size": "16208", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "platform/system/core/Router.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "28671" }, { "name": "CSS", "bytes": "297158" }, { "name": "HTML", "bytes": "44789" }, { "name": "JavaScript", "bytes": "1093957" }, { "name": "PHP", "bytes": "4263223" } ], "symlink_target": "" }
package client.soapaction_use.server; import jakarta.jws.WebService; import jakarta.jws.WebMethod; import jakarta.jws.soap.SOAPBinding; import jakarta.xml.ws.BindingType; import jakarta.xml.ws.WebServiceContext; import jakarta.xml.ws.soap.Addressing; import jakarta.xml.ws.handler.MessageContext; import jakarta.annotation.Resource; import java.util.List; import java.util.Map; /** * @author Rama Pulavarthi */ @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) @WebService(portName = "TestEndpointPort2", targetNamespace = "http://client.soapaction_use.server/", serviceName="TestEndpointService2", name="TestEndpoint2")//, //endpointInterface = "client.soapaction_use.server.TestEndpoint") public class TestEndpoint2Impl { @Resource WebServiceContext wsContext; @WebMethod(action = "http://example.com/action/echoSOAPAction") public String echoSOAPAction(String msg) { MessageContext context = wsContext.getMessageContext(); Map<String, List<String>> requestHeaders = (Map<java.lang.String, java.util.List<java.lang.String>>) context.get(MessageContext.HTTP_REQUEST_HEADERS); String s = requestHeaders.get("SOAPAction").get(0); return s; } }
{ "content_hash": "7e233427ad648da0cc6484201fcf5ca2", "timestamp": "", "source": "github", "line_count": 33, "max_line_length": 162, "avg_line_length": 37.03030303030303, "alnum_prop": 0.7577741407528642, "repo_name": "eclipse-ee4j/metro-jax-ws", "id": "26971fb1c40d1760169ec4fbbd20a2c9ba852b5c", "size": "1558", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "jaxws-ri/tests/unit/testcases/client/soapaction_use/server/TestEndpoint2Impl.java", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Batchfile", "bytes": "2375" }, { "name": "CSS", "bytes": "6017" }, { "name": "Groovy", "bytes": "2488" }, { "name": "HTML", "bytes": "89895" }, { "name": "Java", "bytes": "12221309" }, { "name": "Shell", "bytes": "32701" }, { "name": "XSLT", "bytes": "8914" } ], "symlink_target": "" }
package com.synopsys.integration.blackduck.service.model; import java.util.List; import org.apache.commons.lang3.StringUtils; import org.apache.commons.text.StringEscapeUtils; public class ReportData { private String projectName; private String projectURL; private String projectVersion; private String projectVersionURL; private String phase; private String distribution; private List<BomComponent> components; private int totalComponents; private int vulnerabilityRiskHighCount; private int vulnerabilityRiskMediumCount; private int vulnerabilityRiskLowCount; private int vulnerabilityRiskNoneCount; private int licenseRiskHighCount; private int licenseRiskMediumCount; private int licenseRiskLowCount; private int licenseRiskNoneCount; private int operationalRiskHighCount; private int operationalRiskMediumCount; private int operationalRiskLowCount; private int operationalRiskNoneCount; public String htmlEscape(final String valueToEscape) { if (StringUtils.isBlank(valueToEscape)) { return null; } return StringEscapeUtils.escapeHtml4(valueToEscape); } public String getProjectName() { return projectName; } public void setProjectName(final String projectName) { this.projectName = projectName; } public String getProjectURL() { return projectURL; } public void setProjectURL(final String projectURL) { this.projectURL = projectURL; } public String getProjectVersion() { return projectVersion; } public void setProjectVersion(final String projectVersion) { this.projectVersion = projectVersion; } public String getProjectVersionURL() { return projectVersionURL; } public void setProjectVersionURL(final String projectVersionURL) { this.projectVersionURL = projectVersionURL; } public String getPhase() { return phase; } public void setPhase(final String phase) { this.phase = phase; } public String getDistribution() { return distribution; } public void setDistribution(final String distribution) { this.distribution = distribution; } public int getTotalComponents() { return totalComponents; } public int getVulnerabilityRiskHighCount() { return vulnerabilityRiskHighCount; } public int getVulnerabilityRiskMediumCount() { return vulnerabilityRiskMediumCount; } public int getVulnerabilityRiskLowCount() { return vulnerabilityRiskLowCount; } public int getVulnerabilityRiskNoneCount() { return vulnerabilityRiskNoneCount; } public int getLicenseRiskHighCount() { return licenseRiskHighCount; } public int getLicenseRiskMediumCount() { return licenseRiskMediumCount; } public int getLicenseRiskLowCount() { return licenseRiskLowCount; } public int getLicenseRiskNoneCount() { return licenseRiskNoneCount; } public int getOperationalRiskHighCount() { return operationalRiskHighCount; } public int getOperationalRiskMediumCount() { return operationalRiskMediumCount; } public int getOperationalRiskLowCount() { return operationalRiskLowCount; } public int getOperationalRiskNoneCount() { return operationalRiskNoneCount; } public List<BomComponent> getComponents() { return components; } public void setComponents(final List<BomComponent> components) { this.components = components; vulnerabilityRiskHighCount = 0; vulnerabilityRiskMediumCount = 0; vulnerabilityRiskLowCount = 0; licenseRiskHighCount = 0; licenseRiskMediumCount = 0; licenseRiskLowCount = 0; operationalRiskHighCount = 0; operationalRiskMediumCount = 0; operationalRiskLowCount = 0; for (final BomComponent component : components) { if (component != null) { if (component.getSecurityRiskHighCount() > 0) { vulnerabilityRiskHighCount++; } else if (component.getSecurityRiskMediumCount() > 0) { vulnerabilityRiskMediumCount++; } else if (component.getSecurityRiskLowCount() > 0) { vulnerabilityRiskLowCount++; } if (component.getLicenseRiskHighCount() > 0) { licenseRiskHighCount++; } else if (component.getLicenseRiskMediumCount() > 0) { licenseRiskMediumCount++; } else if (component.getLicenseRiskLowCount() > 0) { licenseRiskLowCount++; } if (component.getOperationalRiskHighCount() > 0) { operationalRiskHighCount++; } else if (component.getOperationalRiskMediumCount() > 0) { operationalRiskMediumCount++; } else if (component.getOperationalRiskLowCount() > 0) { operationalRiskLowCount++; } } } totalComponents = components.size(); vulnerabilityRiskNoneCount = totalComponents - vulnerabilityRiskHighCount - vulnerabilityRiskMediumCount - vulnerabilityRiskLowCount; licenseRiskNoneCount = totalComponents - licenseRiskHighCount - licenseRiskMediumCount - licenseRiskLowCount; operationalRiskNoneCount = totalComponents - operationalRiskHighCount - operationalRiskMediumCount - operationalRiskLowCount; } }
{ "content_hash": "e5eec42ab976ea00f0d29222bb342a95", "timestamp": "", "source": "github", "line_count": 189, "max_line_length": 141, "avg_line_length": 30.116402116402117, "alnum_prop": 0.6647926914968376, "repo_name": "blackducksoftware/hub-common", "id": "aa57cb3f2d25322f42ef614fb757c0979cc025fb", "size": "6557", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/com/synopsys/integration/blackduck/service/model/ReportData.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "4875" }, { "name": "Groovy", "bytes": "56145" }, { "name": "HTML", "bytes": "896" }, { "name": "Java", "bytes": "662514" }, { "name": "JavaScript", "bytes": "51333" } ], "symlink_target": "" }
class ManualDownCommand: public Command { public: ManualDownCommand(); void Initialize(); void Execute(); bool IsFinished(); void End(); void Interrupted(); }; #endif
{ "content_hash": "ec8ee9a14dc052f152ef335f41a76d49", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 39, "avg_line_length": 14.5, "alnum_prop": 0.7126436781609196, "repo_name": "DevilStormRobotics/RecycleRush-Commands", "id": "1b4cec1a0730994641550aba06ff776fe2cf318d", "size": "252", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "RecycleRushBot/src/Commands/ManualDownCommand.h", "mode": "33188", "license": "mit", "language": [ { "name": "C++", "bytes": "38450" } ], "symlink_target": "" }
[中文版](../cn/streaming_rpc.md) # Overview There are some scenarios when the client or server needs to send huge amount of data, which may grow over time or is too large to put into the RPC attachment. For example, it could be the replica or snapshot transmitting between different nodes in a distributed system. Although we could send data segmentation across multiple RPC between client and server, this will introduce the following problems: - If these RPCs are parallel, there is no guarantee on the order of the data at the receiving side, which leads to complicate code of reassembling. - If these RPCs are serial, we have to endure the latency of the network RTT for each RPC together with the process time, which is especially unpredictable. In order to allow large packets to flow between client and server like a stream, we provide a new communication model: Streaming RPC. Streaming RPC enables users to establishes Stream which is a user-space connection between client and service. Multiple Streams can share the same TCP connection at the same time. The basic transmission unit on Stream is message. As a result, the sender can continuously write to messages to a Stream, while the receiver can read them out in the order of sending. Streaming RPC ensures/provides: - The message order at the receiver is exactly the same as that of the sender - Boundary for messages - Full duplex - Flow control - Notification on timeout We do not support segment large messages automatically so that multiple Streams on a single TCP connection may lead to [Head-of-line blocking](https://en.wikipedia.org/wiki/Head-of-line_blocking) problem. Please avoid putting huge data into single message until we provide automatic segmentation. For examples please refer to [example/streaming_echo_c++](https://github.com/brpc/brpc/tree/master/example/streaming_echo_c++/). # Create a Stream Currently stream is established by the client only. A new Stream object is created in client and then is used to issues an RPC (through baidu_std protocol) to the specified service. The service could accept this stream by responding to the request without error, thus a Stream is created once the client receives the response successfully. Any error during this process fails the RPC and thus fails the Stream creation. Take the Linux environment as an example, the client creates a [socket](http://linux.die.net/man/7/socket) first (creates a Stream), and then try to establish a connection with the remote side by [connect](http://linux.die.net/man/2/connect) (establish a Stream through RPC). Finally the stream has been created once the remote side [accept](http://linux.die.net/man/2/accept) the request. > If the client tries to establish a stream to a server that doesn't support streaming RPC, it will always return failure. In the code we use `StreamId` to represent a Stream, which is the key ID to pass when reading, writing, closing the Stream. ```c++ struct StreamOptions // The max size of unconsumed data allowed at remote side. // If |max_buf_size| <= 0, there's no limit of buf size // default: 2097152 (2M) int max_buf_size; // Notify user when there's no data for at least |idle_timeout_ms| // milliseconds since the last time that on_received_messages or on_idle_timeout // finished. // default: -1 long idle_timeout_ms; // Maximum messages in batch passed to handler->on_received_messages // default: 128 size_t messages_in_batch; // Handle input message, if handler is NULL, the remote side is not allowd to // write any message, who will get EBADF on writting // default: NULL StreamInputHandler* handler; }; // [Called at the client side] // Create a Stream at client-side along with the |cntl|, which will be connected // when receiving the response with a Stream from server-side. If |options| is // NULL, the Stream will be created with default options // Return 0 on success, -1 otherwise int StreamCreate(StreamId* request_stream, Controller &cntl, const StreamOptions* options); ``` # Accept a Stream If a Stream is attached inside the request of an RPC, the service can accept the Stream by `StreamAccept`. On success this function fill the created Stream into `response_stream`, which can be used to send message to the client. ```c++ // [Called at the server side] // Accept the Stream. If client didn't create a Stream with the request // (cntl.has_remote_stream() returns false), this method would fail. // Return 0 on success, -1 otherwise. int StreamAccept(StreamId* response_stream, Controller &cntl, const StreamOptions* options); ``` # Read from a Stream Upon creating/accepting a Stream, your can fill the `hander` in `StreamOptions` with your own implemented `StreamInputHandler`. Then you will be notified when the stream receives data, is closed by the other end, or reaches idle timeout. ```c++ class StreamInputHandler { public: // Callback when stream receives data virtual int on_received_messages(StreamId id, butil::IOBuf *const messages[], size_t size) = 0; // Callback when there is no data for a long time on the stream virtual void on_idle_timeout(StreamId id) = 0; // Callback when stream is closed by the other end virtual void on_closed(StreamId id) = 0; }; ``` > ***The first call to `on_received_message `*** > > On the client's side, if the creation process is synchronous, `on_received_message` will be called when the blocking RPC returns. If it's asynchronous, `on_received_message` won't be called until `done->Run()` finishes. > > On the server' side, `on_received_message` will be called once `done->Run()` finishes. # Write to a Stream ```c++ // Write |message| into |stream_id|. The remote-side handler will received the // message by the written order // Returns 0 on success, errno otherwise // Errno: // - EAGAIN: |stream_id| is created with positive |max_buf_size| and buf size // which the remote side hasn't consumed yet excceeds the number. // - EINVAL: |stream_id| is invalied or has been closed int StreamWrite(StreamId stream_id, const butil::IOBuf &message); ``` # Flow Control When the amount of unacknowledged data reaches the limit, the `Write` operation at the sender will fail with EAGAIN immediately. At this moment, you should wait for the receiver to consume the data synchronously or asynchronously. ```c++ // Wait util the pending buffer size is less than |max_buf_size| or error occurs // Returns 0 on success, errno otherwise // Errno: // - ETIMEDOUT: when |due_time| is not NULL and time expired this // - EINVAL: the Stream was close during waiting int StreamWait(StreamId stream_id, const timespec* due_time); // Async wait void StreamWait(StreamId stream_id, const timespec *due_time, void (*on_writable)(StreamId stream_id, void* arg, int error_code), void *arg); ``` # Close a Stream ```c++ // Close |stream_id|, after this function is called: // - All the following |StreamWrite| would fail // - |StreamWait| wakes up immediately. // - Both sides |on_closed| would be notifed after all the pending buffers have // been received // This function could be called multiple times without side-effects int StreamClose(StreamId stream_id); ```
{ "content_hash": "9f35d4db882b3ff4e331b454cc947c01", "timestamp": "", "source": "github", "line_count": 141, "max_line_length": 809, "avg_line_length": 51.787234042553195, "alnum_prop": 0.7454122158312791, "repo_name": "brpc/brpc", "id": "8ea32e2318db115e1b6952c98e23acc92fd43470", "size": "7308", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "docs/en/streaming_rpc.md", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "33259" }, { "name": "C++", "bytes": "9214610" }, { "name": "CMake", "bytes": "137534" }, { "name": "Dockerfile", "bytes": "693" }, { "name": "Makefile", "bytes": "39158" }, { "name": "Objective-C", "bytes": "21762" }, { "name": "Objective-C++", "bytes": "32018" }, { "name": "Perl", "bytes": "149499" }, { "name": "Python", "bytes": "23632" }, { "name": "Shell", "bytes": "57667" }, { "name": "Thrift", "bytes": "297" } ], "symlink_target": "" }
layout: post title: "Free Lorem Ipsum Generator" description: "Lorem Ipsum adalah contoh teks atau dummy dalam industri percetakan dan penataan huruf atau typesetting. " image: "/assets/img/tutorial/lipsum.jpg" main-class: 'css' tags: - js - tutorial - css - html twitter_text: "Free Lorem Ipsum Generator" introduction: "Lorem Ipsum adalah contoh teks atau dummy dalam industri percetakan dan penataan huruf atau typesetting." --- Lorem Ipsum adalah contoh teks atau dummy dalam industri percetakan dan penataan huruf atau typesetting. Lorem Ipsum telah menjadi standar contoh teks sejak tahun 1500an, saat seorang tukang cetak yang tidak dikenal mengambil sebuah kumpulan teks dan mengacaknya untuk menjadi sebuah buku contoh huruf. Lorem ipsum generator ini adalah sebuah alat yang dibuat oleh Taufik Nurrohman dan biasa digunakan oleh developer theme atau template untuk menghasilkan susunan kalimat sebagai bahan postingan untuk template baru mereka. ![Lorem Ipsum Generator](/assets/img/tutorial/lipsum.jpg) ## Mengapa kita menggunakannya? Sudah merupakan fakta bahwa seorang pembaca akan terpengaruh oleh isi tulisan dari sebuah halaman saat ia melihat tata letaknya. Maksud penggunaan Lorem Ipsum adalah karena ia kurang lebih memiliki penyebaran huruf yang normal, ketimbang menggunakan kalimat seperti "Bagian isi disini, bagian isi disini", sehingga ia seolah menjadi naskah Inggris yang bisa dibaca. Banyak paket Desktop Publishing dan editor situs web yang kini menggunakan Lorem Ipsum sebagai contoh teks. Karenanya pencarian terhadap kalimat "Lorem Ipsum" akan berujung pada banyak situs web yang masih dalam tahap pengembangan. Berbagai versi juga telah berubah dari tahun ke tahun, kadang karena tidak sengaja, kadang karena disengaja (misalnya karena dimasukkan unsur humor atau semacamnya) dikutif dari id.lipsum.com Jika anda ingin mencobanya silahkan klik link berikut ini [Lipsum Generator](https://antoncabon.github.io/Lipsum-UI/) atau jika anda ingin membuatnya sendiri silahkan anda download disini [Download](https://github.com/antoncabon/Lipsum-UI/archive/gh-pages.zip) Terimakasih dan semoga ada manfaatnya, salam antoncabon.
{ "content_hash": "5dd8e9ec063606865ad7889ca3abb831", "timestamp": "", "source": "github", "line_count": 25, "max_line_length": 789, "avg_line_length": 87.44, "alnum_prop": 0.8115279048490394, "repo_name": "antoncabon/antoncabon.github.io", "id": "f79e7647d4f7bbe69d040497d5402cabe13d268d", "size": "2191", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "_posts/2016-06-11-free-lorem-ipsum-generator.markdown", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "22948" }, { "name": "HTML", "bytes": "53642" }, { "name": "JavaScript", "bytes": "42394" }, { "name": "PHP", "bytes": "1268" }, { "name": "Ruby", "bytes": "1734" }, { "name": "Shell", "bytes": "4568" } ], "symlink_target": "" }
megamol::mesh::AbstractMeshDataSource::AbstractMeshDataSource() : core::Module() , m_mesh_access_collection({nullptr, {}}) , m_mesh_lhs_slot("meshes", "The slot publishing the loaded data") , m_mesh_rhs_slot("chainMeshes", "The slot for chaining mesh data sources") { this->m_mesh_lhs_slot.SetCallback(CallMesh::ClassName(), "GetData", &AbstractMeshDataSource::getMeshDataCallback); this->m_mesh_lhs_slot.SetCallback( CallMesh::ClassName(), "GetMetaData", &AbstractMeshDataSource::getMeshMetaDataCallback); this->MakeSlotAvailable(&this->m_mesh_lhs_slot); this->m_mesh_rhs_slot.SetCompatibleCall<CallMeshDescription>(); this->MakeSlotAvailable(&this->m_mesh_rhs_slot); } megamol::mesh::AbstractMeshDataSource::~AbstractMeshDataSource() { this->Release(); } bool megamol::mesh::AbstractMeshDataSource::create(void) { // default empty collection m_mesh_access_collection.first = std::make_shared<MeshDataAccessCollection>(); return true; } bool megamol::mesh::AbstractMeshDataSource::getMeshMetaDataCallback(core::Call& caller) { CallMesh* lhs_mesh_call = dynamic_cast<CallMesh*>(&caller); CallMesh* rhs_mesh_call = m_mesh_rhs_slot.CallAs<CallMesh>(); if (lhs_mesh_call == NULL) return false; auto lhs_meta_data = lhs_mesh_call->getMetaData(); unsigned int frame_cnt = 1; auto bbox = lhs_meta_data.m_bboxs.BoundingBox(); auto cbbox = lhs_meta_data.m_bboxs.ClipBox(); if (rhs_mesh_call != NULL) { auto rhs_meta_data = rhs_mesh_call->getMetaData(); rhs_meta_data.m_frame_ID = lhs_meta_data.m_frame_ID; rhs_mesh_call->setMetaData(rhs_meta_data); if (!(*rhs_mesh_call)(1)) return false; rhs_meta_data = rhs_mesh_call->getMetaData(); frame_cnt = std::max(rhs_meta_data.m_frame_cnt, frame_cnt); bbox.Union(rhs_meta_data.m_bboxs.BoundingBox()); cbbox.Union(rhs_meta_data.m_bboxs.ClipBox()); } lhs_meta_data.m_frame_cnt = frame_cnt; lhs_meta_data.m_bboxs.SetBoundingBox(bbox); lhs_meta_data.m_bboxs.SetClipBox(cbbox); lhs_mesh_call->setMetaData(lhs_meta_data); return true; } void megamol::mesh::AbstractMeshDataSource::release() {} void megamol::mesh::AbstractMeshDataSource::clearMeshAccessCollection() { for (auto& identifier : m_mesh_access_collection.second) { m_mesh_access_collection.first->deleteMesh(identifier); } m_mesh_access_collection.second.clear(); }
{ "content_hash": "8a0fbd188e0cc6d5cdeafaaf50d75e99", "timestamp": "", "source": "github", "line_count": 67, "max_line_length": 118, "avg_line_length": 37.417910447761194, "alnum_prop": 0.6788990825688074, "repo_name": "UniStuttgart-VISUS/megamol", "id": "b64a4c94622b0d703d489a6bb05401fc54c9844d", "size": "2549", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "plugins/mesh/src/AbstractMeshDataSource.cpp", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "C", "bytes": "2002354" }, { "name": "C++", "bytes": "19542760" }, { "name": "CMake", "bytes": "132146" }, { "name": "Cuda", "bytes": "1153909" }, { "name": "Dockerfile", "bytes": "931" }, { "name": "GLSL", "bytes": "1171090" }, { "name": "Lua", "bytes": "6010" }, { "name": "NASL", "bytes": "603109" }, { "name": "Perl", "bytes": "60620" }, { "name": "Python", "bytes": "32166" }, { "name": "Roff", "bytes": "8819" }, { "name": "Shell", "bytes": "5349" }, { "name": "TeX", "bytes": "4486" } ], "symlink_target": "" }
<!doctype html> <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en-LB"> <![endif]--> <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en-LB"> <![endif]--> <!--[if IE 8]> <html class="no-js lt-ie9" lang="en-LB"> <![endif]--> <!--[if gt IE 8]><!--> <html class="no-js" lang="en-US"> <!--<![endif]--> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="google-site-verification" content="zfn6R_70flvtiV5lTjaUJNjL6uQ-ADCnmS7hXlV1Tjg" /> <title>Everything iPhone, iPad And Android News and Tutorials | Telephony Lebanon</title> <meta name="description" content="Telephony a weblog dedicated on delivering mobile phone latest news, how to fix, information guides and tutorials about the iPhone, iPad and Android."> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="dns-prefetch" href="//fonts.googleapis.com"> <link rel="dns-prefetch" href="//google-analytics.com"> <link rel="stylesheet" href="/css/bootstrap.css" type="text/css"> <link rel="stylesheet" href="/css/main.css" type="text/css"> <link rel="canonical" href="http://telephony-lebanon.github.io/"> <link rel="alternate" type="application/rss+xml" title="Everything iPhone, iPad And Android News and Tutorials | Telephony Lebanon" href="http://telephony-lebanon.github.io/feed.xml" /> <meta content="Everything iPhone, iPad And Android News and Tutorials | Telephony Lebanon" property="og:site_name"> <meta content="Everything iPhone, iPad And Android News and Tutorials | Telephony Lebanon" property="og:title"> <meta content="website" property="og:type"> <meta content="Telephony a weblog dedicated on delivering mobile phone latest news, how to fix, information guides and tutorials about the iPhone, iPad and Android." property="og:description"> <meta content="http://telephony-lebanon.github.io/" property="og:url"> <meta content="/img/logo-high-resolution.png" property="og:image"> <link rel="apple-touch-icon" sizes="57x57" href="/favicons/apple-touch-icon-57x57.png"> <link rel="apple-touch-icon" sizes="60x60" href="/favicons/apple-touch-icon-60x60.png"> <link rel="apple-touch-icon" sizes="72x72" href="/favicons/apple-touch-icon-72x72.png"> <link rel="apple-touch-icon" sizes="76x76" href="/favicons/apple-touch-icon-76x76.png"> <link rel="apple-touch-icon" sizes="114x114" href="/favicons/apple-touch-icon-114x114.png"> <link rel="apple-touch-icon" sizes="120x120" href="/favicons/apple-touch-icon-120x120.png"> <link rel="apple-touch-icon" sizes="144x144" href="/favicons/apple-touch-icon-144x144.png"> <link rel="apple-touch-icon" sizes="152x152" href="/favicons/apple-touch-icon-152x152.png"> <link rel="apple-touch-icon" sizes="180x180" href="/favicons/apple-touch-icon-180x180.png"> <link rel="icon" type="image/png" href="/favicons/favicon-32x32.png" sizes="32x32"> <link rel="icon" type="image/png" href="/favicons/android-chrome-192x192.png" sizes="192x192"> <link rel="icon" type="image/png" href="/favicons/favicon-96x96.png" sizes="96x96"> <link rel="icon" type="image/png" href="/favicons/favicon-16x16.png" sizes="16x16"> <link rel="manifest" href="/favicons/manifest.json"> <link rel="mask-icon" href="/favicons/safari-pinned-tab.svg" color="#5bbad5"> <link rel="shortcut icon" href="/favicons/favicon.ico"> <meta name="apple-mobile-web-app-title" content="Telephony"> <meta name="application-name" content="Telephony"> <meta name="msapplication-TileColor" content="#2b5797"> <meta name="msapplication-TileImage" content="/favicons/mstile-144x144.png"> <meta name="msapplication-config" content="/favicons/browserconfig.xml"> <meta name="theme-color" content="#216a94"> <script defer type="text/javascript" src="/js/modernizr-2.8.3-respond-1.4.2.min.js"></script> </head> <body> <!--[if lt IE 8]> <p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> <![endif]--> <nav class="navbar navbar-default navbar-static-top"> <div class="container"> <!-- Brand and toggle get grouped for better mobile display --> <div class="navbar-header"> <a class="navbar-brand hidden-sm hidden-xs" href="/"> <img alt="Telephony" height="48" width="48" src="/favicons/android-chrome-48x48.png"> </a> <div class="col-md-offset-8"> <ul class="nav nav-pills nav-justified"> <li class="active"><a href="/">Home</a></li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"> Sites <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a class="navbar-underline text-center" href="/about/">About</a></li> <li><a class="navbar-underline text-center" href="/archive/">Archive</a></li> <li><a class="navbar-underline text-center" href="/sitemap/">Sitemap</a></li> <li><a class="navbar-underline text-center" href="/tags/">Tags</a></li> </ul> </li> <li><a class="navbar-underline" href="#contact-modal" data-toggle="modal">Contact</a></li> </ul> </div> </div> </div><!-- /.container-fluid --> </nav> <main> <div class="container"> <div class="row"> <div class="col-md-offset-2 col-md-8 col-sm-12 col-xs-12"> <div class="ad-widget"> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!-- Project 10 --> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-6486789455195658" data-ad-slot="4936588926" data-ad-format="auto"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> </div> <div class="main-side col-md-8 col-sm-12 col-xs-12"> <article class="post"> <div class="post-image "> <a href="/gmail-new-security-feature" > <img class=" img-responsive" src="/images/large/Google/google-hq-old.png" alt="Gmail new security feature"> </a> </div> <div class="post-body"> <div class="col-md-9 col-sm-9 col-xs-12" id="left-side-post"> <h2> <a href="/gmail-new-security-feature">Gmail new security feature</a> </h2> <p> By <span><a href="/about">Daniel Awde</a></span> • Feb 5, 2017 </p> <p>In honor of the <a href="https://www.saferinternetday.org/">Safer Internet</a> Day, Google on Tuesday announced in a blog post that it has added a lock icon in Gmail’s web interface to denote whether or not your emails are encrypted. Additionally, a question mark icon on a sender’s avatar indicates messages that are not authenticated.</p> </div> <div class="col-md-3 col-sm-3 col-xs-12" id="right-side-post"> <a role="button" class="btn btn-primary pull-right col-md-12 col-sm-12 col-xs-5" href="/gmail-new-security-feature">Read More</a> <a role="button" class="btn btn-default pull-left col-md-12 col-sm-12 col-offset-xs-2 col-xs-5" href="/gmail-new-security-feature#disqus_thread" data-disqus-identifier="Gmail new security feature"> <span class="fa fa-comment" aria-hidden="true"></span> <span class="disqus-comment-count" data-disqus-identifier="Gmail new security feature"></span> </a> </div> <div class="clear"></div> </div> <!-- <div class="col-md-6 col-sm-6 col-xs-12"> <div class="a2a_kit a2a_kit_size_32 a2a_default_style pull-right" data-a2a-url="/gmail-new-security-feature" data-a2a-title="Gmail new security feature" data-a2a-icon-color="#30d16a"> <a class="a2a_button_facebook"></a> <a class="a2a_button_twitter"></a> <a class="a2a_button_linkedin"></a> <a class="a2a_button_email"></a> </div> </div> --> </article> </div> <script id="dsq-count-scr" src="//telephony.disqus.com/count.js" async></script> <aside class="widget-side col-md-4 col-sm-12 col-xs-12"> <div class="widget" id="search"> <h3 class="h3-title">Search This Site</h3> <gcse:search></gcse:search> </div> <div class="ad-widget hidden-sm hidden-xs" id="ads"> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!-- Project 10 --> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-6486789455195658" data-ad-slot="4936588926" data-ad-format="auto"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> <div class="widget" id="tags"> <h3 class="h3-title">Tags</h3> <a class="btn btn-primary" role="button" href="/tags/Google/">Google</a> </div> <div class="widget" id="latest-post"> <h3 class="h3-title">Latest Posts</h3> <div class="row"> <div class="col-md-6 col-sm-12 col-xs-12"> <h4><a href="/gmail-new-security-feature">Gmail new security feature</a></h4> </div> <div class="col-md-6 col-sm-12 col-xs-12 margin-span text-center latest-post"> <ul class="list-unstyled"> <li class="center-div"> <a href="/gmail-new-security-feature" class="thumbnail"> <img height="100" width="150" class="img-rounded" src="/images/small/Google/google-hq-old.png" alt="Gmail new security feature"> </a> </li> <li class="text-center"> <ul class="list-unstyled"> <li><span class="fa fa-pencil"></span> <a href="/about">Daniel Awde</a></li> <li><span class="fa fa-clock-o"></span> Feb 5, 2017</li> </ul> </li> </ul> </div> </div> </div> <div class="widget"> <h3 class="h3-title">Archive</h3> <ul class="list-unstyled"> <li><a role="button" class="btn btn-default" href="/archive/#February 2017">February 2017 <span class="label label-primary">1</span></a></li> </ul> </div> </aside> <div class="clear-fix"></div> <div class="col-md-offset-2 col-md-8 col-sm-12 col-xs-12"> <div class="ad-widget"> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!-- Project 10 --> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-6486789455195658" data-ad-slot="4936588926" data-ad-format="auto"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> </div> </div> </div> </main> <footer> <div class="footer"> <div class="container"> <div class="row text-center"> <div id="about" class="col-lg-3 col-md-6 col-sm-6 col-xs-6"> <h3 class="h3-title" >About</h3> <p><b><a>Telephony</a></b> was founded in Jan 2016 as a weblog focused on delivering mobile phone information guides and tutorials about the iPhone, iPad and Android.The site is updated multiple times daily for best experience.</p> </div> <div class="col-lg-2 col-md-6 col-sm-6 col-xs-6"> <h3 class="h3-title">Home</h3> <ul class="list-unstyled"> <li><a href="/about/">About</a></li> <li><a href="/archive/">Archive</a></li> <li><a href="/sitemap/">Sitemap</a></li> <li><a href="/tags/">Tags</a></li> <li> Subscribe <a href="/feed.xml">via RSS</a> </li> </ul> </div> <div class="col-lg-3 col-md-12 col-sm-12 col-xs-12"> <h3 class="h3-title">Online Support</h3> <ul class="list-unstyled"> <li> <span class="fa fa-envelope"></span> <label>By Email:</label> <p> <a href="mailto:danielawde9@gmail.com" target="_blank"> danielawde9@gmail.com </a> </p> </li> <li> <span class="fa fa-phone"></span> <label>By Phone:</label> <p> <a href="tel:70979482"> Daniel Awde: 70 979 482 </a> </p> </li> <li> <span class="fa fa-map"></span> <label>Our location:</label> <p> <a href="https://goo.gl/maps/RQa0i" target="_blank"> Bater Al Shoof </a> </p> </li> </ul> </div> <div class="col-lg-4 col-md-12 col-sm-12 col-xs-12"> <ul class="list-unstyled"> <li> <h3 class="h3-title">Comming Soon!</h3> <label class="sr-only" for="subscribe">Enter your email</label> <div class="input-group"> <input class="form-control" placeholder="Email@you.com" type="email" id="subscribe" required autocomplete="on" name="email-subscribe" > <span class="input-group-btn"> <button class="btn btn-primary" type="button">Subscribe</button> </span> </div> </li> </ul> </div> </div> </div> </div> <div class="footer-bottom"> <div class="container"> Copyright © <a href="/about"><b>Daniel Awde</b></a> 2016. All right reserved. </div> </div> </footer> <div class="modal fade" tabindex="-1" id="contact-modal" role="dialog" aria-labelledby="contact-modal" aria-hidden="true"> <div class="modal-dialog "> <form class="form-horizontal" action="http://formspree.io/danielawde9@gmail.com" method="POST"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true" style="margin-top: 13px;"> <span class="fa fa-remove" aria-hidden="true"></span> <span class="sr-only">Close</span> </button> <h2 class="modal-title">Contact Us</h2> </div> <div class="modal-body"> <div class="form-group" id="contact-email-id"> <label for="contact-email" class="col-lg-2 control-label">Email:</label> <div class="col-lg-10"> <input type="email" name="_replyto" class="form-control" id="contact-name" placeholder="Email"> </div> </div> <div class="form-group" id="contact-msg-id"> <label for="contact-msg" class="col-lg-2 control-label">Message:</label> <div class="col-lg-10"> <textarea name="body" id="contact-msg" class="form-control" rows="8" placeholder="Description.."></textarea> </div> </div> <input type="text" name="_gotcha" style="display:none" /> <input type="hidden" name="_subject" value="Telephony Lebanon contact"/> <input type="hidden" name="_next" value="/thanks/" /> </div> <div class="modal-footer"> <input class="btn btn-primary pull-right" type="submit" value="Send"> <a role="button" class="btn btn-default pull-left" href="https://github.com/telephony-lebanon/telephony-lebanon.github.io/issues/new" target="_blank"> <span class="fa fa-github fa-lg"></span> Leave A feedback </a> </div> </div> </form> </div> </div> <!-- Google Tag Manager --> <noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-N4JV5P" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-N4JV5P');</script> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js" defer></script> <script src=" /js/main.js " defer></script> <script src=" /js/plugins.js " defer></script> <script src=" /js/bootstrap.min.js " defer></script> <link rel="stylesheet" href="/css/font-awesome.min.css" type="text/css"> <!-- Google Analytics --> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-72621708-1', 'auto'); ga('send', 'pageview'); </script> <!-- Google Search --> <script> (function() { var cx = '005948406272069975561:4viqqkrexwk'; var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = true; gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//cse.google.com/cse.js?cx=' + cx; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s); })(); </script> <script defer type="text/javascript" src="//static.addtoany.com/menu/page.js"></script> <!-- <script defer type="application/ld+json"> { "@context": "http://schema.org", "@type": "WebSite", "url": "http://telephony-lebanon.github.io/", "potentialAction": { "@type": "SearchAction", "target": "https://query.example.com/search?q={search_term_string}", "query-input": "required name=search_term_string" } } </script>--> </body> </html>
{ "content_hash": "2f6c8dc7a3f90477219c3e59fd7851b5", "timestamp": "", "source": "github", "line_count": 487, "max_line_length": 363, "avg_line_length": 46.63244353182751, "alnum_prop": 0.4706296785557023, "repo_name": "telephony-lebanon/telephony-lebanon.github.io", "id": "5c17a41aac8933620c696122aa513f4d94f80c73", "size": "22717", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "_site/index.html", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "78180" }, { "name": "CSS", "bytes": "15342" }, { "name": "HTML", "bytes": "98401" }, { "name": "JavaScript", "bytes": "7084" } ], "symlink_target": "" }
// Scintilla source code edit control /** @file Editor.h ** Defines the main editor class. **/ // Copyright 1998-2011 by Neil Hodgson <neilh@scintilla.org> // The License.txt file describes the conditions under which this software may be distributed. #ifndef EDITOR_H #define EDITOR_H namespace Scintilla { /** */ class Timer { public: bool ticking; int ticksToWait; enum {tickSize = 100}; TickerID tickerID; Timer(); }; /** */ class Idler { public: bool state; IdlerID idlerID; Idler(); }; /** * When platform has a way to generate an event before painting, * accumulate needed styling range and other work items in * WorkNeeded to avoid unnecessary work inside paint handler */ class WorkNeeded { public: enum workItems { workNone=0, workStyle=1, workUpdateUI=2 }; enum workItems items; Sci::Position upTo; WorkNeeded() : items(workNone), upTo(0) {} void Reset() { items = workNone; upTo = 0; } void Need(workItems items_, Sci::Position pos) { if ((items_ & workStyle) && (upTo < pos)) upTo = pos; items = static_cast<workItems>(items | items_); } }; /** * Hold a piece of text selected for copying or dragging, along with encoding and selection format information. */ class SelectionText { std::string s; public: bool rectangular; bool lineCopy; int codePage; int characterSet; SelectionText() : rectangular(false), lineCopy(false), codePage(0), characterSet(0) {} ~SelectionText() { } void Clear() { s.clear(); rectangular = false; lineCopy = false; codePage = 0; characterSet = 0; } void Copy(const std::string &s_, int codePage_, int characterSet_, bool rectangular_, bool lineCopy_) { s = s_; codePage = codePage_; characterSet = characterSet_; rectangular = rectangular_; lineCopy = lineCopy_; FixSelectionForClipboard(); } void Copy(const SelectionText &other) { Copy(other.s, other.codePage, other.characterSet, other.rectangular, other.lineCopy); } const char *Data() const { return s.c_str(); } size_t Length() const { return s.length(); } size_t LengthWithTerminator() const { return s.length() + 1; } bool Empty() const { return s.empty(); } private: void FixSelectionForClipboard() { // To avoid truncating the contents of the clipboard when pasted where the // clipboard contains NUL characters, replace NUL characters by spaces. std::replace(s.begin(), s.end(), '\0', ' '); } }; struct WrapPending { // The range of lines that need to be wrapped enum { lineLarge = 0x7ffffff }; Sci::Line start; // When there are wraps pending, will be in document range Sci::Line end; // May be lineLarge to indicate all of document after start WrapPending() { start = lineLarge; end = lineLarge; } void Reset() { start = lineLarge; end = lineLarge; } void Wrapped(Sci::Line line) { if (start == line) start++; } bool NeedsWrap() const { return start < end; } bool AddRange(Sci::Line lineStart, Sci::Line lineEnd) { const bool neededWrap = NeedsWrap(); bool changed = false; if (start > lineStart) { start = lineStart; changed = true; } if ((end < lineEnd) || !neededWrap) { end = lineEnd; changed = true; } return changed; } }; /** */ class Editor : public EditModel, public DocWatcher { protected: // ScintillaBase subclass needs access to much of Editor /** On GTK+, Scintilla is a container widget holding two scroll bars * whereas on Windows there is just one window with both scroll bars turned on. */ Window wMain; ///< The Scintilla parent window Window wMargin; ///< May be separate when using a scroll view for wMain /** Style resources may be expensive to allocate so are cached between uses. * When a style attribute is changed, this cache is flushed. */ bool stylesValid; ViewStyle vs; int technology; Point sizeRGBAImage; float scaleRGBAImage; MarginView marginView; EditView view; int cursorMode; bool hasFocus; bool mouseDownCaptures; bool mouseWheelCaptures; int xCaretMargin; ///< Ensure this many pixels visible on both sides of caret bool horizontalScrollBarVisible; int scrollWidth; bool verticalScrollBarVisible; bool endAtLastLine; int caretSticky; int marginOptions; bool mouseSelectionRectangularSwitch; bool multipleSelection; bool additionalSelectionTyping; int multiPasteMode; int virtualSpaceOptions; KeyMap kmap; Timer timer; Timer autoScrollTimer; enum { autoScrollDelay = 200 }; Idler idler; Point lastClick; unsigned int lastClickTime; Point doubleClickCloseThreshold; int dwellDelay; int ticksToDwell; bool dwelling; enum { selChar, selWord, selSubLine, selWholeLine } selectionType; Point ptMouseLast; enum { ddNone, ddInitial, ddDragging } inDragDrop; bool dropWentOutside; SelectionPosition posDrop; Sci::Position hotSpotClickPos; int lastXChosen; Sci::Position lineAnchorPos; Sci::Position originalAnchorPos; Sci::Position wordSelectAnchorStartPos; Sci::Position wordSelectAnchorEndPos; Sci::Position wordSelectInitialCaretPos; Sci::Position targetStart; Sci::Position targetEnd; int searchFlags; Sci::Line topLine; Sci::Position posTopLine; Sci::Position lengthForEncode; int needUpdateUI; enum { notPainting, painting, paintAbandoned } paintState; bool paintAbandonedByStyling; PRectangle rcPaint; bool paintingAllText; bool willRedrawAll; WorkNeeded workNeeded; int idleStyling; bool needIdleStyling; int modEventMask; SelectionText drag; int caretXPolicy; int caretXSlop; ///< Ensure this many pixels visible on both sides of caret int caretYPolicy; int caretYSlop; ///< Ensure this many lines visible on both sides of caret int visiblePolicy; int visibleSlop; Sci::Position searchAnchor; bool recordingMacro; int foldAutomatic; // Wrapping support WrapPending wrapPending; bool convertPastes; Editor(); // Deleted so Editor objects can not be copied. explicit Editor(const Editor &) = delete; Editor &operator=(const Editor &) = delete; ~Editor() override; virtual void Initialise() = 0; virtual void Finalise(); void InvalidateStyleData(); void InvalidateStyleRedraw(); void RefreshStyleData(); void SetRepresentations(); void DropGraphics(bool freeObjects); void AllocateGraphics(); // The top left visible point in main window coordinates. Will be 0,0 except for // scroll views where it will be equivalent to the current scroll position. virtual Point GetVisibleOriginInMain() const override; PointDocument DocumentPointFromView(Point ptView) const; // Convert a point from view space to document Sci::Line TopLineOfMain() const override; // Return the line at Main's y coordinate 0 virtual PRectangle GetClientRectangle() const; virtual PRectangle GetClientDrawingRectangle(); PRectangle GetTextRectangle() const; virtual Sci::Line LinesOnScreen() const override; Sci::Line LinesToScroll() const; Sci::Line MaxScrollPos() const; SelectionPosition ClampPositionIntoDocument(SelectionPosition sp) const; Point LocationFromPosition(SelectionPosition pos, PointEnd pe=peDefault); Point LocationFromPosition(Sci::Position pos, PointEnd pe=peDefault); int XFromPosition(Sci::Position pos); int XFromPosition(SelectionPosition sp); SelectionPosition SPositionFromLocation(Point pt, bool canReturnInvalid=false, bool charPosition=false, bool virtualSpace=true); Sci::Position PositionFromLocation(Point pt, bool canReturnInvalid = false, bool charPosition = false); SelectionPosition SPositionFromLineX(Sci::Line lineDoc, int x); Sci::Position PositionFromLineX(Sci::Line lineDoc, int x); Sci::Line LineFromLocation(Point pt) const; void SetTopLine(Sci::Line topLineNew); virtual bool AbandonPaint(); virtual void RedrawRect(PRectangle rc); virtual void DiscardOverdraw(); virtual void Redraw(); void RedrawSelMargin(Sci::Line line=-1, bool allAfter=false); PRectangle RectangleFromRange(Range r, int overlap); void InvalidateRange(Sci::Position start, Sci::Position end); bool UserVirtualSpace() const { return ((virtualSpaceOptions & SCVS_USERACCESSIBLE) != 0); } Sci::Position CurrentPosition() const; bool SelectionEmpty() const; SelectionPosition SelectionStart(); SelectionPosition SelectionEnd(); void SetRectangularRange(); void ThinRectangularRange(); void InvalidateSelection(SelectionRange newMain, bool invalidateWholeSelection=false); void InvalidateWholeSelection(); SelectionRange LineSelectionRange(SelectionPosition currentPos_, SelectionPosition anchor_) const; void SetSelection(SelectionPosition currentPos_, SelectionPosition anchor_); void SetSelection(Sci::Position currentPos_, Sci::Position anchor_); void SetSelection(SelectionPosition currentPos_); void SetSelection(int currentPos_); void SetEmptySelection(SelectionPosition currentPos_); void SetEmptySelection(Sci::Position currentPos_); enum AddNumber { addOne, addEach }; void MultipleSelectAdd(AddNumber addNumber); bool RangeContainsProtected(Sci::Position start, Sci::Position end) const; bool SelectionContainsProtected(); Sci::Position MovePositionOutsideChar(Sci::Position pos, Sci::Position moveDir, bool checkLineEnd=true) const; SelectionPosition MovePositionOutsideChar(SelectionPosition pos, Sci::Position moveDir, bool checkLineEnd=true) const; void MovedCaret(SelectionPosition newPos, SelectionPosition previousPos, bool ensureVisible); void MovePositionTo(SelectionPosition newPos, Selection::selTypes selt=Selection::noSel, bool ensureVisible=true); void MovePositionTo(Sci::Position newPos, Selection::selTypes selt=Selection::noSel, bool ensureVisible=true); SelectionPosition MovePositionSoVisible(SelectionPosition pos, int moveDir); SelectionPosition MovePositionSoVisible(Sci::Position pos, int moveDir); Point PointMainCaret(); void SetLastXChosen(); void ScrollTo(Sci::Line line, bool moveThumb=true); virtual void ScrollText(Sci::Line linesToMove); void HorizontalScrollTo(int xPos); void VerticalCentreCaret(); void MoveSelectedLines(int lineDelta); void MoveSelectedLinesUp(); void MoveSelectedLinesDown(); void MoveCaretInsideView(bool ensureVisible=true); Sci::Line DisplayFromPosition(Sci::Position pos); struct XYScrollPosition { int xOffset; Sci::Line topLine; XYScrollPosition(int xOffset_, Sci::Line topLine_) : xOffset(xOffset_), topLine(topLine_) {} bool operator==(const XYScrollPosition &other) const { return (xOffset == other.xOffset) && (topLine == other.topLine); } }; enum XYScrollOptions { xysUseMargin=0x1, xysVertical=0x2, xysHorizontal=0x4, xysDefault=xysUseMargin|xysVertical|xysHorizontal}; XYScrollPosition XYScrollToMakeVisible(const SelectionRange &range, const XYScrollOptions options); void SetXYScroll(XYScrollPosition newXY); void EnsureCaretVisible(bool useMargin=true, bool vert=true, bool horiz=true); void ScrollRange(SelectionRange range); void ShowCaretAtCurrentPosition(); void DropCaret(); void CaretSetPeriod(int period); void InvalidateCaret(); virtual void NotifyCaretMove(); virtual void UpdateSystemCaret(); bool Wrapping() const; void NeedWrapping(Sci::Line docLineStart=0, Sci::Line docLineEnd=WrapPending::lineLarge); bool WrapOneLine(Surface *surface, Sci::Line lineToWrap); enum class WrapScope {wsAll, wsVisible, wsIdle}; bool WrapLines(WrapScope ws); void LinesJoin(); void LinesSplit(int pixelWidth); void PaintSelMargin(Surface *surfaceWindow, PRectangle &rc); void RefreshPixMaps(Surface *surfaceWindow); void Paint(Surface *surfaceWindow, PRectangle rcArea); Sci::Position FormatRange(bool draw, Sci_RangeToFormat *pfr); int TextWidth(int style, const char *text); virtual void SetVerticalScrollPos() = 0; virtual void SetHorizontalScrollPos() = 0; virtual bool ModifyScrollBars(Sci::Line nMax, Sci::Line nPage) = 0; virtual void ReconfigureScrollBars(); void SetScrollBars(); void ChangeSize(); void FilterSelections(); Sci::Position RealizeVirtualSpace(Sci::Position position, Sci::Position virtualSpace); SelectionPosition RealizeVirtualSpace(const SelectionPosition &position); void AddChar(char ch); virtual void AddCharUTF(const char *s, unsigned int len, bool treatAsDBCS=false); void ClearBeforeTentativeStart(); void InsertPaste(const char *text, int len); enum PasteShape { pasteStream=0, pasteRectangular = 1, pasteLine = 2 }; void InsertPasteShape(const char *text, int len, PasteShape shape); void ClearSelection(bool retainMultipleSelections = false); void ClearAll(); void ClearDocumentStyle(); virtual void Cut(); void PasteRectangular(SelectionPosition pos, const char *ptr, Sci::Position len); virtual void Copy() = 0; virtual void CopyAllowLine(); virtual bool CanPaste(); virtual void Paste() = 0; void Clear(); virtual void SelectAll(); virtual void Undo(); virtual void Redo(); void DelCharBack(bool allowLineStartDeletion); virtual void ClaimSelection() = 0; static int ModifierFlags(bool shift, bool ctrl, bool alt, bool meta=false, bool super=false); virtual void NotifyChange() = 0; virtual void NotifyFocus(bool focus); virtual void SetCtrlID(int identifier); virtual int GetCtrlID() { return ctrlID; } virtual void NotifyParent(SCNotification scn) = 0; virtual void NotifyStyleToNeeded(Sci::Position endStyleNeeded); void NotifyChar(int ch); void NotifySavePoint(bool isSavePoint); void NotifyModifyAttempt(); virtual void NotifyDoubleClick(Point pt, int modifiers); void NotifyHotSpotClicked(Sci::Position position, int modifiers); void NotifyHotSpotDoubleClicked(Sci::Position position, int modifiers); void NotifyHotSpotReleaseClick(Sci::Position position, int modifiers); bool NotifyUpdateUI(); void NotifyPainted(); void NotifyIndicatorClick(bool click, Sci::Position position, int modifiers); bool NotifyMarginClick(Point pt, int modifiers); bool NotifyMarginRightClick(Point pt, int modifiers); void NotifyNeedShown(Sci::Position pos, Sci::Position len); void NotifyDwelling(Point pt, bool state); void NotifyZoom(); void NotifyModifyAttempt(Document *document, void *userData) override; void NotifySavePoint(Document *document, void *userData, bool atSavePoint) override; void CheckModificationForWrap(DocModification mh); void NotifyModified(Document *document, DocModification mh, void *userData) override; void NotifyDeleted(Document *document, void *userData) override; void NotifyStyleNeeded(Document *doc, void *userData, Sci::Position endStyleNeeded) override; void NotifyLexerChanged(Document *doc, void *userData) override; void NotifyErrorOccurred(Document *doc, void *userData, int status) override; void NotifyMacroRecord(unsigned int iMessage, uptr_t wParam, sptr_t lParam); void ContainerNeedsUpdate(int flags); void PageMove(int direction, Selection::selTypes selt=Selection::noSel, bool stuttered = false); enum { cmSame, cmUpper, cmLower }; virtual std::string CaseMapString(const std::string &s, int caseMapping); void ChangeCaseOfSelection(int caseMapping); void LineTranspose(); void LineReverse(); void Duplicate(bool forLine); virtual void CancelModes(); void NewLine(); SelectionPosition PositionUpOrDown(SelectionPosition spStart, int direction, int lastX); void CursorUpOrDown(int direction, Selection::selTypes selt); void ParaUpOrDown(int direction, Selection::selTypes selt); Range RangeDisplayLine(Sci::Line lineVisible); Sci::Position StartEndDisplayLine(Sci::Position pos, bool start); Sci::Position VCHomeDisplayPosition(Sci::Position position); Sci::Position VCHomeWrapPosition(Sci::Position position); Sci::Position LineEndWrapPosition(Sci::Position position); int HorizontalMove(unsigned int iMessage); int DelWordOrLine(unsigned int iMessage); virtual int KeyCommand(unsigned int iMessage); virtual int KeyDefault(int /* key */, int /*modifiers*/); int KeyDownWithModifiers(int key, int modifiers, bool *consumed); void Indent(bool forwards); virtual CaseFolder *CaseFolderForEncoding(); Sci::Position FindText(uptr_t wParam, sptr_t lParam); void SearchAnchor(); Sci::Position SearchText(unsigned int iMessage, uptr_t wParam, sptr_t lParam); Sci::Position SearchInTarget(const char *text, Sci::Position length); void GoToLine(Sci::Line lineNo); virtual void CopyToClipboard(const SelectionText &selectedText) = 0; std::string RangeText(Sci::Position start, Sci::Position end) const; void CopySelectionRange(SelectionText *ss, bool allowLineCopy=false); void CopyRangeToClipboard(Sci::Position start, Sci::Position end); void CopyText(int length, const char *text); void SetDragPosition(SelectionPosition newPos); virtual void DisplayCursor(Window::Cursor c); virtual bool DragThreshold(Point ptStart, Point ptNow); virtual void StartDrag(); void DropAt(SelectionPosition position, const char *value, size_t lengthValue, bool moving, bool rectangular); void DropAt(SelectionPosition position, const char *value, bool moving, bool rectangular); /** PositionInSelection returns true if position in selection. */ bool PositionInSelection(Sci::Position pos); bool PointInSelection(Point pt); bool PointInSelMargin(Point pt) const; Window::Cursor GetMarginCursor(Point pt) const; void TrimAndSetSelection(Sci::Position currentPos_, Sci::Position anchor_); void LineSelection(Sci::Position lineCurrentPos_, Sci::Position lineAnchorPos_, bool wholeLine); void WordSelection(Sci::Position pos); void DwellEnd(bool mouseMoved); void MouseLeave(); virtual void ButtonDownWithModifiers(Point pt, unsigned int curTime, int modifiers); virtual void RightButtonDownWithModifiers(Point pt, unsigned int curTime, int modifiers); void ButtonMoveWithModifiers(Point pt, unsigned int curTime, int modifiers); void ButtonUpWithModifiers(Point pt, unsigned int curTime, int modifiers); bool Idle(); enum TickReason { tickCaret, tickScroll, tickWiden, tickDwell, tickPlatform }; virtual void TickFor(TickReason reason); virtual bool FineTickerRunning(TickReason reason); virtual void FineTickerStart(TickReason reason, int millis, int tolerance); virtual void FineTickerCancel(TickReason reason); virtual bool SetIdle(bool) { return false; } virtual void SetMouseCapture(bool on) = 0; virtual bool HaveMouseCapture() = 0; void SetFocusState(bool focusState); Sci::Position PositionAfterArea(PRectangle rcArea) const; void StyleToPositionInView(Sci::Position pos); Sci::Position PositionAfterMaxStyling(Sci::Position posMax, bool scrolling) const; void StartIdleStyling(bool truncatedLastStyling); void StyleAreaBounded(PRectangle rcArea, bool scrolling); void IdleStyling(); virtual void IdleWork(); virtual void QueueIdleWork(WorkNeeded::workItems items, Sci::Position upTo=0); virtual bool PaintContains(PRectangle rc); bool PaintContainsMargin(); void CheckForChangeOutsidePaint(Range r); void SetBraceHighlight(Sci::Position pos0, Sci::Position pos1, int matchStyle); void SetAnnotationHeights(Sci::Line start, Sci::Line end); virtual void SetDocPointer(Document *document); void SetAnnotationVisible(int visible); Sci::Line ExpandLine(Sci::Line line); void SetFoldExpanded(Sci::Line lineDoc, bool expanded); void FoldLine(Sci::Line line, int action); void FoldExpand(Sci::Line line, int action, int level); Sci::Line ContractedFoldNext(Sci::Line lineStart) const; void EnsureLineVisible(Sci::Line lineDoc, bool enforcePolicy); void FoldChanged(Sci::Line line, int levelNow, int levelPrev); void NeedShown(Sci::Position pos, Sci::Position len); void FoldAll(int action); Sci::Position GetTag(char *tagValue, int tagNumber); Sci::Position ReplaceTarget(bool replacePatterns, const char *text, Sci::Position length=-1); bool PositionIsHotspot(Sci::Position position) const; bool PointIsHotspot(Point pt); void SetHotSpotRange(const Point *pt); Range GetHotSpotRange() const override; void SetHoverIndicatorPosition(Sci::Position position); void SetHoverIndicatorPoint(Point pt); int CodePage() const; virtual bool ValidCodePage(int /* codePage */) const { return true; } int WrapCount(int line); void AddStyledText(char *buffer, Sci::Position appendLength); virtual sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) = 0; bool ValidMargin(uptr_t wParam) const; void StyleSetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam); sptr_t StyleGetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam); void SetSelectionNMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam); static const char *StringFromEOLMode(int eolMode); static sptr_t StringResult(sptr_t lParam, const char *val); static sptr_t BytesResult(sptr_t lParam, const unsigned char *val, size_t len); public: // Public so the COM thunks can access it. bool IsUnicodeMode() const; // Public so scintilla_send_message can use it. virtual sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam); // Public so scintilla_set_id can use it. int ctrlID; // Public so COM methods for drag and drop can set it. int errorStatus; friend class AutoSurface; friend class SelectionLineIterator; }; /** * A smart pointer class to ensure Surfaces are set up and deleted correctly. */ class AutoSurface { private: std::unique_ptr<Surface> surf; public: AutoSurface(Editor *ed, int technology = -1) { if (ed->wMain.GetID()) { surf.reset(Surface::Allocate(technology != -1 ? technology : ed->technology)); surf->Init(ed->wMain.GetID()); surf->SetUnicodeMode(SC_CP_UTF8 == ed->CodePage()); surf->SetDBCSMode(ed->CodePage()); } } AutoSurface(SurfaceID sid, Editor *ed, int technology = -1) { if (ed->wMain.GetID()) { surf.reset(Surface::Allocate(technology != -1 ? technology : ed->technology)); surf->Init(sid, ed->wMain.GetID()); surf->SetUnicodeMode(SC_CP_UTF8 == ed->CodePage()); surf->SetDBCSMode(ed->CodePage()); } } // Deleted so AutoSurface objects can not be copied. AutoSurface(const AutoSurface &) = delete; void operator=(const AutoSurface &) = delete; ~AutoSurface() { } Surface *operator->() const { return surf.get(); } operator Surface *() const { return surf.get(); } }; } #endif
{ "content_hash": "f71acce9b3c50675c2033463a2e820c1", "timestamp": "", "source": "github", "line_count": 625, "max_line_length": 129, "avg_line_length": 35.2352, "alnum_prop": 0.7655072200526746, "repo_name": "louisliangjun/puss", "id": "2e8ac15037ca3fe5d36f7b59b13ba15adda77751", "size": "22022", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "plugins/puss_imgui/scintilla3/src/Editor.h", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "715" }, { "name": "C", "bytes": "4338191" }, { "name": "C++", "bytes": "5365759" }, { "name": "CSS", "bytes": "2721" }, { "name": "HTML", "bytes": "357345" }, { "name": "Lua", "bytes": "211039" }, { "name": "Makefile", "bytes": "10184" }, { "name": "Objective-C", "bytes": "13600" }, { "name": "Roff", "bytes": "5263" }, { "name": "Shell", "bytes": "272" } ], "symlink_target": "" }
/* tslint:disable:max-file-line-count */ 'use strict'; import { StructureCheck, FileRule, FileResult } from "../../../general/structure-check/structure-check"; import { Barrier } from "metristic-core"; /* file structure: root index.html LICENSE scripts font-size.js styles style.css app.css */ let paths = [ '/root', '/root/index.html', '/root/LICENSE', '/root/scripts', '/root/styles', '/root/scripts/font-size.js', '/root/styles/style.css', '/root/styles/app.css' ]; let dirs = ['/root', '/root/scripts', '/root/styles', '/root/LICENSE']; let files = ['/root/index.html', '/root/scripts/font-size.js', '/root/styles/style.css', '/root/styles/app.css']; let fs = { readdir: (path: string, callback: (error: Error, files: string[]) => void) => { switch (path) { case '/root': callback(null, ['index.html', 'LICENSE', 'scripts', 'styles']); break; case '/root/scripts': callback(null, ['font-size.js']); break; case '/root/styles': callback(null, ['style.css', 'app.css']); break; default: callback(null, []); } }, existsSync: (path): boolean => { return paths.indexOf(path) >= 0; }, statSync: (path): { isDirectory: () => boolean, isFile: () => boolean } => { if (paths.indexOf(path) >= 0) { return { isDirectory: () => { return dirs.indexOf(path) >= 0; }, isFile: () => { return files.indexOf(path) >= 0; } }; } else { throw new Error(`ENOENT: no such file or directory, stat ${path}`); } } }; describe("Structure check", () => { let errors; let fileResult; beforeEach(() => { errors = []; fileResult = {}; }); afterEach(() => { expect(errors).toEqual([]); }); describe("checking directory or file [1] ", () => { it('should return "present" for present file [1.1]', () => { StructureCheck.checkDirOrFile(fs, null, {}, '/root/index.html', fileResult); expect(fileResult).toEqual({ present: true }); }); it('should return "missing" for not present file [1.2]', () => { StructureCheck.checkDirOrFile(fs, null, {}, '/root/README.md', fileResult); expect(fileResult).toEqual({ present: false, missing: true }); }); it('should not return "missing" for not present optional file [1.3]', () => { StructureCheck.checkDirOrFile(fs, null, { optional: true }, '/root/README.md', fileResult); expect(fileResult).toEqual({ present: false }); }); it('should return "forbidden" for present file missing parent rule [1.4]', () => { StructureCheck.checkDirOrFile(fs, null, null, '/root/index.html', fileResult); expect(fileResult).toEqual({ present: true, additional: true, forbidden: true }); }); it('should return "forbidden" for present file not allowed in parent rule [1.5]', () => { StructureCheck.checkDirOrFile(fs, { additionalContentForbidden: true }, null, '/root/index.html', fileResult); expect(fileResult).toEqual({ present: true, additional: true, forbidden: true }); }); it('should not return "forbidden" for present file allowed in parent rule [1.6]', () => { StructureCheck.checkDirOrFile(fs, {}, null, '/root/index.html', fileResult); expect(fileResult).toEqual({ present: true, additional: true }); }); it('should return "wrongType" for expected file which is a directory [1.7]', () => { StructureCheck.checkDirOrFile(fs, null, { type: 'FILE' }, '/root/styles', fileResult); expect(fileResult).toEqual({ present: true, wrongType: true }); }); it('should return "wrongType" for expected directory which is a file [1.8]', () => { StructureCheck.checkDirOrFile(fs, null, { type: 'DIR' }, '/root/index.html', fileResult); expect(fileResult).toEqual({ present: true, wrongType: true }); }); it('should not return "wrongType" for expected directory which is not present and a file [1.9]', () => { StructureCheck.checkDirOrFile(fs, null, { type: 'DIR' }, '/root/README.md', fileResult); expect(fileResult).toEqual({ present: false, missing: true }); }); it('should not return "wrongType" for expected file which is not present and a directory [1.9]', () => { StructureCheck.checkDirOrFile(fs, null, { type: 'DIR' }, '/root/images', fileResult); expect(fileResult).toEqual({ present: false, missing: true }); }); }); describe("checking complete structure [2] ", () => { let rule: FileRule = { additionalContentForbidden: true, children: { 'index.html': {}, 'README.md': {}, 'LICENSE': { type: 'FILE' }, 'humans.txt': { optional: true }, 'styles': { children: { 'style.css': {}, '*': { type: 'DIR' } } } } }; let expectedResults: { [name: string]: FileResult } = { 'root': { absolutePath: '/root', children: { 'index.html': { absolutePath: '/root/index.html', present: true }, 'README.md': { absolutePath: '/root/README.md', present: false, missing: true }, 'LICENSE': { absolutePath: '/root/LICENSE', present: true, wrongType: true, children: {} }, 'humans.txt': { absolutePath: '/root/humans.txt', present: false }, 'styles': { absolutePath: '/root/styles', present: true, children: { 'style.css': { absolutePath: '/root/styles/style.css', present: true }, 'app.css': { absolutePath: '/root/styles/app.css', present: true, wrongType: true } } }, 'scripts' : { absolutePath: '/root/scripts', present: true, additional: true, forbidden: true, children: { 'font-size.js': { absolutePath: '/root/scripts/font-size.js', present: true, additional: true } } } } } }; it('should match expected results [2.1]', () => { let barrier = new Barrier(1).then(() => {}); StructureCheck.walkStructure(barrier, fs, '', '/root', null, rule, fileResult, errors); expect(fileResult).toEqual(expectedResults); expect(barrier.waitingFor()).toBe(0); }); }); describe("checking for empty rules [3]", () => { it("should not fail on missing child rule [3.1]", () => { let paths2 = ['/root', '/root/calculator', '/root/calculator/script.js']; let fs2 = { readdir: (path: string, callback: (error: Error, files: string[]) => void) => { switch (path) { case '/root': callback(null, ['calculator']); break; case '/root/calculator': callback(null, ['script.js']); break; default: callback(null, []); } }, existsSync: (path): boolean => { return paths2.indexOf(path) >= 0; }, statSync: (path): { isDirectory: () => boolean, isFile: () => boolean } => { if (paths2.indexOf(path) >= 0) { return { isDirectory: () => { return ['/root', '/root/calculator'].indexOf(path) >= 0; }, isFile: () => { return ['/root/calculator/script.js'].indexOf(path) >= 0; } }; } else { throw new Error(`ENOENT: no such file or directory, stat ${path}`); } } }; let expectedResults: { [name: string]: FileResult } = { 'root': { absolutePath: '/root', children: { 'calculator': { absolutePath: '/root/calculator', present: true, additional: true, children: { 'script.js': { absolutePath: '/root/calculator/script.js', present: true, additional: true } } } } } }; let rule = <FileRule> {}; let barrier = new Barrier(1).then(() => {}); StructureCheck.walkStructure(barrier, fs2, '', '/root', null, rule || {}, fileResult, errors); expect(fileResult).toEqual(expectedResults); expect(barrier.waitingFor()).toBe(0); }); }); });
{ "content_hash": "25178bb9b0bb2b04b8204838b54272be", "timestamp": "", "source": "github", "line_count": 247, "max_line_length": 113, "avg_line_length": 31.11740890688259, "alnum_prop": 0.5900338277387458, "repo_name": "IFS-Web/HSR.Metristic.Plugin.General", "id": "2947b86845cbb61f38d243edbdfe8c147ca2a0b4", "size": "7686", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/tests/check-plugins/structure-check/structure-check.spec.ts", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "582" }, { "name": "HTML", "bytes": "3468" }, { "name": "JavaScript", "bytes": "1699" }, { "name": "TypeScript", "bytes": "59867" } ], "symlink_target": "" }
<? return [ 'routes' => [ ['members\/pages\/(?P<group_sub_id_hash>.*)', 'Members', 'ManageUserPages'], // Manage user pages ['members\/page\/(?P<page_id_hash>.*)', 'Members', 'ViewUserPage'], // View user page ['admin\/members\/pages\/(?P<group_sub_id_hash>.*)\/groups\/add', 'Members', 'AddPagesGroup'], // Add pages group ['admin\/members\/pages\/(?P<group_sub_id_hash>.*)\/groups\/(?P<group_id_hash>.*)\/edit', 'Members', 'EditPagesGroup'], // Edit pages group ['admin\/members\/pages\/(?P<group_sub_id_hash>.*)\/add(\?.*)?', 'Members', 'AddPage'], // Add page ['admin\/members\/pages\/(?P<group_sub_id_hash>.*)\/edit\/(?P<page_id_hash>.*)', 'Members', 'EditPage'], // Edit page ['admin\/members\/pages\/(?P<group_sub_id_hash>.*)', 'Members', 'ManagePages'], // Manage pages ['admin\/members\/page\/(?P<page_id_hash>.*)', 'Members', 'ViewPage'], // View page ['admin\/members\/settings(\?.*)?', 'Members', 'Settings'], // Members settings // API ['admin\/members\/api\/pages\/add\.json(\?.*)?', 'Members', 'APIAddPage'], // [API] Add page ['admin\/members\/api\/pages\/remove\.json(\?.*)?', 'Members', 'APIRemovePage'], // [API] Remove page ['admin\/members\/api\/pages\/update\.json(\?.*)?', 'Members', 'APIUpdatePage'], // [API] Update page ['admin\/members\/api\/pages\/groups\/add\.json(\?.*)?', 'Members', 'APIAddPagesGroup'], // [API] Add pages group ['admin\/members\/api\/pages\/groups\/remove\.json(\?.*)?', 'Members', 'APIRemovePagesGroup'], // [API] Remove pages group ['admin\/members\/api\/pages\/groups\/update\.json(\?.*)?', 'Members', 'APIUpdatePagesGroup'], // [API] Update pages group ['admin\/members\/api\/pages\/get\.json(\?.*)?', 'Members', 'APIGetPages'], // [API] Get page ['admin\/members\/api\/settings\/update\.json(\?.*)?', 'Members', 'APIUpdateSettings'], // [API] Update members settings ] ];
{ "content_hash": "f1f6dd6d150d8693c7fdf81ae5ccc1d6", "timestamp": "", "source": "github", "line_count": 29, "max_line_length": 152, "avg_line_length": 87.48275862068965, "alnum_prop": 0.446196294836421, "repo_name": "kosenkoandrey/mailiq-pult", "id": "b87233ff97cc907a23b3cbf0d18afdf949e59ba1", "size": "2537", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "protected/modules/Members/conf.php", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "23312" }, { "name": "CSS", "bytes": "3262908" }, { "name": "CoffeeScript", "bytes": "14351" }, { "name": "HTML", "bytes": "7488932" }, { "name": "JavaScript", "bytes": "4795592" }, { "name": "Makefile", "bytes": "405" }, { "name": "PHP", "bytes": "10694485" }, { "name": "Shell", "bytes": "680" } ], "symlink_target": "" }
package org.jfree.chart.renderer.category; import java.awt.AlphaComposite; import java.awt.Composite; import java.awt.Font; import java.awt.GradientPaint; import java.awt.Graphics2D; import java.awt.Paint; import java.awt.Shape; import java.awt.Stroke; import java.awt.geom.Ellipse2D; import java.awt.geom.Line2D; import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import org.jfree.chart.LegendItem; import org.jfree.chart.LegendItemCollection; import org.jfree.chart.axis.CategoryAxis; import org.jfree.chart.axis.ValueAxis; import org.jfree.chart.entity.CategoryItemEntity; import org.jfree.chart.entity.EntityCollection; import org.jfree.chart.event.RendererChangeEvent; import org.jfree.chart.labels.CategoryItemLabelGenerator; import org.jfree.chart.labels.CategorySeriesLabelGenerator; import org.jfree.chart.labels.CategoryToolTipGenerator; import org.jfree.chart.labels.ItemLabelPosition; import org.jfree.chart.labels.StandardCategorySeriesLabelGenerator; import org.jfree.chart.plot.CategoryCrosshairState; import org.jfree.chart.plot.CategoryMarker; import org.jfree.chart.plot.CategoryPlot; import org.jfree.chart.plot.DrawingSupplier; import org.jfree.chart.plot.IntervalMarker; import org.jfree.chart.plot.Marker; import org.jfree.chart.plot.PlotOrientation; import org.jfree.chart.plot.PlotRenderingInfo; import org.jfree.chart.plot.ValueMarker; import org.jfree.chart.renderer.AbstractRenderer; import org.jfree.chart.urls.CategoryURLGenerator; import org.jfree.chart.util.ParamChecks; import org.jfree.data.Range; import org.jfree.data.category.CategoryDataset; import org.jfree.data.general.DatasetUtilities; import org.jfree.text.TextUtilities; import org.jfree.ui.GradientPaintTransformer; import org.jfree.ui.LengthAdjustmentType; import org.jfree.ui.RectangleAnchor; import org.jfree.ui.RectangleEdge; import org.jfree.ui.RectangleInsets; import org.jfree.util.ObjectList; import org.jfree.util.ObjectUtilities; import org.jfree.util.PublicCloneable; import org.jfree.util.SortOrder; /** * An abstract base class that you can use to implement a new * {@link CategoryItemRenderer}. When you create a new * {@link CategoryItemRenderer} you are not required to extend this class, * but it makes the job easier. */ public abstract class AbstractCategoryItemRenderer extends AbstractRenderer implements CategoryItemRenderer, Cloneable, PublicCloneable, Serializable { /** For serialization. */ private static final long serialVersionUID = 1247553218442497391L; /** The plot that the renderer is assigned to. */ private CategoryPlot plot; /** A list of item label generators (one per series). */ private ObjectList itemLabelGeneratorList; /** The base item label generator. */ private CategoryItemLabelGenerator baseItemLabelGenerator; /** A list of tool tip generators (one per series). */ private ObjectList toolTipGeneratorList; /** The base tool tip generator. */ private CategoryToolTipGenerator baseToolTipGenerator; /** A list of item label generators (one per series). */ private ObjectList itemURLGeneratorList; /** The base item label generator. */ private CategoryURLGenerator baseItemURLGenerator; /** The legend item label generator. */ private CategorySeriesLabelGenerator legendItemLabelGenerator; /** The legend item tool tip generator. */ private CategorySeriesLabelGenerator legendItemToolTipGenerator; /** The legend item URL generator. */ private CategorySeriesLabelGenerator legendItemURLGenerator; /** The number of rows in the dataset (temporary record). */ private transient int rowCount; /** The number of columns in the dataset (temporary record). */ private transient int columnCount; /** * Creates a new renderer with no tool tip generator and no URL generator. * The defaults (no tool tip or URL generators) have been chosen to * minimise the processing required to generate a default chart. If you * require tool tips or URLs, then you can easily add the required * generators. */ protected AbstractCategoryItemRenderer() { this.itemLabelGenerator = null; this.itemLabelGeneratorList = new ObjectList(); this.toolTipGenerator = null; this.toolTipGeneratorList = new ObjectList(); this.itemURLGenerator = null; this.itemURLGeneratorList = new ObjectList(); this.legendItemLabelGenerator = new StandardCategorySeriesLabelGenerator(); } /** * Returns the number of passes through the dataset required by the * renderer. This method returns <code>1</code>, subclasses should * override if they need more passes. * * @return The pass count. */ @Override public int getPassCount() { return 1; } /** * Returns the plot that the renderer has been assigned to (where * <code>null</code> indicates that the renderer is not currently assigned * to a plot). * * @return The plot (possibly <code>null</code>). * * @see #setPlot(CategoryPlot) */ @Override public CategoryPlot getPlot() { return this.plot; } /** * Sets the plot that the renderer has been assigned to. This method is * usually called by the {@link CategoryPlot}, in normal usage you * shouldn't need to call this method directly. * * @param plot the plot (<code>null</code> not permitted). * * @see #getPlot() */ @Override public void setPlot(CategoryPlot plot) { ParamChecks.nullNotPermitted(plot, "plot"); this.plot = plot; } // ITEM LABEL GENERATOR /** * Returns the item label generator for a data item. This implementation * simply passes control to the {@link #getSeriesItemLabelGenerator(int)} * method. If, for some reason, you want a different generator for * individual items, you can override this method. * * @param row the row index (zero based). * @param column the column index (zero based). * * @return The generator (possibly <code>null</code>). */ @Override public CategoryItemLabelGenerator getItemLabelGenerator(int row, int column) { return getSeriesItemLabelGenerator(row); } /** * Returns the item label generator for a series. * * @param series the series index (zero based). * * @return The generator (possibly <code>null</code>). * * @see #setSeriesItemLabelGenerator(int, CategoryItemLabelGenerator) */ @Override public CategoryItemLabelGenerator getSeriesItemLabelGenerator(int series) { // return the generator for ALL series, if there is one... if (this.itemLabelGenerator != null) { return this.itemLabelGenerator; } // otherwise look up the generator table CategoryItemLabelGenerator generator = (CategoryItemLabelGenerator) this.itemLabelGeneratorList.get(series); if (generator == null) { generator = this.baseItemLabelGenerator; } return generator; } /** * Sets the item label generator for a series and sends a * {@link RendererChangeEvent} to all registered listeners. * * @param series the series index (zero based). * @param generator the generator (<code>null</code> permitted). * * @see #getSeriesItemLabelGenerator(int) */ @Override public void setSeriesItemLabelGenerator(int series, CategoryItemLabelGenerator generator) { this.itemLabelGeneratorList.set(series, generator); fireChangeEvent(); } /** * Returns the base item label generator. * * @return The generator (possibly <code>null</code>). * * @see #setBaseItemLabelGenerator(CategoryItemLabelGenerator) */ @Override public CategoryItemLabelGenerator getBaseItemLabelGenerator() { return this.baseItemLabelGenerator; } /** * Sets the base item label generator and sends a * {@link RendererChangeEvent} to all registered listeners. * * @param generator the generator (<code>null</code> permitted). * * @see #getBaseItemLabelGenerator() */ @Override public void setBaseItemLabelGenerator( CategoryItemLabelGenerator generator) { this.baseItemLabelGenerator = generator; fireChangeEvent(); } // TOOL TIP GENERATOR /** * Returns the tool tip generator that should be used for the specified * item. This method looks up the generator using the "three-layer" * approach outlined in the general description of this interface. You * can override this method if you want to return a different generator per * item. * * @param row the row index (zero-based). * @param column the column index (zero-based). * * @return The generator (possibly <code>null</code>). */ @Override public CategoryToolTipGenerator getToolTipGenerator(int row, int column) { CategoryToolTipGenerator result; if (this.toolTipGenerator != null) { result = this.toolTipGenerator; } else { result = getSeriesToolTipGenerator(row); if (result == null) { result = this.baseToolTipGenerator; } } return result; } /** * Returns the tool tip generator for the specified series (a "layer 1" * generator). * * @param series the series index (zero-based). * * @return The tool tip generator (possibly <code>null</code>). * * @see #setSeriesToolTipGenerator(int, CategoryToolTipGenerator) */ @Override public CategoryToolTipGenerator getSeriesToolTipGenerator(int series) { return (CategoryToolTipGenerator) this.toolTipGeneratorList.get(series); } /** * Sets the tool tip generator for a series and sends a * {@link RendererChangeEvent} to all registered listeners. * * @param series the series index (zero-based). * @param generator the generator (<code>null</code> permitted). * * @see #getSeriesToolTipGenerator(int) */ @Override public void setSeriesToolTipGenerator(int series, CategoryToolTipGenerator generator) { this.toolTipGeneratorList.set(series, generator); fireChangeEvent(); } /** * Returns the base tool tip generator (the "layer 2" generator). * * @return The tool tip generator (possibly <code>null</code>). * * @see #setBaseToolTipGenerator(CategoryToolTipGenerator) */ @Override public CategoryToolTipGenerator getBaseToolTipGenerator() { return this.baseToolTipGenerator; } /** * Sets the base tool tip generator and sends a {@link RendererChangeEvent} * to all registered listeners. * * @param generator the generator (<code>null</code> permitted). * * @see #getBaseToolTipGenerator() */ @Override public void setBaseToolTipGenerator(CategoryToolTipGenerator generator) { this.baseToolTipGenerator = generator; fireChangeEvent(); } // URL GENERATOR /** * Returns the URL generator for a data item. This method just calls the * getSeriesItemURLGenerator method, but you can override this behaviour if * you want to. * * @param row the row index (zero based). * @param column the column index (zero based). * * @return The URL generator. */ @Override public CategoryURLGenerator getItemURLGenerator(int row, int column) { return getSeriesItemURLGenerator(row); } /** * Returns the URL generator for a series. * * @param series the series index (zero based). * * @return The URL generator for the series. * * @see #setSeriesItemURLGenerator(int, CategoryURLGenerator) */ @Override public CategoryURLGenerator getSeriesItemURLGenerator(int series) { // return the generator for ALL series, if there is one... if (this.itemURLGenerator != null) { return this.itemURLGenerator; } // otherwise look up the generator table CategoryURLGenerator generator = (CategoryURLGenerator) this.itemURLGeneratorList.get(series); if (generator == null) { generator = this.baseItemURLGenerator; } return generator; } /** * Sets the URL generator for a series and sends a * {@link RendererChangeEvent} to all registered listeners. * * @param series the series index (zero based). * @param generator the generator. * * @see #getSeriesItemURLGenerator(int) */ @Override public void setSeriesItemURLGenerator(int series, CategoryURLGenerator generator) { this.itemURLGeneratorList.set(series, generator); fireChangeEvent(); } /** * Returns the base item URL generator. * * @return The item URL generator. * * @see #setBaseItemURLGenerator(CategoryURLGenerator) */ @Override public CategoryURLGenerator getBaseItemURLGenerator() { return this.baseItemURLGenerator; } /** * Sets the base item URL generator and sends a * {@link RendererChangeEvent} to all registered listeners. * * @param generator the item URL generator (<code>null</code> permitted). * * @see #getBaseItemURLGenerator() */ @Override public void setBaseItemURLGenerator(CategoryURLGenerator generator) { this.baseItemURLGenerator = generator; fireChangeEvent(); } /** * Returns the number of rows in the dataset. This value is updated in the * {@link AbstractCategoryItemRenderer#initialise} method. * * @return The row count. */ public int getRowCount() { return this.rowCount; } /** * Returns the number of columns in the dataset. This value is updated in * the {@link AbstractCategoryItemRenderer#initialise} method. * * @return The column count. */ public int getColumnCount() { return this.columnCount; } /** * Creates a new state instance---this method is called from the * {@link #initialise(Graphics2D, Rectangle2D, CategoryPlot, int, * PlotRenderingInfo)} method. Subclasses can override this method if * they need to use a subclass of {@link CategoryItemRendererState}. * * @param info collects plot rendering info (<code>null</code> permitted). * * @return The new state instance (never <code>null</code>). * * @since 1.0.5 */ protected CategoryItemRendererState createState(PlotRenderingInfo info) { return new CategoryItemRendererState(info); } /** * Initialises the renderer and returns a state object that will be used * for the remainder of the drawing process for a single chart. The state * object allows for the fact that the renderer may be used simultaneously * by multiple threads (each thread will work with a separate state object). * * @param g2 the graphics device. * @param dataArea the data area. * @param plot the plot. * @param rendererIndex the renderer index. * @param info an object for returning information about the structure of * the plot (<code>null</code> permitted). * * @return The renderer state. */ @Override public CategoryItemRendererState initialise(Graphics2D g2, Rectangle2D dataArea, CategoryPlot plot, int rendererIndex, PlotRenderingInfo info) { setPlot(plot); CategoryDataset data = plot.getDataset(rendererIndex); if (data != null) { this.rowCount = data.getRowCount(); this.columnCount = data.getColumnCount(); } else { this.rowCount = 0; this.columnCount = 0; } CategoryItemRendererState state = createState(info); int[] visibleSeriesTemp = new int[this.rowCount]; int visibleSeriesCount = 0; for (int row = 0; row < this.rowCount; row++) { if (isSeriesVisible(row)) { visibleSeriesTemp[visibleSeriesCount] = row; visibleSeriesCount++; } } int[] visibleSeries = new int[visibleSeriesCount]; System.arraycopy(visibleSeriesTemp, 0, visibleSeries, 0, visibleSeriesCount); state.setVisibleSeriesArray(visibleSeries); return state; } /** * Returns the range of values the renderer requires to display all the * items from the specified dataset. * * @param dataset the dataset (<code>null</code> permitted). * * @return The range (or <code>null</code> if the dataset is * <code>null</code> or empty). */ @Override public Range findRangeBounds(CategoryDataset dataset) { return findRangeBounds(dataset, false); } /** * Returns the range of values the renderer requires to display all the * items from the specified dataset. * * @param dataset the dataset (<code>null</code> permitted). * @param includeInterval include the y-interval if the dataset has one. * * @return The range (<code>null</code> if the dataset is <code>null</code> * or empty). * * @since 1.0.13 */ protected Range findRangeBounds(CategoryDataset dataset, boolean includeInterval) { if (dataset == null) { return null; } if (getDataBoundsIncludesVisibleSeriesOnly()) { List visibleSeriesKeys = new ArrayList(); int seriesCount = dataset.getRowCount(); for (int s = 0; s < seriesCount; s++) { if (isSeriesVisible(s)) { visibleSeriesKeys.add(dataset.getRowKey(s)); } } return DatasetUtilities.findRangeBounds(dataset, visibleSeriesKeys, includeInterval); } else { return DatasetUtilities.findRangeBounds(dataset, includeInterval); } } /** * Returns the Java2D coordinate for the middle of the specified data item. * * @param rowKey the row key. * @param columnKey the column key. * @param dataset the dataset. * @param axis the axis. * @param area the data area. * @param edge the edge along which the axis lies. * * @return The Java2D coordinate for the middle of the item. * * @since 1.0.11 */ @Override public double getItemMiddle(Comparable rowKey, Comparable columnKey, CategoryDataset dataset, CategoryAxis axis, Rectangle2D area, RectangleEdge edge) { return axis.getCategoryMiddle(columnKey, dataset.getColumnKeys(), area, edge); } /** * Draws a background for the data area. The default implementation just * gets the plot to draw the background, but some renderers will override * this behaviour. * * @param g2 the graphics device. * @param plot the plot. * @param dataArea the data area. */ @Override public void drawBackground(Graphics2D g2, CategoryPlot plot, Rectangle2D dataArea) { plot.drawBackground(g2, dataArea); } /** * Draws an outline for the data area. The default implementation just * gets the plot to draw the outline, but some renderers will override this * behaviour. * * @param g2 the graphics device. * @param plot the plot. * @param dataArea the data area. */ @Override public void drawOutline(Graphics2D g2, CategoryPlot plot, Rectangle2D dataArea) { plot.drawOutline(g2, dataArea); } /** * Draws a grid line against the domain axis. * <P> * Note that this default implementation assumes that the horizontal axis * is the domain axis. If this is not the case, you will need to override * this method. * * @param g2 the graphics device. * @param plot the plot. * @param dataArea the area for plotting data (not yet adjusted for any * 3D effect). * @param value the Java2D value at which the grid line should be drawn. * * @see #drawRangeGridline(Graphics2D, CategoryPlot, ValueAxis, * Rectangle2D, double) */ @Override public void drawDomainGridline(Graphics2D g2, CategoryPlot plot, Rectangle2D dataArea, double value) { Line2D line = null; PlotOrientation orientation = plot.getOrientation(); if (orientation == PlotOrientation.HORIZONTAL) { line = new Line2D.Double(dataArea.getMinX(), value, dataArea.getMaxX(), value); } else if (orientation == PlotOrientation.VERTICAL) { line = new Line2D.Double(value, dataArea.getMinY(), value, dataArea.getMaxY()); } Paint paint = plot.getDomainGridlinePaint(); if (paint == null) { paint = CategoryPlot.DEFAULT_GRIDLINE_PAINT; } g2.setPaint(paint); Stroke stroke = plot.getDomainGridlineStroke(); if (stroke == null) { stroke = CategoryPlot.DEFAULT_GRIDLINE_STROKE; } g2.setStroke(stroke); g2.draw(line); } /** * Draws a grid line against the range axis. * * @param g2 the graphics device. * @param plot the plot. * @param axis the value axis. * @param dataArea the area for plotting data (not yet adjusted for any * 3D effect). * @param value the value at which the grid line should be drawn. * * @see #drawDomainGridline(Graphics2D, CategoryPlot, Rectangle2D, double) */ @Override public void drawRangeGridline(Graphics2D g2, CategoryPlot plot, ValueAxis axis, Rectangle2D dataArea, double value) { Range range = axis.getRange(); if (!range.contains(value)) { return; } PlotOrientation orientation = plot.getOrientation(); double v = axis.valueToJava2D(value, dataArea, plot.getRangeAxisEdge()); Line2D line = null; if (orientation == PlotOrientation.HORIZONTAL) { line = new Line2D.Double(v, dataArea.getMinY(), v, dataArea.getMaxY()); } else if (orientation == PlotOrientation.VERTICAL) { line = new Line2D.Double(dataArea.getMinX(), v, dataArea.getMaxX(), v); } Paint paint = plot.getRangeGridlinePaint(); if (paint == null) { paint = CategoryPlot.DEFAULT_GRIDLINE_PAINT; } g2.setPaint(paint); Stroke stroke = plot.getRangeGridlineStroke(); if (stroke == null) { stroke = CategoryPlot.DEFAULT_GRIDLINE_STROKE; } g2.setStroke(stroke); g2.draw(line); } /** * Draws a line perpendicular to the range axis. * * @param g2 the graphics device. * @param plot the plot. * @param axis the value axis. * @param dataArea the area for plotting data (not yet adjusted for any 3D * effect). * @param value the value at which the grid line should be drawn. * @param paint the paint (<code>null</code> not permitted). * @param stroke the stroke (<code>null</code> not permitted). * * @see #drawRangeGridline * * @since 1.0.13 */ public void drawRangeLine(Graphics2D g2, CategoryPlot plot, ValueAxis axis, Rectangle2D dataArea, double value, Paint paint, Stroke stroke) { // TODO: In JFreeChart 1.2.0, put this method in the // CategoryItemRenderer interface Range range = axis.getRange(); if (!range.contains(value)) { return; } PlotOrientation orientation = plot.getOrientation(); Line2D line = null; double v = axis.valueToJava2D(value, dataArea, plot.getRangeAxisEdge()); if (orientation == PlotOrientation.HORIZONTAL) { line = new Line2D.Double(v, dataArea.getMinY(), v, dataArea.getMaxY()); } else if (orientation == PlotOrientation.VERTICAL) { line = new Line2D.Double(dataArea.getMinX(), v, dataArea.getMaxX(), v); } g2.setPaint(paint); g2.setStroke(stroke); g2.draw(line); } /** * Draws a marker for the domain axis. * * @param g2 the graphics device (not <code>null</code>). * @param plot the plot (not <code>null</code>). * @param axis the range axis (not <code>null</code>). * @param marker the marker to be drawn (not <code>null</code>). * @param dataArea the area inside the axes (not <code>null</code>). * * @see #drawRangeMarker(Graphics2D, CategoryPlot, ValueAxis, Marker, * Rectangle2D) */ @Override public void drawDomainMarker(Graphics2D g2, CategoryPlot plot, CategoryAxis axis, CategoryMarker marker, Rectangle2D dataArea) { Comparable category = marker.getKey(); CategoryDataset dataset = plot.getDataset(plot.getIndexOf(this)); int columnIndex = dataset.getColumnIndex(category); if (columnIndex < 0) { return; } final Composite savedComposite = g2.getComposite(); g2.setComposite(AlphaComposite.getInstance( AlphaComposite.SRC_OVER, marker.getAlpha())); PlotOrientation orientation = plot.getOrientation(); Rectangle2D bounds; if (marker.getDrawAsLine()) { double v = axis.getCategoryMiddle(columnIndex, dataset.getColumnCount(), dataArea, plot.getDomainAxisEdge()); Line2D line = null; if (orientation == PlotOrientation.HORIZONTAL) { line = new Line2D.Double(dataArea.getMinX(), v, dataArea.getMaxX(), v); } else if (orientation == PlotOrientation.VERTICAL) { line = new Line2D.Double(v, dataArea.getMinY(), v, dataArea.getMaxY()); } g2.setPaint(marker.getPaint()); g2.setStroke(marker.getStroke()); g2.draw(line); bounds = line.getBounds2D(); } else { double v0 = axis.getCategoryStart(columnIndex, dataset.getColumnCount(), dataArea, plot.getDomainAxisEdge()); double v1 = axis.getCategoryEnd(columnIndex, dataset.getColumnCount(), dataArea, plot.getDomainAxisEdge()); Rectangle2D area = null; if (orientation == PlotOrientation.HORIZONTAL) { area = new Rectangle2D.Double(dataArea.getMinX(), v0, dataArea.getWidth(), (v1 - v0)); } else if (orientation == PlotOrientation.VERTICAL) { area = new Rectangle2D.Double(v0, dataArea.getMinY(), (v1 - v0), dataArea.getHeight()); } g2.setPaint(marker.getPaint()); g2.fill(area); bounds = area; } String label = marker.getLabel(); RectangleAnchor anchor = marker.getLabelAnchor(); if (label != null) { Font labelFont = marker.getLabelFont(); g2.setFont(labelFont); g2.setPaint(marker.getLabelPaint()); Point2D coordinates = calculateDomainMarkerTextAnchorPoint( g2, orientation, dataArea, bounds, marker.getLabelOffset(), marker.getLabelOffsetType(), anchor); TextUtilities.drawAlignedString(label, g2, (float) coordinates.getX(), (float) coordinates.getY(), marker.getLabelTextAnchor()); } g2.setComposite(savedComposite); } /** * Draws a marker for the range axis. * * @param g2 the graphics device (not <code>null</code>). * @param plot the plot (not <code>null</code>). * @param axis the range axis (not <code>null</code>). * @param marker the marker to be drawn (not <code>null</code>). * @param dataArea the area inside the axes (not <code>null</code>). * * @see #drawDomainMarker(Graphics2D, CategoryPlot, CategoryAxis, * CategoryMarker, Rectangle2D) */ @Override public void drawRangeMarker(Graphics2D g2, CategoryPlot plot, ValueAxis axis, Marker marker, Rectangle2D dataArea) { if (marker instanceof ValueMarker) { ValueMarker vm = (ValueMarker) marker; double value = vm.getValue(); Range range = axis.getRange(); if (!range.contains(value)) { return; } final Composite savedComposite = g2.getComposite(); g2.setComposite(AlphaComposite.getInstance( AlphaComposite.SRC_OVER, marker.getAlpha())); PlotOrientation orientation = plot.getOrientation(); double v = axis.valueToJava2D(value, dataArea, plot.getRangeAxisEdge()); Line2D line = null; if (orientation == PlotOrientation.HORIZONTAL) { line = new Line2D.Double(v, dataArea.getMinY(), v, dataArea.getMaxY()); } else if (orientation == PlotOrientation.VERTICAL) { line = new Line2D.Double(dataArea.getMinX(), v, dataArea.getMaxX(), v); } g2.setPaint(marker.getPaint()); g2.setStroke(marker.getStroke()); g2.draw(line); String label = marker.getLabel(); RectangleAnchor anchor = marker.getLabelAnchor(); if (label != null) { Font labelFont = marker.getLabelFont(); g2.setFont(labelFont); g2.setPaint(marker.getLabelPaint()); Point2D coordinates = calculateRangeMarkerTextAnchorPoint( g2, orientation, dataArea, line.getBounds2D(), marker.getLabelOffset(), LengthAdjustmentType.EXPAND, anchor); TextUtilities.drawAlignedString(label, g2, (float) coordinates.getX(), (float) coordinates.getY(), marker.getLabelTextAnchor()); } g2.setComposite(savedComposite); } else if (marker instanceof IntervalMarker) { IntervalMarker im = (IntervalMarker) marker; double start = im.getStartValue(); double end = im.getEndValue(); Range range = axis.getRange(); if (!(range.intersects(start, end))) { return; } final Composite savedComposite = g2.getComposite(); g2.setComposite(AlphaComposite.getInstance( AlphaComposite.SRC_OVER, marker.getAlpha())); double start2d = axis.valueToJava2D(start, dataArea, plot.getRangeAxisEdge()); double end2d = axis.valueToJava2D(end, dataArea, plot.getRangeAxisEdge()); double low = Math.min(start2d, end2d); double high = Math.max(start2d, end2d); PlotOrientation orientation = plot.getOrientation(); Rectangle2D rect = null; if (orientation == PlotOrientation.HORIZONTAL) { // clip left and right bounds to data area low = Math.max(low, dataArea.getMinX()); high = Math.min(high, dataArea.getMaxX()); rect = new Rectangle2D.Double(low, dataArea.getMinY(), high - low, dataArea.getHeight()); } else if (orientation == PlotOrientation.VERTICAL) { // clip top and bottom bounds to data area low = Math.max(low, dataArea.getMinY()); high = Math.min(high, dataArea.getMaxY()); rect = new Rectangle2D.Double(dataArea.getMinX(), low, dataArea.getWidth(), high - low); } Paint p = marker.getPaint(); if (p instanceof GradientPaint) { GradientPaint gp = (GradientPaint) p; GradientPaintTransformer t = im.getGradientPaintTransformer(); if (t != null) { gp = t.transform(gp, rect); } g2.setPaint(gp); } else { g2.setPaint(p); } g2.fill(rect); // now draw the outlines, if visible... if (im.getOutlinePaint() != null && im.getOutlineStroke() != null) { if (orientation == PlotOrientation.VERTICAL) { Line2D line = new Line2D.Double(); double x0 = dataArea.getMinX(); double x1 = dataArea.getMaxX(); g2.setPaint(im.getOutlinePaint()); g2.setStroke(im.getOutlineStroke()); if (range.contains(start)) { line.setLine(x0, start2d, x1, start2d); g2.draw(line); } if (range.contains(end)) { line.setLine(x0, end2d, x1, end2d); g2.draw(line); } } else { // PlotOrientation.HORIZONTAL Line2D line = new Line2D.Double(); double y0 = dataArea.getMinY(); double y1 = dataArea.getMaxY(); g2.setPaint(im.getOutlinePaint()); g2.setStroke(im.getOutlineStroke()); if (range.contains(start)) { line.setLine(start2d, y0, start2d, y1); g2.draw(line); } if (range.contains(end)) { line.setLine(end2d, y0, end2d, y1); g2.draw(line); } } } String label = marker.getLabel(); RectangleAnchor anchor = marker.getLabelAnchor(); if (label != null) { Font labelFont = marker.getLabelFont(); g2.setFont(labelFont); g2.setPaint(marker.getLabelPaint()); Point2D coordinates = calculateRangeMarkerTextAnchorPoint( g2, orientation, dataArea, rect, marker.getLabelOffset(), marker.getLabelOffsetType(), anchor); TextUtilities.drawAlignedString(label, g2, (float) coordinates.getX(), (float) coordinates.getY(), marker.getLabelTextAnchor()); } g2.setComposite(savedComposite); } } /** * Calculates the (x, y) coordinates for drawing the label for a marker on * the range axis. * * @param g2 the graphics device. * @param orientation the plot orientation. * @param dataArea the data area. * @param markerArea the rectangle surrounding the marker. * @param markerOffset the marker offset. * @param labelOffsetType the label offset type. * @param anchor the label anchor. * * @return The coordinates for drawing the marker label. */ protected Point2D calculateDomainMarkerTextAnchorPoint(Graphics2D g2, PlotOrientation orientation, Rectangle2D dataArea, Rectangle2D markerArea, RectangleInsets markerOffset, LengthAdjustmentType labelOffsetType, RectangleAnchor anchor) { Rectangle2D anchorRect = null; if (orientation == PlotOrientation.HORIZONTAL) { anchorRect = markerOffset.createAdjustedRectangle(markerArea, LengthAdjustmentType.CONTRACT, labelOffsetType); } else if (orientation == PlotOrientation.VERTICAL) { anchorRect = markerOffset.createAdjustedRectangle(markerArea, labelOffsetType, LengthAdjustmentType.CONTRACT); } return RectangleAnchor.coordinates(anchorRect, anchor); } /** * Calculates the (x, y) coordinates for drawing a marker label. * * @param g2 the graphics device. * @param orientation the plot orientation. * @param dataArea the data area. * @param markerArea the rectangle surrounding the marker. * @param markerOffset the marker offset. * @param labelOffsetType the label offset type. * @param anchor the label anchor. * * @return The coordinates for drawing the marker label. */ protected Point2D calculateRangeMarkerTextAnchorPoint(Graphics2D g2, PlotOrientation orientation, Rectangle2D dataArea, Rectangle2D markerArea, RectangleInsets markerOffset, LengthAdjustmentType labelOffsetType, RectangleAnchor anchor) { Rectangle2D anchorRect = null; if (orientation == PlotOrientation.HORIZONTAL) { anchorRect = markerOffset.createAdjustedRectangle(markerArea, labelOffsetType, LengthAdjustmentType.CONTRACT); } else if (orientation == PlotOrientation.VERTICAL) { anchorRect = markerOffset.createAdjustedRectangle(markerArea, LengthAdjustmentType.CONTRACT, labelOffsetType); } return RectangleAnchor.coordinates(anchorRect, anchor); } /** * Returns a legend item for a series. This default implementation will * return <code>null</code> if {@link #isSeriesVisible(int)} or * {@link #isSeriesVisibleInLegend(int)} returns <code>false</code>. * * @param datasetIndex the dataset index (zero-based). * @param series the series index (zero-based). * * @return The legend item (possibly <code>null</code>). * * @see #getLegendItems() */ @Override public LegendItem getLegendItem(int datasetIndex, int series) { CategoryPlot p = getPlot(); if (p == null) { return null; } // check that a legend item needs to be displayed... if (!isSeriesVisible(series) || !isSeriesVisibleInLegend(series)) { return null; } CategoryDataset dataset = p.getDataset(datasetIndex); String label = this.legendItemLabelGenerator.generateLabel(dataset, series); String description = label; String toolTipText = null; if (this.legendItemToolTipGenerator != null) { toolTipText = this.legendItemToolTipGenerator.generateLabel( dataset, series); } String urlText = null; if (this.legendItemURLGenerator != null) { urlText = this.legendItemURLGenerator.generateLabel(dataset, series); } Shape shape = lookupLegendShape(series); Paint paint = lookupSeriesPaint(series); Paint outlinePaint = lookupSeriesOutlinePaint(series); Stroke outlineStroke = lookupSeriesOutlineStroke(series); LegendItem item = new LegendItem(label, description, toolTipText, urlText, shape, paint, outlineStroke, outlinePaint); item.setLabelFont(lookupLegendTextFont(series)); Paint labelPaint = lookupLegendTextPaint(series); if (labelPaint != null) { item.setLabelPaint(labelPaint); } item.setSeriesKey(dataset.getRowKey(series)); item.setSeriesIndex(series); item.setDataset(dataset); item.setDatasetIndex(datasetIndex); return item; } /** * Tests this renderer for equality with another object. * * @param obj the object. * * @return <code>true</code> or <code>false</code>. */ @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof AbstractCategoryItemRenderer)) { return false; } AbstractCategoryItemRenderer that = (AbstractCategoryItemRenderer) obj; if (!ObjectUtilities.equal(this.itemLabelGenerator, that.itemLabelGenerator)) { return false; } if (!ObjectUtilities.equal(this.itemLabelGeneratorList, that.itemLabelGeneratorList)) { return false; } if (!ObjectUtilities.equal(this.baseItemLabelGenerator, that.baseItemLabelGenerator)) { return false; } if (!ObjectUtilities.equal(this.toolTipGenerator, that.toolTipGenerator)) { return false; } if (!ObjectUtilities.equal(this.toolTipGeneratorList, that.toolTipGeneratorList)) { return false; } if (!ObjectUtilities.equal(this.baseToolTipGenerator, that.baseToolTipGenerator)) { return false; } if (!ObjectUtilities.equal(this.itemURLGenerator, that.itemURLGenerator)) { return false; } if (!ObjectUtilities.equal(this.itemURLGeneratorList, that.itemURLGeneratorList)) { return false; } if (!ObjectUtilities.equal(this.baseItemURLGenerator, that.baseItemURLGenerator)) { return false; } if (!ObjectUtilities.equal(this.legendItemLabelGenerator, that.legendItemLabelGenerator)) { return false; } if (!ObjectUtilities.equal(this.legendItemToolTipGenerator, that.legendItemToolTipGenerator)) { return false; } if (!ObjectUtilities.equal(this.legendItemURLGenerator, that.legendItemURLGenerator)) { return false; } return super.equals(obj); } /** * Returns a hash code for the renderer. * * @return The hash code. */ @Override public int hashCode() { int result = super.hashCode(); return result; } /** * Returns the drawing supplier from the plot. * * @return The drawing supplier (possibly <code>null</code>). */ @Override public DrawingSupplier getDrawingSupplier() { DrawingSupplier result = null; CategoryPlot cp = getPlot(); if (cp != null) { result = cp.getDrawingSupplier(); } return result; } /** * Considers the current (x, y) coordinate and updates the crosshair point * if it meets the criteria (usually means the (x, y) coordinate is the * closest to the anchor point so far). * * @param crosshairState the crosshair state (<code>null</code> permitted, * but the method does nothing in that case). * @param rowKey the row key. * @param columnKey the column key. * @param value the data value. * @param datasetIndex the dataset index. * @param transX the x-value translated to Java2D space. * @param transY the y-value translated to Java2D space. * @param orientation the plot orientation (<code>null</code> not * permitted). * * @since 1.0.11 */ protected void updateCrosshairValues(CategoryCrosshairState crosshairState, Comparable rowKey, Comparable columnKey, double value, int datasetIndex, double transX, double transY, PlotOrientation orientation) { ParamChecks.nullNotPermitted(orientation, "orientation"); if (crosshairState != null) { if (this.plot.isRangeCrosshairLockedOnData()) { // both axes crosshairState.updateCrosshairPoint(rowKey, columnKey, value, datasetIndex, transX, transY, orientation); } else { crosshairState.updateCrosshairX(rowKey, columnKey, datasetIndex, transX, orientation); } } } /** * Draws an item label. * * @param g2 the graphics device. * @param orientation the orientation. * @param dataset the dataset. * @param row the row. * @param column the column. * @param x the x coordinate (in Java2D space). * @param y the y coordinate (in Java2D space). * @param negative indicates a negative value (which affects the item * label position). */ protected void drawItemLabel(Graphics2D g2, PlotOrientation orientation, CategoryDataset dataset, int row, int column, double x, double y, boolean negative) { CategoryItemLabelGenerator generator = getItemLabelGenerator(row, column); if (generator != null) { Font labelFont = getItemLabelFont(row, column); Paint paint = getItemLabelPaint(row, column); g2.setFont(labelFont); g2.setPaint(paint); String label = generator.generateLabel(dataset, row, column); ItemLabelPosition position; if (!negative) { position = getPositiveItemLabelPosition(row, column); } else { position = getNegativeItemLabelPosition(row, column); } Point2D anchorPoint = calculateLabelAnchorPoint( position.getItemLabelAnchor(), x, y, orientation); TextUtilities.drawRotatedString(label, g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(), position.getTextAnchor(), position.getAngle(), position.getRotationAnchor()); } } /** * Returns an independent copy of the renderer. The <code>plot</code> * reference is shallow copied. * * @return A clone. * * @throws CloneNotSupportedException can be thrown if one of the objects * belonging to the renderer does not support cloning (for example, * an item label generator). */ @Override public Object clone() throws CloneNotSupportedException { AbstractCategoryItemRenderer clone = (AbstractCategoryItemRenderer) super.clone(); if (this.itemLabelGenerator != null) { if (this.itemLabelGenerator instanceof PublicCloneable) { PublicCloneable pc = (PublicCloneable) this.itemLabelGenerator; clone.itemLabelGenerator = (CategoryItemLabelGenerator) pc.clone(); } else { throw new CloneNotSupportedException( "ItemLabelGenerator not cloneable."); } } if (this.itemLabelGeneratorList != null) { clone.itemLabelGeneratorList = (ObjectList) this.itemLabelGeneratorList.clone(); } if (this.baseItemLabelGenerator != null) { if (this.baseItemLabelGenerator instanceof PublicCloneable) { PublicCloneable pc = (PublicCloneable) this.baseItemLabelGenerator; clone.baseItemLabelGenerator = (CategoryItemLabelGenerator) pc.clone(); } else { throw new CloneNotSupportedException( "ItemLabelGenerator not cloneable."); } } if (this.toolTipGenerator != null) { if (this.toolTipGenerator instanceof PublicCloneable) { PublicCloneable pc = (PublicCloneable) this.toolTipGenerator; clone.toolTipGenerator = (CategoryToolTipGenerator) pc.clone(); } else { throw new CloneNotSupportedException( "Tool tip generator not cloneable."); } } if (this.toolTipGeneratorList != null) { clone.toolTipGeneratorList = (ObjectList) this.toolTipGeneratorList.clone(); } if (this.baseToolTipGenerator != null) { if (this.baseToolTipGenerator instanceof PublicCloneable) { PublicCloneable pc = (PublicCloneable) this.baseToolTipGenerator; clone.baseToolTipGenerator = (CategoryToolTipGenerator) pc.clone(); } else { throw new CloneNotSupportedException( "Base tool tip generator not cloneable."); } } if (this.itemURLGenerator != null) { if (this.itemURLGenerator instanceof PublicCloneable) { PublicCloneable pc = (PublicCloneable) this.itemURLGenerator; clone.itemURLGenerator = (CategoryURLGenerator) pc.clone(); } else { throw new CloneNotSupportedException( "Item URL generator not cloneable."); } } if (this.itemURLGeneratorList != null) { clone.itemURLGeneratorList = (ObjectList) this.itemURLGeneratorList.clone(); } if (this.baseItemURLGenerator != null) { if (this.baseItemURLGenerator instanceof PublicCloneable) { PublicCloneable pc = (PublicCloneable) this.baseItemURLGenerator; clone.baseItemURLGenerator = (CategoryURLGenerator) pc.clone(); } else { throw new CloneNotSupportedException( "Base item URL generator not cloneable."); } } if (this.legendItemLabelGenerator instanceof PublicCloneable) { clone.legendItemLabelGenerator = (CategorySeriesLabelGenerator) ObjectUtilities.clone(this.legendItemLabelGenerator); } if (this.legendItemToolTipGenerator instanceof PublicCloneable) { clone.legendItemToolTipGenerator = (CategorySeriesLabelGenerator) ObjectUtilities.clone(this.legendItemToolTipGenerator); } if (this.legendItemURLGenerator instanceof PublicCloneable) { clone.legendItemURLGenerator = (CategorySeriesLabelGenerator) ObjectUtilities.clone(this.legendItemURLGenerator); } return clone; } /** * Returns a domain axis for a plot. * * @param plot the plot. * @param index the axis index. * * @return A domain axis. */ protected CategoryAxis getDomainAxis(CategoryPlot plot, int index) { CategoryAxis result = plot.getDomainAxis(index); if (result == null) { result = plot.getDomainAxis(); } return result; } /** * Returns a range axis for a plot. * * @param plot the plot. * @param index the axis index. * * @return A range axis. */ protected ValueAxis getRangeAxis(CategoryPlot plot, int index) { ValueAxis result = plot.getRangeAxis(index); if (result == null) { result = plot.getRangeAxis(); } return result; } /** * Returns a (possibly empty) collection of legend items for the series * that this renderer is responsible for drawing. * * @return The legend item collection (never <code>null</code>). * * @see #getLegendItem(int, int) */ @Override public LegendItemCollection getLegendItems() { LegendItemCollection result = new LegendItemCollection(); if (this.plot == null) { return result; } int index = this.plot.getIndexOf(this); CategoryDataset dataset = this.plot.getDataset(index); if (dataset == null) { return result; } int seriesCount = dataset.getRowCount(); if (plot.getRowRenderingOrder().equals(SortOrder.ASCENDING)) { for (int i = 0; i < seriesCount; i++) { if (isSeriesVisibleInLegend(i)) { LegendItem item = getLegendItem(index, i); if (item != null) { result.add(item); } } } } else { for (int i = seriesCount - 1; i >= 0; i--) { if (isSeriesVisibleInLegend(i)) { LegendItem item = getLegendItem(index, i); if (item != null) { result.add(item); } } } } return result; } /** * Returns the legend item label generator. * * @return The label generator (never <code>null</code>). * * @see #setLegendItemLabelGenerator(CategorySeriesLabelGenerator) */ public CategorySeriesLabelGenerator getLegendItemLabelGenerator() { return this.legendItemLabelGenerator; } /** * Sets the legend item label generator and sends a * {@link RendererChangeEvent} to all registered listeners. * * @param generator the generator (<code>null</code> not permitted). * * @see #getLegendItemLabelGenerator() */ public void setLegendItemLabelGenerator( CategorySeriesLabelGenerator generator) { ParamChecks.nullNotPermitted(generator, "generator"); this.legendItemLabelGenerator = generator; fireChangeEvent(); } /** * Returns the legend item tool tip generator. * * @return The tool tip generator (possibly <code>null</code>). * * @see #setLegendItemToolTipGenerator(CategorySeriesLabelGenerator) */ public CategorySeriesLabelGenerator getLegendItemToolTipGenerator() { return this.legendItemToolTipGenerator; } /** * Sets the legend item tool tip generator and sends a * {@link RendererChangeEvent} to all registered listeners. * * @param generator the generator (<code>null</code> permitted). * * @see #setLegendItemToolTipGenerator(CategorySeriesLabelGenerator) */ public void setLegendItemToolTipGenerator( CategorySeriesLabelGenerator generator) { this.legendItemToolTipGenerator = generator; fireChangeEvent(); } /** * Returns the legend item URL generator. * * @return The URL generator (possibly <code>null</code>). * * @see #setLegendItemURLGenerator(CategorySeriesLabelGenerator) */ public CategorySeriesLabelGenerator getLegendItemURLGenerator() { return this.legendItemURLGenerator; } /** * Sets the legend item URL generator and sends a * {@link RendererChangeEvent} to all registered listeners. * * @param generator the generator (<code>null</code> permitted). * * @see #getLegendItemURLGenerator() */ public void setLegendItemURLGenerator( CategorySeriesLabelGenerator generator) { this.legendItemURLGenerator = generator; fireChangeEvent(); } /** * Adds an entity with the specified hotspot. * * @param entities the entity collection. * @param dataset the dataset. * @param row the row index. * @param column the column index. * @param hotspot the hotspot (<code>null</code> not permitted). */ protected void addItemEntity(EntityCollection entities, CategoryDataset dataset, int row, int column, Shape hotspot) { ParamChecks.nullNotPermitted(hotspot, "hotspot"); if (!getItemCreateEntity(row, column)) { return; } String tip = null; CategoryToolTipGenerator tipster = getToolTipGenerator(row, column); if (tipster != null) { tip = tipster.generateToolTip(dataset, row, column); } String url = null; CategoryURLGenerator urlster = getItemURLGenerator(row, column); if (urlster != null) { url = urlster.generateURL(dataset, row, column); } CategoryItemEntity entity = new CategoryItemEntity(hotspot, tip, url, dataset, dataset.getRowKey(row), dataset.getColumnKey(column)); entities.add(entity); } /** * Adds an entity to the collection. * * @param entities the entity collection being populated. * @param hotspot the entity area (if <code>null</code> a default will be * used). * @param dataset the dataset. * @param row the series. * @param column the item. * @param entityX the entity's center x-coordinate in user space (only * used if <code>area</code> is <code>null</code>). * @param entityY the entity's center y-coordinate in user space (only * used if <code>area</code> is <code>null</code>). * * @since 1.0.13 */ protected void addEntity(EntityCollection entities, Shape hotspot, CategoryDataset dataset, int row, int column, double entityX, double entityY) { if (!getItemCreateEntity(row, column)) { return; } Shape s = hotspot; if (hotspot == null) { double r = getDefaultEntityRadius(); double w = r * 2; if (getPlot().getOrientation() == PlotOrientation.VERTICAL) { s = new Ellipse2D.Double(entityX - r, entityY - r, w, w); } else { s = new Ellipse2D.Double(entityY - r, entityX - r, w, w); } } String tip = null; CategoryToolTipGenerator generator = getToolTipGenerator(row, column); if (generator != null) { tip = generator.generateToolTip(dataset, row, column); } String url = null; CategoryURLGenerator urlster = getItemURLGenerator(row, column); if (urlster != null) { url = urlster.generateURL(dataset, row, column); } CategoryItemEntity entity = new CategoryItemEntity(s, tip, url, dataset, dataset.getRowKey(row), dataset.getColumnKey(column)); entities.add(entity); } // === DEPRECATED CODE === /** * The item label generator for ALL series. * * @deprecated This field is redundant and deprecated as of version 1.0.6. */ private CategoryItemLabelGenerator itemLabelGenerator; /** * The tool tip generator for ALL series. * * @deprecated This field is redundant and deprecated as of version 1.0.6. */ private CategoryToolTipGenerator toolTipGenerator; /** * The URL generator. * * @deprecated This field is redundant and deprecated as of version 1.0.6. */ private CategoryURLGenerator itemURLGenerator; /** * Sets the item label generator for ALL series and sends a * {@link RendererChangeEvent} to all registered listeners. * * @param generator the generator (<code>null</code> permitted). * * @deprecated This method should no longer be used (as of version 1.0.6). * It is sufficient to rely on {@link #setSeriesItemLabelGenerator(int, * CategoryItemLabelGenerator)} and * {@link #setBaseItemLabelGenerator(CategoryItemLabelGenerator)}. */ @Override public void setItemLabelGenerator(CategoryItemLabelGenerator generator) { this.itemLabelGenerator = generator; fireChangeEvent(); } /** * Returns the tool tip generator that will be used for ALL items in the * dataset (the "layer 0" generator). * * @return A tool tip generator (possibly <code>null</code>). * * @see #setToolTipGenerator(CategoryToolTipGenerator) * * @deprecated This method should no longer be used (as of version 1.0.6). * It is sufficient to rely on {@link #getSeriesToolTipGenerator(int)} * and {@link #getBaseToolTipGenerator()}. */ @Override public CategoryToolTipGenerator getToolTipGenerator() { return this.toolTipGenerator; } /** * Sets the tool tip generator for ALL series and sends a * {@link org.jfree.chart.event.RendererChangeEvent} to all registered * listeners. * * @param generator the generator (<code>null</code> permitted). * * @see #getToolTipGenerator() * * @deprecated This method should no longer be used (as of version 1.0.6). * It is sufficient to rely on {@link #setSeriesToolTipGenerator(int, * CategoryToolTipGenerator)} and * {@link #setBaseToolTipGenerator(CategoryToolTipGenerator)}. */ @Override public void setToolTipGenerator(CategoryToolTipGenerator generator) { this.toolTipGenerator = generator; fireChangeEvent(); } /** * Sets the item URL generator for ALL series and sends a * {@link RendererChangeEvent} to all registered listeners. * * @param generator the generator. * * @deprecated This method should no longer be used (as of version 1.0.6). * It is sufficient to rely on {@link #setSeriesItemURLGenerator(int, * CategoryURLGenerator)} and * {@link #setBaseItemURLGenerator(CategoryURLGenerator)}. */ @Override public void setItemURLGenerator(CategoryURLGenerator generator) { this.itemURLGenerator = generator; fireChangeEvent(); } }
{ "content_hash": "567786c0eb8346098b450a873a2a9f00", "timestamp": "", "source": "github", "line_count": 1737, "max_line_length": 80, "avg_line_length": 35.92055267702936, "alnum_prop": 0.6030708080905215, "repo_name": "Epsilon2/Memetic-Algorithm-for-TSP", "id": "884629ec74f05986d9ffbc23f5a5ca336a7b8e9c", "size": "68086", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "jfreechart-1.0.16/source/org/jfree/chart/renderer/category/AbstractCategoryItemRenderer.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "10537975" }, { "name": "Shell", "bytes": "1957" } ], "symlink_target": "" }
var t = require('tap'); var parquet = require('../'); var file = __dirname + '/test.parquet'; var schema = {int: {type: 'timestamp'}}; var writer = new parquet.ParquetWriter(file, schema); var now = new Date; t.type(writer, 'object'); t.equal(writer.write([[now.getTime()]]), 1); writer.close(); var reader = new parquet.ParquetReader(file); var info = reader.info(); t.type(reader, 'object'); t.equal(info.rowGroups, 1); t.equal(info.columns, 1); t.equal(info.rows, 1); var data = reader.rows(info.rows); t.equal(data[0][0], now.getTime());
{ "content_hash": "3a077e9bf259e5c9bcd2aedc77078223", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 53, "avg_line_length": 27.25, "alnum_prop": 0.6642201834862386, "repo_name": "mvertes/node-parquet", "id": "5eeddd0665234ab29ec4f603a859d5810963c1bf", "size": "566", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "test/date.js", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "C++", "bytes": "26595" }, { "name": "JavaScript", "bytes": "20568" }, { "name": "Python", "bytes": "2268" }, { "name": "Shell", "bytes": "760" } ], "symlink_target": "" }
package org.jesperancinha.xml.adder.csv; import com.opencsv.bean.CsvBindByName; import com.opencsv.bean.CsvBindByPosition; /** * Created by joaofilipesabinoesperancinha on 18-02-16. */ public class AttributeAddBean { @CsvBindByName(capture = "name") @CsvBindByPosition(position = 0) private String name; @CsvBindByName(capture = "value") @CsvBindByPosition(position = 1) private String value; @CsvBindByName(capture = "xpath") @CsvBindByPosition(position = 2) private String xpath; public String getName() { return name; } public String getValue() { return value; } public String getXpath() { return xpath; } public void setName(String name) { this.name = name; } public void setValue(String value) { this.value = value; } public void setXpath(String xpath) { this.xpath = xpath; } }
{ "content_hash": "9bf1eef73203e3645186e3206245cd7b", "timestamp": "", "source": "github", "line_count": 47, "max_line_length": 55, "avg_line_length": 19.78723404255319, "alnum_prop": 0.6419354838709678, "repo_name": "jesperancinha/xml-adder", "id": "0a86ba0c5e0f3ad1465d66045ae18fb75335c8a1", "size": "930", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/src/main/java/org/jesperancinha/xml/adder/csv/AttributeAddBean.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "33983" }, { "name": "Makefile", "bytes": "232" } ], "symlink_target": "" }
ACCEPTED #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
{ "content_hash": "dcfbd736cb5445532080090b9e4d06c5", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 39, "avg_line_length": 10.307692307692308, "alnum_prop": 0.6940298507462687, "repo_name": "mdoering/backbone", "id": "f854a94c179c3bb554e4638ab3c09a3e54d88591", "size": "192", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Fagales/Betulaceae/Betula/Betula procurva/Betula procurva procurva/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android" > <item android:drawable="@drawable/seekbarbuttonpressed" android:state_enabled="false"/> <item android:drawable="@drawable/seekbarbuttonpressed" android:state_pressed="true"/> <item android:drawable="@drawable/seekbarbuttonpressed" android:state_selected="true"/> <item android:drawable="@drawable/seekbarbutton"/> </selector>
{ "content_hash": "76b04b353456dfbf84fedc71c69a8b62", "timestamp": "", "source": "github", "line_count": 9, "max_line_length": 91, "avg_line_length": 50.888888888888886, "alnum_prop": 0.7379912663755459, "repo_name": "MatejVancik/amaroKontrol", "id": "1c4854aeefbadc541d1e15edf571dfa143fdf5db", "size": "458", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "amaroKontrol_wear/mobile/src/main/res/drawable/seekbarbuttonselector.xml", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "449550" }, { "name": "JavaScript", "bytes": "28989" } ], "symlink_target": "" }
program test use FoX_wkml implicit none type(xmlf_t) :: myfile type(color_t) :: mycolor call kmlSetCustomColor(mycolor, 'F90000FF') call kmlBeginFile(myfile, "test.xml", -1) call kmlCreateLineStyle(myfile, id='myid', width=1, colorname='red') call kmlFinishFile(myfile) end program test
{ "content_hash": "b8320250a478e9d7300a8e8e82f0c7b9", "timestamp": "", "source": "github", "line_count": 16, "max_line_length": 70, "avg_line_length": 19.3125, "alnum_prop": 0.7119741100323624, "repo_name": "wilsonCernWq/Simula", "id": "02a2270e0d1cf3df2ab1a8d115ec8f1d6a63d06d", "size": "309", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "fortran/utils/FoX-4.1.2/wkml/test/test_kmlCreateLineStyle_10.f90", "mode": "33188", "license": "mit", "language": [ { "name": "CMake", "bytes": "26038" }, { "name": "CSS", "bytes": "1100" }, { "name": "Fortran", "bytes": "2218016" }, { "name": "HTML", "bytes": "397873" }, { "name": "M4", "bytes": "544767" }, { "name": "Makefile", "bytes": "25366" }, { "name": "Python", "bytes": "1727" }, { "name": "Shell", "bytes": "40683" } ], "symlink_target": "" }
@interface EspecialViewController () <UITableViewDelegate,UITableViewDataSource> @property (weak, nonatomic) IBOutlet UITableView *tvBase; @end static NSString * const especialId = @"especialCell"; @implementation EspecialViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view from its nib. } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } - (void)UIDisplay { [super UIDisplay]; self.title = @"特别物件清单"; [self.tvBase registerNib:[EspecialItemCell loadNib] forCellReuseIdentifier:especialId]; self.tvBase.separatorInset = UIEdgeInsetsZero; self.tvBase.separatorColor = [UIColor vcBackgroundColor]; [self EnableNavRightItemWithSystemItem:UIBarButtonSystemItemAction action:^{ // share ShareView *shareView = [[ShareView alloc] initWithShareChannel:ShareChannelQQ|ShareChannelWeibo|ShareChannelWeChat|ShareChannelMoments withShareTitle:@"分享你的物件清单给好友"]; [shareView show]; }]; } #pragma mark - UITableView Delegate & DataSource - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { EspecialItemCell *especialCell = [tableView dequeueReusableCellWithIdentifier:especialId forIndexPath:indexPath]; return especialCell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; ItemViewController *itemVC = [[ItemViewController alloc] init]; [self.navigationController pushViewController:itemVC animated:YES]; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 5; } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { return 64.0f; } @end
{ "content_hash": "39797b162ac593d38bf6c3e5c1944598", "timestamp": "", "source": "github", "line_count": 55, "max_line_length": 174, "avg_line_length": 34.67272727272727, "alnum_prop": 0.7671735710540115, "repo_name": "zhangqifan/findSomething", "id": "7e69fcec6d3000fba6b2b91604f43db839cba76d", "size": "2216", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "FindSomething/FindSomething/Works/Profile/EspecialViewController.m", "mode": "33188", "license": "mit", "language": [ { "name": "Assembly", "bytes": "19637" }, { "name": "Batchfile", "bytes": "2475" }, { "name": "C", "bytes": "433321" }, { "name": "C++", "bytes": "10494822" }, { "name": "CMake", "bytes": "25089" }, { "name": "Emacs Lisp", "bytes": "13142" }, { "name": "Go", "bytes": "13628" }, { "name": "M4", "bytes": "42090" }, { "name": "Makefile", "bytes": "949607" }, { "name": "Objective-C", "bytes": "3642027" }, { "name": "Objective-C++", "bytes": "609992" }, { "name": "Protocol Buffer", "bytes": "8872" }, { "name": "Python", "bytes": "2490215" }, { "name": "Ruby", "bytes": "1551" }, { "name": "Shell", "bytes": "444932" } ], "symlink_target": "" }
 #pragma once #include <aws/cloudfront/CloudFront_EXPORTS.h> #include <aws/core/utils/memory/stl/AWSVector.h> #include <aws/core/utils/memory/stl/AWSString.h> #include <utility> namespace Aws { namespace Utils { namespace Xml { class XmlNode; } // namespace Xml } // namespace Utils namespace CloudFront { namespace Model { /** * <p>A complex type that contains information about CNAMEs (alternate domain * names), if any, for this distribution. </p><p><h3>See Also:</h3> <a * href="http://docs.aws.amazon.com/goto/WebAPI/cloudfront-2020-05-31/Aliases">AWS * API Reference</a></p> */ class AWS_CLOUDFRONT_API Aliases { public: Aliases(); Aliases(const Aws::Utils::Xml::XmlNode& xmlNode); Aliases& operator=(const Aws::Utils::Xml::XmlNode& xmlNode); void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const; /** * <p>The number of CNAME aliases, if any, that you want to associate with this * distribution.</p> */ inline int GetQuantity() const{ return m_quantity; } /** * <p>The number of CNAME aliases, if any, that you want to associate with this * distribution.</p> */ inline bool QuantityHasBeenSet() const { return m_quantityHasBeenSet; } /** * <p>The number of CNAME aliases, if any, that you want to associate with this * distribution.</p> */ inline void SetQuantity(int value) { m_quantityHasBeenSet = true; m_quantity = value; } /** * <p>The number of CNAME aliases, if any, that you want to associate with this * distribution.</p> */ inline Aliases& WithQuantity(int value) { SetQuantity(value); return *this;} /** * <p>A complex type that contains the CNAME aliases, if any, that you want to * associate with this distribution.</p> */ inline const Aws::Vector<Aws::String>& GetItems() const{ return m_items; } /** * <p>A complex type that contains the CNAME aliases, if any, that you want to * associate with this distribution.</p> */ inline bool ItemsHasBeenSet() const { return m_itemsHasBeenSet; } /** * <p>A complex type that contains the CNAME aliases, if any, that you want to * associate with this distribution.</p> */ inline void SetItems(const Aws::Vector<Aws::String>& value) { m_itemsHasBeenSet = true; m_items = value; } /** * <p>A complex type that contains the CNAME aliases, if any, that you want to * associate with this distribution.</p> */ inline void SetItems(Aws::Vector<Aws::String>&& value) { m_itemsHasBeenSet = true; m_items = std::move(value); } /** * <p>A complex type that contains the CNAME aliases, if any, that you want to * associate with this distribution.</p> */ inline Aliases& WithItems(const Aws::Vector<Aws::String>& value) { SetItems(value); return *this;} /** * <p>A complex type that contains the CNAME aliases, if any, that you want to * associate with this distribution.</p> */ inline Aliases& WithItems(Aws::Vector<Aws::String>&& value) { SetItems(std::move(value)); return *this;} /** * <p>A complex type that contains the CNAME aliases, if any, that you want to * associate with this distribution.</p> */ inline Aliases& AddItems(const Aws::String& value) { m_itemsHasBeenSet = true; m_items.push_back(value); return *this; } /** * <p>A complex type that contains the CNAME aliases, if any, that you want to * associate with this distribution.</p> */ inline Aliases& AddItems(Aws::String&& value) { m_itemsHasBeenSet = true; m_items.push_back(std::move(value)); return *this; } /** * <p>A complex type that contains the CNAME aliases, if any, that you want to * associate with this distribution.</p> */ inline Aliases& AddItems(const char* value) { m_itemsHasBeenSet = true; m_items.push_back(value); return *this; } private: int m_quantity; bool m_quantityHasBeenSet = false; Aws::Vector<Aws::String> m_items; bool m_itemsHasBeenSet = false; }; } // namespace Model } // namespace CloudFront } // namespace Aws
{ "content_hash": "f6ad34211de8ea55d8afd7474d3271d0", "timestamp": "", "source": "github", "line_count": 129, "max_line_length": 130, "avg_line_length": 32.21705426356589, "alnum_prop": 0.6532723772858517, "repo_name": "aws/aws-sdk-cpp", "id": "bb3300eeb4251cc0b7c7f2e127a0dabb0f838184", "size": "4275", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "aws-cpp-sdk-cloudfront/include/aws/cloudfront/model/Aliases.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "309797" }, { "name": "C++", "bytes": "476866144" }, { "name": "CMake", "bytes": "1245180" }, { "name": "Dockerfile", "bytes": "11688" }, { "name": "HTML", "bytes": "8056" }, { "name": "Java", "bytes": "413602" }, { "name": "Python", "bytes": "79245" }, { "name": "Shell", "bytes": "9246" } ], "symlink_target": "" }
#if !defined(FUSION_CONVERT_IMPL_09232005_1341) #define FUSION_CONVERT_IMPL_09232005_1341 #include <boost/fusion/container/set/detail/as_set.hpp> #include <boost/fusion/container/set/set.hpp> #include <boost/fusion/sequence/intrinsic/begin.hpp> #include <boost/fusion/sequence/intrinsic/size.hpp> namespace pdalboost {} namespace boost = pdalboost; namespace pdalboost { namespace fusion { struct set_tag; namespace extension { template <typename T> struct convert_impl; template <> struct convert_impl<set_tag> { template <typename Sequence> struct apply { typedef typename detail::as_set<result_of::size<Sequence>::value> gen; typedef typename gen:: template apply<typename result_of::begin<Sequence>::type>::type type; static type call(Sequence& seq) { return gen::call(fusion::begin(seq)); } }; }; } }} #endif
{ "content_hash": "d8872d23c7b31412c3b0925f89618ff6", "timestamp": "", "source": "github", "line_count": 39, "max_line_length": 90, "avg_line_length": 27.41025641025641, "alnum_prop": 0.5846585594013096, "repo_name": "verma/PDAL", "id": "d1dbe7e80c447968f7ee494712ab269d4ce05368", "size": "1468", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "boost/boost/fusion/container/set/detail/convert_impl.hpp", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "C", "bytes": "755744" }, { "name": "C#", "bytes": "51165" }, { "name": "C++", "bytes": "58234219" }, { "name": "CSS", "bytes": "65128" }, { "name": "JavaScript", "bytes": "81726" }, { "name": "Lasso", "bytes": "1053782" }, { "name": "Perl", "bytes": "4925" }, { "name": "Python", "bytes": "12600" }, { "name": "Shell", "bytes": "40033" }, { "name": "XSLT", "bytes": "7284" } ], "symlink_target": "" }
SYNONYM #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
{ "content_hash": "6f2efe64fa752699d4d6c057ac3fea58", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 39, "avg_line_length": 10.23076923076923, "alnum_prop": 0.6917293233082706, "repo_name": "mdoering/backbone", "id": "12192bdf3693c9914f4d2bbe0de2ecf6655452a8", "size": "193", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Asterales/Campanulaceae/Adenophora/Adenophora liliifolia/ Syn. Campanula liliifolia polyadenia/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
ACCEPTED #### According to Index Fungorum #### Published in null #### Original name Sphaeria setacea var. setacea ### Remarks null
{ "content_hash": "f3b358eaca6d314be45892741b8e1ae4", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 29, "avg_line_length": 10.307692307692308, "alnum_prop": 0.7089552238805971, "repo_name": "mdoering/backbone", "id": "2525cf47b31e05ca962ca397aae73b0a23792bb9", "size": "187", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Fungi/Ascomycota/Sordariomycetes/Diaporthales/Gnomoniaceae/Gnomonia/Gnomonia setacea/Sphaeria setacea setacea/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
namespace installer { std::unique_ptr<SetupSingleton> SetupSingleton::Acquire( const base::CommandLine& command_line, const MasterPreferences& master_preferences, InstallationState* original_state, InstallerState* installer_state) { DCHECK(original_state); DCHECK(installer_state); const base::string16 sync_primitive_name_suffix( base::NumberToString16(std::hash<base::FilePath::StringType>()( installer_state->target_path().value()))); base::win::ScopedHandle setup_mutex(::CreateMutex( nullptr, FALSE, (L"Global\\ChromeSetupMutex_" + sync_primitive_name_suffix).c_str())); if (!setup_mutex.IsValid()) { // UMA data indicates that this happens 0.03 % of the time. return nullptr; } base::win::ScopedHandle exit_event(::CreateEvent( nullptr, TRUE, FALSE, (L"Global\\ChromeSetupExitEvent_" + sync_primitive_name_suffix).c_str())); if (!exit_event.IsValid()) { // UMA data indicates that this happens < 0.01 % of the time. return nullptr; } auto setup_singleton = base::WrapUnique( new SetupSingleton(std::move(setup_mutex), std::move(exit_event))); { // Acquire a mutex to ensure that a single call to SetupSingleton::Acquire() // signals |exit_event_| and waits for |setup_mutex_| to be released at a // time. base::win::ScopedHandle exit_event_mutex(::CreateMutex( nullptr, FALSE, (L"Global\\ChromeSetupExitEventMutex_" + sync_primitive_name_suffix) .c_str())); if (!exit_event_mutex.IsValid()) { // UMA data indicates that this happens < 0.01 % of the time. return nullptr; } ScopedHoldMutex scoped_hold_exit_event_mutex; if (!scoped_hold_exit_event_mutex.Acquire(exit_event_mutex.Get())) { // UMA data indicates that this happens < 0.01 % of the time. return nullptr; } // Signal |exit_event_|. This causes any call to WaitForInterrupt() on a // SetupSingleton bound to the same Chrome installation to return // immediately. setup_singleton->exit_event_.Signal(); // Acquire |setup_mutex_|. if (!setup_singleton->scoped_hold_setup_mutex_.Acquire( setup_singleton->setup_mutex_.Get())) { // UMA data indicates that this happens 0.84 % of the time. return nullptr; } setup_singleton->exit_event_.Reset(); } // Update |original_state| and |installer_state|. original_state->Initialize(); installer_state->Initialize(command_line, master_preferences, *original_state); // UMA data indicates that this method succeeds > 99% of the time. return setup_singleton; } SetupSingleton::~SetupSingleton() = default; bool SetupSingleton::WaitForInterrupt(const base::TimeDelta& max_time) const { const bool exit_event_signaled = exit_event_.TimedWait(max_time); return exit_event_signaled; } SetupSingleton::ScopedHoldMutex::ScopedHoldMutex() = default; SetupSingleton::ScopedHoldMutex::~ScopedHoldMutex() { if (mutex_ != INVALID_HANDLE_VALUE) ::ReleaseMutex(mutex_); } bool SetupSingleton::ScopedHoldMutex::Acquire(HANDLE mutex) { DCHECK_NE(INVALID_HANDLE_VALUE, mutex); DCHECK_EQ(INVALID_HANDLE_VALUE, mutex_); const DWORD wait_return_value = ::WaitForSingleObject( mutex, static_cast<DWORD>(base::TimeDelta::FromSeconds(5).InMilliseconds())); if (wait_return_value == WAIT_ABANDONED || wait_return_value == WAIT_OBJECT_0) { mutex_ = mutex; return true; } DPCHECK(wait_return_value != WAIT_FAILED); return false; } SetupSingleton::SetupSingleton(base::win::ScopedHandle setup_mutex, base::win::ScopedHandle exit_event) : setup_mutex_(std::move(setup_mutex)), exit_event_(std::move(exit_event)) { DCHECK(setup_mutex_.IsValid()); } } // namespace installer
{ "content_hash": "5d4a7a0a257a9305e258fec365cedc8d", "timestamp": "", "source": "github", "line_count": 113, "max_line_length": 80, "avg_line_length": 33.991150442477874, "alnum_prop": 0.6717000781046603, "repo_name": "endlessm/chromium-browser", "id": "409eac1378362adb0431080a8b710aa96c5ec360", "size": "4419", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "chrome/installer/setup/setup_singleton.cc", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
<!DOCTYPE html> <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]--> <!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]--> <!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]--> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>Linda Fittante Photography</title> <meta name="description" content=""> <!-- Enable responsive layouts; tell browsers not to shrink pages to fit small screens --> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- Load styles --> <!-- for production, combine all of these stylesheets --> <link rel="stylesheet" href="css/style.css"> <script src="js/vendor/modernizr-2.6.2.min.js"></script> </head> <body> <!-- page content --> <div class="container"> <div class="portfolio_name_mobile clearfix"><a href="index.html"><img src="img/name_black.png" alt="Linda Fittante"/> </a></div> <div class="nav_mobile clearfix"> <a class="nav-home" href="index.html"></a> <img class="backslash" src="img/slash.png" alt="backslash"/> <a class="nav-about" href="about.html"></a> <img class= "backslash" src="img/slash.png" alt="backslash"/> <a class="nav-contact" href="contact.html"></a> </div> <div class="title clearfix"> <a href="celebrations.html"><img src="img/arrowL.png" alt="previous page"/></a> <img src="img/portraits.png" alt="Portraits Portfolio" /> <a href="babies.html"><img src="img/arrowR.png" alt="next page"/></a> </div> <div class="title_mobile clearfix"> <a href="celebrations.html"><img src="img/arrowL.png" alt="previous page"/></a> <img src="img/portraits_mobile.png" alt="Portraits Portfolio" /> <a href="babies.html"><img src="img/arrowR.png" alt="next page"/></a> </div> <!-- photo grid --> <div class="row_1 clearfix"> <a href="img/brilliant600.jpg" rel="shadowbox[gallery]"> <div class="column lighter"><img src="img/brilliant240.jpg" alt="brilliant author" /></div></a> <a href="img/manly600.jpg" rel="shadowbox[gallery]"> <div class="column lighter"><img src="img/manly240.jpg" alt="business portrait" /></div></a> <a href="img/threshhold600.jpg" rel="shadowbox[gallery]"> <div class="column3 lighter"><img src="img/threshhold240.jpg" alt="teen in dress sitting" /></div></a> </div> <div class="row_2 clearfix"> <a href="img/restart600.jpg" rel="shadowbox[gallery]"> <div class="column lighter"><img src="img/restart240.jpg" alt="happy woman with long black hair" /></div></a> <a href="img/spring600.jpg" rel="shadowbox[gallery]"> <div class="column lighter"><img src="img/spring240.jpg" alt="teen boy and spring grass" /></div></a> <a href="img/history600.jpg" rel="shadowbox[gallery]"> <div class="column3 lighter"><img src="img/history240.jpg" alt="Spanish Historian" /></div></a> </div> <div class="row_3 clearfix"> <a href="img/tommyT600.jpg" rel="shadowbox[gallery]"> <div class="column lighter"><img src="img/tommyT240.jpg" alt="Ethiopian Musician TommyT" /></div></a> <a href="img/sly600.jpg" rel="shadowbox[gallery]"> <div class="column lighter"><img src="img/sly240.jpg" alt="couple" /></div></a> <a href="img/morning600.jpg" rel="shadowbox[gallery]"> <div class="column3 lighter"><img src="img/morning240.jpg" alt="man on bench in the morning" /></div></a> </div> <!-- end photo grid --> <div class="name"><a href="index.html"><img src="img/name.png" alt="Linda Fittante"/> </a></div> <!-- bottom nav --> <div class="nav clearfix"> <a class="nav-home" href="index.html"></a> <img class="backslash" src="img/slash.png" alt="backslash"/> <a class="nav-about" href="about.html"></a> <img class= "backslash" src="img/slash.png" alt="backslash"/> <a class="nav-contact" href="contact.html"></a> </div> <div class="copyright"><img src="img/copyright.png" alt="all images copyright Linda Fittante"</img></div> </div> <!-- end container --> <!-- Load scripts --> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script>window.jQuery || document.write('<script src="js/vendor/jquery-1.10.2.min.js"><\/script>')</script> <script src="js/plugins.js"></script> <script src="js/main.js"></script> <!-- Shadowbox --> <link rel="stylesheet" type="text/css" href="shadowbox-3.0.3/shadowbox.css"> <script type="text/javascript" src="shadowbox-3.0.3/shadowbox.js"></script> <script type="text/javascript"> Shadowbox.init(); </script> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-8811705-27', 'lindafittante.com'); ga('send', 'pageview'); </script> </body> </html>
{ "content_hash": "a3edff8662c0e271e8b0a3c662670d95", "timestamp": "", "source": "github", "line_count": 119, "max_line_length": 167, "avg_line_length": 41.84033613445378, "alnum_prop": 0.6485237999598313, "repo_name": "lindafittante/portfolio", "id": "5a73006cc83b09d8449b5f23f69a1a184ab8ec5e", "size": "4979", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "portraits.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "21344" }, { "name": "HTML", "bytes": "54974" }, { "name": "JavaScript", "bytes": "63144" } ], "symlink_target": "" }
package uk.ac.ebi.embl.api.validation.submission; import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import java.sql.Connection; import java.util.List; import java.util.Optional; import uk.ac.ebi.embl.api.entry.feature.SourceFeature; import uk.ac.ebi.embl.api.entry.genomeassembly.AssemblyInfoEntry; import uk.ac.ebi.embl.api.validation.ValidationEngineException; import uk.ac.ebi.embl.api.validation.helper.taxon.TaxonHelperImpl; import uk.ac.ebi.embl.api.validation.plan.EmblEntryValidationPlanProperty; public class SubmissionOptions { public Optional<SubmissionFiles> submissionFiles = Optional.empty(); public Optional<Context> context = Optional.empty(); public Optional<AssemblyInfoEntry> assemblyInfoEntry = Optional.empty(); public Optional<List<String>> locusTagPrefixes = Optional.empty(); public Optional<SourceFeature> source = Optional.empty(); public Optional<String> analysisId = Optional.empty(); public Optional<Connection> enproConnection = Optional.empty(); public Optional<Connection> eraproConnection = Optional.empty(); public Optional<String> reportDir = Optional.empty(); public Optional<Integer> minGapLength = Optional.empty(); public Optional<String> processDir = Optional.empty(); public Optional<File> reportFile = Optional.empty(); public Optional<Boolean> ignoreError = Optional.empty(); public Optional<String> webinAuthToken = Optional.empty(); public Optional<ServiceConfig> serviceConfig = Optional.empty(); private EmblEntryValidationPlanProperty property =null; public boolean webinCliTestMode = false; public boolean isDevMode = false; public boolean isFixMode = true; public boolean isFixCds = true; public boolean ignoreErrors = false; public boolean isWebinCLI = false; public boolean forceReducedFlatfileCreation = false; private String projectId; public String getProjectId() { return projectId; } public void setProjectId(String projectId) { this.projectId = projectId; } public void init() throws ValidationEngineException { if(!submissionFiles.isPresent() || submissionFiles.get().getFiles() == null || submissionFiles.get().getFiles().isEmpty()) throw new ValidationEngineException("SubmissionOptions:submissionFiles must be provided"); if(!context.isPresent()) throw new ValidationEngineException("SubmissionOptions:context must be provided"); if(!assemblyInfoEntry.isPresent() && isWebinCLI) throw new ValidationEngineException("SubmissionOptions:assemblyinfoentry must be provided"); if(!source.isPresent()&& isWebinCLI) { if(Context.sequence!=context.get()) throw new ValidationEngineException("SubmissionOptions:source must be provided"); } if(!reportDir.isPresent()) throw new ValidationEngineException("SubmissionOptions:reportDir must be provided"); if(!isWebinCLI || isDevMode) { if (!(new File(reportDir.get())).isDirectory()) throw new ValidationEngineException("SubmissionOptions:invalid ReportDir"); } else { for(SubmissionFile file: submissionFiles.get().getFiles()) { if(file.getReportFile() == null ) { throw new ValidationEngineException("SubmissionOptions:reportFile is mandatory for each file."); } } } if(!analysisId.isPresent() && !isWebinCLI) throw new ValidationEngineException("SubmissionOptions:analysisId must be provided."); if(!processDir.isPresent()&&!isWebinCLI &&(context.get()==Context.genome||context.get()==Context.transcriptome)) throw new ValidationEngineException("SubmissionOptions:processDir must be provided to write master file"); if (processDir.isPresent()) { try { if (Files.notExists(Paths.get(processDir.get(), "reduced"))) { Files.createDirectory(Paths.get(processDir.get(), "reduced")); } } catch (IOException e) { throw new ValidationEngineException("Could not create a reduced file directory", e); } } if(!enproConnection.isPresent()||!eraproConnection.isPresent()) { if(!isWebinCLI) { throw new ValidationEngineException("SubmissionOptions:Database connections(ENAPRO,ERAPRO) must be given when validating submission internally"); } } if (!isWebinCLI && ignoreError.isPresent()) { ignoreErrors = ignoreError.get(); } if(!isWebinCLI && context.get() == Context.sequence && !serviceConfig.isPresent()) { throw new ValidationEngineException("SubmissionOptions:Service configuration is mandatory for sequence context"); } } public EmblEntryValidationPlanProperty getEntryValidationPlanProperty() { if(property!=null) return property; property = new EmblEntryValidationPlanProperty(); property.isFixMode.set(isFixMode); property.isFixCds.set(isFixCds); if(locusTagPrefixes.isPresent()) property.locus_tag_prefixes.set(locusTagPrefixes.get()); if(enproConnection.isPresent()) property.enproConnection.set(enproConnection.get()); if(eraproConnection.isPresent()) property.eraproConnection.set(eraproConnection.get()); if(analysisId.isPresent()) property.analysis_id.set(analysisId.get()); if(assemblyInfoEntry.isPresent()) { Integer mgl =minGapLength.isPresent()?minGapLength.get():assemblyInfoEntry.get().getMinGapLength(); if(mgl!=null) property.minGapLength.set(mgl); } if(Context.genome.equals(context.get())) { property.sequenceNumber.set(1); } property.ignore_errors.set(ignoreErrors); property.taxonHelper.set(new TaxonHelperImpl()); property.isRemote.set(isWebinCLI); return property; } public String getWebinERAServiceUrl() { return serviceConfig.get().getEraServiceUrl(); } public String getWebinERAServiceUser() { return serviceConfig.get().getEraServiceUser(); } public String getWebinERAServicePassword() { return serviceConfig.get().getEraServicePassword(); } }
{ "content_hash": "6169acbdcf70aa80165fbd035d70e782", "timestamp": "", "source": "github", "line_count": 146, "max_line_length": 149, "avg_line_length": 39.842465753424655, "alnum_prop": 0.7579508337631081, "repo_name": "enasequence/sequencetools", "id": "125f0b3056a5e0f9fc7ccbe708e30b882195ebfa", "size": "5817", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/uk/ac/ebi/embl/api/validation/submission/SubmissionOptions.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CAP CDS", "bytes": "3626" }, { "name": "Java", "bytes": "4569769" } ], "symlink_target": "" }
static int init() { // regn = cw_register_actions_cipwap_ac(&capwap_actions); return 1; } static struct ac_module module = { .name="Cipwap", .init= init, .detect_by_discovery = 0 }; struct ac_module * mod_cipwap() { return &module; }
{ "content_hash": "5dedd880411dc11b4a903c14f3d1f501", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 57, "avg_line_length": 10.416666666666666, "alnum_prop": 0.636, "repo_name": "7u83/actube", "id": "1e8bacec447c811e183f5d27d187ec0e98350810", "size": "274", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/ac/mod_cipwap.c", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "C", "bytes": "1265098" }, { "name": "CSS", "bytes": "177" }, { "name": "HTML", "bytes": "2512" }, { "name": "JavaScript", "bytes": "1467" }, { "name": "Makefile", "bytes": "14415" }, { "name": "PHP", "bytes": "1165" }, { "name": "Shell", "bytes": "7845" } ], "symlink_target": "" }
/* * Copyright (C) 1990,91 Silicon Graphics, Inc. * _______________________________________________________________________ ______________ S I L I C O N G R A P H I C S I N C . ____________ | | $Revision: 1.2 $ | | Classes: | SoXtResource | | Author(s): David Mott | ______________ S I L I C O N G R A P H I C S I N C . ____________ _______________________________________________________________________ */ #include <Inventor/SbPList.h> #include <Inventor/Xt/SoXtComponent.h> #include <Inventor/Xt/SoXt.h> #include <Inventor/Xt/SoXtResource.h> #include <Inventor/errors/SoDebugError.h> #include <X11/Intrinsic.h> #include <X11/IntrinsicP.h> #include <X11/Xresource.h> // ShellP.h has a variable named 'class' - not good for c++! #define class CLASS #include <X11/ShellP.h> #undef class #define GET_RESOURCE(DISPLAY,STRNAME,STRCLASS,RETTYPE,RETVAL) \ XrmGetResource(XrmGetDatabase(DISPLAY),STRNAME,STRCLASS,RETTYPE,RETVAL) #define GET_QRESOURCE(DISPLAY,QNAME,QCLASS,RETTYPE,RETVAL) \ XrmQGetResource(XrmGetDatabase(DISPLAY),QNAME,QCLASS,RETTYPE,RETVAL) //////////////////////////////////////////////////////////////////////// // // Constructor - this builds a quark list representing the widget // hierarchy leading down to w. // SoXtResource::SoXtResource(Widget widget) // //////////////////////////////////////////////////////////////////////// { if (widget == NULL) return; SbPList nameplist, classplist; SoXtComponent *comp; Widget w = widget; XrmQuark n,c; display = XtDisplay(widget); // Traverse up the widget tree gather widget names and class names. // If the widget is a Inventor component, we do not get these names // from the widget itself; rather, we get them from the component. // This is so that we can fool the X resource manager into looking // up resource values based on our class names (e.g. SoColorPicker) // rather than the 'real' class names (e.g. XmForm). while (w != NULL) { if (comp = SoXtComponent::getComponent(w)) { // get the widget name and class from SoXtComponent. // we do this so that we can use Inventor class names // like "SoMaterialEditor" instead of the Motif names // which the components are really built from (e.g.XmForm). const char *widgetName = comp->getWidgetName(); if (widgetName != NULL) n = XrmStringToQuark(widgetName); else n = XrmStringToQuark(""); const char *className = comp->getClassName(); if (className != NULL) c = XrmStringToQuark(className); else c = XrmStringToQuark(""); } else if ((XtParent(w) == NULL) && XtIsApplicationShell(w)) { // ??? KLUDGE from Xt src code (Xt/Resources.c) // We have to get the application class differently n = w->core.xrm_name; c = ((ApplicationShellWidget) w)->application.xrm_class; // ??? end of kludge } else { // get the widget name and class from the widget n = w->core.xrm_name; c = XtClass(w)->core_class.xrm_class; } nameplist.append((void *) (unsigned long) n); classplist.append((void *) (unsigned long) c); w = XtParent(w); } // Allocate the quark list, and reverse the order of names so that // the list specifies the hierarchy from the root down to this widget. // The size of our list is 2 greater: // 1 for the resource which will be specified later // 1 for a NULL end-of-list sentinel int q,s; int len = nameplist.getLength(); // classplist.getLength() is the same listSize = len + 2; nameList = new XrmQuark[listSize]; classList = new XrmQuark[listSize]; for (q = 0, s = len - 1; s >= 0; q++, s--) { #if (_MIPS_SZPTR == 64 || __ia64) nameList[q] = (XrmQuark) ((long) nameplist[s]); classList[q] = (XrmQuark) ((long) classplist[s]); #else nameList[q] = (XrmQuark) nameplist[s]; classList[q] = (XrmQuark) classplist[s]; #endif } // make the last entry the NULL sentinel nameList[listSize - 1] = NULLQUARK; classList[listSize - 1] = NULLQUARK; } //////////////////////////////////////////////////////////////////////// // // Denstructor - nuke the quark lists. // SoXtResource::~SoXtResource() // //////////////////////////////////////////////////////////////////////// { delete [ /*listSize*/ ] nameList; delete [ /*listSize*/ ] classList; } //////////////////////////////////////////////////////////////////////// // // This gets the 'SbColor' resource value, returning TRUE if successful. // SbBool SoXtResource::getResource(char *resName, char *resClass, SbColor &c) // //////////////////////////////////////////////////////////////////////// { nameList[listSize - 2] = XrmStringToQuark(resName); classList[listSize - 2] = XrmStringToQuark(resClass); return getResource(display, nameList, classList, c); } //////////////////////////////////////////////////////////////////////// // // This gets the 'short' resource value, returning TRUE if successful. // SbBool SoXtResource::getResource(char *resName, char *resClass, short &i) // //////////////////////////////////////////////////////////////////////// { nameList[listSize - 2] = XrmStringToQuark(resName); classList[listSize - 2] = XrmStringToQuark(resClass); return getResource(display, nameList, classList, i); } //////////////////////////////////////////////////////////////////////// // // This gets the 'u_short' resource value, returning TRUE if successful. // SbBool SoXtResource::getResource(char *resName, char *resClass, unsigned short &u) // //////////////////////////////////////////////////////////////////////// { nameList[listSize - 2] = XrmStringToQuark(resName); classList[listSize - 2] = XrmStringToQuark(resClass); return getResource(display, nameList, classList, u); } //////////////////////////////////////////////////////////////////////// // // This gets the value for the resource, returning TRUE if successful. // SbBool SoXtResource::getResource(char *resName, char *resClass, char *&s) // //////////////////////////////////////////////////////////////////////// { nameList[listSize - 2] = XrmStringToQuark(resName); classList[listSize - 2] = XrmStringToQuark(resClass); return getResource(display, nameList, classList, s); } //////////////////////////////////////////////////////////////////////// // // This gets the 'SbBool' resource value, returning TRUE if successful. // SbBool SoXtResource::getResource(char *resName, char *resClass, SbBool &b) // //////////////////////////////////////////////////////////////////////// { nameList[listSize - 2] = XrmStringToQuark(resName); classList[listSize - 2] = XrmStringToQuark(resClass); return getResource(display, nameList, classList, b); } //////////////////////////////////////////////////////////////////////// // // This gets the 'SbBool' resource value, returning TRUE if successful. // SbBool SoXtResource::getResource(char *resName, char *resClass, float &f) // //////////////////////////////////////////////////////////////////////// { nameList[listSize - 2] = XrmStringToQuark(resName); classList[listSize - 2] = XrmStringToQuark(resClass); return getResource(display, nameList, classList, f); } // // Some convenience routines // static SbBool getColor(Display *d, char *val, SbColor &c) { if (val != NULL) { XColor rgb; XParseColor(d, XDefaultColormap(d,DefaultScreen(d)), val, &rgb); short r,g,b; r = rgb.red >> 8; g = rgb.green >> 8; b = rgb.blue >> 8; c.setValue(float(r/255.),float(g/255.),float(b/255.)); return TRUE; } return FALSE; } static SbBool getShort(char *val, short &s) { SbBool ok = FALSE; if (val != NULL) { // the value may or may not be hex (begin with '#') int i; if (sscanf(val, "%d", &i)) { s = i; ok = TRUE; } else if (sscanf(val, "#%x", &i)) { s = i; ok = TRUE; } } return ok; } static SbBool getUShort(char *val, unsigned short &u) { SbBool ok = FALSE; if (val != NULL) { // the value may or may not be hex (begin with '#') int i; if (sscanf(val, "%d", &i)) { u = i; ok = TRUE; } else if (sscanf(val, "#%x", &i)) { u = i; ok = TRUE; } } return ok; } static SbBool getBool(char *val, SbBool &b) { SbBool ok = TRUE; if (val != NULL) { if (strcmp(val, "True") == 0) b = TRUE; else if (strcmp(val, "False") == 0) b = FALSE; else if (strcmp(val, "On") == 0) b = TRUE; else if (strcmp(val, "Off") == 0) b = FALSE; else if (strcmp(val, "true") == 0) b = TRUE; else if (strcmp(val, "false") == 0) b = FALSE; else if (strcmp(val, "on") == 0) b = TRUE; else if (strcmp(val, "off") == 0) b = FALSE; else ok = FALSE; } else ok = FALSE; return ok; } static SbBool getFloat(char *val, float &f) { SbBool ok = FALSE; if (val != NULL) { float g; if (sscanf(val, "%f", &g)) { f = g; ok = TRUE; } } return ok; } // // Get resource from X // //////////////////////////////////////////////////////////////////////// // // Description: // Find the color resource for strName,strClass and return it in c. // // Use: static, private // SbBool SoXtResource::getResource( Display *d, char *strName, char *strClass, SbColor &c) // //////////////////////////////////////////////////////////////////////// { SbBool ok = FALSE; XrmString typeStr; XrmValue result; #ifdef DEBUG // make sure Display is valid if (d == NULL) { SoDebugError::post("SoXtResource::getResource", "ERROR SoXtResource::getResource - Display is NULL"); return FALSE; } #endif if (GET_RESOURCE(d, strName, strClass, &typeStr, &result)) { ok = getColor(d, result.addr, c); } return ok; } //////////////////////////////////////////////////////////////////////// // // Description: // Find the color resource for qName,qClass and return it in c. // // Use: static, public // SbBool SoXtResource::getResource( Display *d, XrmQuarkList qName, XrmQuarkList qClass, SbColor &c) // //////////////////////////////////////////////////////////////////////// { SbBool ok = FALSE; XrmRepresentation rep; XrmValue result; #ifdef DEBUG // make sure Display is valid if (d == NULL) { SoDebugError::post("SoXtResource::getResource", "ERROR SoXtResource::getResource - Display is NULL"); return FALSE; } #endif if (GET_QRESOURCE(d, qName, qClass, &rep, &result)) { ok = getColor(d, result.addr, c); } return ok; } //////////////////////////////////////////////////////////////////////// // // Description: // Find the 'short' resource for strName,strClass and return it in s. // // Use: static, public // SbBool SoXtResource::getResource( Display *d, char *strName, char *strClass, short &s) // //////////////////////////////////////////////////////////////////////// { SbBool ok = FALSE; XrmString typeStr; XrmValue result; #ifdef DEBUG // make sure Display is valid if (d == NULL) { SoDebugError::post("SoXtResource::getResource", "ERROR SoXtResource::getResource - Display is NULL"); return FALSE; } #endif if (GET_RESOURCE(d, strName, strClass, &typeStr, &result)) { ok = getShort(result.addr, s); } return ok; } //////////////////////////////////////////////////////////////////////// // // Description: // Find the 'short' resource for qName,qClass and return it in s. // // Use: static, public // SbBool SoXtResource::getResource( Display *d, XrmQuarkList qName, XrmQuarkList qClass, short &s) // //////////////////////////////////////////////////////////////////////// { SbBool ok = FALSE; XrmRepresentation rep; XrmValue result; #ifdef DEBUG // make sure Display is valid if (d == NULL) { SoDebugError::post("SoXtResource::getResource", "ERROR SoXtResource::getResource - Display is NULL"); return FALSE; } #endif if (GET_QRESOURCE(d, qName, qClass, &rep, &result)) { ok = getShort(result.addr, s); } return ok; } //////////////////////////////////////////////////////////////////////// // // Description: // Find the 'unsigned short' resource for strName,strClass // and return it in u. // // Use: static, public // SbBool SoXtResource::getResource( Display *d, char *strName, char *strClass, unsigned short &u) // //////////////////////////////////////////////////////////////////////// { SbBool ok = FALSE; XrmString typeStr; XrmValue result; #ifdef DEBUG // make sure Display is valid if (d == NULL) { SoDebugError::post("SoXtResource::getResource", "ERROR SoXtResource::getResource - Display is NULL"); return FALSE; } #endif if (GET_RESOURCE(d, strName, strClass, &typeStr, &result)) { ok = getUShort(result.addr, u); } return ok; } //////////////////////////////////////////////////////////////////////// // // Description: // Find the 'unsigned short' resource for qName,qClass // and return it in u. // // Use: static, public // SbBool SoXtResource::getResource( Display *d, XrmQuarkList qName, XrmQuarkList qClass, unsigned short &u) // //////////////////////////////////////////////////////////////////////// { SbBool ok = FALSE; XrmRepresentation rep; XrmValue result; #ifdef DEBUG // make sure Display is valid if (d == NULL) { SoDebugError::post("SoXtResource::getResource", "ERROR SoXtResource::getResource - Display is NULL"); return FALSE; } #endif if (GET_QRESOURCE(d, qName, qClass, &rep, &result)) { ok = getUShort(result.addr, u); } return ok; } //////////////////////////////////////////////////////////////////////// // // Description: // Find the string resource for strName,strClass and return it in s. // // Use: static, public // SbBool SoXtResource::getResource( Display *d, char *strName, char *strClass, char *&s) // //////////////////////////////////////////////////////////////////////// { SbBool ok = FALSE; XrmString typeStr; XrmValue result; #ifdef DEBUG // make sure Display is valid if (d == NULL) { SoDebugError::post("SoXtResource::getResource", "ERROR SoXtResource::getResource - Display is NULL"); return FALSE; } #endif if (GET_RESOURCE(d, strName, strClass, &typeStr, &result)) { if (result.addr != NULL) { s = result.addr; ok = TRUE; } } return ok; } //////////////////////////////////////////////////////////////////////// // // Description: // Find the string resource for qName,qClass and return it in s. // // Use: static, public // SbBool SoXtResource::getResource( Display *d, XrmQuarkList qName, XrmQuarkList qClass, char *&s) // //////////////////////////////////////////////////////////////////////// { SbBool ok = FALSE; XrmRepresentation rep; XrmValue result; #ifdef DEBUG // make sure Display is valid if (d == NULL) { SoDebugError::post("SoXtResource::getResource", "ERROR SoXtResource::getResource - Display is NULL"); return FALSE; } #endif if (GET_QRESOURCE(d, qName, qClass, &rep, &result)) { if (result.addr != NULL) { s = result.addr; ok = TRUE; } } return ok; } //////////////////////////////////////////////////////////////////////// // // Description: // Find the 'SbBool' resource for strName,strClass and return it in b. // Valid strings are "True", "False", "On", "Off". // // Use: static, public // SbBool SoXtResource::getResource( Display *d, char *strName, char *strClass, SbBool &b) // //////////////////////////////////////////////////////////////////////// { SbBool ok = FALSE; XrmString typeStr; XrmValue result; #ifdef DEBUG // make sure Display is valid if (d == NULL) { SoDebugError::post("SoXtResource::getResource", "ERROR SoXtResource::getResource - Display is NULL"); return FALSE; } #endif if (GET_RESOURCE(d, strName, strClass, &typeStr, &result)) { ok = getBool(result.addr, b); } return ok; } //////////////////////////////////////////////////////////////////////// // // Description: // Find the 'short' resource for qName,qClass and return it in s. // Valid strings are "True", "False", "On", "Off". // // Use: static, public // SbBool SoXtResource::getResource( Display *d, XrmQuarkList qName, XrmQuarkList qClass, SbBool &b) // //////////////////////////////////////////////////////////////////////// { SbBool ok = FALSE; XrmRepresentation rep; XrmValue result; #ifdef DEBUG // make sure Display is valid if (d == NULL) { SoDebugError::post("SoXtResource::getResource", "ERROR SoXtResource::getResource - Display is NULL"); return FALSE; } #endif if (GET_QRESOURCE(d, qName, qClass, &rep, &result)) { ok = getBool(result.addr, b); } return ok; } //////////////////////////////////////////////////////////////////////// // // Description: // Get a float value. // // Use: static, private // SbBool SoXtResource::getResource( Display *d, char *strName, char *strClass, float &f) // //////////////////////////////////////////////////////////////////////// { SbBool ok = FALSE; XrmString typeStr; XrmValue result; #ifdef DEBUG // make sure Display is valid if (d == NULL) { SoDebugError::post("SoXtResource::getResource", "ERROR SoXtResource::getResource - Display is NULL"); return FALSE; } #endif if (GET_RESOURCE(d, strName, strClass, &typeStr, &result)) { ok = getFloat(result.addr, f); } return ok; } //////////////////////////////////////////////////////////////////////// // // Description: // Get a float value. // // Use: static, private // SbBool SoXtResource::getResource( Display *d, XrmQuarkList qName, XrmQuarkList qClass, float &f) // //////////////////////////////////////////////////////////////////////// { SbBool ok = FALSE; XrmRepresentation rep; XrmValue result; #ifdef DEBUG // make sure Display is valid if (d == NULL) { SoDebugError::post("SoXtResource::getResource", "ERROR SoXtResource::getResource - Display is NULL"); return FALSE; } #endif if (GET_QRESOURCE(d, qName, qClass, &rep, &result)) { ok = getFloat(result.addr, f); } return ok; }
{ "content_hash": "889433ee3d2f315575787bfc373789aa", "timestamp": "", "source": "github", "line_count": 784, "max_line_length": 75, "avg_line_length": 23.7015306122449, "alnum_prop": 0.5207727908728877, "repo_name": "OpenXIP/xip-libraries", "id": "0165cd4b1e41fe15c4a6e2b88e88dd6f3bfd18e7", "size": "20088", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/extern/inventor/libSoXt/src/SoXtRsrc.c++", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Assembly", "bytes": "8314" }, { "name": "C", "bytes": "21064260" }, { "name": "C#", "bytes": "41726" }, { "name": "C++", "bytes": "33308677" }, { "name": "D", "bytes": "373" }, { "name": "Java", "bytes": "59889" }, { "name": "JavaScript", "bytes": "35954" }, { "name": "Objective-C", "bytes": "272450" }, { "name": "Perl", "bytes": "727865" }, { "name": "Prolog", "bytes": "101780" }, { "name": "Puppet", "bytes": "371631" }, { "name": "Python", "bytes": "162364" }, { "name": "Shell", "bytes": "906979" }, { "name": "Smalltalk", "bytes": "10530" }, { "name": "SuperCollider", "bytes": "2169433" }, { "name": "Tcl", "bytes": "10289" } ], "symlink_target": "" }
package org.apache.tomcat.websocket.server; import java.io.IOException; import javax.servlet.FilterChain; import javax.servlet.GenericFilter; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Handles the initial HTTP connection for WebSocket connections. */ public class WsFilter extends GenericFilter { private static final long serialVersionUID = 1L; private WsServerContainer sc; @Override public void init() throws ServletException { sc = (WsServerContainer) getServletContext().getAttribute( Constants.SERVER_CONTAINER_SERVLET_CONTEXT_ATTRIBUTE); } @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { // This filter only needs to handle WebSocket upgrade requests if (!sc.areEndpointsRegistered() || !UpgradeUtil.isWebSocketUpgradeRequest(request, response)) { chain.doFilter(request, response); return; } // HTTP request with an upgrade header for WebSocket present HttpServletRequest req = (HttpServletRequest) request; HttpServletResponse resp = (HttpServletResponse) response; // Check to see if this WebSocket implementation has a matching mapping String path; String pathInfo = req.getPathInfo(); if (pathInfo == null) { path = req.getServletPath(); } else { path = req.getServletPath() + pathInfo; } WsMappingResult mappingResult = sc.findMapping(path); if (mappingResult == null) { // No endpoint registered for the requested path. Let the // application handle it (it might redirect or forward for example) chain.doFilter(request, response); return; } UpgradeUtil.doUpgrade(sc, req, resp, mappingResult.getConfig(), mappingResult.getPathParams()); } }
{ "content_hash": "ad8b94edd56395727a83b700d3ebc5a8", "timestamp": "", "source": "github", "line_count": 66, "max_line_length": 79, "avg_line_length": 32.68181818181818, "alnum_prop": 0.6773296244784422, "repo_name": "Nickname0806/Test_Q4", "id": "17f56511beba895d889c77b4b492ce8238bd707e", "size": "2958", "binary": false, "copies": "1", "ref": "refs/heads/trunk", "path": "java/org/apache/tomcat/websocket/server/WsFilter.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "37067" }, { "name": "CSS", "bytes": "13304" }, { "name": "HTML", "bytes": "324818" }, { "name": "Java", "bytes": "18705370" }, { "name": "NSIS", "bytes": "40764" }, { "name": "Perl", "bytes": "13860" }, { "name": "Shell", "bytes": "47014" }, { "name": "XSLT", "bytes": "31592" } ], "symlink_target": "" }
using System; using VistaMedTools.Properties; namespace VistaMedTools { public class ReestrDdParams: DateRangeParams { public DateTime CreateDate { get; set; } public string AccountNumbers { get; set; } public string DirName { get; set; } public static new ReestrDdParams GetParams() { return GetTypedParams<ReestrDdParams>(); } } }
{ "content_hash": "6e10d9769e3ff68d93b7ebad65f1309c", "timestamp": "", "source": "github", "line_count": 17, "max_line_length": 52, "avg_line_length": 23.88235294117647, "alnum_prop": 0.6403940886699507, "repo_name": "vvboborykin/VistaMedTools", "id": "5ed609e59deb2514d1cfd6cfa21d08cabcbc578f", "size": "406", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "VistaMedTools/Reports/ReestrDd/ReestrDdParams.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "8041452" } ], "symlink_target": "" }
<?php namespace frontend\modules\user_post\controllers; use yii\web\Controller; /** * Default controller for the `user_post` module */ class DefaultController extends Controller { /** * Renders the index view for the module * @return string */ public function actionIndex() { return $this->render('index'); } }
{ "content_hash": "b58eadbaaa92b223506f06aba93eb7a8", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 49, "avg_line_length": 17.75, "alnum_prop": 0.647887323943662, "repo_name": "king199025/bikers", "id": "4e16005d68060608050912c3393c4548ee3a586a", "size": "355", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "frontend/modules/user_post/controllers/DefaultController.php", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "ApacheConf", "bytes": "1758" }, { "name": "Batchfile", "bytes": "1541" }, { "name": "CSS", "bytes": "1532462" }, { "name": "HTML", "bytes": "3445488" }, { "name": "JavaScript", "bytes": "6231880" }, { "name": "PHP", "bytes": "675031" } ], "symlink_target": "" }
<?xml encoding="utf-8" ?> <WebBrowser Margin="20" Uri="www.baidu.com" > </WebBrowser>
{ "content_hash": "2aebea6bb81a37e73062ec021bda16f4", "timestamp": "", "source": "github", "line_count": 4, "max_line_length": 45, "avg_line_length": 21.75, "alnum_prop": 0.6551724137931034, "repo_name": "china20/MPFUI", "id": "bfaf6f81a47206e550d9798c8bf0bd2f482ad095", "size": "87", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "bin/resource/MPF/Controls/WebBrowser.xml", "mode": "33188", "license": "mit", "language": [ { "name": "Assembly", "bytes": "5746" }, { "name": "C", "bytes": "462785" }, { "name": "C++", "bytes": "10311198" }, { "name": "Makefile", "bytes": "907" }, { "name": "Objective-C", "bytes": "107281" } ], "symlink_target": "" }
require 'rubygems/gem_runner' require 'rubygems/exceptions' require 'rubygems/commands/install_command' require 'rubygems/commands/update_command' require 'fileutils' module Gem class GemRunner def run_command(command_name, args) args.unshift command_name.to_s do_configuration(args) cmd_manager = @command_manager_class.instance config_args = Gem.configuration[command_name.to_s] config_args = case config_args when String config_args.split ' ' else Array(config_args) end Command.add_specific_extra_args(command_name, config_args) cmd_manager.run(Gem.configuration.args) rescue Gem::SystemExitException cmd_manager.cmd ensure cmd_manager.cmd end end class Command def get_all_referenced_gem_specs get_all_gem_names.map { |name| Gem.source_index.find_name(name).last }.compact end end class CommandManager attr_accessor :cmd alias :original_find_command :find_command def find_command(cmd_name) self.cmd = original_find_command(cmd_name) self.cmd end end module MiniGems module ScriptHelper def minigems_path @minigems_path ||= begin if (gem_spec = Gem.source_index.find_name('minigems').sort_by { |g| g.version }.last) gem_spec.full_gem_path else raise "Minigems gem not found!" end end end def adapt_executables_for(gemspec) gemspec.executables.each do |executable| next if executable == 'minigem' # better not modify minigem itself if File.exists?(wrapper_path = File.join(Gem.bindir, executable)) wrapper_code = interpolate_wrapper(gemspec.name, executable) begin if File.open(wrapper_path, 'w') { |f| f.write(wrapper_code) } puts "Adapted #{wrapper_path} to use minigems instead of rubygems." else puts "Failed to adapt #{wrapper_path} - maybe you need sudo permissions?" end rescue Errno::EACCES => e puts "Failed to adapt #{wrapper_path} - maybe you need sudo permissions?" end end end end def revert_executables_for(gemspec) gemspec.executables.each do |executable| next if executable == 'minigem' # better not modify minigem itself if File.exists?(wrapper_path = File.join(Gem.bindir, executable)) wrapper_code = interpolate_wrapper(gemspec.name, executable, 'rubygems') begin if File.open(wrapper_path, 'w') { |f| f.write(wrapper_code) } puts "Reverted #{wrapper_path} to use rubygems instead of minigems." else puts "Failed to revert #{wrapper_path} - maybe you need sudo permissions?" end rescue Errno::EACCES => e puts "Failed to revert #{wrapper_path} - maybe you need sudo permissions?" end end end end def ensure_in_load_path!(force = false) install_path = File.join(Gem::ConfigMap[:sitelibdir], 'minigems.rb') if force || !File.exists?(install_path) if File.exists?(source_path = File.join(minigems_path, 'lib', 'minigems.rb')) begin minigems_code = File.read(source_path) placeholder = "FULL_RUBYGEMS_METHODS = []" replacement = "FULL_RUBYGEMS_METHODS = %w[\n " replacement << (Gem.methods - Object.methods).sort.join("\n ") replacement << "\n ]" File.open(install_path, 'w') do |f| f.write minigems_code.sub(placeholder, replacement) end minigems_dir = File.join(minigems_path, 'lib', 'minigems') FileUtils.cp_r(minigems_dir, Gem::ConfigMap[:sitelibdir]) puts "Installed minigems at #{install_path}" rescue Errno::EACCES puts "Could not install minigems at #{install_path} (try sudo)" end end end end def remove_minigems! minigems_dir = File.join(Gem::ConfigMap[:sitelibdir], 'minigems') if File.exists?(install_path = File.join(Gem::ConfigMap[:sitelibdir], 'minigems.rb')) if FileUtils.rm(install_path) && FileUtils.rm_rf(minigems_dir) puts "Succesfully removed #{install_path}" return end end rescue => e puts e.message puts "Could not remove #{install_path} (try sudo)" end def interpolate_wrapper(gem_name, executable_name, mode = 'minigems') @template_code ||= File.read(File.join(minigems_path, 'lib', 'minigems', 'executable_wrapper')) vars = { 'GEM_NAME' => gem_name, 'EXECUTABLE_NAME' => executable_name } vars['SHEBANG'] = "#!/usr/bin/env " + Gem::ConfigMap[:ruby_install_name] vars['GEM_MODE'] = mode vars.inject(@template_code) { |str,(k,v)| str.gsub(k,v) } end end end end
{ "content_hash": "63359e4d9c6ce9ee3ec50d02855b8411", "timestamp": "", "source": "github", "line_count": 141, "max_line_length": 111, "avg_line_length": 36.90070921985816, "alnum_prop": 0.5787045935037478, "repo_name": "fabien/minigems", "id": "f1c42d5fa173b790001ffb5aa5412b51ce868d39", "size": "5203", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/minigems/script_helper.rb", "mode": "33188", "license": "mit", "language": [ { "name": "Ruby", "bytes": "31398" } ], "symlink_target": "" }
ACCEPTED #### According to International Plant Names Index #### Published in null #### Original name null ### Remarks null
{ "content_hash": "a13db837707019e8da34de2a71480e5f", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 31, "avg_line_length": 9.692307692307692, "alnum_prop": 0.7063492063492064, "repo_name": "mdoering/backbone", "id": "919a121f48c654f7d343f5f2d98ec64a7a81014b", "size": "178", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Malpighiales/Rhizophoraceae/Cassipourea/Cassipourea microphylla/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
package VMOMI::AlarmEmailFailedEvent; use parent 'VMOMI::AlarmEvent'; use strict; use warnings; our @class_ancestors = ( 'AlarmEvent', 'Event', 'DynamicData', ); our @class_members = ( ['entity', 'ManagedEntityEventArgument', 0, ], ['to', undef, 0, ], ['reason', 'LocalizedMethodFault', 0, ], ); sub get_class_ancestors { return @class_ancestors; } sub get_class_members { my $class = shift; my @super_members = $class->SUPER::get_class_members(); return (@super_members, @class_members); } 1;
{ "content_hash": "3b9fdc9405763ba0b29f615c5b4ccb54", "timestamp": "", "source": "github", "line_count": 29, "max_line_length": 59, "avg_line_length": 18.689655172413794, "alnum_prop": 0.6328413284132841, "repo_name": "stumpr/p5-vmomi", "id": "051c004153470d78d825b093878a7772a03d9338", "size": "542", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/VMOMI/AlarmEmailFailedEvent.pm", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Perl", "bytes": "2084415" } ], "symlink_target": "" }