text:
package io.datalayer.data.shuffle;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class Shuffle {

    public static void main(String... args) {
        List<String> l = Arrays.asList(args);
        Collections.shuffle(l);
        System.out.println(l);
    }
}

redpajama_set_name: RedPajamaGithub


text:
package org.myeslib.example.jdbi.routes;

import lombok.RequiredArgsConstructor;

import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.myeslib.core.Command;
import org.myeslib.util.gson.CommandFromStringFunction;

import com.google.inject.Inject;

@RequiredArgsConstructor(onConstructor=@__(@Inject))
public class ReceiveCommandsAsJsonRoute  extends RouteBuilder{

    final String sourceUri;
    final String targetUri;
    final CommandFromStringFunction commandFromStringFunction;

    @Override
    public void configure() throws Exception {

        from(sourceUri)
            .streamCaching()
            .routeId("receive-commands-as-json")
            .process(new Processor() {
                @Override
                public void process(Exchange e) throws Exception {
                    String body = e.getIn().getBody(String.class);
                    e.getOut().setBody(commandFromStringFunction.apply(body), Command.class);
                }
            })
            .log("received id ${body.id} - targetVersion ${body.targetVersion}")
            .to(targetUri);

	}

}


text:
const HTTPResponse = require('../shared/HTTPResponse');

module.exports = (superclass) => class HTTPResponsePayload extends superclass {
  constructor(httpResponse) {
    super();
    this.setHTTPResponse(new HTTPResponse(httpResponse));
  }

  /**
  * Sets the httpResponse for the payload.
  * @param {HTTPResponse} httpResponse The HTTPResponse object to be set on the payload.
  * @public
  */
  setHTTPResponse(httpResponse) {
    this.httpResponse = httpResponse;
  }
}


text:
package com.spiny.util.yaml;

import java.io.File;
import java.io.IOException;

import org.bukkit.configuration.file.YamlConfiguration;

import com.spiny.util.file.IOMethod;

public class YamlIOMethod implements IOMethod<YamlConfiguration> {

	@Override
	public YamlConfiguration load(File file) {
		return YamlConfiguration.loadConfiguration(file);
	}

