text:
package layers

import (
	"encoding/binary"
	"fmt"
	"github.com/google/gopacket"
	"net"
)

// IPv6 is the layer for the IPv6 header.
type IPv6 struct {
	// http://www.networksorcery.com/enp/protocol/ipv6.htm
	BaseLayer
	Version      uint8
	TrafficClass uint8
	FlowLabel    uint32
	Length       uint16
	NextHeader   IPProtocol
	HopLimit     uint8
	SrcIP        net.IP
	DstIP        net.IP
	HopByHop     *IPv6HopByHop
	// hbh will be pointed to by HopByHop if that layer exists.
	hbh IPv6HopByHop
}

// LayerType returns LayerTypeIPv6
func (i *IPv6) LayerType() gopacket.LayerType { return LayerTypeIPv6 }
func (i *IPv6) NetworkFlow() gopacket.Flow {
	return gopacket.NewFlow(EndpointIPv6, i.SrcIP, i.DstIP)
}

const (
	IPv6HopByHopOptionJumbogram = 0xC2 // RFC 2675
)

// SerializeTo writes the serialized form of this layer into the
// SerializationBuffer, implementing gopacket.SerializableLayer.
// See the docs for gopacket.SerializableLayer for more info.
func (ip6 *IPv6) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error {
	payload := b.Bytes()
	if ip6.HopByHop != nil {
		return fmt.Errorf("unable to serialize hopbyhop for now")
	}
	bytes, err := b.PrependBytes(40)
	if err != nil {
		return err
	}
	bytes[0] = (ip6.Version << 4) | (ip6.TrafficClass >> 4)
	bytes[1] = (ip6.TrafficClass << 4) | uint8(ip6.FlowLabel>>16)
	binary.BigEndian.PutUint16(bytes[2:], uint16(ip6.FlowLabel))
	if opts.FixLengths {
		ip6.Length = uint16(len(payload))
	}
	binary.BigEndian.PutUint16(bytes[4:], ip6.Length)
	bytes[6] = byte(ip6.NextHeader)
	bytes[7] = byte(ip6.HopLimit)
	if len(ip6.SrcIP) != 16 {
		return fmt.Errorf("invalid src ip %v", ip6.SrcIP)
	}
	if len(ip6.DstIP) != 16 {
		return fmt.Errorf("invalid dst ip %v", ip6.DstIP)
	}
	copy(bytes[8:], ip6.SrcIP)
	copy(bytes[24:], ip6.DstIP)
	return nil
}

func (ip6 *IPv6) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
	ip6.Version = uint8(data[0]) >> 4
	ip6.TrafficClass = uint8((binary.BigEndian.Uint16(data[0:2]) >> 4) & 0x00FF)
	ip6.FlowLabel = binary.BigEndian.Uint32(data[0:4]) & 0x000FFFFF
	ip6.Length = binary.BigEndian.Uint16(data[4:6])
	ip6.NextHeader = IPProtocol(data[6])
	ip6.HopLimit = data[7]
	ip6.SrcIP = data[8:24]
	ip6.DstIP = data[24:40]
	ip6.HopByHop = nil
	// We initially set the payload to all bytes after 40.  ip6.Length or the
	// HopByHop jumbogram option can both change this eventually, though.
	ip6.BaseLayer = BaseLayer{data[:40], data[40:]}

	// We treat a HopByHop IPv6 option as part of the IPv6 packet, since its
	// options are crucial for understanding what's actually happening per packet.
	if ip6.NextHeader == IPProtocolIPv6HopByHop {
		ip6.hbh.DecodeFromBytes(ip6.Payload, df)
		hbhLen := len(ip6.hbh.Contents)
		// Reset IPv6 contents to include the HopByHop header.
		ip6.BaseLayer = BaseLayer{data[:40+hbhLen], data[40+hbhLen:]}
		ip6.HopByHop = &ip6.hbh
		if ip6.Length == 0 {
			for _, o := range ip6.hbh.Options {
				if o.OptionType == IPv6HopByHopOptionJumbogram {
					if len(o.OptionData) != 4 {
						return fmt.Errorf("Invalid jumbo packet option length")
					}
					payloadLength := binary.BigEndian.Uint32(o.OptionData)
					pEnd := int(payloadLength)
					if pEnd > len(ip6.Payload) {
						df.SetTruncated()
					} else {
						ip6.Payload = ip6.Payload[:pEnd]
						ip6.hbh.Payload = ip6.Payload
					}
					return nil
				}
			}
			return fmt.Errorf("IPv6 length 0, but HopByHop header does not have jumbogram option")
		}
	}
	if ip6.Length == 0 {
		return fmt.Errorf("IPv6 length 0, but next header is %v, not HopByHop", ip6.NextHeader)
	} else {
		pEnd := int(ip6.Length)
		if pEnd > len(ip6.Payload) {
			df.SetTruncated()
			pEnd = len(ip6.Payload)
		}
		ip6.Payload = ip6.Payload[:pEnd]
	}
	return nil
}

func (i *IPv6) CanDecode() gopacket.LayerClass {
	return LayerTypeIPv6
}
func (i *IPv6) NextLayerType() gopacket.LayerType {
	if i.HopByHop != nil {
		return i.HopByHop.NextHeader.LayerType()
	}
	return i.NextHeader.LayerType()
}

func decodeIPv6(data []byte, p gopacket.PacketBuilder) error {
	ip6 := &IPv6{}
	err := ip6.DecodeFromBytes(data, p)
	p.AddLayer(ip6)
	p.SetNetworkLayer(ip6)
	if ip6.HopByHop != nil {
		// TODO(gconnell):  Since HopByHop is now an integral part of the IPv6
		// layer, should it actually be added as its own layer?  I'm leaning towards
		// no.
		p.AddLayer(ip6.HopByHop)
	}
	if err != nil {
		return err
	}
	if ip6.HopByHop != nil {
		return p.NextDecoder(ip6.HopByHop.NextHeader)
	}
	return p.NextDecoder(ip6.NextHeader)
}

func (i *IPv6HopByHop) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
	i.ipv6ExtensionBase = decodeIPv6ExtensionBase(data)
	i.Options = i.opts[:0]
	var opt *IPv6HopByHopOption
	for d := i.Contents[2:]; len(d) > 0; d = d[opt.ActualLength:] {
		i.Options = append(i.Options, IPv6HopByHopOption(decodeIPv6HeaderTLVOption(d)))
		opt = &i.Options[len(i.Options)-1]
	}
	return nil
}

func decodeIPv6HopByHop(data []byte, p gopacket.PacketBuilder) error {
	i := &IPv6HopByHop{}
	err := i.DecodeFromBytes(data, p)
	p.AddLayer(i)
	if err != nil {
		return err
	}
	return p.NextDecoder(i.NextHeader)
}

type ipv6HeaderTLVOption struct {
	OptionType, OptionLength uint8
	ActualLength             int
	OptionData               []byte
}

func decodeIPv6HeaderTLVOption(data []byte) (h ipv6HeaderTLVOption) {
	if data[0] == 0 {
		h.ActualLength = 1
		return
	}
	h.OptionType = data[0]
	h.OptionLength = data[1]
	h.ActualLength = int(h.OptionLength) + 2
	h.OptionData = data[2:h.ActualLength]
	return
}

func (h *ipv6HeaderTLVOption) serializeTo(b gopacket.SerializeBuffer, fixLengths bool) (int, error) {
	if fixLengths {
		h.OptionLength = uint8(len(h.OptionData))
	}
	length := int(h.OptionLength) + 2
	data, err := b.PrependBytes(length)
	if err != nil {
		return 0, err
	}
	data[0] = h.OptionType
	data[1] = h.OptionLength
	copy(data[2:], h.OptionData)
	return length, nil
}

// IPv6HopByHopOption is a TLV option present in an IPv6 hop-by-hop extension.
type IPv6HopByHopOption ipv6HeaderTLVOption

type ipv6ExtensionBase struct {
	BaseLayer
	NextHeader   IPProtocol
	HeaderLength uint8
	ActualLength int
}

func decodeIPv6ExtensionBase(data []byte) (i ipv6ExtensionBase) {
	i.NextHeader = IPProtocol(data[0])
	i.HeaderLength = data[1]
	i.ActualLength = int(i.HeaderLength)*8 + 8
	i.Contents = data[:i.ActualLength]
	i.Payload = data[i.ActualLength:]
	return
}

// IPv6ExtensionSkipper is a DecodingLayer which decodes and ignores v6
// extensions.  You can use it with a DecodingLayerParser to handle IPv6 stacks
// which may or may not have extensions.
type IPv6ExtensionSkipper struct {
	NextHeader IPProtocol
	BaseLayer
}

func (i *IPv6ExtensionSkipper) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
	extension := decodeIPv6ExtensionBase(data)
	i.BaseLayer = BaseLayer{data[:extension.ActualLength], data[extension.ActualLength:]}
	i.NextHeader = extension.NextHeader
	return nil
}
func (i *IPv6ExtensionSkipper) CanDecode() gopacket.LayerClass {
	return LayerClassIPv6Extension
}
func (i *IPv6ExtensionSkipper) NextLayerType() gopacket.LayerType {
	return i.NextHeader.LayerType()
}

// IPv6HopByHop is the IPv6 hop-by-hop extension.
type IPv6HopByHop struct {
	ipv6ExtensionBase
	Options []IPv6HopByHopOption
	opts    [2]IPv6HopByHopOption
}

// LayerType returns LayerTypeIPv6HopByHop.
func (i *IPv6HopByHop) LayerType() gopacket.LayerType { return LayerTypeIPv6HopByHop }

// IPv6Routing is the IPv6 routing extension.
type IPv6Routing struct {
	ipv6ExtensionBase
	RoutingType  uint8
	SegmentsLeft uint8
	// This segment is supposed to be zero according to RFC2460, the second set of
	// 4 bytes in the extension.
	Reserved []byte
	// SourceRoutingIPs is the set of IPv6 addresses requested for source routing,
	// set only if RoutingType == 0.
	SourceRoutingIPs []net.IP
}

// LayerType returns LayerTypeIPv6Routing.
func (i *IPv6Routing) LayerType() gopacket.LayerType { return LayerTypeIPv6Routing }

func decodeIPv6Routing(data []byte, p gopacket.PacketBuilder) error {
	i := &IPv6Routing{
		ipv6ExtensionBase: decodeIPv6ExtensionBase(data),
		RoutingType:       data[2],
		SegmentsLeft:      data[3],
		Reserved:          data[4:8],
	}
	switch i.RoutingType {
	case 0: // Source routing
		if (len(data)-8)%16 != 0 {
			return fmt.Errorf("Invalid IPv6 source routing, length of type 0 packet %d", len(data))
		}
		for d := i.Contents[8:]; len(d) >= 16; d = d[16:] {
			i.SourceRoutingIPs = append(i.SourceRoutingIPs, net.IP(d[:16]))
		}
	}
	p.AddLayer(i)
	return p.NextDecoder(i.NextHeader)
}

// IPv6Fragment is the IPv6 fragment header, used for packet
// fragmentation/defragmentation.
type IPv6Fragment struct {
	BaseLayer
	NextHeader IPProtocol
	// Reserved1 is bits [8-16), from least to most significant, 0-indexed
	Reserved1      uint8
	FragmentOffset uint16
	// Reserved2 is bits [29-31), from least to most significant, 0-indexed
	Reserved2      uint8
	MoreFragments  bool
	Identification uint32
}

// LayerType returns LayerTypeIPv6Fragment.
func (i *IPv6Fragment) LayerType() gopacket.LayerType { return LayerTypeIPv6Fragment }

func decodeIPv6Fragment(data []byte, p gopacket.PacketBuilder) error {
	i := &IPv6Fragment{
		BaseLayer:      BaseLayer{data[:8], data[8:]},
		NextHeader:     IPProtocol(data[0]),
		Reserved1:      data[1],
		FragmentOffset: binary.BigEndian.Uint16(data[2:4]) >> 3,
		Reserved2:      data[3] & 0x6 >> 1,
		MoreFragments:  data[3]&0x1 != 0,
		Identification: binary.BigEndian.Uint32(data[4:8]),
	}
	p.AddLayer(i)
	return p.NextDecoder(gopacket.DecodeFragment)
}

// IPv6DestinationOption is a TLV option present in an IPv6 destination options extension.
type IPv6DestinationOption ipv6HeaderTLVOption

func (o *IPv6DestinationOption) serializeTo(b gopacket.SerializeBuffer, fixLengths bool) (int, error) {
	return (*ipv6HeaderTLVOption)(o).serializeTo(b, fixLengths)
}

// IPv6Destination is the IPv6 destination options header.
type IPv6Destination struct {
	ipv6ExtensionBase
	Options []IPv6DestinationOption
}

// LayerType returns LayerTypeIPv6Destination.
func (i *IPv6Destination) LayerType() gopacket.LayerType { return LayerTypeIPv6Destination }