	@Override
	public void save(File file, YamlConfiguration o) {
		try {
			o.save(file);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}


text:
module I18n::Backend::Cells
  def load_translations(*filenames)
    return super(*filenames) if filenames.present?

    additional_cell_paths = [
      Dir[Folio::Engine.root.join("app", "cells", "**", "*.yml").to_s],
      Dir[Rails.root.join("app", "cells", "**", "*.yml").to_s]
    ]

    super(*(I18n.load_path + additional_cell_paths))
  end
end

I18n::Backend::Simple.include(I18n::Backend::Cells)


text:
package tests

import (
	. "github.com/onsi/ginkgo/v2"
)

var _ = DescribeTable("Booklit", (Example).Run,
	Entry("references to other sections on the same page", Example{
		Input: `\title{Hello, world!}

See also \reference{section-c}{the last section}.

\section{
	\title{Section A}

	See also \reference{section-b}.
}

\section{
	\title{Section B}

	See also \reference{section-a}.
}

\section{
	\title{Section C}

	See also \reference{hello-world}.
}
`,

		Outputs: Files{
			"hello-world.html": `

Hello, world!

See also the last section.

1 Section A

See also Section B.

2 Section B

See also Section A.

3 Section C

See also Hello, world!.

`,
		},
	}),

	Entry("references to other sections on split pages", Example{
		Input: `\title{Hello, world!}

See also \reference{section-c}{the last section}.

\split-sections

\section{
	\title{Section A}

	See also \reference{section-b}.
}

\section{
	\title{Section B}

	See also \reference{section-a}.
}

\section{
	\title{Section C}

	See also \reference{hello-world}.
}
`,

		Outputs: Files{
			"hello-world.html": `

Hello, world!

See also the last section.

`,
			"section-a.html": `

1 Section A

See also Section B.

`,
			"section-b.html": `

2 Section B

See also Section A.

`,
			"section-c.html": `

3 Section C

See also Hello, world!.

`,
		},
	}),

	Entry("explicit target elements", Example{
		Input: `\title{Hello, world!}

\reference{target-a}

\reference{target-a}{with display}

\reference{target-without-display}

\reference{target-without-display}{with display}

\section{
	\title{Some Section}

	Foo bar.

	\target{target-a}{Target A} Here's target A.

	\target{target-without-display} Here's another target.
}
`,

		Outputs: Files{
			"hello-world.html": `

Hello, world!

Target A

with display

target-without-display

with display

1 Some Section

Foo bar.

 Here's target A.

 Here's another target.

`,
		},
	}),

	Entry("aux", Example{
		Input: `\title{Hello, world!\aux{: Foo Bar}}

See also \reference{section-c}{the last section}.

\table-of-contents

\section{
	\title{Section A}

	See also \reference{section-b}.
}

\section{
	\title{Section B\aux{aby}}

	See also \reference{some-anchor}.
}

\section{
	\title{Section C}

	\target{some-anchor}{I'm an\aux{ awesome} anchor.}See also \reference{hello-world}.
}
`,

		Outputs: Files{
			"hello-world.html": `

Hello, world!: Foo Bar

See also the last section.

Section A

Section B

Section C

1 Section A

See also Section B.

2 Section Baby

See also I'm an anchor..

3 Section C

See also Hello, world!.

`,
		},
	}),
)


text:
.icon-NeedsReviewFill { background-image: url('png/NeedsReviewFill.png'); background-repeat: no-repeat; }

.icon-NeedsReviewOpen { background-image: url('png/NeedsReviewOpen.png'); background-repeat: no-repeat; }

.icon-PDF_icon { background-image: url('png/PDF_icon.png'); background-repeat: no-repeat; }

.icon-add { background-image: url('png/add.png'); background-repeat: no-repeat; }

.icon-admin-white { background-image: url('png/admin-white.png'); background-repeat: no-repeat; }

.icon-admin { background-image: url('png/admin.png'); background-repeat: no-repeat; }

.icon-angle-bracket-left { background-image: url('png/angle-bracket-left.png'); background-repeat: no-repeat; }

.icon-angle-bracket-right { background-image: url('png/angle-bracket-right.png'); background-repeat: no-repeat; }

.icon-arrow-right { background-image: url('png/arrow-right.png'); background-repeat: no-repeat; }

.icon-arrow-select { background-image: url('png/arrow-select.png'); background-repeat: no-repeat; }

.icon-bars { background-image: url('png/bars.png'); background-repeat: no-repeat; }

.icon-bell { background-image: url('png/bell.png'); background-repeat: no-repeat; }

.icon-book-symbol-1 { background-image: url('png/book-symbol-1.png'); background-repeat: no-repeat; }

.icon-book-symbol-10 { background-image: url('png/book-symbol-10.png'); background-repeat: no-repeat; }

.icon-book-symbol-11 { background-image: url('png/book-symbol-11.png'); background-repeat: no-repeat; }

.icon-book-symbol-12 { background-image: url('png/book-symbol-12.png'); background-repeat: no-repeat; }

.icon-book-symbol-2 { background-image: url('png/book-symbol-2.png'); background-repeat: no-repeat; }

.icon-book-symbol-3 { background-image: url('png/book-symbol-3.png'); background-repeat: no-repeat; }

.icon-book-symbol-4 { background-image: url('png/book-symbol-4.png'); background-repeat: no-repeat; }

.icon-book-symbol-5 { background-image: url('png/book-symbol-5.png'); background-repeat: no-repeat; }

.icon-book-symbol-6 { background-image: url('png/book-symbol-6.png'); background-repeat: no-repeat; }

.icon-book-symbol-7 { background-image: url('png/book-symbol-7.png'); background-repeat: no-repeat; }

.icon-book-symbol-8 { background-image: url('png/book-symbol-8.png'); background-repeat: no-repeat; }

.icon-book-symbol-9 { background-image: url('png/book-symbol-9.png'); background-repeat: no-repeat; }

.icon-book { background-image: url('png/book.png'); background-repeat: no-repeat; }

.icon-bookcase-white { background-image: url('png/bookcase-white.png'); background-repeat: no-repeat; }

.icon-bookcase { background-image: url('png/bookcase.png'); background-repeat: no-repeat; }

.icon-booklet { background-image: url('png/booklet.png'); background-repeat: no-repeat; }

.icon-bracket-left { background-image: url('png/bracket-left.png'); background-repeat: no-repeat; }

.icon-bracket-right { background-image: url('png/bracket-right.png'); background-repeat: no-repeat; }

.icon-calendar { background-image: url('png/calendar.png'); background-repeat: no-repeat; }

.icon-cart { background-image: url('png/cart.png'); background-repeat: no-repeat; }

.icon-celtic1 { background-image: url('png/celtic1.png'); background-repeat: no-repeat; }

.icon-celtic2 { background-image: url('png/celtic2.png'); background-repeat: no-repeat; }

.icon-check-circle-filled { background-image: url('png/check-circle-filled.png'); background-repeat: no-repeat; }

.icon-check-circle { background-image: url('png/check-circle.png'); background-repeat: no-repeat; }

.icon-check { background-image: url('png/check.png'); background-repeat: no-repeat; }

.icon-chevron-down-heavy { background-image: url('png/chevron-down-heavy.png'); background-repeat: no-repeat; }

.icon-chevron-down { background-image: url('png/chevron-down.png'); background-repeat: no-repeat; }

.icon-chevron-left-heavy-trans { background-image: url('png/chevron-left-heavy-trans.png'); background-repeat: no-repeat; }

.icon-chevron-left-heavy { background-image: url('png/chevron-left-heavy.png'); background-repeat: no-repeat; }

.icon-chevron-left { background-image: url('png/chevron-left.png'); background-repeat: no-repeat; }

.icon-chevron-right-heavy-trans { background-image: url('png/chevron-right-heavy-trans.png'); background-repeat: no-repeat; }

.icon-chevron-right-heavy { background-image: url('png/chevron-right-heavy.png'); background-repeat: no-repeat; }

.icon-chevron-right { background-image: url('png/chevron-right.png'); background-repeat: no-repeat; }

.icon-chocolate-white { background-image: url('png/chocolate-white.png'); background-repeat: no-repeat; }

.icon-chocolate { background-image: url('png/chocolate.png'); background-repeat: no-repeat; }

.icon-choose-icon { background-image: url('png/choose-icon.png'); background-repeat: no-repeat; }

.icon-circle-outline { background-image: url('png/circle-outline.png'); background-repeat: no-repeat; }

.icon-close-white { background-image: url('png/close-white.png'); background-repeat: no-repeat; }

.icon-close { background-image: url('png/close.png'); background-repeat: no-repeat; }

.icon-copy-icon { background-image: url('png/copy-icon.png'); background-repeat: no-repeat; }

.icon-curly-bracket-left { background-image: url('png/curly-bracket-left.png'); background-repeat: no-repeat; }

.icon-curly-bracket-right { background-image: url('png/curly-bracket-right.png'); background-repeat: no-repeat; }

.icon-dashboard { background-image: url('png/dashboard.png'); background-repeat: no-repeat; }

.icon-default-size-white { background-image: url('png/default-size-white.png'); background-repeat: no-repeat; }

.icon-default-size { background-image: url('png/default-size.png'); background-repeat: no-repeat; }

.icon-document { background-image: url('png/document.png'); background-repeat: no-repeat; }

.icon-download { background-image: url('png/download.png'); background-repeat: no-repeat; }

.icon-eye { background-image: url('png/eye.png'); background-repeat: no-repeat; }

.icon-facebook { background-image: url('png/facebook.png'); background-repeat: no-repeat; }

.icon-filter { background-image: url('png/filter.png'); background-repeat: no-repeat; }

.icon-folder { background-image: url('png/folder.png'); background-repeat: no-repeat; }

.icon-globe-white { background-image: url('png/globe-white.png'); background-repeat: no-repeat; }

.icon-globe { background-image: url('png/globe.png'); background-repeat: no-repeat; }

.icon-google-plus { background-image: url('png/google-plus.png'); background-repeat: no-repeat; }

.icon-graduation-hat { background-image: url('png/graduation-hat.png'); background-repeat: no-repeat; }

.icon-grid { background-image: url('png/grid.png'); background-repeat: no-repeat; }

.icon-id-card { background-image: url('png/id-card.png'); background-repeat: no-repeat; }

.icon-info-circle-filled { background-image: url('png/info-circle-filled.png'); background-repeat: no-repeat; }

.icon-info-circle { background-image: url('png/info-circle.png'); background-repeat: no-repeat; }

.icon-institution { background-image: url('png/institution.png'); background-repeat: no-repeat; }

.icon-key { background-image: url('png/key.png'); background-repeat: no-repeat; }

.icon-label-holder { background-image: url('png/label-holder.png'); background-repeat: no-repeat; }

.icon-leather { background-image: url('png/leather.png'); background-repeat: no-repeat; }

.icon-linkedin { background-image: url('png/linkedin.png'); background-repeat: no-repeat; }

.icon-list { background-image: url('png/list.png'); background-repeat: no-repeat; }

.icon-lock { background-image: url('png/lock.png'); background-repeat: no-repeat; }

.icon-mail { background-image: url('png/mail.png'); background-repeat: no-repeat; }

.icon-mandala1 { background-image: url('png/mandala1.png'); background-repeat: no-repeat; }

.icon-maximize-white { background-image: url('png/maximize-white.png'); background-repeat: no-repeat; }

.icon-maximize { background-image: url('png/maximize.png'); background-repeat: no-repeat; }

.icon-minimize-white { background-image: url('png/minimize-white.png'); background-repeat: no-repeat; }

.icon-minimize { background-image: url('png/minimize.png'); background-repeat: no-repeat; }

.icon-needs-review-nofill { background-image: url('png/needs-review-nofill.png'); background-repeat: no-repeat; }

.icon-parentheses-left { background-image: url('png/parentheses-left.png'); background-repeat: no-repeat; }

.icon-parentheses-right { background-image: url('png/parentheses-right.png'); background-repeat: no-repeat; }

.icon-pencil { background-image: url('png/pencil.png'); background-repeat: no-repeat; }

.icon-phone { background-image: url('png/phone.png'); background-repeat: no-repeat; }

.icon-pinterest { background-image: url('png/pinterest.png'); background-repeat: no-repeat; }

.icon-printer { background-image: url('png/printer.png'); background-repeat: no-repeat; }

.icon-profile-icon { background-image: url('png/profile-icon.png'); background-repeat: no-repeat; }

.icon-question-mark-circle { background-image: url('png/question-mark-circle.png'); background-repeat: no-repeat; }

.icon-question-mark { background-image: url('png/question-mark.png'); background-repeat: no-repeat; }

.icon-receipt { background-image: url('png/receipt.png'); background-repeat: no-repeat; }

.icon-review-icon { background-image: url('png/review-icon.png'); background-repeat: no-repeat; }

.icon-star { background-image: url('png/star.png'); background-repeat: no-repeat; }

.icon-thumbs-up { background-image: url('png/thumbs-up.png'); background-repeat: no-repeat; }

.icon-trash { background-image: url('png/trash.png'); background-repeat: no-repeat; }

.icon-twitter { background-image: url('png/twitter.png'); background-repeat: no-repeat; }

.icon-unread-circle { background-image: url('png/unread-circle.png'); background-repeat: no-repeat; }

.icon-user { background-image: url('png/user.png'); background-repeat: no-repeat; }

.icon-warning-shape { background-image: url('png/warning-shape.png'); background-repeat: no-repeat; }

.icon-warning-symbol { background-image: url('png/warning-symbol.png'); background-repeat: no-repeat; }

.icon-warning { background-image: url('png/warning.png'); background-repeat: no-repeat; }

.icon-what-icon { background-image: url('png/what-icon.png'); background-repeat: no-repeat; }

.icon-wood-90 { background-image: url('png/wood-90.png'); background-repeat: no-repeat; }

.icon-wood { background-image: url('png/wood.png'); background-repeat: no-repeat; }

.icon-x { background-image: url('png/x.png'); background-repeat: no-repeat; }

.icon-youtube { background-image: url('png/youtube.png'); background-repeat: no-repeat; }


text:
package com.qust.demo;

import android.content.Context;
import android.view.WindowManager;

/**
 * 屏幕帮助类
 *
 * @author zhaokaiqiang
 *
 */
public class ScreenUtils {

	/**
	 * 获取屏幕宽度
	 *
	 * @return
	 */
	@SuppressWarnings("deprecation")
	public static int getScreenWidth(Context context) {
		return ((WindowManager) context
				.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay()
				.getWidth();
	}

	/**
	 * 获取屏幕宽度
	 *
	 * @return
	 */
	@SuppressWarnings("deprecation")
	public static int getScreenHeight(Context context) {
		return ((WindowManager) context
				.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay()
				.getHeight();
	}

}


text:
<?php

namespace Integrated\Common\Content;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Integrated\Common\Content\Embedded\RelationInterface;

/**
 * @author Jeroen van Leeuwen <jeroen@e-active.nl>
 * @author Jan Sanne Mulder <jansanne@e-active.nl>
 * @author Johnny Borg <johnny@e-active.nl>
 */
interface ContentInterface
{
    /**
     * Return the id of the content.
     *
     * @return string
     */
    public function getId();

    /**
     * Return the Slug of the content.
     *
     * @return string
     */
    public function getSlug();

    /**
     * Set the slug of the Content.
     *
     * @param string $slug
     *
     * @return ContentInterface
     */
    public function setSlug($slug);

    /**
     * Return the contentType of the Content.
     *
     * @return string
     */
    public function getContentType();

    /**
     * Set the contentType of the Content.
     *
     * @param string $contentType
     *
     * @return ContentInterface
     */
    public function setContentType($contentType);

    /**
     * Get the relations of the document.
     *
     * @return ArrayCollection
     */
    public function getRelations();

    /**
     * @param $relationId
     *
     * @return RelationInterface|bool
     */
    public function getRelation($relationId);

    /**
     * Set the relations of the document.
     *
     * @param Collection $relations
     *
     * @return ContentInterface
     */
    public function setRelations(Collection $relations);

    /**
     * Add relation to relations collection.
     *
     * @param RelationInterface $relation
     *
     * @return ContentInterface
     */
    public function addRelation(RelationInterface $relation);

    /**
     * Remove relation from relations collection.
     *
     * @param RelationInterface $relation
     *
     * @return ContentInterface
     */
    public function removeRelation(RelationInterface $relation);
}


text:
const ariaDescribedBy = 'aria-describedby';
export default ariaDescribedBy;


text:
package org.apache.cassandra.transport.messages;

import java.util.UUID;

import com.google.common.collect.ImmutableMap;
import io.netty.buffer.ByteBuf;

import org.apache.cassandra.cql3.CQLStatement;
import org.apache.cassandra.cql3.ColumnSpecification;
import org.apache.cassandra.cql3.QueryHandler;
import org.apache.cassandra.cql3.QueryOptions;
import org.apache.cassandra.cql3.statements.ParsedStatement;
import org.apache.cassandra.exceptions.PreparedQueryNotFoundException;
import org.apache.cassandra.service.ClientState;
import org.apache.cassandra.service.QueryState;
import org.apache.cassandra.tracing.Tracing;
import org.apache.cassandra.transport.*;
import org.apache.cassandra.utils.JVMStabilityInspector;
import org.apache.cassandra.utils.MD5Digest;
import org.apache.cassandra.utils.UUIDGen;

public class ExecuteMessage extends Message.Request
{
    public static final Message.Codec<ExecuteMessage> codec = new Message.Codec<ExecuteMessage>()
    {
        public ExecuteMessage decode(ByteBuf body, int version)
        {
            byte[] id = CBUtil.readBytes(body);
            return new ExecuteMessage(MD5Digest.wrap(id), QueryOptions.codec.decode(body, version));
        }

        public void encode(ExecuteMessage msg, ByteBuf dest, int version)
        {
            CBUtil.writeBytes(msg.statementId.bytes, dest);
            if (version == 1)
            {
                CBUtil.writeValueList(msg.options.getValues(), dest);
                CBUtil.writeConsistencyLevel(msg.options.getConsistency(), dest);
            }
            else
            {
                QueryOptions.codec.encode(msg.options, dest, version);
            }
        }

        public int encodedSize(ExecuteMessage msg, int version)
        {
            int size = 0;
            size += CBUtil.sizeOfBytes(msg.statementId.bytes);
            if (version == 1)
            {
                size += CBUtil.sizeOfValueList(msg.options.getValues());
                size += CBUtil.sizeOfConsistencyLevel(msg.options.getConsistency());
            }
            else
            {
                size += QueryOptions.codec.encodedSize(msg.options, version);
            }
            return size;
        }
    };

    public final MD5Digest statementId;
    public final QueryOptions options;

    public ExecuteMessage(MD5Digest statementId, QueryOptions options)
    {
        super(Message.Type.EXECUTE);
        this.statementId = statementId;
        this.options = options;
    }

    public Message.Response execute(QueryState state)
    {
        try
        {
            QueryHandler handler = ClientState.getCQLQueryHandler();
            ParsedStatement.Prepared prepared = handler.getPrepared(statementId);
            if (prepared == null)
                throw new PreparedQueryNotFoundException(statementId);

            options.prepare(prepared.boundNames);
            CQLStatement statement = prepared.statement;

            if (options.getPageSize() == 0)
                throw new ProtocolException("The page size cannot be 0");

            UUID tracingId = null;
            if (isTracingRequested())
            {
                tracingId = UUIDGen.getTimeUUID();
                state.prepareTracingSession(tracingId);
            }

            if (state.traceNextQuery())
            {
                state.createTracingSession(getCustomPayload());

                ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
                if (options.getPageSize() > 0)
                    builder.put("page_size", Integer.toString(options.getPageSize()));
                if(options.getConsistency() != null)
                    builder.put("consistency_level", options.getConsistency().name());
                if(options.getSerialConsistency() != null)
                    builder.put("serial_consistency_level", options.getSerialConsistency().name());
                builder.put("query", prepared.rawCQLStatement);

                for(int i=0;i<prepared.boundNames.size();i++)
                {
                    ColumnSpecification cs = prepared.boundNames.get(i);
                    String boundName = cs.name.toString();
                    String boundValue = cs.type.asCQL3Type().toCQLLiteral(options.getValues().get(i), options.getProtocolVersion());
                    if ( boundValue.length() > 1000 )
                    {
                        boundValue = boundValue.substring(0, 1000) + "...'";
                    }

                    //Here we prefix boundName with the index to avoid possible collission in builder keys due to
                    //having multiple boundValues for the same variable
                    builder.put("bound_var_" + Integer.toString(i) + "_" + boundName, boundValue);
                }

                Tracing.instance.begin("Execute CQL3 prepared query", state.getClientAddress(), builder.build());
            }

            // Some custom QueryHandlers are interested by the bound names. We provide them this information
            // by wrapping the QueryOptions.
            QueryOptions queryOptions = QueryOptions.addColumnSpecifications(options, prepared.boundNames);
            Message.Response response = handler.processPrepared(statement, state, queryOptions, getCustomPayload());
            if (options.skipMetadata() && response instanceof ResultMessage.Rows)
                ((ResultMessage.Rows)response).result.metadata.setSkipMetadata();

            if (tracingId != null)
                response.setTracingId(tracingId);

            return response;
        }
        catch (Exception e)
        {
            JVMStabilityInspector.inspectThrowable(e);
            return ErrorMessage.fromException(e);
        }
        finally
        {
            Tracing.instance.stopSession();
        }
    }

    @Override
    public String toString()
    {
        return "EXECUTE " + statementId + " with " + options.getValues().size() + " values at consistency " + options.getConsistency();
    }
}


text:
define(function(require, exports, module) {

/**
 * Simple fold-data struct.
 **/
var Fold = exports.Fold = function(range, placeholder) {
    this.foldLine = null;
    this.placeholder = placeholder;
    this.range = range;
    this.start = range.start;
    this.end = range.end;

    this.sameRow = range.start.row == range.end.row;
    this.subFolds = [];
};

(function() {

    this.toString = function() {
        return '"' + this.placeholder + '" ' + this.range.toString();
    };

    this.setFoldLine = function(foldLine) {
        this.foldLine = foldLine;
        this.subFolds.forEach(function(fold) {
            fold.setFoldLine(foldLine);
        });
    };

    this.clone = function() {
        var range = this.range.clone();
        var fold = new Fold(range, this.placeholder);
        this.subFolds.forEach(function(subFold) {
            fold.subFolds.push(subFold.clone());
        });
        return fold;
    };

}).call(Fold.prototype);

});


text:
package flex2.compiler.common;

import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import flex2.compiler.config.ConfigurationException;
import flex2.compiler.config.ConfigurationInfo;
import flex2.compiler.config.ConfigurationValue;
import flex2.compiler.io.VirtualFile;

/**
 *  Configuration options association with the
 *  runtime-shared-library-path option.
 *
 *  @author dloverin
 *
 */
public class RuntimeSharedLibrarySettingsConfiguration
{

    private Configuration configuration;

    public RuntimeSharedLibrarySettingsConfiguration(Configuration configuration)
    {
        this.configuration = configuration;
    }

    protected ConfigurationPathResolver configResolver;

    public void setConfigPathResolver( ConfigurationPathResolver resolver )
    {
        this.configResolver = resolver;
    }

    //
    // 'force-rsl' option
    //
    private Set<VirtualFile> forceRsls;

    /**
     * Get the array of SWCs that should have their RSLs loaded, even if
     * the compiler detects no classes being used from the SWC.
     * @return Array of SWCs that should have their RSLs loaded.
     */
    public VirtualFile[] getForceRsls()
    {
        if (forceRsls == null)
        {
            return new VirtualFile[0];
        }

        return forceRsls.toArray(new VirtualFile[0]);
    }

    /**
     * Get the SWCs that are forced to load RSLs as a set of paths.
     *
     * @return a set of SWC paths.
     */
    public Set<String> getForceRslsPaths()
    {
        if (forceRsls == null)
        {
            return Collections.emptySet();
        }

        Set<String> rslPaths = new HashSet<String>();
        for (VirtualFile file : forceRsls)
        {
            rslPaths.add(file.getName());
        }

        return rslPaths;
    }

    public void cfgForceRsls(ConfigurationValue cfgval,
            String[] args)  throws ConfigurationException
    {
        // ignore the force option if we are static linking
        if (configuration.getStaticLinkRsl())
            return;

        if (forceRsls == null)
        {
            forceRsls = new HashSet<VirtualFile>();
        }

        // Add swc to the forceRsls set.
        for (String arg : args)
        {
            // path-element parameter (swc)
            // verify path exists and the swc has an
            // existing -rslp option specified.
            VirtualFile swcFile = ConfigurationPathResolver.getVirtualFile(arg, configResolver, cfgval);
            String swcPath = swcFile.getName();

            // verify the swc is used in an the RSL configuration.
            if (!doesSwcHaveRSLInfo(swcPath))
            {
                throw new ConfigurationException.SwcDoesNotHaveRslData(swcPath,
                              cfgval.getVar(), cfgval.getSource(), cfgval.getLine());
            }

            forceRsls.add(swcFile);
        }
    }

    public static ConfigurationInfo getForceRslsInfo()
    {
        return new ConfigurationInfo(-1, new String[] {"path-element"})
        {
            public boolean allowMultiple()
            {
                return true;
            }

            public boolean isAdvanced()
            {
                return true;
            }
        };
    }

    //
    // 'application-domain' option
    //

    /**
     *  Enum of the supported application domain targets of an RSL. The string
     *  values represent the valid values that may specified for the
     *  application-domain option.
     */
    public static enum ApplicationDomainTarget
    {
        DEFAULT("default"),
        CURRENT("current"),
        PARENT("parent"),
        TOP_LEVEL("top-level");

        private String applicationDomainValue;

        private ApplicationDomainTarget( String applicationDomainValue )
        {
            this.applicationDomainValue = applicationDomainValue;
        }

        public String getApplicationDomainValue()
        {
            return applicationDomainValue;
        }

    }

    /*
     * Key: swc file path; Value: application domain
     */
    private HashMap<VirtualFile,String> applicationDomains;

    /**
     * Get the application domain an RSL should be loaded into. The default is
     * the current application domain but the user can override this setting.
     * @param swcPath The full path of the swc file.
     *
     * @return The application domain the RSL should be loaded into. If the
     * swc is not found, then 'default' is returned.
     */
    public String getApplicationDomain(String swcPath)
    {
        if (applicationDomains == null || swcPath == null)
        {
            return ApplicationDomainTarget.DEFAULT.applicationDomainValue;
        }

        for (Map.Entry<VirtualFile, String> entry : applicationDomains.entrySet())
        {
            VirtualFile swcFile = entry.getKey();
            if (swcFile.getName().equals(swcPath))
            {
                return entry.getValue();
            }
        }

        return ApplicationDomainTarget.DEFAULT.applicationDomainValue;
    }

    /**
     * Get the HashMap of any applicationDomain overrides for RSL loading.
     *
     * @return Map, key: SWC file path, value: on of application domain strings.
     */
    public Map<VirtualFile,String> getApplicationDomains()
    {
        if (applicationDomains == null)
        {
            return Collections.emptyMap();
        }

        return applicationDomains;
    }

    public void cfgApplicationDomain(ConfigurationValue cfgval,
            String[] args)  throws ConfigurationException
    {
        // ignore the force option if we are static linking
        if (configuration.getStaticLinkRsl())
            return;

        if (applicationDomains == null)
        {
            applicationDomains = new HashMap<VirtualFile,String>();
        }

        // Add swc and application domain target to the map.
        // The args are: swc file path, application domain type, ...
        for (int i = 0; i < args.length; i++)
        {
            String arg = args[i++];

            // path-element parameter (swc)
            // verify path exists and the swc has an
            // existing -rslp option specified.
            VirtualFile swcFile = ConfigurationPathResolver.getVirtualFile(arg, configResolver, cfgval);
            String swcPath = swcFile.getName();

            // verify the swc is used in an the RSL configuration.
            if (!doesSwcHaveRSLInfo(swcPath))
            {
                throw new ConfigurationException.SwcDoesNotHaveRslData(swcPath,
                              cfgval.getVar(), cfgval.getSource(), cfgval.getLine());
            }

            // Verify the application domain target is valid.
            arg = args[i];
            if (!isValidApplicationDomainTarget(arg))
            {
                // throw a configuration exception that the application domain
                // type is incorrect.
                throw new ConfigurationException.BadApplicationDomainValue(swcPath, arg, cfgval.getVar(),
                        cfgval.getSource(), cfgval.getLine());
            }

            applicationDomains.put(swcFile, arg);
        }
    }

    public static ConfigurationInfo getApplicationDomainInfo()
    {
        return new ConfigurationInfo(-1, new String[] {"path-element", "application-domain-target"})
        {
            public boolean allowMultiple()
            {
                return true;
            }

            public boolean isAdvanced()
            {
                return true;
            }

            public String getArgName(int argnum)
            {
                String argName = null;

                argnum = argnum % 2;
                if (argnum == 0)
                {
                    argName = "path-element";
                }
                else
                {
                    argName = "application-domain-target";
                }
                return argName;
            }

        };
    }

    /**
     * Check if the SWC has any RSL info associated with it.
     * @param swcPath
     * @return true if the swc has RSL info, false otherwise.
     */
    private boolean doesSwcHaveRSLInfo(String swcPath)
    {
        if (swcPath == null)
            return false;

        List<Configuration.RslPathInfo> rslInfoList = configuration.getRslPathInfo();
        for (Configuration.RslPathInfo rslInfo : rslInfoList)
        {
            if (swcPath.equals(rslInfo.getSwcVirtualFile().getName()))
                return true;
        }

        return false;
    }

    /**
     * Test if the specified parameter is a valid application domain type.
     * @param arg
     * @return true if parameter is a valid application domain type, false otherwise.
     */
    private boolean isValidApplicationDomainTarget(String arg)
    {
        for (ApplicationDomainTarget appDomain : ApplicationDomainTarget.values())
        {
            if (appDomain.applicationDomainValue.equals(arg))
                return true;
        }

        return false;
    }

}


text:
module RedmineProjectAuthor
  module Patches
    # Path project - add project author association
    module ProjectPatch

      def self.included(base) # :nodoc:
        base.class_eval do
          unloadable # Send unloadable so it will not be unloaded in development
          belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'

          # Selected user has to be valid
          validate do |project|
            user_ids = User.all.map { |u| u.id }
            user_ids << nil
            errors.add(:author, I18n.t('author_must_exist_in_system')) unless user_ids.include? project.author_id
          end

          # Enable passing author_id parameter
          Project.safe_attributes 'author_id'
        end
      end

    end
  end
end


text:
/*
 * ChessPiece.h
 *
 *  Created on: Nov 1, 2013
 *      Author: Samet Sait Talayhan
 */

#ifndef CHESSPIECE_H_
#define CHESSPIECE_H_

#include <string>
#include "101044044HW04P01.h"

using std::string;

namespace Talayhan {

#define BLACK 0
#define WHITE 1

class ChessPiece {
public:
	ChessPiece();

	bool canMove(const char &column, const int &row) const;

	// getters and setters for data members.
	const string& getPieceName() const;
	void setPieceName(const string& pieceName);
	BoardPosition getPiecePosition() const;
	void setPiecePosition(BoardPosition piecePosition);

private:
	string pieceName;
	BoardPosition piecePosition;
	int color; //black is 0, white is 1.
};

} /* namespace Talayhan */
#endif /* CHESSPIECE_H_ */


text:
import React from 'react';
import renderer from 'react-test-renderer';
import { theme} from "@looker/components"
import { ThemeProvider } from "styled-components"

import { SQLSnippet } from '../../components/SQLSnippet'

it('renders correctly', () => {
  const tree = renderer
    .create(
      <ThemeProvider theme={theme}>
        <SQLSnippet
          isRow={false}
          src={"SELECT * from users;"}
        />)
      </ThemeProvider>
    ).toJSON();
  expect(tree).toMatchSnapshot();
})


text:
package org.apache.stratos.messaging.domain.topology;

import org.apache.stratos.messaging.util.bean.type.map.MapAdapter;

import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.io.Serializable;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

/**
 * Defines a member node in a cluster.
 * Key: serviceName, clusterId, memberId
 */
@XmlRootElement
public class Member implements Serializable {
    private static final long serialVersionUID = 4179661867903664661L;

    private final String serviceName;
    private final String clusterId;
    private final String networkPartitionId;
    private final String partitionId;
    private final String memberId;

    private MemberStatus status;
    private String memberIp;
    @XmlJavaTypeAdapter(MapAdapter.class)
    private final Map<String, Port> portMap;
    @XmlJavaTypeAdapter(MapAdapter.class)
    private Properties properties;
    private String lbClusterId;

    public Member(String serviceName, String clusterId, String networkPartitionId, String partitionId, String memberId) {
        this.serviceName = serviceName;
        this.clusterId = clusterId;
        this.networkPartitionId = networkPartitionId;
        this.partitionId = partitionId;
        this.memberId = memberId;
        this.portMap = new HashMap<String, Port>();
    }

    public String getServiceName() {
        return serviceName;
    }

    public String getClusterId() {
        return clusterId;
    }

    public String getMemberId() {
        return memberId;
    }

    public MemberStatus getStatus() {
        return status;
    }

    public void setStatus(MemberStatus status) {
        this.status = status;
    }

    public boolean isActive() {
        return (this.status == MemberStatus.Activated);
    }

    public Collection<Port> getPorts() {
        return portMap.values();
    }

    public void addPort(Port port) {
        this.portMap.put(port.getProtocol(), port);
    }

    public void addPorts(Collection<Port> ports) {
        for(Port port: ports) {
            addPort(port);
        }
    }

    public void removePort(Port port) {
        this.portMap.remove(port.getProtocol());
    }

    public void removePort(String protocol) {
        this.portMap.remove(protocol);
    }

    public boolean portExists(Port port) {
        return this.portMap.containsKey(port.getProtocol());
    }

    public Port getPort(String protocol) {
        return this.portMap.get(protocol);
    }

    public Properties getProperties() {
        return properties;
    }

    public void setProperties(Properties properties) {
        this.properties = properties;
    }

	public String getMemberIp() {
	    return memberIp;
    }

	public void setMemberIp(String memberIp) {
	    this.memberIp = memberIp;
    }

    public String getPartitionId() {
        return partitionId;
    }

    public void setLbClusterId(String lbClusterId) {
        this.lbClusterId = lbClusterId;
    }

    public String getLbClusterId() {
        return lbClusterId;
    }

    public String getNetworkPartitionId() {
        return networkPartitionId;
    }
}


text:
//
// io_context.hpp
// ~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2021 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//

#ifndef BOOST_ASIO_IO_CONTEXT_HPP
#define BOOST_ASIO_IO_CONTEXT_HPP

#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)

#include <boost/asio/detail/config.hpp>
#include <cstddef>
#include <stdexcept>
#include <typeinfo>
#include <boost/asio/async_result.hpp>
#include <boost/asio/detail/wrapped_handler.hpp>
#include <boost/system/error_code.hpp>
#include <boost/asio/execution.hpp>
#include <boost/asio/execution_context.hpp>

#if defined(BOOST_ASIO_HAS_CHRONO)
# include <boost/asio/detail/chrono.hpp>
#endif // defined(BOOST_ASIO_HAS_CHRONO)

#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
# include <boost/asio/detail/winsock_init.hpp>
#elif defined(__sun) || defined(__QNX__) || defined(__hpux) || defined(_AIX) \
  || defined(__osf__)
# include <boost/asio/detail/signal_init.hpp>
#endif

#if defined(BOOST_ASIO_HAS_IOCP)
# include <boost/asio/detail/win_iocp_io_context.hpp>
#else
# include <boost/asio/detail/scheduler.hpp>
#endif

#include <boost/asio/detail/push_options.hpp>

namespace boost {
namespace asio {

namespace detail {
#if defined(BOOST_ASIO_HAS_IOCP)
  typedef win_iocp_io_context io_context_impl;
  class win_iocp_overlapped_ptr;
#else
  typedef scheduler io_context_impl;
#endif

  struct io_context_bits
  {
    BOOST_ASIO_STATIC_CONSTEXPR(unsigned int, blocking_never = 1);
    BOOST_ASIO_STATIC_CONSTEXPR(unsigned int, relationship_continuation = 2);
    BOOST_ASIO_STATIC_CONSTEXPR(unsigned int, outstanding_work_tracked = 4);
  };
} // namespace detail

/// Provides core I/O functionality.
/**
 * The io_context class provides the core I/O functionality for users of the
 * asynchronous I/O objects, including:
 *
 * @li boost::asio::ip::tcp::socket
 * @li boost::asio::ip::tcp::acceptor
 * @li boost::asio::ip::udp::socket
 * @li boost::asio::deadline_timer.
 *
 * The io_context class also includes facilities intended for developers of
 * custom asynchronous services.
 *
 * @par Thread Safety
 * @e Distinct @e objects: Safe.@n
 * @e Shared @e objects: Safe, with the specific exceptions of the restart()
 * and notify_fork() functions. Calling restart() while there are unfinished
 * run(), run_one(), run_for(), run_until(), poll() or poll_one() calls results
 * in undefined behaviour. The notify_fork() function should not be called
 * while any io_context function, or any function on an I/O object that is
 * associated with the io_context, is being called in another thread.
 *
 * @par Concepts:
 * Dispatcher.
 *
 * @par Synchronous and asynchronous operations
 *
 * Synchronous operations on I/O objects implicitly run the io_context object
 * for an individual operation. The io_context functions run(), run_one(),
 * run_for(), run_until(), poll() or poll_one() must be called for the
 * io_context to perform asynchronous operations on behalf of a C++ program.
 * Notification that an asynchronous operation has completed is delivered by
 * invocation of the associated handler. Handlers are invoked only by a thread
 * that is currently calling any overload of run(), run_one(), run_for(),
 * run_until(), poll() or poll_one() for the io_context.
 *
 * @par Effect of exceptions thrown from handlers
 *
 * If an exception is thrown from a handler, the exception is allowed to
 * propagate through the throwing thread's invocation of run(), run_one(),
 * run_for(), run_until(), poll() or poll_one(). No other threads that are
 * calling any of these functions are affected. It is then the responsibility
 * of the application to catch the exception.
 *
 * After the exception has been caught, the run(), run_one(), run_for(),
 * run_until(), poll() or poll_one() call may be restarted @em without the need
 * for an intervening call to restart(). This allows the thread to rejoin the
 * io_context object's thread pool without impacting any other threads in the
 * pool.
 *
 * For example:
 *
 * @code
 * boost::asio::io_context io_context;
 * ...
 * for (;;)
 * {
 *   try
 *   {
 *     io_context.run();
 *     break; // run() exited normally
 *   }
 *   catch (my_exception& e)
 *   {
 *     // Deal with exception as appropriate.
 *   }
 * }
 * @endcode
 *
 * @par Submitting arbitrary tasks to the io_context
 *
 * To submit functions to the io_context, use the @ref boost::asio::dispatch,
 * @ref boost::asio::post or @ref boost::asio::defer free functions.
 *
 * For example:
 *
 * @code void my_task()
 * {
 *   ...
 * }
 *
 * ...
 *
 * boost::asio::io_context io_context;
 *
 * // Submit a function to the io_context.
 * boost::asio::post(io_context, my_task);
 *
 * // Submit a lambda object to the io_context.
 * boost::asio::post(io_context,
 *     []()
 *     {
 *       ...
 *     });
 *
 * // Run the io_context until it runs out of work.
 * io_context.run(); @endcode
 *
 * @par Stopping the io_context from running out of work
 *
 * Some applications may need to prevent an io_context object's run() call from
 * returning when there is no more work to do. For example, the io_context may
 * be being run in a background thread that is launched prior to the
 * application's asynchronous operations. The run() call may be kept running by
 * creating an executor that tracks work against the io_context:
 *
 * @code boost::asio::io_context io_context;
 * auto work = boost::asio::require(io_context.get_executor(),
 *     boost::asio::execution::outstanding_work.tracked);
 * ... @endcode
 *
 * If using C++03, which lacks automatic variable type deduction, you may
 * compute the return type of the require call:
 *
 * @code boost::asio::io_context io_context;
 * typename boost::asio::require_result<
 *     boost::asio::io_context::executor_type,
 *     boost::asio::exeution::outstanding_work_t::tracked_t>
 *   work = boost::asio::require(io_context.get_executor(),
 *     boost::asio::execution::outstanding_work.tracked);
 * ... @endcode
 *
 * or store the result in the type-erasing executor wrapper, any_io_executor:
 *
 * @code boost::asio::io_context io_context;
 * boost::asio::any_io_executor work
 *   = boost::asio::require(io_context.get_executor(),
 *       boost::asio::execution::outstanding_work.tracked);
 * ... @endcode
 *
 * To effect a shutdown, the application will then need to call the io_context
 * object's stop() member function. This will cause the io_context run() call
 * to return as soon as possible, abandoning unfinished operations and without
 * permitting ready handlers to be dispatched.
 *
 * Alternatively, if the application requires that all operations and handlers
 * be allowed to finish normally, store the work-tracking executor in an
 * any_io_executor object, so that it may be explicitly reset.
 *
 * @code boost::asio::io_context io_context;
 * boost::asio::any_io_executor work
 *   = boost::asio::require(io_context.get_executor(),
 *       boost::asio::execution::outstanding_work.tracked);
 * ...
 * work = boost::asio::any_io_executor(); // Allow run() to exit. @endcode
 */
class io_context
  : public execution_context
{
private:
  typedef detail::io_context_impl impl_type;
#if defined(BOOST_ASIO_HAS_IOCP)
  friend class detail::win_iocp_overlapped_ptr;
#endif

public:
  template <typename Allocator, unsigned int Bits>
  class basic_executor_type;

  template <typename Allocator, unsigned int Bits>
  friend class basic_executor_type;

  /// Executor used to submit functions to an io_context.
  typedef basic_executor_type<std::allocator<void>, 0> executor_type;

#if !defined(BOOST_ASIO_NO_DEPRECATED)
  class work;
  friend class work;
#endif // !defined(BOOST_ASIO_NO_DEPRECATED)

  class service;

#if !defined(BOOST_ASIO_NO_EXTENSIONS) \
  && !defined(BOOST_ASIO_NO_TS_EXECUTORS)
  class strand;
#endif // !defined(BOOST_ASIO_NO_EXTENSIONS)
       //   && !defined(BOOST_ASIO_NO_TS_EXECUTORS)

  /// The type used to count the number of handlers executed by the context.
  typedef std::size_t count_type;

  /// Constructor.
  BOOST_ASIO_DECL io_context();

  /// Constructor.
  /**
   * Construct with a hint about the required level of concurrency.
   *
   * @param concurrency_hint A suggestion to the implementation on how many
   * threads it should allow to run simultaneously.
   */
  BOOST_ASIO_DECL explicit io_context(int concurrency_hint);

  /// Destructor.
  /**
   * On destruction, the io_context performs the following sequence of
   * operations:
   *
   * @li For each service object @c svc in the io_context set, in reverse order
   * of the beginning of service object lifetime, performs
   * @c svc->shutdown().
   *
   * @li Uninvoked handler objects that were scheduled for deferred invocation
   * on the io_context, or any associated strand, are destroyed.
   *
   * @li For each service object @c svc in the io_context set, in reverse order
   * of the beginning of service object lifetime, performs
   * <tt>delete static_cast<io_context::service*>(svc)</tt>.
   *
   * @note The destruction sequence described above permits programs to
   * simplify their resource management by using @c shared_ptr<>. Where an
   * object's lifetime is tied to the lifetime of a connection (or some other
   * sequence of asynchronous operations), a @c shared_ptr to the object would
   * be bound into the handlers for all asynchronous operations associated with
   * it. This works as follows:
   *
   * @li When a single connection ends, all associated asynchronous operations
   * complete. The corresponding handler objects are destroyed, and all
   * @c shared_ptr references to the objects are destroyed.
   *
   * @li To shut down the whole program, the io_context function stop() is
   * called to terminate any run() calls as soon as possible. The io_context
   * destructor defined above destroys all handlers, causing all @c shared_ptr
   * references to all connection objects to be destroyed.
   */
  BOOST_ASIO_DECL ~io_context();

  /// Obtains the executor associated with the io_context.
  executor_type get_executor() BOOST_ASIO_NOEXCEPT;

  /// Run the io_context object's event processing loop.
  /**
   * The run() function blocks until all work has finished and there are no
   * more handlers to be dispatched, or until the io_context has been stopped.
   *
   * Multiple threads may call the run() function to set up a pool of threads
   * from which the io_context may execute handlers. All threads that are
   * waiting in the pool are equivalent and the io_context may choose any one
   * of them to invoke a handler.
   *
   * A normal exit from the run() function implies that the io_context object
   * is stopped (the stopped() function returns @c true). Subsequent calls to
   * run(), run_one(), poll() or poll_one() will return immediately unless there
   * is a prior call to restart().
   *
   * @return The number of handlers that were executed.
   *
   * @note Calling the run() function from a thread that is currently calling
   * one of run(), run_one(), run_for(), run_until(), poll() or poll_one() on
   * the same io_context object may introduce the potential for deadlock. It is
   * the caller's reponsibility to avoid this.
   *
   * The poll() function may also be used to dispatch ready handlers, but
   * without blocking.
   */
  BOOST_ASIO_DECL count_type run();

#if !defined(BOOST_ASIO_NO_DEPRECATED)
  /// (Deprecated: Use non-error_code overload.) Run the io_context object's
  /// event processing loop.
  /**
   * The run() function blocks until all work has finished and there are no
   * more handlers to be dispatched, or until the io_context has been stopped.
   *
   * Multiple threads may call the run() function to set up a pool of threads
   * from which the io_context may execute handlers. All threads that are
   * waiting in the pool are equivalent and the io_context may choose any one
   * of them to invoke a handler.
   *
   * A normal exit from the run() function implies that the io_context object
   * is stopped (the stopped() function returns @c true). Subsequent calls to
   * run(), run_one(), poll() or poll_one() will return immediately unless there
   * is a prior call to restart().
   *
   * @param ec Set to indicate what error occurred, if any.
   *
   * @return The number of handlers that were executed.
   *
   * @note Calling the run() function from a thread that is currently calling
   * one of run(), run_one(), run_for(), run_until(), poll() or poll_one() on
   * the same io_context object may introduce the potential for deadlock. It is
   * the caller's reponsibility to avoid this.
   *
   * The poll() function may also be used to dispatch ready handlers, but
   * without blocking.
   */
  BOOST_ASIO_DECL count_type run(boost::system::error_code& ec);
#endif // !defined(BOOST_ASIO_NO_DEPRECATED)

#if defined(BOOST_ASIO_HAS_CHRONO) || defined(GENERATING_DOCUMENTATION)
  /// Run the io_context object's event processing loop for a specified
  /// duration.
  /**
   * The run_for() function blocks until all work has finished and there are no
   * more handlers to be dispatched, until the io_context has been stopped, or
   * until the specified duration has elapsed.
   *
   * @param rel_time The duration for which the call may block.
   *
   * @return The number of handlers that were executed.
   */
  template <typename Rep, typename Period>
  std::size_t run_for(const chrono::duration<Rep, Period>& rel_time);

  /// Run the io_context object's event processing loop until a specified time.
  /**
   * The run_until() function blocks until all work has finished and there are
   * no more handlers to be dispatched, until the io_context has been stopped,
   * or until the specified time has been reached.
   *
   * @param abs_time The time point until which the call may block.
   *
   * @return The number of handlers that were executed.
   */
  template <typename Clock, typename Duration>
  std::size_t run_until(const chrono::time_point<Clock, Duration>& abs_time);
#endif // defined(BOOST_ASIO_HAS_CHRONO) || defined(GENERATING_DOCUMENTATION)

  /// Run the io_context object's event processing loop to execute at most one
  /// handler.
  /**
   * The run_one() function blocks until one handler has been dispatched, or
   * until the io_context has been stopped.
   *
   * @return The number of handlers that were executed. A zero return value
   * implies that the io_context object is stopped (the stopped() function
   * returns @c true). Subsequent calls to run(), run_one(), poll() or
   * poll_one() will return immediately unless there is a prior call to
   * restart().
   *
   * @note Calling the run_one() function from a thread that is currently
   * calling one of run(), run_one(), run_for(), run_until(), poll() or
   * poll_one() on the same io_context object may introduce the potential for
   * deadlock. It is the caller's reponsibility to avoid this.
   */
  BOOST_ASIO_DECL count_type run_one();

#if !defined(BOOST_ASIO_NO_DEPRECATED)
  /// (Deprecated: Use non-error_code overlaod.) Run the io_context object's
  /// event processing loop to execute at most one handler.
  /**
   * The run_one() function blocks until one handler has been dispatched, or
   * until the io_context has been stopped.
   *
   * @return The number of handlers that were executed. A zero return value
   * implies that the io_context object is stopped (the stopped() function
   * returns @c true). Subsequent calls to run(), run_one(), poll() or
   * poll_one() will return immediately unless there is a prior call to
   * restart().
   *
   * @return The number of handlers that were executed.
   *
   * @note Calling the run_one() function from a thread that is currently
   * calling one of run(), run_one(), run_for(), run_until(), poll() or
   * poll_one() on the same io_context object may introduce the potential for
   * deadlock. It is the caller's reponsibility to avoid this.
   */
  BOOST_ASIO_DECL count_type run_one(boost::system::error_code& ec);
#endif // !defined(BOOST_ASIO_NO_DEPRECATED)

#if defined(BOOST_ASIO_HAS_CHRONO) || defined(GENERATING_DOCUMENTATION)
  /// Run the io_context object's event processing loop for a specified duration
  /// to execute at most one handler.
  /**
   * The run_one_for() function blocks until one handler has been dispatched,
   * until the io_context has been stopped, or until the specified duration has
   * elapsed.
   *
   * @param rel_time The duration for which the call may block.
   *
   * @return The number of handlers that were executed.
   */
  template <typename Rep, typename Period>
  std::size_t run_one_for(const chrono::duration<Rep, Period>& rel_time);

  /// Run the io_context object's event processing loop until a specified time
  /// to execute at most one handler.
  /**
   * The run_one_until() function blocks until one handler has been dispatched,
   * until the io_context has been stopped, or until the specified time has
   * been reached.
   *
   * @param abs_time The time point until which the call may block.
   *
   * @return The number of handlers that were executed.
   */
  template <typename Clock, typename Duration>
  std::size_t run_one_until(
      const chrono::time_point<Clock, Duration>& abs_time);
#endif // defined(BOOST_ASIO_HAS_CHRONO) || defined(GENERATING_DOCUMENTATION)

  /// Run the io_context object's event processing loop to execute ready
  /// handlers.
  /**
   * The poll() function runs handlers that are ready to run, without blocking,
   * until the io_context has been stopped or there are no more ready handlers.
   *
   * @return The number of handlers that were executed.
   */
  BOOST_ASIO_DECL count_type poll();

#if !defined(BOOST_ASIO_NO_DEPRECATED)
  /// (Deprecated: Use non-error_code overload.) Run the io_context object's
  /// event processing loop to execute ready handlers.
  /**
   * The poll() function runs handlers that are ready to run, without blocking,
   * until the io_context has been stopped or there are no more ready handlers.
   *
   * @param ec Set to indicate what error occurred, if any.
   *
   * @return The number of handlers that were executed.
   */
  BOOST_ASIO_DECL count_type poll(boost::system::error_code& ec);
#endif // !defined(BOOST_ASIO_NO_DEPRECATED)

  /// Run the io_context object's event processing loop to execute one ready
  /// handler.
  /**
   * The poll_one() function runs at most one handler that is ready to run,
   * without blocking.
   *
   * @return The number of handlers that were executed.
   */
  BOOST_ASIO_DECL count_type poll_one();

#if !defined(BOOST_ASIO_NO_DEPRECATED)
  /// (Deprecated: Use non-error_code overload.) Run the io_context object's
  /// event processing loop to execute one ready handler.
  /**
   * The poll_one() function runs at most one handler that is ready to run,
   * without blocking.
   *
   * @param ec Set to indicate what error occurred, if any.
   *
   * @return The number of handlers that were executed.
   */
  BOOST_ASIO_DECL count_type poll_one(boost::system::error_code& ec);
#endif // !defined(BOOST_ASIO_NO_DEPRECATED)

  /// Stop the io_context object's event processing loop.
  /**
   * This function does not block, but instead simply signals the io_context to
   * stop. All invocations of its run() or run_one() member functions should
   * return as soon as possible. Subsequent calls to run(), run_one(), poll()
   * or poll_one() will return immediately until restart() is called.
   */
  BOOST_ASIO_DECL void stop();

  /// Determine whether the io_context object has been stopped.
  /**
   * This function is used to determine whether an io_context object has been
   * stopped, either through an explicit call to stop(), or due to running out
   * of work. When an io_context object is stopped, calls to run(), run_one(),
   * poll() or poll_one() will return immediately without invoking any
   * handlers.
   *
   * @return @c true if the io_context object is stopped, otherwise @c false.
   */
  BOOST_ASIO_DECL bool stopped() const;

  /// Restart the io_context in preparation for a subsequent run() invocation.
  /**
   * This function must be called prior to any second or later set of
   * invocations of the run(), run_one(), poll() or poll_one() functions when a
   * previous invocation of these functions returned due to the io_context
   * being stopped or running out of work. After a call to restart(), the
   * io_context object's stopped() function will return @c false.
   *
   * This function must not be called while there are any unfinished calls to
   * the run(), run_one(), poll() or poll_one() functions.
   */
  BOOST_ASIO_DECL void restart();

#if !defined(BOOST_ASIO_NO_DEPRECATED)
  /// (Deprecated: Use restart().) Reset the io_context in preparation for a
  /// subsequent run() invocation.
  /**
   * This function must be called prior to any second or later set of
   * invocations of the run(), run_one(), poll() or poll_one() functions when a
   * previous invocation of these functions returned due to the io_context
   * being stopped or running out of work. After a call to restart(), the
   * io_context object's stopped() function will return @c false.
   *
   * This function must not be called while there are any unfinished calls to
   * the run(), run_one(), poll() or poll_one() functions.
   */
  void reset();

  /// (Deprecated: Use boost::asio::dispatch().) Request the io_context to
  /// invoke the given handler.
  /**
   * This function is used to ask the io_context to execute the given handler.
   *
   * The io_context guarantees that the handler will only be called in a thread
   * in which the run(), run_one(), poll() or poll_one() member functions is
   * currently being invoked. The handler may be executed inside this function
   * if the guarantee can be met.
   *
   * @param handler The handler to be called. The io_context will make
   * a copy of the handler object as required. The function signature of the
   * handler must be: @code void handler(); @endcode
   *
   * @note This function throws an exception only if:
   *
   * @li the handler's @c asio_handler_allocate function; or
   *
   * @li the handler's copy constructor
   *
   * throws an exception.
   */
  template <typename LegacyCompletionHandler>
  BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(LegacyCompletionHandler, void ())
  dispatch(BOOST_ASIO_MOVE_ARG(LegacyCompletionHandler) handler);

  /// (Deprecated: Use boost::asio::post().) Request the io_context to invoke
  /// the given handler and return immediately.
  /**
   * This function is used to ask the io_context to execute the given handler,
   * but without allowing the io_context to call the handler from inside this
   * function.
   *
   * The io_context guarantees that the handler will only be called in a thread
   * in which the run(), run_one(), poll() or poll_one() member functions is
   * currently being invoked.
   *
   * @param handler The handler to be called. The io_context will make
   * a copy of the handler object as required. The function signature of the
   * handler must be: @code void handler(); @endcode
   *
   * @note This function throws an exception only if:
   *
   * @li the handler's @c asio_handler_allocate function; or
   *
   * @li the handler's copy constructor
   *
   * throws an exception.
   */
  template <typename LegacyCompletionHandler>
  BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(LegacyCompletionHandler, void ())
  post(BOOST_ASIO_MOVE_ARG(LegacyCompletionHandler) handler);

  /// (Deprecated: Use boost::asio::bind_executor().) Create a new handler that
  /// automatically dispatches the wrapped handler on the io_context.
  /**
   * This function is used to create a new handler function object that, when
   * invoked, will automatically pass the wrapped handler to the io_context
   * object's dispatch function.
   *
   * @param handler The handler to be wrapped. The io_context will make a copy
   * of the handler object as required. The function signature of the handler
   * must be: @code void handler(A1 a1, ... An an); @endcode
   *
   * @return A function object that, when invoked, passes the wrapped handler to
   * the io_context object's dispatch function. Given a function object with the
   * signature:
   * @code R f(A1 a1, ... An an); @endcode
   * If this function object is passed to the wrap function like so:
   * @code io_context.wrap(f); @endcode
   * then the return value is a function object with the signature
   * @code void g(A1 a1, ... An an); @endcode
   * that, when invoked, executes code equivalent to:
   * @code io_context.dispatch(boost::bind(f, a1, ... an)); @endcode
   */
  template <typename Handler>
#if defined(GENERATING_DOCUMENTATION)
  unspecified
#else
  detail::wrapped_handler<io_context&, Handler>
#endif
  wrap(Handler handler);
#endif // !defined(BOOST_ASIO_NO_DEPRECATED)

private:
  io_context(const io_context&) BOOST_ASIO_DELETED;
  io_context& operator=(const io_context&) BOOST_ASIO_DELETED;

#if !defined(BOOST_ASIO_NO_DEPRECATED)
  struct initiate_dispatch;
  struct initiate_post;
#endif // !defined(BOOST_ASIO_NO_DEPRECATED)

  // Helper function to add the implementation.
  BOOST_ASIO_DECL impl_type& add_impl(impl_type* impl);

  // Backwards compatible overload for use with services derived from
  // io_context::service.
  template <typename Service>
  friend Service& use_service(io_context& ioc);

#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
  detail::winsock_init<> init_;
#elif defined(__sun) || defined(__QNX__) || defined(__hpux) || defined(_AIX) \
  || defined(__osf__)
  detail::signal_init<> init_;
#endif

  // The implementation.
  impl_type& impl_;
};

namespace detail {

} // namespace detail

/// Executor implementation type used to submit functions to an io_context.
template <typename Allocator, unsigned int Bits>
class io_context::basic_executor_type : detail::io_context_bits
{
public:
  /// Copy constructor.
  basic_executor_type(
      const basic_executor_type& other) BOOST_ASIO_NOEXCEPT
    : io_context_(other.io_context_),
      allocator_(other.allocator_),
      bits_(other.bits_)
  {
    if (Bits & outstanding_work_tracked)
      if (io_context_)
        io_context_->impl_.work_started();
  }

#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
  /// Move constructor.
  basic_executor_type(basic_executor_type&& other) BOOST_ASIO_NOEXCEPT
    : io_context_(other.io_context_),
      allocator_(BOOST_ASIO_MOVE_CAST(Allocator)(other.allocator_)),
      bits_(other.bits_)
  {
    if (Bits & outstanding_work_tracked)
      other.io_context_ = 0;
  }
#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)

  /// Destructor.
  ~basic_executor_type() BOOST_ASIO_NOEXCEPT
  {
    if (Bits & outstanding_work_tracked)
      if (io_context_)
        io_context_->impl_.work_finished();
  }

  /// Assignment operator.
  basic_executor_type& operator=(
      const basic_executor_type& other) BOOST_ASIO_NOEXCEPT;

#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
  /// Move assignment operator.
  basic_executor_type& operator=(
      basic_executor_type&& other) BOOST_ASIO_NOEXCEPT;
#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)

#if !defined(GENERATING_DOCUMENTATION)
private:
  friend struct boost_asio_require_fn::impl;
  friend struct boost_asio_prefer_fn::impl;
#endif // !defined(GENERATING_DOCUMENTATION)

  /// Obtain an executor with the @c blocking.possibly property.
  /**
   * Do not call this function directly. It is intended for use with the
   * boost::asio::require customisation point.
   *
   * For example:
   * @code auto ex1 = my_io_context.get_executor();
   * auto ex2 = boost::asio::require(ex1,
   *     boost::asio::execution::blocking.possibly); @endcode
   */
  BOOST_ASIO_CONSTEXPR basic_executor_type require(
      execution::blocking_t::possibly_t) const
  {
    return basic_executor_type(io_context_,
        allocator_, bits_ & ~blocking_never);
  }

  /// Obtain an executor with the @c blocking.never property.
  /**
   * Do not call this function directly. It is intended for use with the
   * boost::asio::require customisation point.
   *
   * For example:
   * @code auto ex1 = my_io_context.get_executor();
   * auto ex2 = boost::asio::require(ex1,
   *     boost::asio::execution::blocking.never); @endcode
   */
  BOOST_ASIO_CONSTEXPR basic_executor_type require(
      execution::blocking_t::never_t) const
  {
    return basic_executor_type(io_context_,
        allocator_, bits_ | blocking_never);
  }

  /// Obtain an executor with the @c relationship.fork property.
  /**
   * Do not call this function directly. It is intended for use with the
   * boost::asio::require customisation point.
   *
   * For example:
   * @code auto ex1 = my_io_context.get_executor();
   * auto ex2 = boost::asio::require(ex1,
   *     boost::asio::execution::relationship.fork); @endcode
   */
  BOOST_ASIO_CONSTEXPR basic_executor_type require(
      execution::relationship_t::fork_t) const
  {
    return basic_executor_type(io_context_,
        allocator_, bits_ & ~relationship_continuation);
  }

  /// Obtain an executor with the @c relationship.continuation property.
  /**
   * Do not call this function directly. It is intended for use with the
   * boost::asio::require customisation point.
   *
   * For example:
   * @code auto ex1 = my_io_context.get_executor();
   * auto ex2 = boost::asio::require(ex1,
   *     boost::asio::execution::relationship.continuation); @endcode
   */
  BOOST_ASIO_CONSTEXPR basic_executor_type require(
      execution::relationship_t::continuation_t) const
  {
    return basic_executor_type(io_context_,
        allocator_, bits_ | relationship_continuation);
  }

  /// Obtain an executor with the @c outstanding_work.tracked property.
  /**
   * Do not call this function directly. It is intended for use with the
   * boost::asio::require customisation point.
   *
   * For example:
   * @code auto ex1 = my_io_context.get_executor();
   * auto ex2 = boost::asio::require(ex1,
   *     boost::asio::execution::outstanding_work.tracked); @endcode
   */
  BOOST_ASIO_CONSTEXPR basic_executor_type<Allocator,
      BOOST_ASIO_UNSPECIFIED(Bits | outstanding_work_tracked)>
  require(execution::outstanding_work_t::tracked_t) const
  {
    return basic_executor_type<Allocator, Bits | outstanding_work_tracked>(
        io_context_, allocator_, bits_);
  }

  /// Obtain an executor with the @c outstanding_work.untracked property.
  /**
   * Do not call this function directly. It is intended for use with the
   * boost::asio::require customisation point.
   *
   * For example:
   * @code auto ex1 = my_io_context.get_executor();
   * auto ex2 = boost::asio::require(ex1,
   *     boost::asio::execution::outstanding_work.untracked); @endcode
   */
  BOOST_ASIO_CONSTEXPR basic_executor_type<Allocator,
      BOOST_ASIO_UNSPECIFIED(Bits & ~outstanding_work_tracked)>
  require(execution::outstanding_work_t::untracked_t) const
  {
    return basic_executor_type<Allocator, Bits & ~outstanding_work_tracked>(
        io_context_, allocator_, bits_);
  }

  /// Obtain an executor with the specified @c allocator property.
  /**
   * Do not call this function directly. It is intended for use with the
   * boost::asio::require customisation point.
   *
   * For example:
   * @code auto ex1 = my_io_context.get_executor();
   * auto ex2 = boost::asio::require(ex1,
   *     boost::asio::execution::allocator(my_allocator)); @endcode
   */
  template <typename OtherAllocator>
  BOOST_ASIO_CONSTEXPR basic_executor_type<OtherAllocator, Bits>
  require(execution::allocator_t<OtherAllocator> a) const
  {
    return basic_executor_type<OtherAllocator, Bits>(
        io_context_, a.value(), bits_);
  }

  /// Obtain an executor with the default @c allocator property.
  /**
   * Do not call this function directly. It is intended for use with the
   * boost::asio::require customisation point.
   *
   * For example:
   * @code auto ex1 = my_io_context.get_executor();
   * auto ex2 = boost::asio::require(ex1,
   *     boost::asio::execution::allocator); @endcode
   */
  BOOST_ASIO_CONSTEXPR basic_executor_type<std::allocator<void>, Bits>
  require(execution::allocator_t<void>) const
  {
    return basic_executor_type<std::allocator<void>, Bits>(
        io_context_, std::allocator<void>(), bits_);
  }

#if !defined(GENERATING_DOCUMENTATION)
private:
  friend struct boost_asio_query_fn::impl;
  friend struct boost::asio::execution::detail::mapping_t<0>;
  friend struct boost::asio::execution::detail::outstanding_work_t<0>;
#endif // !defined(GENERATING_DOCUMENTATION)

  /// Query the current value of the @c mapping property.
  /**
   * Do not call this function directly. It is intended for use with the
   * boost::asio::query customisation point.
   *
   * For example:
   * @code auto ex = my_io_context.get_executor();
   * if (boost::asio::query(ex, boost::asio::execution::mapping)
   *       == boost::asio::execution::mapping.thread)
   *   ... @endcode
   */
  static BOOST_ASIO_CONSTEXPR execution::mapping_t query(
      execution::mapping_t) BOOST_ASIO_NOEXCEPT
  {
    return execution::mapping.thread;
  }

  /// Query the current value of the @c context property.
  /**
   * Do not call this function directly. It is intended for use with the
   * boost::asio::query customisation point.
   *
   * For example:
   * @code auto ex = my_io_context.get_executor();
   * boost::asio::io_context& ctx = boost::asio::query(
   *     ex, boost::asio::execution::context); @endcode
   */
  io_context& query(execution::context_t) const BOOST_ASIO_NOEXCEPT
  {
    return *io_context_;
  }

  /// Query the current value of the @c blocking property.
  /**
   * Do not call this function directly. It is intended for use with the
   * boost::asio::query customisation point.
   *
   * For example:
   * @code auto ex = my_io_context.get_executor();
   * if (boost::asio::query(ex, boost::asio::execution::blocking)
   *       == boost::asio::execution::blocking.always)
   *   ... @endcode
   */
  BOOST_ASIO_CONSTEXPR execution::blocking_t query(
      execution::blocking_t) const BOOST_ASIO_NOEXCEPT
  {
    return (bits_ & blocking_never)
      ? execution::blocking_t(execution::blocking.never)
      : execution::blocking_t(execution::blocking.possibly);
  }

  /// Query the current value of the @c relationship property.
  /**
   * Do not call this function directly. It is intended for use with the
   * boost::asio::query customisation point.
   *
   * For example:
   * @code auto ex = my_io_context.get_executor();
   * if (boost::asio::query(ex, boost::asio::execution::relationship)
   *       == boost::asio::execution::relationship.continuation)
   *   ... @endcode
   */
  BOOST_ASIO_CONSTEXPR execution::relationship_t query(
      execution::relationship_t) const BOOST_ASIO_NOEXCEPT
  {
    return (bits_ & relationship_continuation)
      ? execution::relationship_t(execution::relationship.continuation)
      : execution::relationship_t(execution::relationship.fork);
  }

  /// Query the current value of the @c outstanding_work property.
  /**
   * Do not call this function directly. It is intended for use with the
   * boost::asio::query customisation point.
   *
   * For example:
   * @code auto ex = my_io_context.get_executor();
   * if (boost::asio::query(ex, boost::asio::execution::outstanding_work)
   *       == boost::asio::execution::outstanding_work.tracked)
   *   ... @endcode
   */
  static BOOST_ASIO_CONSTEXPR execution::outstanding_work_t query(
      execution::outstanding_work_t) BOOST_ASIO_NOEXCEPT
  {
    return (Bits & outstanding_work_tracked)
      ? execution::outstanding_work_t(execution::outstanding_work.tracked)
      : execution::outstanding_work_t(execution::outstanding_work.untracked);
  }

  /// Query the current value of the @c allocator property.
  /**
   * Do not call this function directly. It is intended for use with the
   * boost::asio::query customisation point.
   *
   * For example:
   * @code auto ex = my_io_context.get_executor();
   * auto alloc = boost::asio::query(ex,
   *     boost::asio::execution::allocator); @endcode
   */
  template <typename OtherAllocator>
  BOOST_ASIO_CONSTEXPR Allocator query(
      execution::allocator_t<OtherAllocator>) const BOOST_ASIO_NOEXCEPT
  {
    return allocator_;
  }

  /// Query the current value of the @c allocator property.
  /**
   * Do not call this function directly. It is intended for use with the
   * boost::asio::query customisation point.
   *
   * For example:
   * @code auto ex = my_io_context.get_executor();
   * auto alloc = boost::asio::query(ex,
   *     boost::asio::execution::allocator); @endcode
   */
  BOOST_ASIO_CONSTEXPR Allocator query(
      execution::allocator_t<void>) const BOOST_ASIO_NOEXCEPT
  {
    return allocator_;
  }

public:
  /// Determine whether the io_context is running in the current thread.
  /**
   * @return @c true if the current thread is running the io_context. Otherwise
   * returns @c false.
   */
  bool running_in_this_thread() const BOOST_ASIO_NOEXCEPT;

  /// Compare two executors for equality.
  /**
   * Two executors are equal if they refer to the same underlying io_context.
   */
  friend bool operator==(const basic_executor_type& a,
      const basic_executor_type& b) BOOST_ASIO_NOEXCEPT
  {
    return a.io_context_ == b.io_context_
      && a.allocator_ == b.allocator_
      && a.bits_ == b.bits_;
  }

  /// Compare two executors for inequality.
  /**
   * Two executors are equal if they refer to the same underlying io_context.
   */
  friend bool operator!=(const basic_executor_type& a,
      const basic_executor_type& b) BOOST_ASIO_NOEXCEPT
  {
    return a.io_context_ != b.io_context_
      || a.allocator_ != b.allocator_
      || a.bits_ != b.bits_;
  }

#if !defined(GENERATING_DOCUMENTATION)
private:
  friend struct boost_asio_execution_execute_fn::impl;
#endif // !defined(GENERATING_DOCUMENTATION)

  /// Execution function.
  /**
   * Do not call this function directly. It is intended for use with the
   * execution::execute customisation point.
   *
   * For example:
   * @code auto ex = my_io_context.get_executor();
   * execution::execute(ex, my_function_object); @endcode
   */
  template <typename Function>
  void execute(BOOST_ASIO_MOVE_ARG(Function) f) const;

#if !defined(BOOST_ASIO_NO_TS_EXECUTORS)
public:
  /// Obtain the underlying execution context.
  io_context& context() const BOOST_ASIO_NOEXCEPT;

  /// Inform the io_context that it has some outstanding work to do.
  /**
   * This function is used to inform the io_context that some work has begun.
   * This ensures that the io_context's run() and run_one() functions do not
   * exit while the work is underway.
   */
  void on_work_started() const BOOST_ASIO_NOEXCEPT;

  /// Inform the io_context that some work is no longer outstanding.
  /**
   * This function is used to inform the io_context that some work has
   * finished. Once the count of unfinished work reaches zero, the io_context
   * is stopped and the run() and run_one() functions may exit.
   */
  void on_work_finished() const BOOST_ASIO_NOEXCEPT;

  /// Request the io_context to invoke the given function object.
  /**
   * This function is used to ask the io_context to execute the given function
   * object. If the current thread is running the io_context, @c dispatch()
   * executes the function before returning. Otherwise, the function will be
   * scheduled to run on the io_context.
   *
   * @param f The function object to be called. The executor will make a copy
   * of the handler object as required. The function signature of the function
   * object must be: @code void function(); @endcode
   *
   * @param a An allocator that may be used by the executor to allocate the
   * internal storage needed for function invocation.
   */
  template <typename Function, typename OtherAllocator>
  void dispatch(BOOST_ASIO_MOVE_ARG(Function) f,
      const OtherAllocator& a) const;

  /// Request the io_context to invoke the given function object.
  /**
   * This function is used to ask the io_context to execute the given function
   * object. The function object will never be executed inside @c post().
   * Instead, it will be scheduled to run on the io_context.
   *
   * @param f The function object to be called. The executor will make a copy
   * of the handler object as required. The function signature of the function
   * object must be: @code void function(); @endcode
   *
   * @param a An allocator that may be used by the executor to allocate the
   * internal storage needed for function invocation.
   */
  template <typename Function, typename OtherAllocator>
  void post(BOOST_ASIO_MOVE_ARG(Function) f,
      const OtherAllocator& a) const;

  /// Request the io_context to invoke the given function object.
  /**
   * This function is used to ask the io_context to execute the given function
   * object. The function object will never be executed inside @c defer().
   * Instead, it will be scheduled to run on the io_context.
   *
   * If the current thread belongs to the io_context, @c defer() will delay
   * scheduling the function object until the current thread returns control to
   * the pool.
   *
   * @param f The function object to be called. The executor will make a copy
   * of the handler object as required. The function signature of the function
   * object must be: @code void function(); @endcode
   *
   * @param a An allocator that may be used by the executor to allocate the
   * internal storage needed for function invocation.
   */
  template <typename Function, typename OtherAllocator>
  void defer(BOOST_ASIO_MOVE_ARG(Function) f,
      const OtherAllocator& a) const;
#endif // !defined(BOOST_ASIO_NO_TS_EXECUTORS)

private:
  friend class io_context;
  template <typename, unsigned int> friend class basic_executor_type;

  // Constructor used by io_context::get_executor().
  explicit basic_executor_type(io_context& i) BOOST_ASIO_NOEXCEPT
    : io_context_(&i),
      allocator_(),
      bits_(0)
  {
    if (Bits & outstanding_work_tracked)
      io_context_->impl_.work_started();
  }

  // Constructor used by require().
  basic_executor_type(io_context* i,
      const Allocator& a, unsigned int bits) BOOST_ASIO_NOEXCEPT
    : io_context_(i),
      allocator_(a),
      bits_(bits)
  {
    if (Bits & outstanding_work_tracked)
      if (io_context_)
        io_context_->impl_.work_started();
  }

  // The underlying io_context.
  io_context* io_context_;

  // The allocator used for execution functions.
  Allocator allocator_;

  // The runtime-switched properties of the io_context executor.
  unsigned int bits_;
};

#if !defined(BOOST_ASIO_NO_DEPRECATED)
/// (Deprecated: Use executor_work_guard.) Class to inform the io_context when
/// it has work to do.
/**
 * The work class is used to inform the io_context when work starts and
 * finishes. This ensures that the io_context object's run() function will not
 * exit while work is underway, and that it does exit when there is no
 * unfinished work remaining.
 *
 * The work class is copy-constructible so that it may be used as a data member
 * in a handler class. It is not assignable.
 */
class io_context::work
{
public:
  /// Constructor notifies the io_context that work is starting.
  /**
   * The constructor is used to inform the io_context that some work has begun.
   * This ensures that the io_context object's run() function will not exit
   * while the work is underway.
   */
  explicit work(boost::asio::io_context& io_context);

  /// Copy constructor notifies the io_context that work is starting.
  /**
   * The constructor is used to inform the io_context that some work has begun.
   * This ensures that the io_context object's run() function will not exit
   * while the work is underway.
   */
  work(const work& other);

  /// Destructor notifies the io_context that the work is complete.
  /**
   * The destructor is used to inform the io_context that some work has
   * finished. Once the count of unfinished work reaches zero, the io_context
   * object's run() function is permitted to exit.
   */
  ~work();

  /// Get the io_context associated with the work.
  boost::asio::io_context& get_io_context();

private:
  // Prevent assignment.
  void operator=(const work& other);

  // The io_context implementation.
  detail::io_context_impl& io_context_impl_;
};
#endif // !defined(BOOST_ASIO_NO_DEPRECATED)

/// Base class for all io_context services.
class io_context::service
  : public execution_context::service
{
public:
  /// Get the io_context object that owns the service.
  boost::asio::io_context& get_io_context();

private:
  /// Destroy all user-defined handler objects owned by the service.
  BOOST_ASIO_DECL virtual void shutdown();

#if !defined(BOOST_ASIO_NO_DEPRECATED)
  /// (Deprecated: Use shutdown().) Destroy all user-defined handler objects
  /// owned by the service.
  BOOST_ASIO_DECL virtual void shutdown_service();
#endif // !defined(BOOST_ASIO_NO_DEPRECATED)

  /// Handle notification of a fork-related event to perform any necessary
  /// housekeeping.
  /**
   * This function is not a pure virtual so that services only have to
   * implement it if necessary. The default implementation does nothing.
   */
  BOOST_ASIO_DECL virtual void notify_fork(
      execution_context::fork_event event);

#if !defined(BOOST_ASIO_NO_DEPRECATED)
  /// (Deprecated: Use notify_fork().) Handle notification of a fork-related
  /// event to perform any necessary housekeeping.
  /**
   * This function is not a pure virtual so that services only have to
   * implement it if necessary. The default implementation does nothing.
   */
  BOOST_ASIO_DECL virtual void fork_service(
      execution_context::fork_event event);
#endif // !defined(BOOST_ASIO_NO_DEPRECATED)

protected:
  /// Constructor.
  /**
   * @param owner The io_context object that owns the service.
   */
  BOOST_ASIO_DECL service(boost::asio::io_context& owner);

  /// Destructor.
  BOOST_ASIO_DECL virtual ~service();
};

namespace detail {

// Special service base class to keep classes header-file only.
template <typename Type>
class service_base
  : public boost::asio::io_context::service
{
public:
  static boost::asio::detail::service_id<Type> id;

  // Constructor.
  service_base(boost::asio::io_context& io_context)
    : boost::asio::io_context::service(io_context)
  {
  }
};

template <typename Type>
boost::asio::detail::service_id<Type> service_base<Type>::id;

} // namespace detail

#if !defined(GENERATING_DOCUMENTATION)

namespace traits {

#if !defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT)

template <typename Allocator, unsigned int Bits>
struct equality_comparable<
    boost::asio::io_context::basic_executor_type<Allocator, Bits>
  >
{
  BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
  BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
};

#endif // !defined(BOOST_ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT)

#if !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT)

template <typename Allocator, unsigned int Bits, typename Function>
struct execute_member<
    boost::asio::io_context::basic_executor_type<Allocator, Bits>,
    Function
  >
{
  BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
  BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
  typedef void result_type;
};

#endif // !defined(BOOST_ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT)

#if !defined(BOOST_ASIO_HAS_DEDUCED_REQUIRE_MEMBER_TRAIT)

template <typename Allocator, unsigned int Bits>
struct require_member<
    boost::asio::io_context::basic_executor_type<Allocator, Bits>,
    boost::asio::execution::blocking_t::possibly_t
  >
{
  BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
  BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
  typedef boost::asio::io_context::basic_executor_type<
      Allocator, Bits> result_type;
};

template <typename Allocator, unsigned int Bits>
struct require_member<
    boost::asio::io_context::basic_executor_type<Allocator, Bits>,
    boost::asio::execution::blocking_t::never_t
  >
{
  BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
  BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
  typedef boost::asio::io_context::basic_executor_type<
      Allocator, Bits> result_type;
};

template <typename Allocator, unsigned int Bits>
struct require_member<
    boost::asio::io_context::basic_executor_type<Allocator, Bits>,
    boost::asio::execution::relationship_t::fork_t
  >
{
  BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
  BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
  typedef boost::asio::io_context::basic_executor_type<
      Allocator, Bits> result_type;
};

template <typename Allocator, unsigned int Bits>
struct require_member<
    boost::asio::io_context::basic_executor_type<Allocator, Bits>,
    boost::asio::execution::relationship_t::continuation_t
  >
{
  BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
  BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
  typedef boost::asio::io_context::basic_executor_type<
      Allocator, Bits> result_type;
};

template <typename Allocator, unsigned int Bits>
struct require_member<
    boost::asio::io_context::basic_executor_type<Allocator, Bits>,
    boost::asio::execution::outstanding_work_t::tracked_t
  > : boost::asio::detail::io_context_bits
{
  BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
  BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
  typedef boost::asio::io_context::basic_executor_type<
      Allocator, Bits | outstanding_work_tracked> result_type;
};

template <typename Allocator, unsigned int Bits>
struct require_member<
    boost::asio::io_context::basic_executor_type<Allocator, Bits>,
    boost::asio::execution::outstanding_work_t::untracked_t
  > : boost::asio::detail::io_context_bits
{
  BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
  BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
  typedef boost::asio::io_context::basic_executor_type<
      Allocator, Bits & ~outstanding_work_tracked> result_type;
};

template <typename Allocator, unsigned int Bits>
struct require_member<
    boost::asio::io_context::basic_executor_type<Allocator, Bits>,
    boost::asio::execution::allocator_t<void>
  >
{
  BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
  BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
  typedef boost::asio::io_context::basic_executor_type<
      std::allocator<void>, Bits> result_type;
};

template <unsigned int Bits,
    typename Allocator, typename OtherAllocator>
struct require_member<
    boost::asio::io_context::basic_executor_type<Allocator, Bits>,
    boost::asio::execution::allocator_t<OtherAllocator>
  >
{
  BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
  BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = false);
  typedef boost::asio::io_context::basic_executor_type<
      OtherAllocator, Bits> result_type;
};

#endif // !defined(BOOST_ASIO_HAS_DEDUCED_REQUIRE_MEMBER_TRAIT)

#if !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)

template <typename Allocator, unsigned int Bits, typename Property>
struct query_static_constexpr_member<
    boost::asio::io_context::basic_executor_type<Allocator, Bits>,
    Property,
    typename boost::asio::enable_if<
      boost::asio::is_convertible<
        Property,
        boost::asio::execution::outstanding_work_t
      >::value
    >::type
  > : boost::asio::detail::io_context_bits
{
  BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
  BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
  typedef boost::asio::execution::outstanding_work_t result_type;

  static BOOST_ASIO_CONSTEXPR result_type value() BOOST_ASIO_NOEXCEPT
  {
    return (Bits & outstanding_work_tracked)
      ? execution::outstanding_work_t(execution::outstanding_work.tracked)
      : execution::outstanding_work_t(execution::outstanding_work.untracked);
  }
};

template <typename Allocator, unsigned int Bits, typename Property>
struct query_static_constexpr_member<
    boost::asio::io_context::basic_executor_type<Allocator, Bits>,
    Property,
    typename boost::asio::enable_if<
      boost::asio::is_convertible<
        Property,
        boost::asio::execution::mapping_t
      >::value
    >::type
  >
{
  BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
  BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
  typedef boost::asio::execution::mapping_t::thread_t result_type;

  static BOOST_ASIO_CONSTEXPR result_type value() BOOST_ASIO_NOEXCEPT
  {
    return result_type();
  }
};

#endif // !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)

#if !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT)

template <typename Allocator, unsigned int Bits, typename Property>
struct query_member<
    boost::asio::io_context::basic_executor_type<Allocator, Bits>,
    Property,
    typename boost::asio::enable_if<
      boost::asio::is_convertible<
        Property,
        boost::asio::execution::blocking_t
      >::value
    >::type
  >
{
  BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
  BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
  typedef boost::asio::execution::blocking_t result_type;
};

template <typename Allocator, unsigned int Bits, typename Property>
struct query_member<
    boost::asio::io_context::basic_executor_type<Allocator, Bits>,
    Property,
    typename boost::asio::enable_if<
      boost::asio::is_convertible<
        Property,
        boost::asio::execution::relationship_t
      >::value
    >::type
  >
{
  BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
  BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
  typedef boost::asio::execution::relationship_t result_type;
};

template <typename Allocator, unsigned int Bits>
struct query_member<
    boost::asio::io_context::basic_executor_type<Allocator, Bits>,
    boost::asio::execution::context_t
  >
{
  BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
  BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
  typedef boost::asio::io_context& result_type;
};

template <typename Allocator, unsigned int Bits>
struct query_member<
    boost::asio::io_context::basic_executor_type<Allocator, Bits>,
    boost::asio::execution::allocator_t<void>
  >
{
  BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
  BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
  typedef Allocator result_type;
};

template <typename Allocator, unsigned int Bits, typename OtherAllocator>
struct query_member<
    boost::asio::io_context::basic_executor_type<Allocator, Bits>,
    boost::asio::execution::allocator_t<OtherAllocator>
  >
{
  BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true);
  BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true);
  typedef Allocator result_type;
};

#endif // !defined(BOOST_ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT)

} // namespace traits

#endif // !defined(GENERATING_DOCUMENTATION)

} // namespace asio
} // namespace boost

#include <boost/asio/detail/pop_options.hpp>

#include <boost/asio/impl/io_context.hpp>
#if defined(BOOST_ASIO_HEADER_ONLY)
# include <boost/asio/impl/io_context.ipp>
#endif // defined(BOOST_ASIO_HEADER_ONLY)

// If both io_context.hpp and strand.hpp have been included, automatically
// include the header file needed for the io_context::strand class.
#if !defined(BOOST_ASIO_NO_EXTENSIONS)
# if defined(BOOST_ASIO_STRAND_HPP)
#  include <boost/asio/io_context_strand.hpp>
# endif // defined(BOOST_ASIO_STRAND_HPP)
#endif // !defined(BOOST_ASIO_NO_EXTENSIONS)

#endif // BOOST_ASIO_IO_CONTEXT_HPP


text:
            <input class="input_field input_field-secondary" type="text" id="vimeoId" data-ng-model="project.vimeoId"/>

                Vimeo ID

                <button data-ng-click="toggleEditFn(0)" class="btn btn-main grow btn-warning">Cancel</button>

                <button type="submit" data-ng-click="toggleEditFn(0)" class="btn btn-main grow">Save</button>

Vimeo ID

            <input class="input_field input_field-secondary" type="text" id="soundCloudId" data-ng-model="project.soundCloudId"/>

                Sound Cloud ID

                <button data-ng-click="toggleEditFn(0)" class="btn btn-main grow btn-warning">Cancel</button>

                <button type="submit" data-ng-click="toggleEditFn(0)" class="btn btn-main grow">Save</button>