func decodeIPv6Destination(data []byte, p gopacket.PacketBuilder) error {
	i := &IPv6Destination{
		ipv6ExtensionBase: decodeIPv6ExtensionBase(data),
		// We guess we'll 1-2 options, one regular option at least, then maybe one
		// padding option.
		Options: make([]IPv6DestinationOption, 0, 2),
	}
	var opt *IPv6DestinationOption
	for d := i.Contents[2:]; len(d) > 0; d = d[opt.ActualLength:] {
		i.Options = append(i.Options, IPv6DestinationOption(decodeIPv6HeaderTLVOption(d)))
		opt = &i.Options[len(i.Options)-1]
	}
	p.AddLayer(i)
	return p.NextDecoder(i.NextHeader)
}

// SerializeTo writes the serialized form of this layer into the
// SerializationBuffer, implementing gopacket.SerializableLayer.
// See the docs for gopacket.SerializableLayer for more info.
func (i *IPv6Destination) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error {
	optionLength := 0
	for _, opt := range i.Options {
		l, err := opt.serializeTo(b, opts.FixLengths)
		if err != nil {
			return err
		}
		optionLength += l
	}
	bytes, err := b.PrependBytes(2)
	if err != nil {
		return err
	}
	bytes[0] = uint8(i.NextHeader)
	if opts.FixLengths {
		i.HeaderLength = uint8((optionLength + 2) / 8)
	}
	bytes[1] = i.HeaderLength
	return nil
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;

namespace Adxstudio.Xrm.Search.WindowsAzure
{
	[DataContract]
	public class EntitySearchResultPage
	{
		public EntitySearchResultPage(IEnumerable<EntitySearchResult> results, int approximateTotalHits, int pageNumber, int pageSize)
		{
			if (results == null)
			{
				throw new ArgumentNullException("results");
			}

			Results = results.ToArray();

			ApproximateTotalHits = approximateTotalHits;
			PageNumber = pageNumber;
			PageSize = pageSize;
		}

		[DataMember]
		public int ApproximateTotalHits { get; set; }

		[DataMember]
		public bool IndexNotFound { get; set; }

		[DataMember]
		public int PageNumber { get; set; }

		[DataMember]
		public int PageSize { get; set; }

		[DataMember]
		public EntitySearchResult[] Results { get; set; }
	}
}

redpajama_set_name: RedPajamaGithub


text:
class AddCategoryToProfiles < ActiveRecord::Migration[5.0]
  def change
    add_column :profiles, :category, :string
  end
end


text:
using System;
using System.Collections.Generic;

namespace Imms.Implementation {
	static partial class TrieVector<TValue> {
		internal abstract partial class Node {
			static readonly Node empty = new Leaf(new TValue[0], Lineage.Immutable, 0);
			public readonly int Height;
			protected readonly Lineage Lineage;
			public int ArrSize;
			public bool IsFull;
			public int Length;

			protected Node(int height, int length, bool isFull, Lineage lineage, int arrSize) {
				Height = height;
				Length = length;
				IsFull = isFull;
				Lineage = lineage;
				ArrSize = arrSize;
			}

			public static Node Empty {
				get { return empty; }
			}

			public abstract TValue this[int index] { get; }

			/// <summary>
			///     This method is not optimized.
			/// </summary>
			public abstract bool IsParent { get; }

			public abstract Node Add(TValue item, Lineage lineage);

			public abstract Node AddRange(TValue[] arr, Lineage lineage, int maxHeight, ref int count, ref int i);

			public abstract TrieVector<TOut>.Node Apply<TOut>(Func<TValue, TOut> transform, Lineage lineage);

			public abstract Node RemoveLast(Lineage lineage);

			public abstract IEnumerator<TValue> GetEnumerator(bool forward);

			public abstract void Iter(Action<TValue> action);

			public abstract void IterBack(Action<TValue> action);

			public abstract bool IterBackWhile(Func<TValue, bool> conditional);

			public abstract bool IterWhile(Func<TValue, bool> conditional);

			public abstract int RecursiveTotalLength();

			/// <summary>
			///     WARNING THE PARAMETER CALLED 'index' IS NOT THE INDEX IN THIS NODE, BUT IN THE ENTIRE TREE!!!! <br />
			///     IF YOU DO index < this.Length you will get FALSE!!!!
			/// </summary>
			/// <param name="index"></param>
			/// <param name="lineage"></param>
			/// <returns></returns>
			public abstract Node Take(int index, Lineage lineage);

			/// <summary>
			///     Begins iterating over the trie at the specified index.
			/// </summary>
			/// <param name="index"></param>
			/// <param name="conditional"></param>
			/// <returns></returns>
			public abstract bool IterWhileFrom(int index, Func<TValue, bool> conditional);

			public abstract Node Update(int index, TValue value, Lineage lineage);

			public abstract Node Reverse(Lineage lineage);

		}
	}
}


text:
#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_SCANENTRY_H
#define MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_SCANENTRY_H

#include "py/obj.h"
#include "shared-module/_bleio/ScanEntry.h"

extern const mp_obj_type_t bleio_scanentry_type;

mp_obj_t common_hal_bleio_scanentry_get_address(bleio_scanentry_obj_t *self);
mp_obj_t common_hal_bleio_scanentry_get_advertisement_bytes(bleio_scanentry_obj_t *self);
mp_int_t common_hal_bleio_scanentry_get_rssi(bleio_scanentry_obj_t *self);
bool common_hal_bleio_scanentry_get_connectable(bleio_scanentry_obj_t *self);
bool common_hal_bleio_scanentry_get_scan_response(bleio_scanentry_obj_t *self);
bool common_hal_bleio_scanentry_matches(bleio_scanentry_obj_t *self, uint8_t* prefixes, size_t prefixes_len, bool all);

#endif // MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_SCANENTRY_H


text:
![XMPPFramework](xmppframework.png)

## XMPPFramework
[![Build Status](https://travis-ci.org/robbiehanson/XMPPFramework.svg?branch=master)](https://travis-ci.org/robbiehanson/XMPPFramework) [![Version Status](https://img.shields.io/cocoapods/v/XMPPFramework.svg?style=flat)](https://github.com/robbiehanson/XMPPFramework) [![Platform](https://img.shields.io/cocoapods/p/XMPPFramework.svg?style=flat)](https://cocoapods.org/?q=XMPPFramework) [![License (3-Clause BSD)](https://img.shields.io/badge/license-BSD%203--Clause-orange.svg?style=flat)](http://opensource.org/licenses/BSD-3-Clause)

An XMPP Framework in Objective-C for the Mac and iOS development community.

### Abstract
XMPPFramework provides a core implementation of RFC-3920 (the XMPP standard), along with the tools needed to read & write XML. It comes with multiple popular extensions (XEP's), all built atop a modular architecture, allowing you to plug-in any code needed for the job. Additionally the framework is massively parallel and thread-safe. Structured using GCD, this framework performs well regardless of whether it's being run on an old iPhone, or on a 12-core Mac Pro. (And it won't block the main thread... at all)

### Install

The minimum deployment target is iOS 8.0 / macOS 10.8.

The easiest way to install `XMPPFramework` is using CocoaPods. Remember to add to the top of your `Podfile` the `use_frameworks!` line (even if you are not using swift):

- This will install the whole framework with all the avaiable extensions:

```ruby
# The version pushed to CocoaPods is very out of date, use master branch for now
pod 'XMPPFramework', :git => "https://github.com/robbiehanson/XMPPFramework.git", :branch => 'master'
# pod 'XMPPFramework'
```

- If you want to pick what extensions to install:

```
pod 'XMPPFramework/XEP-0009'
pod 'XMPPFramework/XEP-0224'
```

After `pod install` open the `.xcworkspace` and import:

```
import XMPPFramework      // swift
@import XMPPFramework;   //objective-c
```

### Wiki:
For more info please take a look at the wiki.

- [Overview of the XMPP Framework](https://github.com/robbiehanson/XMPPFramework/wiki/IntroToFramework)
- [Getting started using XMPPFramework on Mac OS X](https://github.com/robbiehanson/XMPPFramework/wiki/GettingStarted_Mac)
- [Getting started using XMPPFramework on iOS](https://github.com/robbiehanson/XMPPFramework/wiki/GettingStarted_iOS)
- [XEPs supported by the XMPPFramework](https://github.com/robbiehanson/XMPPFramework/wiki/XEPs)
- [Learn more about XMPPFramework](https://github.com/robbiehanson/XMPPFramework/wiki)

Can't find the answer to your question in any of the [wiki](https://github.com/robbiehanson/XMPPFramework/wiki) articles? Try the [mailing list](http://groups.google.com/group/xmppframework).

Love the project? Wanna buy me a ☕? (or a 🍺 😀):

[![donation-bitcoin](https://bitpay.com/img/donate-sm.png)](https://onename.com/robbiehanson)
[![donation-paypal](https://www.paypal.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=CV6XGZTPQU9HY)


text:
package gov.va.med.lom.vistabroker.patient.dao;

import gov.va.med.lom.vistabroker.dao.BaseDao;

import java.util.List;

public class CombatVetDao extends BaseDao {

  // CONSTRUCTORS
  public CombatVetDao() {
    super();
  }

  public CombatVetDao(BaseDao baseDao) {
    super(baseDao);
  }

  // RPC API
  public List<String> getCombatVetInfo(String dfn) throws Exception {
    setDefaultContext("ALS CPRS COM OBJECT RPCS");
    setDefaultRpcName("ALSI COMBAT VET");
    return lCall(dfn);
  }
}


text:
#ifndef CRC_T_H
#define CRC_T_H

#include <stdint.h>
#include <errno.h>
#include <fstream>    // for std::ifstream
#include <ios>        // for std::ios_base, etc.

// For GCC 4.6 or higher, in C++ you can use a standard
// static_assert(exp, msg) in *.c and in *.h files.
// For GCC 4.6 is required to add CFLAGS += -std="c++0x"
// A lot of variants, it is the most simple and intuitive
// It can be used in *.c and in *.h files.
// (macros that use function style can be used in *.c files only)
//
// Disadvantages: you can not be set msg to display the console when compiling
//
// Example:
//
//  CRC_STATIC_ASSERT( sizeof(char) == 1)  //good job
//  CRC_STATIC_ASSERT( sizeof(char) != 1)  //You will get a compilation error
//
#define CRC_ASSERT_CONCAT_(a, b) a##b
#define CRC_ASSERT_CONCAT(a, b) CRC_ASSERT_CONCAT_(a, b)
#define CRC_STATIC_ASSERT(expr) \
    enum { CRC_ASSERT_CONCAT(assert_line_, __LINE__) = 1/(int)(!!(expr)) }

template<uint8_t Bits_minus_1_div_8> struct CRC_Type_helper{ typedef uint64_t value_type; }; // default

template<> struct CRC_Type_helper<0> { typedef uint8_t  value_type; }; //for Bits 1..8
template<> struct CRC_Type_helper<1> { typedef uint16_t value_type; }; //for Bits 9..16
template<> struct CRC_Type_helper<2> { typedef uint32_t value_type; }; //for Bits 17..24
template<> struct CRC_Type_helper<3> { typedef uint32_t value_type; }; //for Bits 25..32

#define CRC_TYPE typename CRC_Type_helper< (Bits-1)/8 >::value_type

/*
 * CRCBase_t - is the base class that we will use in various algorithms.
 * This class accepts an Impl template parameter (use Curiously Recurring Template Pattern (CRTP)).
 * This allows us to use the get_raw_crc_impl() method from the implementation class without using virtual methods.
 */
template <uint8_t Bits, CRC_TYPE Poly, CRC_TYPE Init, bool RefIn, bool RefOut, CRC_TYPE XorOut, class Impl>
class CRCBase_t
{
    CRC_STATIC_ASSERT(Bits >= 1);
    CRC_STATIC_ASSERT(Bits <= 64);

    public:

        typedef CRC_TYPE CRC_Type;

        CRCBase_t();

        // get param CRC
        uint8_t  get_bits()    const { return Bits;  }
        CRC_Type get_poly()    const { return Poly;  }
        CRC_Type get_init()    const { return Init;  }
        CRC_Type get_xor_out() const { return XorOut;}
        bool     get_ref_in()  const { return RefIn; }
        bool     get_ref_out() const { return RefOut;}

        CRC_Type get_top_bit() const { return (CRC_Type)1 << (Bits - 1);      }
        CRC_Type get_crc_mask()const { return ( (get_top_bit() - 1) << 1) | 1;}
        CRC_Type get_crc_init()const { return crc_init;} //crc_init = reflect(Init, Bits) if RefIn, else = Init
        CRC_Type get_check()   const;                    //crc for ASCII string "123456789" (i.e. 313233... (hexadecimal)).

        // Calculate methods
        CRC_Type get_crc(const void* data, size_t len) const;
        int      get_crc(CRC_Type &crc, const char* file_name) const;
        int      get_crc(CRC_Type &crc, const char* file_name, void* buf, size_t size_buf) const;

        // Calculate for chunks of data
        CRC_Type get_raw_crc(const void* data, size_t len) const;                   //get raw_crc for first chunk of data
        CRC_Type get_raw_crc(const void* data, size_t len, CRC_Type raw_crc) const; //get raw_crc for chunk of data
        CRC_Type get_end_crc(CRC_Type raw_crc) const;

        CRC_Type reflect(CRC_Type data, uint8_t num_bits) const;

    protected:
        CRC_Type get_raw_normal_crc(uint8_t byte) const;
        CRC_Type get_raw_reflected_crc(uint8_t byte) const;

    private:
        CRC_Type crc_init;

        int      get_crc(CRC_Type &crc, std::ifstream& ifs, void* buf, size_t size_buf) const;
};

template <uint8_t Bits, CRC_TYPE Poly, CRC_TYPE Init, bool RefIn, bool RefOut, CRC_TYPE XorOut, class Impl>
CRCBase_t<Bits, Poly, Init, RefIn, RefOut, XorOut, Impl>::CRCBase_t()
{
    if(RefIn)
    {
        crc_init = reflect(Init, Bits);
    }
    else
    {
        crc_init = Init;
    }
}

template <uint8_t Bits, CRC_TYPE Poly, CRC_TYPE Init, bool RefIn, bool RefOut, CRC_TYPE XorOut, class Impl>
CRC_TYPE CRCBase_t<Bits, Poly, Init, RefIn, RefOut, XorOut, Impl>::get_check() const
{
    const uint8_t data[] = {0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39};

    return get_crc(data, sizeof(data));
}

template <uint8_t Bits, CRC_TYPE Poly, CRC_TYPE Init, bool RefIn, bool RefOut, CRC_TYPE XorOut, class Impl>
CRC_TYPE CRCBase_t<Bits, Poly, Init, RefIn, RefOut, XorOut, Impl>::get_crc(const void* data, size_t len) const
{
    CRC_Type crc = get_raw_crc(data, len, crc_init);

    return get_end_crc(crc);
}

template <uint8_t Bits, CRC_TYPE Poly, CRC_TYPE Init, bool RefIn, bool RefOut, CRC_TYPE XorOut, class Impl>
int CRCBase_t<Bits, Poly, Init, RefIn, RefOut, XorOut, Impl>::get_crc(CRC_Type &crc, const char *file_name) const
{
    char buf[4096];

    return get_crc(crc, file_name, buf, sizeof(buf));
}

template <uint8_t Bits, CRC_TYPE Poly, CRC_TYPE Init, bool RefIn, bool RefOut, CRC_TYPE XorOut, class Impl>
int CRCBase_t<Bits, Poly, Init, RefIn, RefOut, XorOut, Impl>::get_crc(CRC_Type &crc, const char* file_name, void* buf, size_t size_buf) const
{
    std::ifstream ifs(file_name, std::ios_base::binary);

    if( !ifs || !buf || !size_buf)
    {
        errno = EINVAL;
        return -1;
    }

    return get_crc(crc, ifs, buf, size_buf);
}

template <uint8_t Bits, CRC_TYPE Poly, CRC_TYPE Init, bool RefIn, bool RefOut, CRC_TYPE XorOut, class Impl>
int CRCBase_t<Bits, Poly, Init, RefIn, RefOut, XorOut, Impl>::get_crc(CRC_Type &crc, std::ifstream& ifs, void* buf, size_t size_buf) const
{
    crc = crc_init;

    while( ifs )
    {
        ifs.read(static_cast<char *>(buf), size_buf);
        crc = get_raw_crc(buf, ifs.gcount(), crc);
    }

    crc = get_end_crc(crc);

    return (ifs.rdstate() & std::ios_base::badbit);  //return 0 if all good
}

template <uint8_t Bits, CRC_TYPE Poly, CRC_TYPE Init, bool RefIn, bool RefOut, CRC_TYPE XorOut, class Impl>
CRC_TYPE CRCBase_t<Bits, Poly, Init, RefIn, RefOut, XorOut, Impl>::get_raw_crc(const void* data, size_t len) const
{
    return get_raw_crc(data, len, get_crc_init());
}

template <uint8_t Bits, CRC_TYPE Poly, CRC_TYPE Init, bool RefIn, bool RefOut, CRC_TYPE XorOut, class Impl>
CRC_TYPE CRCBase_t<Bits, Poly, Init, RefIn, RefOut, XorOut, Impl>::get_raw_crc(const void* data, size_t len, CRC_Type raw_crc) const
{
    //use Curiously Recurring Template Pattern (CRTP)
    return static_cast<const Impl*>(this)->get_raw_crc_impl(data, len, raw_crc);
}

template <uint8_t Bits, CRC_TYPE Poly, CRC_TYPE Init, bool RefIn, bool RefOut, CRC_TYPE XorOut, class Impl>
CRC_TYPE CRCBase_t<Bits, Poly, Init, RefIn, RefOut, XorOut, Impl>::get_end_crc(CRC_Type raw_crc) const
{
    if(RefOut^RefIn)
        raw_crc = reflect(raw_crc, Bits);

    raw_crc ^= XorOut;
    raw_crc &= get_crc_mask(); //for CRC not a multiple of a byte (8 bits)

    return raw_crc;
}

template <uint8_t Bits, CRC_TYPE Poly, CRC_TYPE Init, bool RefIn, bool RefOut, CRC_TYPE XorOut, class Impl>
CRC_TYPE CRCBase_t<Bits, Poly, Init, RefIn, RefOut, XorOut, Impl>::reflect(CRC_Type data, uint8_t num_bits) const
{
    CRC_Type reflection = 0;

    while( num_bits-- )
    {
        reflection = (reflection << 1) | (data & 1);
        data >>= 1;
    }

    return reflection;
}

template <uint8_t Bits, CRC_TYPE Poly, CRC_TYPE Init, bool RefIn, bool RefOut, CRC_TYPE XorOut, class Impl>
CRC_TYPE CRCBase_t<Bits, Poly, Init, RefIn, RefOut, XorOut, Impl>::get_raw_normal_crc(uint8_t byte)  const
{
    CRC_Type crc = 0;

    for(int bit = 0x80; bit; bit >>= 1)
    {
        if( byte & bit )
            crc ^= get_top_bit();

        if( crc & get_top_bit() )
        {
            crc <<= 1;
            crc ^= Poly;
        }
        else
            crc <<= 1;
    }

    return crc & get_crc_mask(); //for CRC not a multiple of a byte (8 bits);
}

template <uint8_t Bits, CRC_TYPE Poly, CRC_TYPE Init, bool RefIn, bool RefOut, CRC_TYPE XorOut, class Impl>
CRC_TYPE CRCBase_t<Bits, Poly, Init, RefIn, RefOut, XorOut, Impl>::get_raw_reflected_crc(uint8_t byte) const
{
    static CRC_Type ref_poly = reflect(Poly, Bits);

    CRC_Type crc = byte;

    for(int bit = 0x80; bit; bit >>= 1)
    {
        if( crc & 1 )
        {
            crc >>= 1;
            crc ^= ref_poly;
        }
        else
            crc >>= 1;
    }

    return crc;
}

template <uint8_t Bits, CRC_TYPE Poly, CRC_TYPE Init, bool RefIn, bool RefOut, CRC_TYPE XorOut>
class CRCImplTable8: public CRCBase_t<Bits, Poly, Init, RefIn, RefOut, XorOut,
                                      CRCImplTable8<Bits, Poly, Init, RefIn, RefOut, XorOut> >
{
    public:

        typedef CRC_TYPE CRC_Type;

        CRCImplTable8();

        CRC_Type get_raw_crc_impl(const void* data, size_t len, CRC_Type crc) const; //for first byte crc = init (must be)

    private:
        CRC_Type crc_table[256];

        void     init_crc_table();
};

template <uint8_t Bits, CRC_TYPE Poly, CRC_TYPE Init, bool RefIn, bool RefOut, CRC_TYPE XorOut>
CRCImplTable8<Bits, Poly, Init, RefIn, RefOut, XorOut>::CRCImplTable8()
{
    init_crc_table();
}

template <uint8_t Bits, CRC_TYPE Poly, CRC_TYPE Init, bool RefIn, bool RefOut, CRC_TYPE XorOut>
CRC_TYPE CRCImplTable8<Bits, Poly, Init, RefIn, RefOut, XorOut>::get_raw_crc_impl(const void* data, size_t len, CRC_Type crc) const
{
    const uint8_t* buf = static_cast< const uint8_t* >(data);

    int shift;

    if(Bits > 8)
        shift = (Bits - 8);
    else
        shift = (8 - Bits);

    if(Bits > 8)
    {
        if(RefIn)
            while (len--)
                crc = (crc >> 8) ^ crc_table[ (crc & 0xff) ^ *buf++];
        else
            while (len--)
                crc = (crc << 8) ^ crc_table[ ((crc >> shift) & 0xff) ^ *buf++ ];
    }
    else
    {
        if (RefIn)
            while (len--)
                crc = crc_table[ crc ^ *buf++ ];
        else
            while (len--)
                crc = crc_table[ (crc << shift) ^ *buf++ ];
    }

    return crc;
}

template <uint8_t Bits, CRC_TYPE Poly, CRC_TYPE Init, bool RefIn, bool RefOut, CRC_TYPE XorOut>
void CRCImplTable8<Bits, Poly, Init, RefIn, RefOut, XorOut>::init_crc_table()
{
    //Calculation of the CRC table for byte.
    for(int byte = 0; byte < 256; byte++)
    {
        if(RefIn)
            crc_table[byte] = this->get_raw_reflected_crc(byte); // Reflected CRC table for byte.
        else
            crc_table[byte] = this->get_raw_normal_crc(byte);    // Normal CRC table for byte.
    }
}

template <uint8_t Bits, CRC_TYPE Poly, CRC_TYPE Init, bool RefIn, bool RefOut, CRC_TYPE XorOut>
class CRCImplBits: public CRCBase_t<Bits, Poly, Init, RefIn, RefOut, XorOut,
                                    CRCImplBits<Bits, Poly, Init, RefIn, RefOut, XorOut> >
{
    public:

        typedef CRC_TYPE CRC_Type;

        CRC_Type get_raw_crc_impl(const void* data, size_t len, CRC_Type crc) const; //for first byte crc = init (must be)
};

template <uint8_t Bits, CRC_TYPE Poly, CRC_TYPE Init, bool RefIn, bool RefOut, CRC_TYPE XorOut>
CRC_TYPE CRCImplBits<Bits, Poly, Init, RefIn, RefOut, XorOut>::get_raw_crc_impl(const void* data, size_t len, CRC_Type crc) const
{
    const uint8_t* buf = static_cast< const uint8_t* >(data);

    int shift;

    if(Bits > 8)
        shift = (Bits - 8);
    else
        shift = (8 - Bits);

    if(Bits > 8)
    {
        if(RefIn)
            while (len--)
                crc = (crc >> 8) ^ this->get_raw_reflected_crc((crc & 0xff) ^ *buf++);
        else
            while (len--)
                crc = (crc << 8) ^ this->get_raw_normal_crc(((crc >> shift) & 0xff) ^ *buf++);
    }
    else
    {
        if(RefIn)
            while (len--)
                crc = this->get_raw_reflected_crc(crc ^ *buf++);
        else
            while (len--)
                crc = this->get_raw_normal_crc((crc << shift) ^ *buf++);
    }

    return crc;
}

template <uint8_t Bits, CRC_TYPE Poly, CRC_TYPE Init, bool RefIn, bool RefOut, CRC_TYPE XorOut>
class CRCImplTable4: public CRCBase_t<Bits, Poly, Init, RefIn, RefOut, XorOut,
                                      CRCImplTable4<Bits, Poly, Init, RefIn, RefOut, XorOut> >
{
    public:

        typedef CRC_TYPE CRC_Type;

        CRCImplTable4();

        CRC_Type get_raw_crc_impl(const void* data, size_t len, CRC_Type crc) const; //for first byte crc = init (must be)

    private:
        CRC_Type crc_table[16];

        void     init_crc_table();
};

template <uint8_t Bits, CRC_TYPE Poly, CRC_TYPE Init, bool RefIn, bool RefOut, CRC_TYPE XorOut>
CRCImplTable4<Bits, Poly, Init, RefIn, RefOut, XorOut>::CRCImplTable4()
{
    init_crc_table();
}

template <uint8_t Bits, CRC_TYPE Poly, CRC_TYPE Init, bool RefIn, bool RefOut, CRC_TYPE XorOut>
CRC_TYPE CRCImplTable4<Bits, Poly, Init, RefIn, RefOut, XorOut>::get_raw_crc_impl(const void* data, size_t len, CRC_Type crc) const
{
    const uint8_t* buf = static_cast< const uint8_t* >(data);

    int shift;

    if(Bits > 4)
        shift = Bits - 4;
    else
        shift = 4 - Bits;

    if(Bits > 4)
    {
        if(RefIn)
            while (len--)
            {
                crc = crc_table[(crc ^ *buf       ) & 0x0f] ^ (crc >> 4);
                crc = crc_table[(crc ^ (*buf >> 4)) & 0x0f] ^ (crc >> 4);
                buf++;
            }
        else
            while (len--)
            {
                crc = crc_table[((crc >> shift) ^ (*buf >> 4)) & 0x0f] ^ (crc << 4);
                crc = crc_table[((crc >> shift) ^ *buf       ) & 0x0f] ^ (crc << 4);
                buf++;
            }
    }
    else//Bits <= 4
    {
        if(RefIn)
            while (len--)
            {
                crc = crc_table[(crc ^ *buf       ) & 0x0f];
                crc = crc_table[(crc ^ (*buf >> 4)) & 0x0f];
                buf++;
            }
        else
            while (len--)
            {
                crc = crc_table[((crc << shift) ^ (*buf >> 4)) & 0x0f];
                crc = crc_table[((crc << shift) ^ *buf       ) & 0x0f];
                buf++;
            }
    }

    return crc;
}

template <uint8_t Bits, CRC_TYPE Poly, CRC_TYPE Init, bool RefIn, bool RefOut, CRC_TYPE XorOut>
void CRCImplTable4<Bits, Poly, Init, RefIn, RefOut, XorOut>::init_crc_table()
{
    //Calculation of the CRC table for half byte.
    for(int byte = 0; byte < 16; byte++)
    {
        if(RefIn)
            crc_table[byte] = this->get_raw_reflected_crc(byte*16); //see note1
        else
            crc_table[byte] = this->get_raw_normal_crc(byte);
    }

    //note1: *16 it's equivalent function for calculating CRC for 4 bits (the result of symmetry)
}

template <uint8_t Bits, CRC_TYPE Poly, CRC_TYPE Init, bool RefIn, bool RefOut, CRC_TYPE XorOut,
          template<uint8_t, CRC_TYPE, CRC_TYPE, bool, bool, CRC_TYPE> class Impl = CRCImplTable8>
class CRC_t: public Impl<Bits, Poly, Init, RefIn, RefOut, XorOut>
{

};

#endif // CRC_T_H


text:
(function(root, factory) {

    "use strict";
    if (typeof define === "function" && define.amd) {
        // AMD. Register as an anonymous module.
        define(["jquery"], factory);
    } else if (typeof exports === "object") {
        // Node. Does not work with strict CommonJS, but
        // only CommonJS-like environments that support module.exports,
        // like Node.
        module.exports = factory(require("jquery"));
    } else {
        // Browser globals (root is window)
        root.ModalBox = factory(root.jQuery, window, document);
    }

}(this, function init($, window, document, undefined) {

    if (!window.bootbox) throw new Error('ModalBox requires bootbox.js');

    if (!$.fn.slimScroll) throw new Error('ModalBox requires slimScroll.js');

    function _init(options) {
        if (options.url) {
            if (!options.type || (options.type != 'ajax' && options.type != 'iframe')) {
                options.type = 'ajax';
            }
        }

        if(options.ajax){
            options.type = 'ajax';
            if (typeof options.ajax === 'object') options.url = options.ajax.url;
        } else if (options.remote) {
            options.type = 'ajax';
            if (typeof options.remote === 'string') options.url = options.remote;
        } else if (options.iframe) {
            options.type = 'iframe';
            if (typeof options.iframe === 'string') options.url = options.iframe;
        } else if (options.custom) {
            options.type = 'custom';
            if (typeof options.custom === 'string') {
                var $doms;
                try {
                    $doms = $(options.custom);
                } catch (e) {}

                if ($doms && $doms.length) {
                    options.custom = $doms;
                } else if ($.isFunction(window[options.custom])) {
                    options.custom = window[options.custom];
                }
            }
        }
    }

    var NAME = 'mower.modalbox';

    var defaults = {
        type: 'custom',
        width: null, // number, css definition
        size: null, // 'md', 'sm', 'lg', 'fullscreen'
        height: 'auto',
        name: 'remoteModal',
        spinner: '

',
        delay: 0
    };

    var templates = {
        dialog: "
" +
            "
" +
            "
" +
            "

" +
            "
" +
            "
" +
            "
",
        header: "
" +
            "

" +
            "
",
        footer: "

"
    };

    // our public object; augmented after our private API
    var exports = bootbox;

    exports.ajaxDialog = function(option) {
        var options = $.extend({}, defaults, option);

        _init(options);
        // capture the user's show value; we always set this to false before
        // spawning the dialog to give us a chance to attach some handlers to
        // it, but we need to make sure we respect a preference not to show it
        var shouldShow = (options.show === undefined) ? true : options.show;

        options.show = false;
        var that = this,
            $modal = exports.dialog(options),
            $dialog = $modal.find('.modal-dialog'),
            custom = options.custom,
            $body = $dialog.find('.modal-body').css('padding', ''),
            $header = $dialog.find('.modal-header'),
            $content = $dialog.find('.modal-content');

        $modal.addClass(options.cssClass);
        $dialog.toggleClass('modal-md', options.size === 'md')
            .toggleClass('modal-sm', options.size === 'sm')
            .toggleClass('modal-lg', options.size === 'lg')
            .toggleClass('modal-loading', true);
        if (options.size) {
            options.width = '';
            options.height = '';
        }

        var readyToShow = function(delay) {
            // 异步设置宽高,容易导致尺寸变化出现动画,位置计算不准
            //if (typeof delay === 'undefined') delay = 300;
            //setTimeout(function() {
                $dialog = $modal.find('.modal-dialog');
                if (options.width && options.width != 'auto') {
                    $dialog.css('width', options.width);
                }
                if (options.height && options.height !== 'auto') {

                    $dialog.css('height', options.height);

                    if (options.type === 'iframe') {
                        $body.css('height', $dialog.height() - $header.outerHeight());
                    } else {
                        $body.slimScroll({
                            height: $dialog.height() - $header.outerHeight()
                        });
                    }
                }
                $modal.removeClass('modal-loading');
            //}, delay);
        };

        if (options.type === 'custom' && custom) {
            if ($.isFunction(custom)) {
                var customContent = custom({
                    modal: $modal,
                    options: options,
                    ready: readyToShow
                });
                if (typeof customContent === 'string') {
                    $body.find(".bootbox-body").html(customContent);
                    readyToShow();
                }
            } else if (custom instanceof $) {
                $body.find(".bootbox-body").html($('
').append(custom.clone()).html());
                readyToShow();
            } else {
                $body.find(".bootbox-body").html(custom);
                readyToShow();
            }
        } else if (options.url) {
            $modal.attr('ref', options.url);
            if (options.type === 'iframe') {
                $modal.addClass('modal-iframe');
                this.firstLoad = true;
                var iframeName = 'iframe-' + options.name;
                $header.detach();
                $body.detach();
                $content.empty().append($header).append($body);
                $body.find(".bootbox-body").css('padding', 0).css('height', '100%')
                    .html('');

                if (options.waittime > 0) {
                    that.waitTimeout = setTimeout(readyToShow, options.waittime);
                }

                var frame = document.getElementById(iframeName);
                frame.onload = frame.onreadystatechange = function() {
                    if (that.firstLoad) $modal.addClass('modal-loading');
                    if (this.readyState && this.readyState != 'complete') return;
                    that.firstLoad = false;

                    if (options.waittime > 0) {
                        clearTimeout(that.waitTimeout);
                    }

                    try {
                        $modal.attr('ref', frame.contentWindow.location.href);
                        var frame$ = window.frames[iframeName].$;
                        if (frame$ && options.height === 'auto') {
                            // todo: update iframe url to ref attribute
                            var $framebody = frame$('body').addClass('body-modal');
                            var ajustFrameSize = function() {
                                $modal.removeClass('fade');
                                var height = $framebody.outerHeight();
                                $body.css('height', height);
                                if (options.fade) $modal.addClass('fade');
                                readyToShow();
                            };

                            $modal.callEvent('loaded.mower.modal', {
                                modalType: 'iframe'
                            });

                            setTimeout(ajustFrameSize, 100);

                            $framebody.off('resize.' + NAME).on('resize.' + NAME, ajustFrameSize);

                            frame$.extend({
                                closeModal: window.closeModal
                            });
                        } else {
                            readyToShow();
                        }
                    } catch (e) {
                        readyToShow();
                    }
                };
            } else {
                var ajaxOptions = $.extend({}, options.ajax || {}, {
                    'url': options.url,
                    'dataType': 'html'
                });
                $.ajax(ajaxOptions).done(function(data) {
                    try {
                        var $html = $(data);

                        //update version
                        var version = $html.filter('meta');
                        if (version.exists()) {
                            $('meta[name=version]', document).attr('content', version.attr('content'));
                        }

                        var exclude = ':not(meta)';
                        //update content
                        $($.parseHTML(data)).filter(exclude).each(function() {
                            var $data = $(this);
                            if ($data.hasClass('modal-dialog')) {
                                $dialog.replaceWith($data);
                            } else if ($data.hasClass('modal-content')) {
                                $dialog.find('.modal-content').replaceWith($data);
                            } else if ($data.hasClass('modal-title')) {
                                $dialog.find('.modal-title').replaceWith($data);
                            } else if ($data.hasClass('modal-body')) {
                                $dialog.find('.modal-body').replaceWith($data);
                            } else {
                                $body.find(".bootbox-body").wrapInner($data);
                            }
                        });

                        //reinit document ready function in the new fragment
                        $(document).triggerHandler('update', $modal[0]);

                        //update javascript
                        $html.filter('script').each(function() {
                            var $script = $(this);
                            $modal.append($script);
                        });
                    } catch (e) {
                        $body.find(".bootbox-body").wrapInner(data);
                    }

                    $modal.callEvent('loaded.mower.modal', {
                        modalType: 'ajax'
                    });
                    readyToShow();
                });
            }
        }

        //modal show
        if (shouldShow === true) {
            //add loading spinner
            $modal.prepend(options.spinner);
            $modal.modal("show");
        }

        return $modal;
    };

    $(document).on('click.' + NAME + '.data-api', '[data-toggle="modalbox"]', function(e) {
        var $this = $(this);
        exports.ajaxDialog($.extend({}, $this.data()));

        if ($this.is('a')) {
            e.preventDefault();
        }
    });

    return exports;
}));


text:
function data = read_hitran_cross_section(wnrange, fname)
% data = read_hitran_cross_section(wnrange, filename)

wls = [min(wnrange) max(wnrange)];

load(fname);

wn = data.WaveNumber;

ind = find(wn>min(wnrange) & wn<max(wnrange));

fnames = fieldnames(data);
if (isempty(ind)~=1)
    for n=1:length(fnames)
        temp = data.(char(fnames(n)));
        data.(char(fnames(n))) = temp(ind);
    end
else
    for n=1:length(fnames)
        data.(char(fnames(n))) = [];
    end
end


text:
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';

import { Theme, ThemeSelection } from '../theme/theme';

@Component({
  selector: 'app-header',
  templateUrl: './header.component.html',
  styleUrls: ['./header.component.less']
})
export class HeaderComponent implements OnInit {

  @Input()
  text: String;

  @Input()
  themes: Theme[];

  @Output()
  onThemeChanged: EventEmitter<ThemeSelection> = new EventEmitter<ThemeSelection>();

  constructor() { }

  ngOnInit() {
  }

  handleThemeChanged(theme: ThemeSelection) {
    this.onThemeChanged.emit(theme); // simply push it along..
  }

}


text:
namespace StarterKit.Service
{
    using Autofac;
    using MassTransit;
    using Topshelf;
    using Topshelf.Logging;

    public class MyService : ServiceControl
    {
        readonly LogWriter _log = HostLogger.Get<MyService>();

        IBusControl _busControl;
        BusHandle _busHandle;

        public MyService(IBusControl busControl)
        {
            _busControl = busControl;
        }

        public bool Start(HostControl hostControl)
        {
            _log.Info("Starting bus...");

            _busHandle = _busControl.Start();

            return true;
        }

        public bool Stop(HostControl hostControl)
        {
            _log.Info("Stopping bus...");

            if (_busHandle != null)
                _busHandle.Stop();

            return true;
        }
    }
}


text:
from __future__ import print_function
import argparse

from speech_recognition import Recognizer

from mycroft.client.speech.mic import MutableMicrophone
from mycroft.util import play_wav

"""
Audio Test
A tool for recording X seconds of audio, and then playing them back. Useful
for testing hardware, and ensures
compatibility with mycroft recognizer loop code.
"""

def record(filename, duration):
    mic = MutableMicrophone()
    recognizer = Recognizer()
    with mic as source:
        audio = recognizer.record(source, duration=duration)
        with open(filename, 'wb') as f:
            f.write(audio.get_wav_data())

def main():
    parser = argparse.ArgumentParser()
    parser.add_argument(
        '-f', '--filename', dest='filename', default="/tmp/test.wav",
        help="Filename for saved audio (Default: /tmp/test.wav)")
    parser.add_argument(
        '-d', '--duration', dest='duration', type=int, default=10,
        help="Duration of recording in seconds (Default: 10)")
    args = parser.parse_args()

    print(" ===========================================================")
    print(" ==         STARTING TO RECORD, MAKE SOME NOISE!          ==")
    print(" ===========================================================")

    record(args.filename, args.duration)

    print(" ===========================================================")
    print(" ==           DONE RECORDING, PLAYING BACK...             ==")
    print(" ===========================================================")
    play_wav(args.filename)

if __name__ == "__main__":
    main()


text:
using System.Linq;
using System.Web.Routing;
using NGM.Forum.Extensions;
using NGM.Forum.Models;
using NGM.Forum.Services;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Handlers;
using Orchard.Core.Common.Models;
using Orchard.Data;
using Orchard.Security;

namespace NGM.Forum.Handlers {
    public class ThreadPartHandler : ContentHandler {
        private readonly IPostService _postService;
        private readonly IThreadService _threadService;
        private readonly IForumService _forumService;
        private readonly IContentManager _contentManager;

        public ThreadPartHandler(IRepository<ThreadPartRecord> repository,
            IPostService postService,
            IThreadService threadService,
            IForumService forumService,
            IContentManager contentManager) {
            _postService = postService;
            _threadService = threadService;
            _forumService = forumService;
            _contentManager = contentManager;

            Filters.Add(StorageFilter.For(repository));

            OnGetDisplayShape<ThreadPart>(SetModelProperties);
            OnGetEditorShape<ThreadPart>(SetModelProperties);
            OnUpdateEditorShape<ThreadPart>(SetModelProperties);

            OnActivated<ThreadPart>(PropertyHandlers);
            OnLoading<ThreadPart>((context, part) => LazyLoadHandlers(part));
            OnCreated<ThreadPart>((context, part) => UpdateForumPartCounters(part));
            OnPublished<ThreadPart>((context, part) => UpdateForumPartCounters(part));
            OnUnpublished<ThreadPart>((context, part) => UpdateForumPartCounters(part));
            OnVersioning<ThreadPart>((context, part, newVersionPart) => LazyLoadHandlers(newVersionPart));
            OnVersioned<ThreadPart>((context, part, newVersionPart) => UpdateForumPartCounters(newVersionPart));
            OnRemoved<ThreadPart>((context, part) => UpdateForumPartCounters(part));

            OnRemoved<ForumPart>((context, b) =>
                _threadService.Delete(context.ContentItem.As<ForumPart>()));
        }

        private void SetModelProperties(BuildShapeContext context, ThreadPart threadPart) {
            context.Shape.Forum = threadPart.ForumPart;
            context.Shape.StickyClass = threadPart.IsSticky ? "Sticky" : string.Empty;
        }

        private void UpdateForumPartCounters(ThreadPart threadPart) {
            var commonPart = threadPart.As<CommonPart>();
            if (commonPart != null && commonPart.Record.Container != null) {

                var forumPart = threadPart.ForumPart ?? _forumService.Get(commonPart.Record.Container.Id, VersionOptions.Published);

                // TODO: Refactor this to do the count in the DB and not make 3 DB calls.
                forumPart.ThreadCount = _threadService.Count(forumPart, VersionOptions.Published);
                forumPart.PostCount = _threadService
                    .Get(forumPart, VersionOptions.Published)
                    .Sum(publishedThreadPart => _postService
                        .Count(publishedThreadPart, VersionOptions.Published));
            }
        }

        protected void LazyLoadHandlers(ThreadPart part) {
            // Add handlers that will load content for id's just-in-time
            part.ClosedByField.Loader(() => _contentManager.Get<IUser>(part.Record.ClosedById));
        }

        protected void PropertyHandlers(ActivatedContentContext context, ThreadPart part) {
            // Add handlers that will update records when part properties are set

            part.ClosedByField.Setter(user => {
                part.Record.ClosedById = user == null
                    ? 0
                    : user.ContentItem.Id;
                return user;
            });

            // Force call to setter if we had already set a value
            if (part.ClosedByField.Value != null)
                part.ClosedByField.Value = part.ClosedByField.Value;

            // Setup FirstPost & LatestPost fields
            part.FirstPostField.Loader(() => _postService.GetPositional(part, ThreadPostPositional.First));
            part.LatestPostField.Loader(() => _postService.GetPositional(part, ThreadPostPositional.Latest));
        }

        protected override void GetItemMetadata(GetContentItemMetadataContext context) {
            var thread = context.ContentItem.As<ThreadPart>();

            if (thread == null)
                return;

            if (thread.ForumPart != null) {
                context.Metadata.DisplayRouteValues = new RouteValueDictionary
                    {
                        {"Area", Constants.LocalArea},
                        {"Controller", "Thread"},
                        {"Action", "Item"},
                        {"forumId", thread.ForumPart.ContentItem.Id},
                        {"threadId", context.ContentItem.Id}
                    };
            }

            context.Metadata.AdminRouteValues = new RouteValueDictionary {
                {"Area", Constants.LocalArea},
                {"Controller", "ThreadAdmin"},
                {"Action", "Item"},
                {"threadId", context.ContentItem.Id}
            };
        }
    }
}


text:
    #include <GLUT/GLUT.h>
#elif __linux
    #include <GL/glut.h>
#endif

RIVUIDropdown::RIVUIDropdown(int x, int y, int width, int height, const std::vector<std::string>& stringElements) : RIVUIElement(x,y,width,height) {
	if(stringElements.size()) {
		selectedElementIndex = 0;
	}
	else {
		selectedElementIndex = -1;
	}
	createDropdownElements(stringElements);
}
RIVUIDropdown::RIVUIDropdown(int x, int y, int width, int heights) : RIVUIElement(x,y,width,height) {
	selectedElementIndex = -1;
}
void RIVUIDropdown::createDropdownElements(const std::vector<std::string>& texts) {
	elements.clear();
	int elementY = y - height;
	for(int i = 0 ; i < texts.size() ; ++i) {
		elements.push_back(RIVDropdownElement(elementY,texts[i]));
		elementY -= height;
	}
}
void RIVUIDropdown::SetValues(const std::vector<std::string>& values) {
	createDropdownElements(values);
}
void RIVUIDropdown::SetSelectedValue(const std::string& value) {
	for(int i = 0 ; i < elements.size() ; ++i) {
		if(elements[i].text == value) {
			selectedElementIndex = i;
			notifyListeners();
			return;
		}
	}
	throw std::runtime_error("No such value exists in this dropdown");
}
void RIVUIDropdown::SetSelectedValue(int i) {
	if(i < elements.size()) {
		selectedElementIndex = i;
		notifyListeners();
	}
	else {
		throw std::runtime_error("Not that many elements exist.");
	}
}
void RIVUIDropdown::Draw() {
	needsRedraw = true;
	if(needsRedraw && !hidden) {
		if(selectedElementIndex >= 0) {
			printf("RIVUIDropdown %s redraw\n",elements[selectedElementIndex].text.c_str());
		}

		const int lineWidth = 2;

		glClearColor(1, 1, 1, 0);
		glColor3f(1, 1,1);

		//Draw a rectangle as background
		//	glRectf(x, y, width, height);

		glColor3f(0, 0, 0);
		glLineWidth(lineWidth);
		//Draw the lines around the rectangle

		glBegin(GL_LINE_LOOP);
		glVertex2f(x, y);
		glVertex2f(x + width - lineWidth, y);
		glVertex2f(x + width - lineWidth, y + height - lineWidth);
		glVertex2f(x, y + height - lineWidth);
		glEnd();

		if(selectedElementIndex >= 0) {
			//		if(collapsed) {
			const std::string& selectedText = elements[selectedElementIndex].text;
			drawText(selectedText, x + 5,y + 5, 0.08);
			//		}
			if(!collapsed) {
				//Draw all the dropdown elements
				for(const RIVDropdownElement& element : elements) {
					glColor3f(1,1,1);
					glRectf(x, element.y, x+width, element.y + height);
					glLineWidth(lineWidth);
					glColor3f(0,0, 0);
					glBegin(GL_LINE_LOOP);
					glVertex2f(x, element.y);
					glVertex2f(x + width - lineWidth, element.y);
					glVertex2f(x + width - lineWidth, element.y + height - lineWidth);
					glVertex2f(x, element.y + height - lineWidth);
					glEnd();
					drawText(element.text, x + 5,element.y + 5, 0.08);
				}
			}
		}
		needsRedraw = false;
	}

	//Draw the active text

}
void RIVUIDropdown::AddListener(RIVUIDropdownListener *listener) {
	listeners.push_back(listener);
}
void RIVUIDropdown::notifyListeners() {
	for(auto listener : listeners) {
		listener->OnValueChanged(this, selectedElementIndex, elements[selectedElementIndex].text);
	}
}
bool RIVUIDropdown::Mouse(int x, int y, int button, int state) {
	if(containsPoint(x, y)) {
		if(state == GLUT_DOWN) {
			if(collapsed) {

				if(collapsed) {
					printf("Dropdown is now uncollapsed.\n");
				}
			}
			else {

				printf("Dropdown is now collapsed.\n");
			}
			collapsed = !collapsed;
			needsRedraw = true;
			return true;
		}
	}
	else if(!collapsed) { //If it not collapsed it is allowed to extend beyond its view bounds
		int i = 0 ;
		for(const RIVDropdownElement& element : elements) {
			if(y > element.y && y < element.y + height) {

				printf("newly selected index = %d\n",i);
				needsRedraw = true;
				selectedElementIndex = i;
				collapsed = true;

				notifyListeners();

				return true;
			}
			++i;
		}
	}
	return false;
}
int RIVUIDropdown::GetSelectedIndex() {
	return selectedElementIndex;
}
std::string RIVUIDropdown::GetSelectedValue() {
	return elements[selectedElementIndex].text;
}
void RIVUIDropdown::AddValue(const std::string &value) {

}


text:
audio::audio() {
	music.setVolume(22);
	music.setLoop(true);
}

audio::~audio(){}

void audio::play_background_music(){
	if(!music.openFromFile("Sounds/Glorious_morning.ogg")){
		std::cout << "can't find Glorious_morning.ogg";
	}
	music.play();
}

void audio::spawn_swordsman(){
	sound_spawn.resetBuffer();
	if(!buffer_spawn.loadFromFile("Sounds/Sword_spawn.wav")){
		std::cout << "can't find Sword_spawn.wav";
	}
	sound_spawn.setBuffer(buffer_spawn);
	sound_spawn.play();
}

void audio::spawn_archer(){
	sound_spawn.resetBuffer();
	if(!buffer_spawn.loadFromFile("Sounds/Archer_spawn.wav")){
		std::cout << "can't find Archer_spawn.wav";
	}
	sound_spawn.setBuffer(buffer_spawn);
	sound_spawn.play();
}

void audio::spawn_horseman(){
	sound_spawn.resetBuffer();
	if(!buffer_spawn.loadFromFile("Sounds/Horse_spawn.wav")){
		std::cout << "can't find Horse_spawn.wav";
	}
	sound_spawn.setBuffer(buffer_spawn);
	sound_spawn.play();
}

void audio::unit_down(){
	sound.resetBuffer();
	if(!buffer.loadFromFile("Sounds/Unit_down.wav")){
		std::cout << "can't find Unit_down.wav";
	}
	sound.setBuffer(buffer);
	sound.play();
}

void audio::lumber_up(){
	sound_up.resetBuffer();
	if(!buffer_up.loadFromFile("Sounds/Axe.wav")){
		std::cout << "can't find Axe.wav";
	}
	sound_up.setBuffer(buffer_up);
	sound_up.play();
}

void audio::farm_up(){
	sound_up.resetBuffer();
	if(!buffer_up.loadFromFile("Sounds/Scythe.wav")){
		std::cout << "can't find Scythe.wav";
	}
	sound_up.setBuffer(buffer_up);
	sound_up.play();
}

void audio::mine_up(){
	sound_up.resetBuffer();
	if(!buffer_up.loadFromFile("Sounds/Pickaxe.wav")){
		std::cout << "can't find Pickaxe.wav";
	}
	sound_up.setBuffer(buffer_up);
	sound_up.play();
}

void audio::we_are_under_attack(){
	sound_up.resetBuffer();
	if(!buffer_up.loadFromFile("Sounds/We_are_under_attack.wav")){
		std::cout << "can't find We_are_under_attack.wav";
	}
	sound_up.setBuffer(buffer_up);
	sound_up.play();
}


text:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"></link>

back

libra
rhea
uriel
virgo


text:
/* csv - stuff to help process comma separated values.  Have to wrap quotes around
 * things with commas, and escape quotes with more quotes sometimes. */

#ifndef CSV_H
#define CSV_H

void csvEscapeAndAppend(struct dyString *dy, char *string);
/* Append escaped string to dy.  Will insert comma if dy is non-empty */

char *csvEscapeToDyString(struct dyString *dy, char *string);
/* Wrap string in quotes if it has any commas.  Put result into dy, and return it as a
 * string.   Anything already in quotes get double-quoted */

void csvWriteVal(char *val, FILE *f);
/* Write val, which may have some quotes or commas in it, in a way to be compatable with
 * csv list representation */

char *csvParseNext(char **pos, struct dyString *scratch);
/* Return next value starting at pos, putting results into scratch and
 * returning scratch->string or NULL if no values left. Will update *pos
 * to after trailing comma if any. This will tolerate and ignore leading
 * and trailing white space.
 *     Since an empty or all-white string will return NULL, if you
 * want empty strings to be a legitimate value then they have to be quoted
 * or followed by a comma. */

boolean csvNeedsParsing(char *s);
/* Return TRUE if s is something that needs parsing through the csv parser.  That
 * is it either starts with a quote or has a comma */

struct slName *csvParse(char *csv);
/* Return a list of parsed out csv values.  Do a slFreeList of this when done */

#endif /* CSV_H */


text:
package io.agrest.runtime.processor.delete.provider;

import io.agrest.DeleteStage;
import io.agrest.processor.Processor;
import io.agrest.runtime.AgExceptionMappers;
import io.agrest.runtime.processor.delete.DeleteContext;
import io.agrest.runtime.processor.delete.DeleteProcessorFactory;
import io.agrest.runtime.processor.delete.stage.DeleteAuthorizeChangesStage;
import io.agrest.runtime.processor.delete.stage.DeleteInDataStoreStage;
import io.agrest.runtime.processor.delete.stage.DeleteMapChangesStage;
import io.agrest.runtime.processor.delete.stage.DeleteStartStage;
import org.apache.cayenne.di.DIRuntimeException;
import org.apache.cayenne.di.Inject;
import org.apache.cayenne.di.Provider;

import java.util.EnumMap;

/**
 * @since 2.7
 */
public class DeleteProcessorFactoryProvider implements Provider<DeleteProcessorFactory> {

    private final EnumMap<DeleteStage, Processor<DeleteContext<?>>> stages;
    private final AgExceptionMappers exceptionMappers;

    public DeleteProcessorFactoryProvider(
            @Inject DeleteStartStage startStage,
            @Inject DeleteMapChangesStage mapChangesStage,
            @Inject DeleteAuthorizeChangesStage authorizeChangesStage,
            @Inject DeleteInDataStoreStage deleteInDataStoreStage,
            @Inject AgExceptionMappers exceptionMappers) {

        this.exceptionMappers = exceptionMappers;

        stages = new EnumMap<>(DeleteStage.class);
        stages.put(DeleteStage.START, startStage);
        stages.put(DeleteStage.MAP_CHANGES, mapChangesStage);
        stages.put(DeleteStage.AUTHORIZE_CHANGES, authorizeChangesStage);
        stages.put(DeleteStage.DELETE_IN_DATA_STORE, deleteInDataStoreStage);
    }

    @Override
    public DeleteProcessorFactory get() throws DIRuntimeException {
        return new DeleteProcessorFactory(stages, exceptionMappers);
    }
}


text:
from __future__ import unicode_literals

from django.conf import settings
from django.db import models
from django.utils.translation import pgettext_lazy
from django.utils.encoding import python_2_unicode_compatible
from django_prices.models import PriceField
from prices import FixedDiscount

class NotApplicable(ValueError):
    pass

@python_2_unicode_compatible
class FixedProductDiscount(models.Model):
    name = models.CharField(max_length=255)
    products = models.ManyToManyField('Product', blank=True)
    discount = PriceField(pgettext_lazy('Discount field', 'discount value'),
                          currency=settings.DEFAULT_CURRENCY,
                          max_digits=12, decimal_places=2)

    class Meta:
        app_label = 'product'

    def __repr__(self):
        return 'FixedProductDiscount(name=%r, discount=%r)' % (
            str(self.discount), self.name)

    def __str__(self):
        return self.name

    def modifier_for_product(self, variant):
        if not self.products.filter(pk=variant.product.pk).exists():
            raise NotApplicable('Discount not applicable for this product')
        if self.discount > variant.get_price(discounted=False):
            raise NotApplicable('Discount too high for this product')
        return FixedDiscount(self.discount, name=self.name)

def get_product_discounts(variant, discounts, **kwargs):
    for discount in discounts:
        try:
            yield discount.modifier_for_product(variant, **kwargs)
        except NotApplicable:
            pass


text:
gcloud iam service-accounts create kube-deployer
gcloud iam service-accounts keys create kube-deployer-keys.json --iam-account=kube-deployer@burnished-block-834.iam.gserviceaccount.com
gcloud projects add-iam-policy-binding burnished-block-834 --member serviceAccount:kube-deployer@burnished-block-834.iam.gserviceaccount.com --role roles/container.developer
echo $GPG_PASSPHRASE | gpg --passphrase-fd 0 --symmetric  -o- kube-deployer-keys.json | base64 > kube-deployer-keys.json.gpg
aws s3 cp --acl public-read kube-deployer-keys.json.gpg s3://assen-configs

# to use:
#gcloud auth activate-service-account kube-deployer@burnished-block-834.iam.gserviceaccount.com --key-file=kube-deployer-keys.json


text:
import ScrollBar from 'react-perfect-scrollbar'
import 'react-perfect-scrollbar/dist/css/styles.css'
import './index.less'

export default ScrollBar


text:
Climate change has risen from simple environmental protection to the existence and development of Human beings .
But it has more important and urgent practical significance for China.
Changing the coal based energy structure of China and industrial structure with high pollution and high energy consumption
is an urgent requirement to govern environment and global climate change within China.
In the meantime, it is also the international responsibility of China in global governance and the construction of a community of human destiny
to actively respond to climate change.


text:
// Generated by gtkmmproc -- DO NOT MODIFY!

#include <glibmm.h>

#include <pangomm/layoutline.h>
#include <pangomm/private/layoutline_p.h>

// -*- c++ -*-
/* $Id: layoutline.ccg,v 1.3 2006/05/30 17:14:21 murrayc Exp $ */

/*
 *
 * Copyright 1998-2002 The gtkmm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include <pangomm/layout.h>
#include <pango/pangocairo.h>

namespace Pango {

Rectangle LayoutLine::get_ink_extents() const
{
  Rectangle ink_rect;
  pango_layout_line_get_extents(const_cast<PangoLayoutLine*>(gobj()), ink_rect.gobj(), 0);
  return ink_rect;
}

Rectangle LayoutLine::get_logical_extents() const
{
  Rectangle logical_rect;
  pango_layout_line_get_extents(const_cast<PangoLayoutLine*>(gobj()), 0, logical_rect.gobj());
  return logical_rect;
}

Rectangle LayoutLine::get_pixel_ink_extents() const
{
  Rectangle ink_rect;
  pango_layout_line_get_pixel_extents(const_cast<PangoLayoutLine*>(gobj()), ink_rect.gobj(), 0);
  return ink_rect;
}

Rectangle LayoutLine::get_pixel_logical_extents() const
{
  Rectangle logical_rect;
  pango_layout_line_get_pixel_extents(const_cast<PangoLayoutLine*>(gobj()), 0, logical_rect.gobj());
  return logical_rect;
}

int LayoutLine::index_to_x(int index, bool trailing) const
{
  int x_pos;
  pango_layout_line_index_to_x(const_cast<PangoLayoutLine*>(gobj()), index, trailing, &x_pos);
  return x_pos;
}

Glib::ArrayHandle<std::pair<int,int> > LayoutLine::get_x_ranges(int start_index, int end_index) const
{
  int* ranges = 0;
  int n_ranges = 0;
  pango_layout_line_get_x_ranges(const_cast<PangoLayoutLine*>(gobj()), start_index, end_index, &ranges, &n_ranges);
  return Glib::ArrayHandle<std::pair<int,int> >(reinterpret_cast<std::pair<int,int>*>(ranges), n_ranges, Glib::OWNERSHIP_SHALLOW);
}

void LayoutLine::show_in_cairo_context(const Cairo::RefPtr<Cairo::Context>& context)
{
  pango_cairo_show_layout_line(context->cobj(), gobj());
}

void LayoutLine::add_to_cairo_context(const Cairo::RefPtr<Cairo::Context>& context)
{
  pango_cairo_layout_line_path(context->cobj(), gobj());
}

} /* namespace Pango */

namespace
{
} // anonymous namespace

/* Why reinterpret_cast<LayoutLine*>(gobject) is needed:
 *
 * A LayoutLine instance is in fact always a PangoLayoutLine instance.
 * Unfortunately, PangoLayoutLine cannot be a member of LayoutLine,
 * because it is an opaque struct.  Also, the C interface does not provide
 * any hooks to install a destroy notification handler, thus we cannot
 * wrap it dynamically either.
 *
 * The cast works because LayoutLine does not have any member data, and
 * it is impossible to derive from it.  This is ensured by not implementing
 * the (protected) default constructor.  The ctor is protected rather than
 * private just to avoid a compile warning.
 */

namespace Glib
{

Glib::RefPtr<Pango::LayoutLine> wrap(PangoLayoutLine* object, bool take_copy)
{
  if(take_copy && object)
    pango_layout_line_ref(object);

  // See the comment at the top of this file, if you want to know why the cast works.
  return Glib::RefPtr<Pango::LayoutLine>(reinterpret_cast<Pango::LayoutLine*>(object));
}

} // namespace Glib

namespace Pango
{

void LayoutLine::reference() const
{
  // See the comment at the top of this file, if you want to know why the cast works.
  pango_layout_line_ref(reinterpret_cast<PangoLayoutLine*>(const_cast<LayoutLine*>(this)));
}

void LayoutLine::unreference() const
{
  // See the comment at the top of this file, if you want to know why the cast works.
  pango_layout_line_unref(reinterpret_cast<PangoLayoutLine*>(const_cast<LayoutLine*>(this)));
}

PangoLayoutLine* LayoutLine::gobj()
{
  // See the comment at the top of this file, if you want to know why the cast works.
  return reinterpret_cast<PangoLayoutLine*>(this);
}

const PangoLayoutLine* LayoutLine::gobj() const
{
  // See the comment at the top of this file, if you want to know why the cast works.
  return reinterpret_cast<const PangoLayoutLine*>(this);
}

PangoLayoutLine* LayoutLine::gobj_copy() const
{
  // See the comment at the top of this file, if you want to know why the cast works.
  PangoLayoutLine *const gobject = reinterpret_cast<PangoLayoutLine*>(const_cast<LayoutLine*>(this));
  pango_layout_line_ref(gobject);
  return gobject;
}

bool LayoutLine::x_to_index(int x_pos, int& index, int& trailing) const
{
  return pango_layout_line_x_to_index(const_cast<PangoLayoutLine*>(gobj()), x_pos, &(index), &(trailing));
}

void LayoutLine::get_extents(Rectangle& ink_rect, Rectangle& logical_rect) const
{
pango_layout_line_get_extents(const_cast<PangoLayoutLine*>(gobj()), (ink_rect).gobj(), (logical_rect).gobj());
}

void LayoutLine::get_pixel_extents(Rectangle& ink_rect, Rectangle& logical_rect) const
{
pango_layout_line_get_pixel_extents(const_cast<PangoLayoutLine*>(gobj()), (ink_rect).gobj(), (logical_rect).gobj());
}

 Glib::RefPtr<Pango::Layout> LayoutLine::get_layout()
{
  Glib::RefPtr<Pango::Layout> ref_ptr(Glib::wrap(gobj()->layout));

  if(ref_ptr)
    ref_ptr->reference();

  return ref_ptr;
}

Glib::RefPtr<const Pango::Layout> LayoutLine::get_layout() const
{
  Glib::RefPtr<const Pango::Layout> ref_ptr(Glib::wrap(gobj()->layout));

  if(ref_ptr)
    ref_ptr->reference();

  return ref_ptr;
}

 int LayoutLine::get_length() const
{
  return gobj()->length;
}

 int LayoutLine::get_start_index() const
{
  return gobj()->start_index;
}

} // namespace Pango


text:
package org.http.channel.client;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Vector;

public class SimpleCache {
	private Map<String, CacheItem> cache = Collections.synchronizedMap(new HashMap<String, CacheItem>());

	/**
	 * @param key
	 * @param obj
	 * @param expired -- 过期时间,单位:秒
	 */
	public void set(String key, Object obj, int expired){
		CacheItem item = new CacheItem();
		item.obj = obj;
		item.expiredTime = expired * 1000;
		cache.put(key, item);
	}

	public boolean hasKey(String key){
		cleanObject();
		return cache.containsKey(key);
	}

	public Object get(String key){
		return get(key, true);
	}
	public Object get(String key, boolean update){
		cleanObject();
		CacheItem item = cache.get(key);
		if(item != null){
			if(System.currentTimeMillis() - item.lastAccess < item.expiredTime){
				if(update){
					item.lastAccess = System.currentTimeMillis();
				}
				return item.obj;
			}else {
				cache.remove(key);
			}
		}
		return null;
	}

	public void remove(String key){
		cache.remove(key);
	}

	public Collection<String> keys(){
		cleanObject();
		return new ArrayList<String>(cache.keySet());
	}

	private void cleanObject(){
		Vector<String> keys = new Vector<String>();
		keys.addAll(cache.keySet());
		for(String key: keys){
			CacheItem item = cache.get(key);
			if(item != null &&
			   System.currentTimeMillis() - item.lastAccess
			   > item.expiredTime ){
				cache.remove(key);
			}
		}
	}

	class CacheItem{
		Object obj = null;
		long lastAccess = System.currentTimeMillis();
		long expiredTime = 0;
	}
}


text:
namespace Common
{
	using System;

	public static class SharedConsoleIo
	{
		public static void WriteInitialQuestion()
		{
			Console.Write("\r\nWhat is the difficulty of the given task? (0-3 scale with 3 being the hardest");
		}

		public static void WriteStrategyThatShouldBeTried(Strategies.WorkStrategy strategy)
		{
			Console.WriteLine("Try the following Strategy: '{0}'", strategy.StrategyText);
		}

		public static int GetDifficultyEntry()
		{
			string difficultyValue = Console.ReadLine();
			return int.Parse(difficultyValue);
		}

		public static void WritePerformStrategyMessage()
		{
			Console.WriteLine("\r\nPress a button to perform the strategy: ");
		}
	}
}


text:
<?php defined('BX_DOL') or die('hack attempt');

bx_import('BxDolMenuQuery');
bx_import('BxDolPermalinks');

/**
 * @page objects
 * @section menu Menu
 * @ref BxDolMenu
 */

/**
 * Menus.
 *
 * Menu uses some set of items and the template to display it,
 * so it is possible to have several menus which uses the same set of items but different templates.
 *
 * Menu is any set of some links or actions, for example menu can be links in site's footer or actions in profile view.
 *
 *
 * @section menu_create Creating the Menu object:
 *
 * 1. Add record to 'sys_objects_menu' table:
 *
 * - object: name of the menu object, in the format: vendor prefix, underscore, module prefix, underscore, internal identifier or nothing; for example: bx_groups_actions - actions menu in group view.
 * - title: name of the menu, displayed in the studio menu builder.
 * - set_name: name of items' set.
 * - module: the module this menu belongs to.
 * - template_id: the template to use for menu displaying, this is id from 'sys_menu_templates' table.
 * - deletable: it determines if menu can be deleted from the studio menu builder.
 * - active: it is possible to disable particular menu, then it will not be displayed.
 * - override_class_name: user defined class name which is derived from BxTemplMenu.
 * - override_class_file: the location of the user defined class, leave it empty if class is located in system folders.
 *
 * Menu templates are stored in 'sys_menu_templates' table:
 * - id: template id.
 * - template: template file.
 * - title: template title to display in the studio menu builder.
 * All menu templates iterate through 'bx_repeat:menu_items' and use the following template variables for each menu item: __link__, __target__, __onclick__, __title__, __class_add__.
 *
 *
 * 2. Add menu an empty menu set to 'sys_menu_sets' table (if you want to use new set of items for created menu):
 * - set_name: the set name.
 * - module: the module this set belongs to.
 * - title: name of the set, displayed in studio menu builder.
 * - deletable: it determines if the set can be deleted from menu builder.
 *
 *
 * 3. Add menu items to the set by adding records to 'sys_menu_items' table:
 * - set_name: the set name this item belogs to.
 * - module: the module this item belongs to.
 * - name: name of the item (not displayed to the end user), unique in the particular set.
 * - title: menu item title to display to the end user, please note that some templates can still display menu as icons without text titles.
 * - link: menu item URL.
 * - onclick: menu item onclick event.
 * - target: menu item target.
 * - icon: menu item icon, please note that some templates can still display menu as text without icons.
 * - addon: display additional data near menu item, only for supported menu templates, this is serialized array of service call parameters: module - module name, method - service method name, params - array of parameters.
 * - visible_for_levels: bit field with set of member level ids. To use member level id in bit field - the level id minus 1 as power of 2 is used, for example:
 *      - user level id = 1 -> 2^(1-1) = 1
 *      - user level id = 2 -> 2^(2-1) = 2
 *      - user level id = 3 -> 2^(3-1) = 4
 *      - user level id = 4 -> 2^(4-1) = 8
 * - active: it is possible to disable particular menu item, then it will not be displayed.
 * - order: menu item order in the particular set.
 *
 *
 * 4. Display Menu.
 * Use the following sample code to display menu:
 * @code
 *     bx_import('BxTemplMenu');
 *     $oMenu = BxTemplMenu::getObjectInstance('sample_menu'); // 'sample_menu' is 'object' field from 'sys_objects_menu' table.
 *     if ($oMenu)
 *         echo $oMenu->getCode; // display menu
 * @endcode
 *
 * But in most cases you don't need to use above code to display menu,
 * menu objects are integrated into pages - there is special 'menu' page block type for it.
 *
 */
class BxDolMenu extends BxDol implements iBxDolFactoryObject, iBxDolReplaceable
{
    protected static $SEL_MODULE = '';
    protected static $SEL_NAME = '';

    protected $_sSelModule;
    protected $_sSelName;

    protected $_sObject;
    protected $_aObject;
    protected $_oQuery;
    protected $_oPermalinks;
    protected $_aMarkers = array ();

    /**
     * Constructor
     * @param $aObject array of menu options
     */
    public function __construct($aObject)
    {
        parent::__construct();

        $this->_sObject = isset($aObject['object']) ? $aObject['object'] : 'bx-menu-obj-' . time() . rand(0, PHP_INT_MAX);
        $this->_aObject = $aObject;
        $this->_oQuery = new BxDolMenuQuery($this->_aObject);
        $this->_oPermalinks = BxDolPermalinks::getInstance();

        if (isLogged()) {
            bx_import('BxDolProfile');
            $oProfile = BxDolProfile::getInstance();
            if ($oProfile) {
                $this->addMarkers(array(
                    'member_id' => $oProfile->id(),
                    'member_display_name' => $oProfile->getDisplayName(),
                    'member_url' => $oProfile->getUrl(),
                ));
            }
        }
    }

    /**
     * Get menu object instance by object name
     * @param $sObject object name
     * @return object instance or false on error
     */
    static public function getObjectInstance($sObject, $oTemplate = false)
    {
        if (isset($GLOBALS['bxDolClasses']['BxDolMenu!'.$sObject]))
            return $GLOBALS['bxDolClasses']['BxDolMenu!'.$sObject];

        $aObject = BxDolMenuQuery::getMenuObject($sObject);
        if (!$aObject || !is_array($aObject))
            return false;

        bx_import('BxTemplMenu');
        $sClass = 'BxTemplMenu';
        if (!empty($aObject['override_class_name'])) {
            $sClass = $aObject['override_class_name'];
            if (!empty($aObject['override_class_file']))
                require_once(BX_DIRECTORY_PATH_ROOT . $aObject['override_class_file']);
            else
                bx_import($sClass);
        }

        $o = new $sClass($aObject, $oTemplate);

        return ($GLOBALS['bxDolClasses']['BxDolMenu!'.$sObject] = $o);
    }

    /**
     * Set selected menu item globally.
     * @param $sModule menu item module to set as selected
     * @param $sName menu item name to set as selected
     */
    static public function setSelectedGlobal ($sModule, $sName)
    {
        self::$SEL_MODULE = $sModule;
        self::$SEL_NAME = $sName;
    }

    /**
     * Process menu triggers.
     * Menu triggers allow to automatically add menu items to modules with no different if dependant module was install before or after the module menu item belongs to.
     * For example module "Notes" adds menu items to all profiles modules (Persons, Organizations, etc)
     * with no difference if persons module was installed before or after "Notes" module was installed.
     * @param $sMenuTriggerName trigger name to process, usually specified in module installer class - @see BxBaseModGeneralInstaller
     * @return always true, always success
     */
    static public function processMenuTrigger ($sMenuTriggerName)
    {
        // get list of active modules
        bx_import('BxDolModuleQuery');
        $aModules = BxDolModuleQuery::getInstance()->getModulesBy(array(
            'type' => 'modules',
            'active' => 1,
        ));

        // get list of menu triggers
        $aMenuItems = BxDolMenuQuery::getMenuTriggers($sMenuTriggerName);

        // check each menu item trigger for all modules
        foreach ($aMenuItems as $aMenuItem) {
            foreach ($aModules as $aModule) {
                if (!BxDolRequest::serviceExists($aModule['name'], 'get_menu_set_name_for_menu_trigger'))
                    continue;

                if (!($sMenuSet = BxDolService::call($aModule['name'], 'get_menu_set_name_for_menu_trigger', array($sMenuTriggerName))))
                    continue;

                $aMenuItem['set_name'] = $sMenuSet;
                BxDolMenuQuery::addMenuItemToSet($aMenuItem);
            }
        }

        return true;
    }

    /**
     * Set selected menu item for current menu object only.
     * @param $sModule menu item module to set as selected
     * @param $sName menu item name to set as selected
     */
    public function setSelected ($sModule, $sName)
    {
        $this->_sSelModule = $sModule;
        $this->_sSelName = $sName;
    }

    /**
     * Add replace markers.
     * @param $a array of markers as key => value
     * @return true on success or false on error
     */
    public function addMarkers ($a)
    {
        if (empty($a) || !is_array($a))
            return false;
        $this->_aMarkers = array_merge ($this->_aMarkers, $a);
        return true;
    }

    /**
     * Remove marker
     * @param $s marker key
     */
    public function removeMarker ($s)
    {
        unset($this->_aMarkers[$s]);
    }

    /**
     * Check if menu items is selected.
     * @param $a menu item array
     * @return boolean
     */
    protected function _isSelected ($a)
    {
        if ($this->_sSelModule || $this->_sSelName)
            return (!isset($a['module']) || $a['module'] == $this->_sSelModule) && (isset($a['name']) && $a['name'] == $this->_sSelName) ? true : false;
        return (!isset($a['module']) || $a['module'] == self::$SEL_MODULE) && (isset($a['name']) && $a['name'] == self::$SEL_NAME) ? true : false;
    }

    /**
     * Check if menu items is visible.
     * @param $a menu item array
     * @return boolean
     */
    protected function _isVisible ($a)
    {
        bx_import('BxDolAcl');
        return BxDolAcl::getInstance()->isMemberLevelInSet($a['visible_for_levels']);
    }

    /**
     * Replace provided markers in menu item array, curently markers are replaced in title, link and onclick fields.
     * @param $a menu item array
     * @return array where markes are replaced with real values
     */
    protected function _replaceMarkers ($a)
    {
        if (empty($this->_aMarkers))
            return $a;
        $aReplacebleFields = array ('title', 'link', 'onclick');
        foreach ($aReplacebleFields as $sField)
            if (isset($a[$sField]))
                $a[$sField] = bx_replace_markers($a[$sField], $this->_aMarkers);
        return $a;
    }

}

/** @} */


text:
import { Component, Input, OnInit } from "@angular/core";
import { PathItem } from "./model/model";

@Component({
    selector: "folder-view",
    styleUrls: [],
    templateUrl: "folder.view.component.html"
})
export class FolderViewComponent implements OnInit {

    @Input()
    public itemList: PathItem[] = [];

    constructor() { }

    ngOnInit() { }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<TITLE>
类 java.io.Writer 的使用 (Java Platform SE 6)
</TITLE>

<META NAME="date" CONTENT="2007-03-19">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

      概述
      软件包
      类
    使用
      树
      已过时
      索引
      帮助

JavaTM Platform
Standard Ed. 6

 上一个
 下一个

  框架
 无框架

  所有类

类 java.io.Writer
的使用

使用 Writer 的软件包

java.io
通过数据流、序列化和文件系统提供系统输入和输出。

java.nio.channels
定义了各种通道,这些通道表示到能够执行 I/O 操作的实体(如文件和套接字)的连接;定义了用于多路复用的、非阻塞 I/O 操作的选择器。

java.sql
提供使用 JavaTM 编程语言访问并处理存储在数据源(通常是一个关系数据库)中的数据的 API。

java.util
包含 collection 框架、遗留的 collection 类、事件模型、日期和时间设施、国际化和各种实用工具类(字符串标记生成器、随机数生成器和位数组)。

javax.lang.model.util
用来帮助处理程序元素和类型的实用工具。

javax.script
脚本 API 由定义 Java TM Scripting Engines 的接口和类组成,并为它们在 Java 应用程序中的使用提供框架。

javax.sql.rowset
JDBC RowSet 实现的标准接口和基类。

javax.sql.rowset.serial
提供实用工具类,允许 SQL 类型与 Java 编程语言数据类型之间的可序列化映射关系。

javax.sql.rowset.spi
第三方供应商在其同步提供者的实现中必须使用的标准类和接口。

javax.swing.text
提供类 HTMLEditorKit 和创建 HTML 文本编辑器的支持类。

javax.swing.text.html
提供类 HTMLEditorKit 和创建 HTML 文本编辑器的支持类。

javax.swing.text.rtf
提供一个类 (RTFEditorKit),用于创建富文本格式(Rich-Text-Format)的文本编辑器。

javax.tools
为能够从程序(例如,编译器)中调用的工具提供接口。

javax.xml.bind

为包含解组、编组和验证功能的客户端应用程序提供运行时绑定框架。

javax.xml.bind.helpers

仅由 JAXB 提供者用于: 提供某些 <tt>javax.xml.bind</tt> 接口的部分默认实现。

javax.xml.stream

javax.xml.stream.events

javax.xml.transform.stream
此包实现特定于流和 URI 的转换 API。

org.w3c.dom.ls

java.io 中 Writer 的使用

java.io 中 Writer 的子类

 class
BufferedWriter

          将文本写入字符输出流,缓冲各个字符,从而提供单个字符、数组和字符串的高效写入。

 class
CharArrayWriter

          此类实现一个可用作 Writer 的字符缓冲区。

 class
FileWriter

          用来写入字符文件的便捷类。

 class
FilterWriter

          用于写入已过滤的字符流的抽象类。

 class
OutputStreamWriter

          OutputStreamWriter 是字符流通向字节流的桥梁:可使用指定的 charset 将要写入流中的字符编码成字节。

 class
PipedWriter

          传送的字符输出流。

 class
PrintWriter

          向文本输出流打印对象的格式化表示形式。

 class
StringWriter

          一个字符流,可以用其回收在字符串缓冲区中的输出来构造字符串。

声明为 Writer 的 java.io 中的字段

protected  Writer
FilterWriter.out

          底层字符输出流。

protected  Writer
PrintWriter.out

          此 PrintWriter 的底层字符输出流。

返回 Writer 的 java.io 中的方法

 Writer
Writer.append(char c)

          将指定字符添加到此 writer。

 Writer
Writer.append(CharSequence csq)

          将指定字符序列添加到此 writer。

 Writer
Writer.append(CharSequence csq,
       int start,
       int end)

          将指定字符序列的子序列添加到此 writer.<tt>Appendable</tt>。

参数类型为 Writer 的 java.io 中的方法

 void
CharArrayWriter.writeTo(Writer out)

          将缓冲区的内容写入另一个字符流。

参数类型为 Writer 的 java.io 中的构造方法

BufferedWriter(Writer out)

          创建一个使用默认大小输出缓冲区的缓冲字符输出流。

BufferedWriter(Writer out,
               int sz)

          创建一个使用给定大小输出缓冲区的新缓冲字符输出流。

FilterWriter(Writer out)

          创建一个新的 filtered writer。

PrintWriter(Writer out)

          创建不带自动行刷新的新 PrintWriter。

PrintWriter(Writer out,
            boolean autoFlush)

          创建新 PrintWriter。

java.nio.channels 中 Writer 的使用

返回 Writer 的 java.nio.channels 中的方法

static Writer
Channels.newWriter(WritableByteChannel ch,
          CharsetEncoder enc,
          int minBufferCap)

          构造一个 writer,它使用给定的编码器对字符进行编码,并将所得的字节写入给定的信道。

static Writer
Channels.newWriter(WritableByteChannel ch,
          String csName)

          构造一个 writer,它根据指定的 charset 对字符进行编码,并将所得的字节写入给定的信道。

java.sql 中 Writer 的使用

返回 Writer 的 java.sql 中的方法

 Writer
SQLXML.setCharacterStream()

          获取用于写入此 SQLXML 实例表示的 XML 值的流。

 Writer
Clob.setCharacterStream(long pos)

          获取用于将 Unicode 字符流写入此 Clob 对象表示的 CLOB 值中(位置 pos 处)的流。

java.util 中 Writer 的使用

参数类型为 Writer 的 java.util 中的方法

 void
Properties.store(Writer writer,
      String comments)

          以适合使用 load(Reader) 方法的格式,将此 Properties 表中的属性列表(键和元素对)写入输出字符。

javax.lang.model.util 中 Writer 的使用

参数类型为 Writer 的 javax.lang.model.util 中的方法

 void
Elements.printElements(Writer w,
              Element... elements)

          按指定顺序将元素的表示形式打印到给定 writer。

javax.script 中 Writer 的使用

声明为 Writer 的 javax.script 中的字段

protected  Writer
SimpleScriptContext.errorWriter

          此字段是用于脚本输出错误的 writer。

protected  Writer
SimpleScriptContext.writer

          此字段是用于脚本输出的 writer。

返回 Writer 的 javax.script 中的方法

 Writer
ScriptContext.getErrorWriter()

          返回用来显示错误输出的 Writer。

 Writer
SimpleScriptContext.getErrorWriter()

          返回用来显示错误输出的 Writer。

 Writer
ScriptContext.getWriter()

          返回脚本的 Writer,以便在显示输出时使用。

 Writer
SimpleScriptContext.getWriter()

          返回脚本的 Writer,以便在显示输出时使用。

参数类型为 Writer 的 javax.script 中的方法

 void
ScriptContext.setErrorWriter(Writer writer)

          设置用来显示错误输出的 Writer。

 void
SimpleScriptContext.setErrorWriter(Writer writer)

          设置用来显示错误输出的 Writer。

 void
ScriptContext.setWriter(Writer writer)

          设置脚本的 Writer,以便在显示输出时使用。

 void
SimpleScriptContext.setWriter(Writer writer)

          设置脚本的 Writer,以便在显示输出时使用。

javax.sql.rowset 中 Writer 的使用

参数类型为 Writer 的 javax.sql.rowset 中的方法

 void
WebRowSet.writeXml(ResultSet rs,
         Writer writer)

          使用给定 ResultSet 对象的内容填充此 WebRowSet 对象,并以 XML 格式将其数据、属性和元数据写入给定的 Writer 对象。

 void
WebRowSet.writeXml(Writer writer)

          以 XML 格式将此 WebRowSet 对象的数据、属性和元数据写入给定的 Writer 对象。

javax.sql.rowset.serial 中 Writer 的使用

返回 Writer 的 javax.sql.rowset.serial 中的方法

 Writer
SerialClob.setCharacterStream(long pos)

          获取用于将 Unicode 字符流写入此 SerialClob 对象所表示的 CLOB 值(位置 pos 处)的流。

javax.sql.rowset.spi 中 Writer 的使用

参数类型为 Writer 的 javax.sql.rowset.spi 中的方法

 void
XmlWriter.writeXML(WebRowSet caller,
         Writer writer)

          将给定的 WebRowSet 对象以 XML 文档的形式编写到指定的 java.io.Writer 输出流。

javax.swing.text 中 Writer 的使用

返回 Writer 的 javax.swing.text 中的方法

protected  Writer
AbstractWriter.getWriter()

          返回用于输出内容的 Writer。

参数类型为 Writer 的 javax.swing.text 中的方法

 void
JTextComponent.write(Writer out)

          将模型的内容存储到给定的流中。

 void
DefaultEditorKit.write(Writer out,
      Document doc,
      int pos,
      int len)

          将取自文档的内容以纯文本格式写入给定流。

abstract  void
EditorKit.write(Writer out,
      Document doc,
      int pos,
      int len)

          将文档中的内容以适合此类型内容处理程序的格式写入给定的流。

参数类型为 Writer 的 javax.swing.text 中的构造方法

AbstractWriter(Writer w,
               Document doc)

          创建新的 AbstractWriter。

AbstractWriter(Writer w,
               Document doc,
               int pos,
               int len)

          创建新的 AbstractWriter。

AbstractWriter(Writer w,
               Element root)

          创建新的 AbstractWriter。

AbstractWriter(Writer w,
               Element root,
               int pos,
               int len)

          创建新的 AbstractWriter。

javax.swing.text.html 中 Writer 的使用

参数类型为 Writer 的 javax.swing.text.html 中的方法

 void
HTMLEditorKit.write(Writer out,
      Document doc,
      int pos,
      int len)

          以适合此类内容处理程序的格式,将文档中的内容写入给定流。

参数类型为 Writer 的 javax.swing.text.html 中的构造方法

HTMLWriter(Writer w,
           HTMLDocument doc)

          创建新的 HTMLWriter。

HTMLWriter(Writer w,
           HTMLDocument doc,
           int pos,
           int len)

          创建新的 HTMLWriter。

MinimalHTMLWriter(Writer w,
                  StyledDocument doc)

          创建一个新的 MinimalHTMLWriter。

MinimalHTMLWriter(Writer w,
                  StyledDocument doc,
                  int pos,
                  int len)

          创建一个新的 MinimalHTMLWriter。

javax.swing.text.rtf 中 Writer 的使用

参数类型为 Writer 的 javax.swing.text.rtf 中的方法

 void
RTFEditorKit.write(Writer out,
      Document doc,
      int pos,
      int len)

          将文档中的内容作为纯文本写入给定的流。

javax.tools 中 Writer 的使用

返回 Writer 的 javax.tools 中的方法

 Writer
FileObject.openWriter()

          获取此文件对象的 Writer。

 Writer
ForwardingFileObject.openWriter()

 Writer
SimpleJavaFileObject.openWriter()

          在 Writer 中包装 openOutputStream 的结果。

参数类型为 Writer 的 javax.tools 中的方法

 JavaCompiler.CompilationTask
JavaCompiler.getTask(Writer out,
        JavaFileManager fileManager,
        DiagnosticListener<? super JavaFileObject> diagnosticListener,
        Iterable<String> options,
        Iterable<String> classes,
        Iterable<? extends JavaFileObject> compilationUnits)

          使用给定组件和参数创建编译任务的 future。

javax.xml.bind 中 Writer 的使用

参数类型为 Writer 的 javax.xml.bind 中的方法

 void
Marshaller.marshal(Object jaxbElement,
        Writer writer)

          将以 jaxbElement 为根的内容树编组到 Writer 中。

javax.xml.bind.helpers 中 Writer 的使用

参数类型为 Writer 的 javax.xml.bind.helpers 中的方法

 void
AbstractMarshallerImpl.marshal(Object obj,
        Writer w)

javax.xml.stream 中 Writer 的使用

参数类型为 Writer 的 javax.xml.stream 中的方法

abstract  XMLEventWriter
XMLOutputFactory.createXMLEventWriter(Writer stream)

          创建一个写入到 writer 的新 XMLEventWriter。

abstract  XMLStreamWriter
XMLOutputFactory.createXMLStreamWriter(Writer stream)

          创建一个写入到 writer 的新 XMLStreamWriter。

javax.xml.stream.events 中 Writer 的使用

参数类型为 Writer 的 javax.xml.stream.events 中的方法

 void
XMLEvent.writeAsEncodedUnicode(Writer writer)

          此方法根据 XML 1.0 规范将 XMLEvent 编写为 Unicode 字符。

javax.xml.transform.stream 中 Writer 的使用

返回 Writer 的 javax.xml.transform.stream 中的方法

 Writer
StreamResult.getWriter()

          获取通过 setWriter 设置的字符流。

参数类型为 Writer 的 javax.xml.transform.stream 中的方法

 void
StreamResult.setWriter(Writer writer)

          设置要接收结果的 writer。

参数类型为 Writer 的 javax.xml.transform.stream 中的构造方法

StreamResult(Writer writer)

          从字符流构造 StreamResult。

org.w3c.dom.ls 中 Writer 的使用

返回 Writer 的 org.w3c.dom.ls 中的方法

 Writer
LSOutput.getCharacterStream()

          具有语言和绑定依赖性类型的属性,它表示可向其输出 16 位单元的可写流。

参数类型为 Writer 的 org.w3c.dom.ls 中的方法

 void
LSOutput.setCharacterStream(Writer characterStream)

          具有语言和绑定依赖性类型的属性,它表示可向其输出 16 位单元的可写流。

      概述
      软件包
      类
    使用
      树
      已过时
      索引
      帮助

JavaTM Platform
Standard Ed. 6

 上一个
 下一个

  框架
 无框架

  所有类

提交错误或意见
有关更多的 API 参考资料和开发人员文档,请参阅 Java SE 开发人员文档。该文档包含更详细的、面向开发人员的描述,以及总体概述、术语定义、使用技巧和工作代码示例。
版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策。