Sound Cloud ID

            <input class="input_field input_field-secondary" type="text" id="imageGallery" data-ng-model="project.imageGallery"/>

                Images

                <button data-ng-click="toggleEditFn(0)" class="btn btn-main grow btn-warning">Cancel</button>

                <button type="submit" data-ng-click="toggleEditFn(0)" class="btn btn-main grow">Save</button>

Images

            <input class="input_field input_field-secondary" type="text" id="status" data-ng-model="project.status"/>

                Submission Status

                <button data-ng-click="toggleEditFn(0)" class="btn btn-main grow btn-warning">Cancel</button>

                <button type="submit" data-ng-click="toggleEditFn(0)" class="btn btn-main grow">Save</button>

Submission Status

            <input class="input_field input_field-secondary" type="text" id="storySummary" data-ng-model="project.storySummary"/>

                Story Summary

                <button data-ng-click="toggleEditFn(0)" class="btn btn-main grow btn-warning">Cancel</button>

                <button type="submit" data-ng-click="toggleEditFn(0)" class="btn btn-main grow">Save</button>

Story Summary

            <input class="input_field input_field-secondary" type="text" id="street" data-ng-model="project.userStreet"/>

                Street

                <button data-ng-click="toggleEditFn(0)" class="btn btn-main grow btn-warning">Cancel</button>

                <button type="submit" data-ng-click="toggleEditFn(0)" class="btn btn-main grow">Save</button>

Street


text:
class CopyMachine::Configuration
  include ActiveSupport::Configurable

  config.notifiers = []

  class << config
    [:before_copy, :after_copy].each do |m|
      class_eval %{
        def #{m}(&blk)
          send("#{m}_hook=", blk)
        end
      }
    end

    def alter_sql(&blk)
      self.sql_alteration = blk
    end
  end

end