text:
Important New Decisions - April 25, 2011
Plaintiff's Self-serving Declaration Is All That Required for the Dissolution on Irretrievably Broken Ground
In AC v DR, --- N.Y.S.2d ----, 2011 WL 1137739 (N.Y.Sup.) on a prior motion to the court, in which the husband sought full consolidation of Action 1 and Action 2, the wife sought joinder of the actions for trial, without consolidation, so that she could pursue the benefits of the newly enacted matrimonial legislation available to all actions commenced after October 12, 2010. By decision and order dated January 18, 2011, the court directed that Action 1 and Action 2 be joined for trial and discovery. In Action 2, the wife moved to partake in the benefits of the new matrimonial legislation and sought pendente lite maintenance and counsel fees as well as partial summary judgment on grounds (DRL 170[7] ) under the new law. The Court observed that the newly enacted matrimonial legislation, effective October 12, 2010, provides a new no-fault ground for divorce, DRL 170(7), as follows: (7) The relationship between husband and wife has broken down irretrievably for a period of at least six months, provided that one party has so stated under oath ... Citing a Massachusetts case the Supreme Court concluded that the decision that a marriage is irretrievably broken need not be based on any objectifiable fact. It is sufficient that one or both of the parties subjectively decide that their marriage is over and there is no hope for reconciliation (Citing Caffyn v. Caffyn 441 Mass. 487, 806 N.E.2d 415 [2004] ). It concluded that a plaintiff's self-serving declaration about his or her state of mind is all that is required for the dissolution of a marriage on grounds that it is irretrievably broken. It asserted that the conclusion, that it is sufficient that a party subjectively decide that their marriage is over, finds support in the reasoning of other courts. (citing In re Marriage of Walton, 28 Cal.App.3d 108, 117 [1972]; Joy v. Joy, 178 Conn. 254, 255 [1979]; Mattson v. Mattson, 375 A.2d 473, 475 [Me. 1977]; Matter of the Marriage of Dunn, 13 Or.App. 497, 501-502, n. 1 [1973] Caffyn v. Caffyn, supra, n. 17 ). In the court's view, the Legislature did not intend nor is there a defense to DRL 170(7). Nevertheless, while the court would ordinarily grant partial summary judgment to movant, where there are no defenses and no triable issues of fact, the court pointed out that the new legislation directs that "no judgment of divorce shall be granted under this subdivision unless and until the economic issues of equitable distribution of marital property, the payment or waiver of spousal support, the payment of child support, the payment of counsel and experts; fees and expenses as well as the custody and visitation with the infant children of the marriage have been resolved by the parties, or determined by the court and incorporated into the judgment of divorce". (DRL 170 [7] ). It noted that it had been the practice of the Part, when deemed appropriate, to hold bifurcated trials with respect to grounds for the purpose of disposing of fault issues so, if a divorce was granted, the court could concentrate its resources on equitable distribution. If a divorce was not granted, issues of support and custody, as well as related issues, always remained before the court. This was in aid of judicial economy. Yet, even in those cases where a divorce was granted, the court always held entry of judgment in abeyance pending determination of all other issues, as now set forth in detail in the new legislation. Since the new legislation directs that a judgment of divorce may not be "granted " when the cause of action is predicated on the no-fault ground until all the financial issues are complete, the court concluded that a motion for partial summary judgment cannot be granted nor can a bifurcated trial be held with respect to DRL 170(7). To continue this practice would allow fault trials on one party's claim to advance in time against the other party's no-fault claim. Moreover, since there is no defense to the no-fault ground, no judicial economy would be served by having a bifurcated trial on fault grounds, the only purpose of which was to determine whether a divorce would be granted in the first instance, and a divorce would be granted in this case provided the matter proceeds to its expected conclusion. Therefore, the wife's motion for partial summary judgment was denied, and that portion of the court's previous order, dated January 18, 2011, that directed a bifurcated trial on fault grounds was sua sponte recalled and vacated.
Anglo-American Custom to Give Child the Father's Name Is Not an Objection to Hyphenated Name
In Matter of Eberhardt, --- N.Y.S.2d ----, 2011 WL 1206136 (N.Y.A.D. 2 Dept.), 2011 the mother petitioned the Supreme Court for permission to change the child's surname by hyphenating the father's surname with the mother's surname. The impetus for the change was the mother's use of both parties' surnames on the child's application for a passport. The father, before signing the application, redacted the mother's surname. The mother reinserted her surname and filed the application, leading the father, once he saw the child's passport, to contact federal officials and ask that the passport reflect her legal name. The Appellate Division observed that to the extent the father's objection was based on traditional values, meaning that it is Anglo-American custom to give a child the father's name, the objection was not reasonable, because neither parent has a superior right to determine the surname of the child (citing Swank v. Petkovsek, 216 A.D.2d 920; Matter of Bell v. Bell, 116 A.D.2d 97, 99; Matter of Cohan v. Cunningham, 104 A.D.2d 716; Rio v. Rio, 132 Misc.2d at 319).
Family Court May Prohibit Mother from Telling Child That Any Man Other than the Father Is Child's Biological Father
In Matter of Buxenbaum v Fulmer, --- N.Y.S.2d ----, 2011 WL 1206140 (N.Y.A.D. 2 Dept.) the Appellate Division held that the Family Court's determination that there had been a change in circumstances since the issuance of the prior order of custody and visitation dated January 28, 2008, and that it was in the child's best interests to award sole custody to the father, was supported by a sound and substantial basis in the record. It held that Family Court properly took judicial notice of the order of filiation entered on consent. The Family Court's determination that the mother could not testify, in rebuttal to the admission of the order of filiation, that she had lacked the capacity to consent to the order of filiation, was not an improvident exercise of discretion (see Matter of Lane v. Lane, 68 AD3d 995, 997). The Family Court providently exercised its discretion in prohibiting the mother from telling the child that any man other than the father is the child's biological father (citing Matter of Powell v. Blumenthal, 35 AD3d 615, 617).
Error For Supreme Court to Disregard Parties Stipulation
In Aloi v Simoni, 918 N.Y.S.2d 506 (2 Dept 2011) the Appellate Division observed that where the determination as to equitable distribution has been made after a nonjury trial, the trial court's assessment of the credibility of witnesses is afforded great weight on appeal. It held that Supreme Court erred in disregarding the parties' stipulation that the appreciation in the value of the plaintiff's retirement account during the course of the marriage was the sum of $25,189. The plaintiff was entitled to 50% of the sum of the appreciation of the parties' respective retirement accounts (50% of $450,115 + $25,189 = $237,652). In calculating the amount to be paid to the plaintiff, the defendant was entitled to a credit of the appreciation remaining in the plaintiff's account ($25,189). Accordingly, the amended judgment had to be modified to direct the defendant to pay the plaintiff the sum of $212,463. The Supreme Court also erred in failing to award interest on the plaintiff's distributive award from the date of the decision until the entry of the judgment, and from the entry of the judgment to the date of payment. In exercising its discretionary power to award an attorney's fee, the court may consider, among other things, "whether either party has engaged in conduct or taken positions resulting in a delay of the proceedings or unnecessary litigation" Here, there was a significant economic disparity between the defendant and the plaintiff, and the complexity of the defendant's business endeavors, as well as the defendant's uncooperativeness with discovery and with sorting out his financial affairs, greatly contributed to the high cost of the litigation. Under these circumstances, it was appropriate to award the plaintiff one half of her total counsel fees, which, after crediting the defendant for his payment of interim counsel fees, amounted to $81,103.
Needs of a Child must Take Precedence over the Terms of the Agreement Where Needs Not Met
In Duggan v Duggan, --- N.Y.S.2d ----, 2011 WL 1331920 (N.Y.A.D. 2 Dept.), the father, and the mother entered into stipulation of settlement on February 26, 2009, to end their marriage. They had four children. The stipulation noted that the father's annual gross income was $475,000, whereas the mother had no income. It further noted that, according to the child support percentage calculation provided in the Child Support Standards Act the father's monthly child support obligation would be $11,929.54. The parties, however, agreed to deviate from this calculation, and set the father's monthly child support obligation at $8,000. The mother filed a petition seeking child support arrears. At the ensuing hearing, the husband stated that his yearly income had dropped from $475,000 to $466,757, and he argued that, pursuant to the language in the stipulation, this decrease in income entitled him to an 80 percent decrease in his child support payments, to $1,600 per month. In a fact-finding order dated April 21, 2010, the Family Court denied the father's motion to dismiss the petition, holding that his interpretation of the stipulation was "not plausible." The same court issued an order on the same day, in which it directed the father to pay the mother child support arrears in the sum of $19,200. The father filed objections, and the Family Court denied the objections in an order dated June 14, 2010. The Family Court held that the language of the stipulation, as interpreted by the father, would violate the CSSA, and was against the best interests of the children. The Appellate Divison held that Family Court was without jurisdiction to modify the terms of a separation agreement absent a showing of an unanticipated and unreasonable change in circumstances, which the father had not alleged here (citing Kleila v. Kleila, 50 N.Y.2d 277). But the Family Court does have the authority to interpret and enforce the provisions of a separation agreement.. It pointed out that "When interpreting a contract, such as a separation agreement, the court should arrive at a construction that will give fair meaning to all of the language employed by the parties to reach a practical interpretation of the expressions of the parties so that their reasonable expectations will be realized" (Matter of Schiano v. Hirsch, 22 AD3d at 502). But "the needs of a child must take precedence over the terms of the agreement when it appears that the best interests of the child are not being met" (Matter of Gravlin, 98 N.Y.2d 1, 5). Thus, the Family Court had the authority to find that a provision in a stipulation of settlement violates the CSSA. The stipulation here provided that, according to the child support percentage calculation provided in the CSSA, the father's monthly child support obligation would be $11,929.54 per month. But the parties agreed to deviate from this calculation, on the grounds that it was in the best interests of the children and that the children's needs would be met, and set the father's monthly child support obligation at the sum of $8,000 per month. The father now sought to use the provision at issue to lower his child support obligation--for four children--to $1,600 per month, or 13% of the presumptive support level based on the CSSA. He sought to do this because his income dropped by 1.7%--from $475,000 per year to $466,757 per year. The Appellate Division concluded that Family Court properly found that this was against the best interests of the children.
Not Reversible Error to Deny Party's Right to Make Opening Statement
In Matter of Sagese v Steinmetz, --- N.Y.S.2d ----, 2011 WL 1306419 (N.Y.A.D. 3 Dept.) Petitioner (father) and respondent (mother) were the parents of a daughter (born in 2004). The mother also had another child. In 2006, the parties consented to an order which granted them joint legal and physical custody of the child. In April 2009, based on allegations that there was a drug overdose in the residence where the mother resided, the father commenced a modification proceeding seeking sole custody of the child. In response, the mother filed a family offense petition and criminal complaint against the father alleging that the father struck her on the mouth during an argument. The father was subsequently arrested for assault, at which time he was found to be in possession of marihuana. The assault charge was later adjourned in contemplation of dismissal and the father paid a fine for the marihuana violation. In August 2009, Family Court issued a temporary order of custody providing that the parties share joint legal custody of the children, that the children reside with the paternal grandfather and, based on the father's marihuana conviction, that he submit to a chemical dependency evaluation. The resulting evaluation, based in part on a positive drug screen, diagnosed the father with cannabis abuse and recommended treatment. After a fact-finding hearing, Family Court awarded the parties joint legal custody of the children. Family Court further ordered that the father successfully complete chemical dependency treatment. The Appellate Divison rejected the father' argument that Family Court committed reversible error by denying the father the right to present an opening statement. While a party to a civil proceeding has the right to make an opening statement (see CPLR 4016 [a]; De Vito v. Katsch, 157 A.D.2d 413, 415 [1990] ), it found that Family Court's error did not require reversal since the court was fully familiar with the facts of the case, the parties and their respective arguments through the numerous court appearances during the year prior to trial (citing Lohmiller v. Lohmiller, 140 A.D.2d 497, 497 [1988] ). The court held that Family Court did not err in ordering the father to attend substance abuse treatment. So long as a party's right to access to his or her child is not conditioned on participation in, or completion of, counseling, Family Court may, as part of its visitation or custody order, direct a party to obtain substance abuse treatment or counseling if such treatment or counseling will serve the children's best interests. In this regard, evidence of a party's continuous use of an illegal drug is certainly relevant to a determination of whether substance abuse treatment for the parent is in the children's best interests. Here, the father had already been convicted of the violation of unlawful possession of marihuana and, at the fact-finding hearing, he admitted to smoking marihuana "no more than once or twice per week" and during the pendency of his custody proceeding. While Family Court found the father to be a good parent, it did not find his testimony--that he did not purchase the drug, keep it in his home or use it in the presence of the children--to be credible. Family Court was also unpersuaded that the father's routine use of marihuana--which the record reflected could affect a person's judgment, memory and problem-solving ability--posed no risk to the children. Finally, to the extent that the father argued that treatment would create a financial burden, the record reflected that costs are based on ability to pay and the father was eligible to apply for Medicaid benefits, which would completely cover the costs of treatment.
Not Error to Suspend Child Support Payment Where Child Not of Employable Age
In Dobies v Brefka, --- N.Y.S.2d ----, 2011 WL 1307284 (N.Y.A.D. 3 Dept.) Petitioner (father) and respondent (mother) were the unmarried parents of two children, Jaclyn (born in 1993) and Nikolas (born in 1995). In October 2008, the father commenced violation proceedings. Family Court, inter alia, granted the father sole physical and legal custody of Nikolas, terminated the father's child support obligations for Jaclyn, and suspended the father's child support obligations for Nikolas..The father claimed that a sufficient change in circumstance had occurred since entry of these prior orders based on, among other things, the mother's deliberate attempts to influence and disrupt the father's parenting time with the children. At the hearing of this matter, the father testified that he had not had any visitation with Jaclyn since March 2007 and has had no weekend parenting time with Nikolas between August 2008 and March 2009. The father recounted multiple examples of alienating behavior engaged in by the mother, including in the spring of 2007 when the mother refused to let Nikolas participate in visitation with the father because of inclement weather--despite the fact that both parties had already driven to the custody exchange point. The father also testified that, in 2007, the mother told Jaclyn that she did not have to participate in the spring break visit with the father. The father further testified that on two occasions--in April 2007 and at the commencement of Father's Day weekend in June 2007--when Jaclyn refused to participate in visitation with the father, the mother indicated that there was nothing she could do about it and that Jaclyn had a mind of her own. The father also testified that during an attempted exchange occurring in the summer of 2007 at a restaurant parking lot--an exchange that never occurred--the mother refused to transfer Nikolas' suitcase to the father's car and then laughed at the father and took a photograph of him with her cell phone while she walked inside the restaurant with the children. Family Court found the mother's explanations for her conduct insufficient and her "credibility to be seriously impaired and her testimony contradictory throughout the trial, particularly when she denied actively discouraging the children from having a relationship with their father." Thus, there was sufficient evidence in the record supporting the court's conclusion that the mother interfered in the father's relationship with the children, such that the father established the requisite change in circumstances. While a determination of the children's best interests must be based on a totality of the circumstances "[e]vidence that the custodial parent intentionally interfered with the noncustodial parent's relationship with the [children] is so inconsistent with the best interests of the [children] as to, per se, raise a strong probability that [the offending party] is unfit to act as custodial parent". The Appellate Divison held that Family Court did not err in terminating the father's child support obligation for Jaclyn and suspending the father's child support obligation for Nikolas. Child support payments may be suspended " '[w]here it can be established by the noncustodial parent that the custodial parent has unjustifiably frustrated the noncustodial parent's right of reasonable access' " (Usack v. Usack, 17 AD3d 736, 737-738 [2005] ). In addition, child support payments may be deemed forfeited when "a child of employable age ... actively abandons the noncustodial parent by refusing all contact and visitation, without cause, ... a concept sometimes referred to as the doctrine of self-emancipation" (Labanowski v. Labanowski, 49 AD3d 1051, 1053 [2008] ). However, abandonment by a child who is not "of employable age" cannot be deemed to constitute constructive emancipation (Foster v. Daigle, 25 AD3d at 1004) Family Court's determination that the mother deliberately frustrated the father's relationship with Nikolas had a sound and substantial basis in the record. While it agreed with the mother that Jaclyn, who was only 16 years of age at the time of the court's order, was unable to abandon the father so as to forfeit his support obligation and, thus, Family Court erred in terminating the father's child support obligation as to her the facts clearly supported a finding that the father's support obligation should also be suspended with respect to Jaclyn based on the mother's conduct in deliberately frustrating his relationship with Jaclyn . Accordingly, the father's support obligations with respect to Jaclyn were suspended pending further court order upon a showing that the mother has made good faith efforts to actively encourage and restore the father's relationship with the children.
Husbands Claim of Extreme Hardship Rejected Where No Appreciable Change in Lifestyle.
In Taylor v Taylor, --- N.Y.S.2d ----, 2011 WL 1440992 (N.Y.A.D. 2 Dept.) the parties 2005 stipulation of settlement, which was incorporated but not merged into their divorce judgment, provided that the plaintiff would have custody of the children, and that the defendant would pay maintenance and child support in an agreed-upon amount. The stipulation also provided that the defendant waived his right to seek any downward modification of his maintenance obligation until August 1, 2012, "excluding an unforeseen, unanticipated catastrophic event, that so negatively impacts the Husband's health or earning capacity as to result in 'extreme hardship' to him as that term is set forth in [Domestic Relations Law] 236(B)(9)(b)." After the defendant lost his job at Bear Stearns in 2008 and was hired by Natixis, a French bank, the defendant moved for a downward modification of his maintenance and child support obligations. After a hearing, Supreme Court denied defendant's motion for a downward modification of his maintenance obligation. The Appellate Division observed that the evidence at the hearing showed that, although the economic downturn resulted in the defendant losing his job at Bear Stearns and earning a substantially smaller bonus in 2009 than he had received in previous years at Bear Stearns, the defendant's base salary and compensation plan at Natixis were similar to his base salary and compensation plan at Bear Stearns. Moreover, the evidence at the hearing showed that the economic downturn did not result in any appreciable change in the defendant's lifestyle. Accordingly, the defendant failed to demonstrate that continued enforcement of his obligation to pay maintenance under the parties' stipulation of settlement would create an "extreme hardship" .
Labels: Important New Decisions


For this, you must think about the different things that you do in your home like sleeping, relaxing, working, eating and so on. Once you are done with this, it is time for you to create separate zones for these activities. Extra rooms in a home can easily be created by using curtains, chairs, tables and other furnishings in the smartest way possible.
If you have unused attic area in your home then you can easily transform it into a stylish and functional living space. This will help you in adding a completely new level to your house. The attic area can be used for creating an additional bedroom along with a bathroom. You can even use this area as library study, home office or entertainment centre.
Here it is important to note that there are several advantages of making the use of bi-fold doors. These doors are available in multiple designs to suit the preferred designs and styles of the homeowners. Bi-folding doors are basically a set of folding doors with hinged sections. These doors can easily be opened from either side and folded both sides. These can even be used in the form of barn doors and room dividers. Bi-fold doors help in doing away with the problem of insufficient space in small apartments.
You might be completely surprised to find the amount of space that your house has simply by taking a walk around and identifying potential storage capacities. You know there are small spaces between different pieces of furniture used in a home. For example, the space between the cabinet and the fridge can be put to perfect use by building a pull-out spice rack. In the same way, walls behind the doors generally remain bare. These walls can be used for creating family command centres that are both decorative and fun. Similarly, baskets can be kept under the coffee and console tables for hiding game consoles and magazines that look cluttered.
Creating home space means you cannot afford to have things in your home merely for their aesthetic appeal. You must aim at using stylish and decorative pieces of furniture that not only look good but are functional at the same time. This will probably help you in creating a fully functioning and beautiful home space.
The future always needs to be considered when thinking of increasing home space. Prior to coming up with the right decision, it is necessary that you consider the future requirements of your home.


text:
Q: How to import functions from "back-end" js file to "front-end" js file I have a Pinata IPFS js file with a "PinFileToIPFS" function inside; I'm wanting to call this function from another js file. The problem is that the Pinata js file uses "require()" to import its libraries, but my other "front-end" js file doesn't support node.js functions, and thus throws an error when loaded in the browser.
I need a way to import the PinFileToIPFS function into my other js file so it can be called upon completion of a certain front-end event. As stated before, I can't use require() to bring in the function, and if I try to use "import nameOfFunction from module;" to import the function I get the error:

Uncaught SyntaxError: Cannot use import statement outside a module.

I've seen similar questions asked, but none pertaining to my specific problem. I'm also new to programming, so any and all feedback is appreciated.

redpajama_set_name: RedPajamaStackExchange


Home/English, Evenimente @en/Seek that Leak 2019!
The Romanian Water Association and with support of Water company- ECOAQUA Calarasi will organize the 12-th regional Leak Detection Competition – Vasile Ciomoș this year in Calarasi, Romania. From the first until the 11th edition the number of participants have constantly increase from 6 till 28.
We expect that between 12 June – 14 June 2019 the operational teams (with their own autoloboratories) from Romania and observers teams to gathered again to find out who could track down leaks most accurately and with the greatest speed.


text:
Recent Posts tagged with Western Digital
Western Digital Offers New WD Gold NVMe SSDs
By SVG Staff | Thursday, March 5, 2020 - 4:22 pm
Western Digital is enabling small and medium-sized enterprises (SMEs) to easily transition to NVMe storage and dramatically improve application performance with a new addition to its portfolio of data center […] More
Quantum Agrees With Western Digital Technologies to Pick Up ActiveScale Object Storage Business
By SVG Staff | Tuesday, February 4, 2020 - 11:40 am
Quantum Corporation has entered into an agreement with Western Digital Technologies, a subsidiary of Western Digital, to acquire its ActiveScale object storage business. The addition of the ActiveScale product line […] More
Western Digital Sells IntelliFlash Business to DDN; Intends to Exit Storage Systems
By SVG Staff | Wednesday, October 2, 2019 - 10:06 am
Western Digital has entered into a definitive agreement to sell its IntelliFlash business to DDN. In addition, Western Digital and DDN have agreed to expand their existing partnership through a […] More
IBC 2019: Western Digital flaunts latest in storage products
By SVG Staff | Saturday, September 14, 2019 - 11:29 am
Changing the game for every step of the media and entertainment workflow — Western Digital (stand 7.D02) is showcasing one of the world's broadest and most trusted portfolios of storage […] More
Western Digital Receives 'Challenger' Distinction in the Gartner Magic Quadrant for File Systems and Object Storage
By SVG Staff | Tuesday, July 30, 2019 - 9:52 am
Western Digital continues its significant progress in this year's Gartner Distributed File and Object Storage Magic Quadrant based on advancements in ActiveScale Cloud Object Storage System. By reading the Gartner […] More
NAB 2019: Western Digital Highlights Faster, Smarter Workflows
By SVG Staff | Tuesday, April 9, 2019 - 2:07 pm
Western Digital (Booth SL4616) is showcasing a broad portfolio of storage systems and solutions from its G-Technology, Western Digital, and SanDisk brands for the M&E industry. From storing, transferring, distributing, […] More
Western Digital Data Center Gains Increased Momentum During Storage Infrastructure Transformation
By SVG Staff | Tuesday, March 26, 2019 - 9:56 am
Western Digital's Data Center Systems (DCS) business continues to gain momentum with record growth and achievements, as enterprise and cloud-scale customers accelerate deployment of DCS solutions to meet the data […] More
Western Digital Accelerates NVMe Transition With WD Blue Solid State Drive Portfolio Integration
By SVG Staff | Thursday, March 14, 2019 - 10:59 am
Western Digital is accelerating the NVMe transition of value-PC storage by adding an NVMe model to its WD Blue solid state drive (SSD) portfolio, the WD Blue SN500 NVMe SSD. […] More
Esports Production Forum: How the Cloud and Object Storage Are Changing MAM for Esports
By Jason Dachman, Chief Editor | Tuesday, December 4, 2018 - 10:29 am
Esports-content creators face a unique challenge when it comes to postproduction and media-asset-management (MAM). With content pouring into archives at an exponential rate, esports operations are finding unique new workflows […] More
Register Now for Western Digital's 'TP Talk' With VP Urvashi Sheth
By SVG Staff | Thursday, September 20, 2018 - 8:55 am
Western Digital is one of the largest computer data storage and hard disk drive manufacturers in the world. They manage more than 1,000 different SKUs and annually sell over 500 […] More

redpajama_set_name: RedPajamaCommonCrawl


If you are making an insurance claim bear in mind that you are entitled to choose your own preferred contractor, not one appointed by your insurance company.
Despite the use of professional loss adjusters or assessors the insured may not receive the level of technical support imagined. Few if any adjusters understand or carry out technical measurement of damage and usually rely on experienced fingers to assess dryness ! Nominated contractors are often illegally installed by appointed loss adjusters or insurers as if there was no alternative. But the insurance ombudsman (FSA) has made it crystal clear that the insured may appoint contractors of their choice. Problems associated with nominated contractors usually revolve around availability, time line to site appearance or more importantly the level of assistance. As nominated contractors work to contract parameters regarding cost & equipment, you may find that your recovery assistance depends on average costs or contractor profit margins not what they would ideally recommend in a free market.
Ambient Preservation are an independent flood and fire damage restoration company. We are not contractually tied to any Insurance companies and work exclusively for you the client.


This is the time of year when everything gets really exciting online. We start seeing all of the impending updates, releases and trends on the horizon, and I've rounded up some of the most striking business trends right here.
All of these can inspire some really dynamic changes in the story of your business, so you should definitely sit up and make some notes (colour-coded, naturally).
We've seen the potential of augmented realities this year, with Pokemon Go taking the world by storm, and it's anticipated that more businesses will embrace this tech in 2017.
Virtual reality and blended reality can both be incorporated into your digital efforts without investing an arm and a leg in a pro. Think about how you can start blending fantasy into your marketing and advertising attempts.
They say that the average user is connected through five distinct (but targetable) devices. Obviously this offers a lot of scope to market to people, but there is also the challenge tracking consumer actions across these different devices.
This is something to bear in mind when creating your content execution plan (more on that later), particularly as it takes around 6 touches before someone chooses to buy from you.
In its simplest form, influencer marketing is all about getting a big-wig in your industry to promote you, your product or your business. Trust me when I say it's worth the effort – the public trusts recommendations from people they know far beyond even the most creative advertising efforts.
'Good' content will be measured by engagement, distribution and where it's posted – influencers will be a God send in this respect. Whether they're publishing a guest post from you, promoting your content across social media, or writing about/linking to you, you will see the benefits.
Recently we've seen an upturn in the tools that offer brands and customers ways to communicate in real time – whether this be in live events, webinars, Q&A's, live streams or more.
One way I've incorporated this into my business is to have a "Live Chat" function on my site. I've found that doing this helps alleviate any customer doubts that may be holding them back from that "buy now" button.
Tools like Live Chat Inc. makes it super easy to provide an instant chat function, so that your customers and clients can engage directly through your website. I have it on all sales pages, my website and as a tab on my Facebook Page.
With ever-improving tech, tools and wifi, live streaming can only be heading in one direction. The best part is that anybody – from global brands to one man bands – has the power to livestream without investing in expensive software or equipment.
For actionable ideas to bring live streaming into your social media marketing strategy, take a peek at my Simply Smart Live Stream Hacks.
We're seeing some fantastic results with Facebook Live, particularly in terms of reach and engagement.
Social media "buy" buttons already exist on many platforms, but they're not used as much as they could be. This will likely change in 2017 as Facebook, Pinterest, Twitter and Youtube continue to channel their efforts into facilitating buying experiences (both for brands and for customers).
Your content execution framework will become more important than your content plan.
It's easy to spend a few hours brainstorming impactful content and popping it onto a plan, but that document is not always quite so easy to execute. A content plan tends to be about big picture ideas, rather than the mechanics of how, where and why you're going to publish your content.
Instead think about specific action steps that need to take place, and responsibilities that need to be assigned, and resources you'll need access to. Developing a robust plan of this sort is what will help you thrive online in 2017.
I call mine my 'content engine' and I'd be lost without my trusty copywriter, Daire, who makes the engine purr like a contented cat.
Original visuals are on the rise.
With connection becoming more and more important – so does the connection your visual content creates. That means it may time to say au revoir to stock imagery.
Your audience wants authenticity, not the same standard photographs that everyone else in your field is still relying on.
Commission a series of exclusive-to-you illustrations from a local artist, or even from Fiverr.
Take your own photographs, or hire a pro.
Use striking, on brand typography to evoke an emotion.
So many online business owners are already taking advantage of all the opportunities offered by live webinars, but it looks like we can expect some changes over the coming year.
Currently, many people use webinars simply to sell, rather than as a vehicle to showcase their expertise. I use webinars to offer live training sessions – I like to think people go away with implementable knowledge, whether they're buying what I'm selling or not. As time goes on, I expect we'll see more emphasis on creating a valuable learning experience, rather than a pitch.
We can also expect a rise of automated webinars. Despite what I've just said about automation, these can be an amazing way to create nurture paths to scale your business.
If you fancy dipping your toe into the world of webinars, my favourite platforms are Demio and Crowdcast.
Expiring content to inspire action.
Ephemeral content (or content that expires that expires after a specific window of time) is a fantastic way to create a sense of urgency, and ensure that customers make the time to view your content. Look how well it's worked for Snapchat!
This is a brilliant tactic to employ in your launch content too if you're hoping to inspire lots of sales – it's what I did for my Simply Smart Business Academy. That ticking clock pushes people into making buying decisions, so take advantage of that.


In order to validate your review and ensure we collect only honest and real reviews about Pacific Debt Inc., please include the email address you used when signing up for their services.
Have you used Pacific Debt Inc. to help with your debt? We want to hear all about it: good, bad or ugly! Here at BDC we value the voice of real consumers just like you. So, leave your rating and comments in the form above and help others make the right decision!


Thank you to everyone who has supported our campaign! We are a little over half way through the first part where we can earn 20% of purchases and $10 on each $25 eGift card. You can purchase one $25 eGift card per email address! If you have trouble finding a delivery date that works for you, please keep in mind that Schwan's can leave your pre-paid delivery in a freezer bag that can sit for up to 6 hours.


Well I have not done much on my blog this whole summer except update my summer manifesto occasionally. Trying to get back into a groove, so I thought I would review a book I just finished. It is called Seven by Jen Hatmaker, and I really enjoyed it. I love her sense of humor, it reminded a lot of my own, and of my best friend. Actually I thought if you combined myself and Tanya, you would get Jen Hatmaker. And it must be mentioned, Jen claims to have a big head, like literally. I confess, I do too. Of course I wouldn't know this if it weren't for the hat making industry who makes hats that say one size fits all, and I can't even get it around the very top portion of my head. Even when hats say M/L rarely do they fit my head. It makes for lots of laughing when hat shopping with Tanya, by that I mean she really splits a gut at how ridiculous I look. She can put on any hat, and it looks fabulous, me, nada. First world problem, right...... So when I read that about Jen, I immediately bonded, us big headed ladies have to stick together! I loved the premise of the book, and closed the last page not only inspired, but also feeling consoled. I have survivors guilt, why not me guilt, guilt period, some of which is good common sense, but not all. She gave me a little perspective for seeing it biblically. Jen says : Hear this: I don't think God wants you at war with yourself. He sent the Prince of peace to soothe those tumultuous waters already. Self-deprecation is a cruel response to Jesus. Guilt is not Jesus' medium. He is battling for global redemption right now; His objective hardly includes huddling in the corner with us, rehashing our shame again. He finished that discussion on the cross. Plus, there's no time for that. Did you hear that, Jesus is not in the medium of guilt. That is the truth. I should make a sign to hang in my house that says that.
I loved hearing about their church and their world view concerning it. That is so where I am, but not necessarily my church. I am trying to figure out what I need to do about it, what God would have me do. More guilt. Right now there are Christian refugees that are fighting for their life, and I am glittering stuff for an upcoming wedding, trying to carve out time for art, and happy to get to enjoy more warm weather before the cool weather moves in. It rolls through my head constantly, especially any time I am enjoying myself or feel excited about something. I have heard stories of retired military people going over there to fight along side others, and well as help the refugees, praise God.
It was entertaining to read Jen's experience going through the different months. I related to several of those occasions as well. The one thing I wasn't in agreement about was her view of environmentalism, had to part ways a little bit there. I plan to explore her resources for companies with a conscience. I recently found out about the documentary on Netflix called The True Cost that is about the unconscionable things that are happening all for fashion.
In month seven that covered fasting from stress. I loved the idea of honoring the hours through prayer pauses, seven to be exact, every day. This is a practice that goes way back. I love how it makes stop, and be mindful . I usually pray through out my day, but I like the fact that there are specific times, with specific purposes based on the hour. I am going to work on incorporating that to some extent.
So if any of this appeals to you, or you want to join the mutiny against excess, then this book may be for you. It will open your eyes, and support you through the journey. I don't think you will be disappointed. Here is a link the Jen Hatmaker's website.
I will leave you with a photo of myself taken by Tanya who could barely contain herself long enough to take this picture. This is a beanie, it's supposed to have stretch, and yet it was so tight around my head that is was distorting my eyes and forehead which is not evident in the photo, but you can see how tight that thing is. It should have a nice slouchy fit.
I was beyond excited to see this!! I love your blog. The image of you had me giggling at my desk. So good to see you here in this space.


Generate a stunning search with his Violet Colored Contacts. These types of bright contact lenses absolutely handle your current normal eyes shade, so they really hide also dim eyesight colours. It feels right fully scary and these upgraded lenses are fantastic for Hallow's eve costumes.
Violet Colored Contacts make it easy to generate a freaky look. Extremely high good quality contact lenses occur in a number of designs, out of obstruct hues to Hallow's eve contacts, scary models plus freaky outfit contacts Violet Colored Contacts are lumination, delicate and comfortable to wear. Their 38% drinking water content ensures that your eye stay hydrated along with feel refreshing all day.
Most natural hued lenses are created to mimic the particular eye from the eye. The particular iris means colored perhaps the attention, is often not really an individual strong coloration and it is instead composed of a variety of shapes, strains plus dots. It's among the list of reasons Violet Colored Contacts offers just one, two as well as 3 toned lens therefore supplying a natural look. Even though donning shaded contact lenses would make a big difference for a the color of eyes, ideal results vary depending on what exactly your current natural eye coloring is. On this submit, we'll look into what colors perform best in your eyes.
Prescription free dyed contacts typically also come in 3 classes: rankings tints, opaque tints plus medicine tints and it's usually belief that in case you have black colored sight people moves regarding opaque shaded lenses. Opaque improved lenses can absolutely wipe out your current initial colouring, as opposed to for those who have lighting tinted eye you could possibly opt for increaser upgraded lenses which usually provides out your colorations of one's view and add more definition.
The key reason every person loves Violet Colored Contacts so significantly is they create your little brown eyes stand out beautifully. Seeing since you can modify your hair colouring, toe nail colour along with lips colouring to fit your model in addition to seems, have you thought to make positive changes to the color of eyes far too, specially when it's properly safe and sound to perform so. Violet Colored Contacts don't just simply should be intended for make-up designers, models and also famous actors, many people use them regarding special events like marriages or perhaps on the night out together with friends. Violet Colored Contacts can alter your complete appearance as well as help make your view totally mesmerising.
Now we have looked at various different facets along with how to affect on your appearance especially with regards to observation, hair and skin colors. At this moment its your decision, if you'd like to stay ahead of your crows along with an uplifting fresh look or maybe choose a far more refined search with Violet Colored Contacts that work well together with your coloring.


text:
BSLS_IDENT("$Id$ $CSID$")

//@PURPOSE: Provide a mechanism for regular expression pattern matching.
//
//@CLASSES:
//  bdlpcre::RegEx: mechanism for compiling and matching regular expressions
//
//@SEE_ALSO: http://www.pcre.org/
//
//@DESCRIPTION: This component provides a mechanism, 'bdlpcre::RegEx', for
// compiling (or "preparing") regular expressions, and subsequently matching
// subject strings against a prepared expression.  The regular expressions
// supported by this component correspond approximately with Perl 5.10.  See
// the appendix entitled "Perl Compatibility" below for more information.
//
// Upon construction, a 'bdlpcre::RegEx' object is initially not associated
// with a regular expression.  A regular expression pattern is compiled for use
// by the object using the 'prepare' method.  Subject strings may then be
// matched against the prepared pattern using the set of overloaded 'match'
// methods.
//
// The component provides the following groups of 'match' overloads:
//: 1 The first group of 'match' overloads simply returns 0 if a given subject
//:   string matches the prepared regular expression, and returns a non-zero
//:   value otherwise.
//:
//: 2 The second group of 'match' overloads returns the substring of the
//:   subject that was matched, either as a 'bslstl::StringRef', or as a
//:   'bsl::pair<size_t, size_t>' holding the (offset, length) pair.
//:
//: 3 The third group of 'match' overloads returns a vector of either
//:   'bslstl::StringRef' or 'bsl::pair<size_t, size_t>' holding the matched
//:   substrings.  The first element of the vector indicate the substring of
//:   the subject that matched the entire pattern.  Subsequent elements
//:   indicate the substrings of the subject that matched respective
//:   sub-patterns.
//
///"Prepared" State
///----------------
// A 'bdlpcre::RegEx' object must first be prepared with a valid regular
// expression before attempting to match subject strings.  We say that an
// instance of 'bdlpcre::RegEx' is in the "prepared" state if the object holds
// a valid regular expression, in which case calls to the overloaded 'match'
// methods of that instance are valid.  Otherwise, the object is in the
// "unprepared" state.  Upon construction, an 'bdlpcre::RegEx' object is in the
// "unprepared" state.  A successful call to the 'prepare' method puts the
// object into the "prepared" state.  The 'clear' method, as well as an
// unsuccessful call to 'prepare', puts the object into the "unprepared" state.
// The 'isPrepared' accessor may be used to determine whether an object is
// prepared.
//
///Prepare-Time Flags
///------------------
// A set of flags may be optionally supplied to the 'prepare' method to affect
// specific pattern matching behavior.  The flags recognized by 'prepare' are
// defined in an enumeration declared within the 'bdlpcre::RegEx'.  The
// following describes these flags and their effects.
//
///Case-Insensitive Matching
///- - - - - - - - - - - - -
// If 'RegEx::k_FLAG_CASELESS' is included in the flags supplied to 'prepare',
// then letters in the regular expression pattern supplied to 'prepare' match
// both lower- and upper-case letters in subject strings subsequently supplied
// to 'match'.  This is equivalent to Perl's '/i' option, and can be turned off
// within a pattern by a '(?i)' option setting.
//
///Multi-Line Matching
///- - - - - - - - - -
// By default, a subject string supplied to 'match' is treated as consisting of
// a single line of characters (even if it actually contains '\n' characters).
// The start-of-line meta-character '^' matches only at the beginning of the
// string, and the end-of-line meta-character '$' matches only at the end of
// the string (or before a terminating '\n', if present).  This matches the
// behavior of Perl.
//
// If 'RegEx::k_FLAG_MULTILINE' is included in the flags supplied to 'prepare',
// then start-of-line and end-of-line meta-characters match immediately
// following or immediately before any '\n' characters in subject strings
// supplied to 'match', respectively (as well as at the very start and end of
// subject strings).  This is equivalent to Perl's '/m' option, and can be
// turned off within a pattern by a '(?m)' option setting.  If there are no
// '\n' characters in the subject string, or if there are no occurrences of '^'
// or '$' in the prepared pattern, then including 'k_FLAG_MULTILINE' has no
// effect.
//
///UTF-8 Support
///- - - - - - -
// If 'RegEx::k_FLAG_UTF8' is included in the flags supplied to 'prepare', then
// the regular expression pattern supplied to 'prepare', as well as the subject
// strings subsequently supplied to 'match', are interpreted as strings of
// UTF-8 characters instead of strings of ASCII characters.  The behavior of
// 'match' methods is undefined if 'pattern()' was prepared with 'k_FLAG_UTF8',
// but 'subject' is not a valid UTF-8 string.
//
///Dot Matches All
///- - - - - - - -
// If 'RegEx::k_FLAG_DOTMATCHESALL' is included in the flags supplied to
// 'prepare', then a dot metacharacter in the pattern matches a character of
// any value, including one that indicates a newline.  However, it only ever
// matches one character, even if newlines are encoded as '\r\n'.  If
// 'k_FLAG_DOTMATCHESALL' is not used to prepare a regular expression, a dot
// metacharacter will *not* match a newline; hence, patterns expected to match
// across lines will fail to do so.  This flag is equivalent to Perl's '/s'
// option, and can be changed within a pattern by a '(?s)' option setting.  A
// negative class such as '[^a]' always matches newline characters, independent
// of the setting of this option.
//
///JIT Compiling optimization
///--------------------------
// Just-in-time compiling is a heavyweight optimization that can greatly speed
// up pattern matching on supported platforms.  However, it comes at the cost
// of extra processing before the match is performed, so it is of most benefit
// when the same pattern is going to be matched many times.  This does not
// necessarily mean many calls of a matching function; if the pattern is not
// anchored, matching attempts may take place many times at various positions
// in the subject, even for a single call.  Therefore, if the subject string is
// very long, it may still pay to use JIT even for one-off matches.
//
// If 'RegEx::k_FLAG_JIT' is included in the flags supplied to 'prepare', then
// all following matches will be performed with JIT optimization.  To turn off
// JIT optimization support, regular expression should be prepared again,
// without using 'k_FLAG_JIT'.
//
// JIT is supported on following platforms:
//..
//  ARM 32-bit (v5, v7, and Thumb2)
//  ARM 64-bit
//  Intel x86 32-bit and 64-bit
//  MIPS 32-bit and 64-bit
//  Power PC 32-bit and 64-bit
//  SPARC 32-bit
//..
//
// The tables below demonstrate the benefit of the 'match' method with JIT
// optimizations, as well as the increased cost for 'prepare' when enabling JIT
// optimizations:
//..
//  Legend
//  ------
//  'SIMPLE_PATTERN':
//      Pattern - X(abc)*Z
//      Subject - XXXabcabcZZZ
//
//  'EMAIL_PATTERN':
//      Pattern - [A-Za-z0-9._-]+@[[A-Za-z0-9.-]+
//      Subject - john.dow@bloomberg.net
//
//  'IP_ADDRESS_PATTERN':
//      Pattern - (?:[0-9]{1,3}\.){3}[0-9]{1,3}
//      Subject - 255.255.255.255
//
//   Each pattern/subject returns 1 match.
//..
// In this first table, for each pattern, 'prepare' was called once, and match
// was called 100000 times (measurements are in seconds):
//..
//   Table 1: Performance Improvement for 'match' using k_JIT_FLAG
//  +--------------------+---------------------+---------------------+
//  | Pattern            | 'match' without-JIT |  'match' using-JIT  |
//  +====================+=====================+=====================+
//  | SIMPLE_PATTERN     |    0.0559 (~5.1x)   |        0.0108       |
//  +--------------------+---------------------+---------------------+
//  | EMAIL_PATTERN      |    0.0222 (~2.6x)   |        0.0086       |
//  +--------------------+---------------------+---------------------+
//  | IP_ADDRESS_PATTERN |    0.0331 (~5.3x)   |        0.0062       |
//  +--------------------+---------------------+---------------------+
//..
// In this second table, for each pattern, we measured 10000 iterations, where
// 'prepare' was called once, and 'match' was called once (measurements are in
// seconds):
//..
//   Table 2: Performance Cost for 'prepare' using k_JIT_FLAG
//  +--------------------+-----------------------+-----------------------+
//  | Pattern            | 'prepare' without-JIT |  'prepare' using-JIT  |
//  +====================+=======================+=======================+
//  | SIMPLE_PATTERN     |         0.2514        |     2.1426 (~8.5x)   |
//  +--------------------+-----------------------+-----------------------+
//  | EMAIL_PATTERN      |         0.3386        |     2.5758 (~7.6x)    |
//  +--------------------+-----------------------+-----------------------+
//  | IP_ADDRESS_PATTERN |         0.3016        |     2.4433 (~8.1x)    |
//  +--------------------+-----------------------+-----------------------+
//..
// Note that the tests were run on Linux / Intel Xeon CPU (3.47GHz, 64-bit),
// compiled with gcc-4.8.2 in optimized mode.
//
///Thread Safety
///-------------
// 'bdlpcre::RegEx' is *const* *thread-safe*, meaning that accessors may be
// invoked concurrently from different threads, but it is not safe to access or
// modify a 'bdlpcre::RegEx' in one thread while another thread modifies the
// same object.  Specifically, the 'match' method can be called from multiple
// threads after the pattern has been prepared.
//
// Note that 'bdlpcre::RegEx' incurs some overhead in order to provide
// thread-safe pattern matching functionality.  To perform the pattern match,
// the underlaying PCRE2 library requires a set of buffers that cannot be
// shared between threads.
//
// The table below demonstrate the difference of invoking the 'match' method
// from main (thread that invokes 'prepare') and other threads:
//..
//   Table 3: Performance cost for 'match' in multi-threaded application
//  +--------------------+-----------------------+----------------------------+
//  | Pattern            | 'match' (main thread) |  'match' (other thread(s)) |
//  +====================+=======================+============================+
//  | SIMPLE_PATTERN     |    0.0549 (~1.4x)     |           0.0759           |
//  +--------------------+-----------------------+----------------------------+
//  | EMAIL_PATTERN      |    0.0259 (~1.8x)     |           0.0464           |
//  +--------------------+-----------------------+----------------------------+
//  | IP_ADDRESS_PATTERN |    0.0377 (~1.5x)     |           0.0560           |
//  +--------------------+-----------------------+----------------------------+
//..
// Note that JIT stack is functionally part of the match context. Using large
// JIT stack can incur additional performance penalty in the multi-threaded
// applications.
//
///Note on memory allocation exceptions
///------------------------------------
// PCRE2 library supports memory allocation/deallocation functions supplied by
// the client.  'bdlpcre_regex' provides wrappers around bslma allocators that
// are called from the context of the PCRE2 library (C linkage).  Any
// exceptions thrown during memory allocation are caught by the wrapper
// functions and are not propagated to the PCRE2 library.
//
///Usage
///-----
// The following snippets of code illustrate using this component to extract
// the text of the "Subject:" field from an Internet e-mail message (RFC822).
// The following 'parseSubject' function accepts an RFC822-compliant message of
// a specified length and returns the text of the message's subject in the
// 'result' "out" parameter:
//..
//  int parseSubject(bsl::string *result,
//                   const char  *message,
//                   bsl::size_t  messageLength)
//      // Parse the specified 'message' of the specified 'messageLength' for
//      // the "Subject:" field of 'message'.  Return 0 on success and load the
//      // specified 'result' with the text of the subject of 'message'; return
//      // a non-zero value otherwise with no effect on 'result'.
//  {
//..
// The following is the regular expression that will be used to find the
// subject text of 'message'.  The "?P<subjectText>" syntax, borrowed from
// Python, allows us later to refer to a particular matched sub-pattern (i.e.,
// the text between the ':' and the '\r' in the "Subject:" field of the header)
// by the name "subjectText":
//..
//      const char PATTERN[] = "^subject:(?P<subjectText>[^\r]*)";
//..
// First we compile the 'PATTERN', using the 'prepare' method, in order to
// match subject strings against it.  In the event that 'prepare' fails, the
// first two arguments will be loaded with diagnostic information (an
// informational string and an index into the pattern at which the error
// occurred, respectively).  Two flags, 'RegEx::k_FLAG_CASELESS' and
// 'RegEx::k_FLAG_MULTILINE', are used in preparing the pattern since Internet
// message headers contain case-insensitive content as well as '\n' characters.
// The 'prepare' method returns 0 on success, and a non-zero value otherwise:
//..
//      RegEx       regEx;
//      bsl::string errorMessage;
//      size_t      errorOffset;
//
//      int returnValue = regEx.prepare(&errorMessage,
//                                      &errorOffset,
//                                      PATTERN,
//                                      RegEx::k_FLAG_CASELESS |
//                                      RegEx::k_FLAG_MULTILINE);
//      assert(0 == returnValue);
//..
// Next we call 'match' supplying 'message' and its length.  The 'matchVector'
// will be populated with (offset, length) pairs describing substrings in
// 'message' that match the prepared 'PATTERN'.  All variants of the overloaded
// 'match' method return 0 if a match is found, and return a non-zero value
// otherwise:
//..
//      bsl::vector<bsl::pair<size_t, size_t> > matchVector;
//      returnValue = regEx.match(&matchVector, message, messageLength);
//
//      if (0 != returnValue) {
//          return returnValue;  // no match
//      }
//..
// Then we pass "subjectText" to the 'subpatternIndex' method to obtain the
// index into 'matchVector' that describes how to locate the subject text
// within 'message'.  The text is then extracted from 'message' and assigned to
// the 'result' "out" parameter:
//..
//      const bsl::pair<size_t, size_t> capturedSubject =
//                           matchVector[regEx.subpatternIndex("subjectText")];
//
//      *result = bsl::string(&message[capturedSubject.first],
//                            capturedSubject.second);
//
//      return 0;
//  }
//..
// The following array contains the sample Internet e-mail message from which
// we will extract the subject:
//..
//  const char RFC822_MESSAGE[] =
//      "Received: ; Fri, 23 Apr 2004 14:30:00 -0400\r\n"
//      "Message-ID: <12345@mailgate.bloomberg.net>\r\n"
//      "Date: Fri, 23 Apr 2004 14:30:00 -0400\r\n"
//      "From: <someone@bloomberg.net>\r\n"
//      "To: <someone_else@bloomberg.net>\r\n"
//      "Subject: This is the subject text\r\n"
//      "MIME-Version: 1.0\r\n"
//      "Content-Type: text/plain\r\n"
//      "\r\n"
//      "This is the message body.\r\n"
//      ".\r\n";
//..
// Finally, we call 'parseSubject' to extract the subject from
// 'RFC822_MESSAGE'.  The assertions verify that the subject of the message is
// correctly extracted and assigned to the local 'subject' variable:
//..
//  int main()
//  {
//      bsl::string subject;
//      const int   returnValue = parseSubject(&subject,
//                                             RFC822_MESSAGE,
//                                             sizeof(RFC822_MESSAGE) - 1);
//      assert(0 == returnValue);
//      assert(" This is the subject text" == subject);
//  }
//..
//
///Appendix: Perl Compatibility
/// - - - - - - - - - - - - - -
// This section describes the differences in the ways that PCRE2 and Perl
// handle regular expressions.  The differences described here are with respect
// to Perl versions 5.10 and above.
//
// 1) PCRE2 has only a subset of Perl's Unicode support.
//
// 2) PCRE2 allows repeat quantifiers only on parenthesized assertions, but
// they do not mean what you might think.  For example, '(?!a){3}' does not
// assert that the next three characters are not '"a"'.  It just asserts that
// the next character is not '"a"' three times (in principle: PCRE2 optimizes
// this to run the assertion just once).  Perl allows repeat quantifiers on
// other assertions such as '\b', but these do not seem to have any use.
//
// 3) Capturing subpatterns that occur inside negative lookahead assertions are
// counted, but their entries in the offsets vector are never set.  Perl
// sometimes (but not always) sets its numerical variables from inside negative
// assertions.
//
// 4) The following Perl escape sequences are not supported: '\l', '\u', '\L',
// '\U', and '\N' when followed by a character name or Unicode value.  ('\N' on
// its own, matching a non-newline character, is supported.)  In fact these are
// implemented by Perl's general string-handling and are not part of its
// pattern matching engine.  If any of these are encountered by PCRE2, an error
// is generated by default.
//
// 5) The Perl escape sequences '\p,' '\P,' and '\X' are supported only if
// PCRE2 is built with Unicode support.  The properties that can be tested with
// '\p' and '\P' are limited to the general category properties such as 'Lu'
// and 'Nd', script names such as Greek or Han, and the derived properties
// 'Any' and 'L&'.  PCRE2 does support the 'Cs' (surrogate) property, which
// Perl does not; the Perl documentation says "Because Perl hides the need for
// the user to understand the internal representation of Unicode characters,
// there is no need to implement the somewhat messy concept of surrogates."
//
// 6) PCRE2 does support the '\Q...\E' escape for quoting substrings.
// Characters in between are treated as literals.  This is slightly different
// from Perl in that '$' and '@' are also handled as literals inside the
// quotes.  In Perl, they cause variable interpolation (but of course PCRE2
// does not have variables).  Note the following examples:
//..
// Pattern            PCRE2 matches  Perl matches
// ----------------   -------------  ------------------------------------
// \Qabc$xyz\E        abc$xyz        abc followed by the contents of $xyz
// \Qabc\$xyz\E       abc\$xyz       abc\$xyz
// \Qabc\E\$\Qxyz\E   abc$xyz        abc$xyz
//..
// The '\Q...\E' sequence is recognized both inside and outside character
// classes.
//
// 7) PCRE2 does not support the '(?{code})' and '(??{code})' constructions.
// However, there is support for recursive patterns.  This is not available in
// Perl 5.8, but it is in Perl 5.10.
//
// 8) Subroutine calls (whether recursive or not) are treated as atomic groups.
// Atomic recursion is like Python, but unlike Perl.  Captured values that are
// set outside a subroutine call can be referenced from inside in PCRE2, but
// not in Perl.
//
// 9) If any of the backtracking control verbs are used in a subpattern that is
// called as a subroutine (whether or not recursively), their effect is
// confined to that subpattern; it does not extend to the surrounding pattern.
// This is not always the case in Perl.  In particular, if '(*THEN)' is present
// in a group that is called as a subroutine, its action is limited to that
// group, even if the group does not contain any '|' characters.  Note that
// such subpatterns are processed as anchored at the point where they are
// tested.
//
// 10) If a pattern contains more than one backtracking control verb, the first
// one that is backtracked onto acts.  For example, in the pattern
// 'A(*COMMIT)B(*PRUNE)C' a failure in 'B' triggers '(*COMMIT),' but a failure
// in 'C' triggers '(*PRUNE)'.  Perl's behaviour is more complex; in many cases
// it is the same as PCRE2, but there are examples where it differs.
//
// 11) Most backtracking verbs in assertions have their normal actions.  They
// are not confined to the assertion.
//
// 12) There are some differences that are concerned with the settings of
// captured strings when part of a pattern is repeated.  For example, matching
// '"aba"' against the pattern '/^(a(b)?)+$/' in Perl leaves '$2' unset, but in
// PCRE2 it is set to '"b"'.
//
// 13) PCRE2's handling of duplicate subpattern numbers and duplicate
// subpattern names is not as general as Perl's.  This is a consequence of the
// fact the PCRE2 works internally just with numbers, using an external table
// to translate between numbers and names.  In particular, a pattern such as
// '(?|(?<a>A)|(?<b)B)', where the two capturing parentheses have the same
// number but different names, is not supported, and causes an error at compile
// time.  If it were allowed, it would not be possible to distinguish which
// parentheses matched, because both names map to capturing subpattern number
// 1.  To avoid this confusing situation, an error is given at compile time.
//
// 14) Perl recognizes comments in some places that PCRE2 does not, for
// example, between the '(' and '?' at the start of a subpattern.  If the '/x'
// modifier is set, Perl allows white space between '(' and '?' (though current
// Perls warn that this is deprecated) but PCRE2 never does, even if the
// 'PCRE2_EXTENDED' option is set.
//
// 15) Perl, when in warning mode, gives warnings for character classes such as
// '[A-\d]' or '[a-[:digit:]]'.  It then treats the hyphens as literals.  PCRE2
// has no warning features, so it gives an error in these cases because they
// are almost certainly user mistakes.
//
// 16) In PCRE2, the upper/lower case character properties 'Lu' and 'Ll' are
// not affected when case-independent matching is specified.  For example,
// '\p{Lu}' always matches an upper case letter.
//
// 17) PCRE2 provides some extensions to the Perl regular expression
// facilities.  This list is with respect to Perl 5.10:
//
// (a) Although lookbehind assertions in PCRE2 must match fixed length strings,
// each alternative branch of a lookbehind assertion can match a different
// length of string.  Perl requires them all to have the same length.
//
// (b) If 'PCRE2_DOLLAR_ENDONLY' is set and 'PCRE2_MULTILINE' is not set, the
// '$' meta-character matches only at the very end of the string.
//
// (c) A backslash followed by a letter with no special meaning is faulted.
// (Perl can be made to issue a warning.)
//
// (d) If 'PCRE2_UNGREEDY' is set, the greediness of the repetition quantifiers
// is inverted, that is, by default they are not greedy, but if followed by a
// question mark they are.
//
// (e) 'PCRE2_ANCHORED' can be used at matching time to force a pattern to be
// tried only at the first matching position in the subject string.
//
// (f) The 'PCRE2_NOTBOL', 'PCRE2_NOTEOL', 'PCRE2_NOTEMPTY',
// 'PCRE2_NOTEMPTY_ATSTART', and 'PCRE2_NO_AUTO_CAPTURE' options have no Perl
// equivalents.
//
// (g) The '\R' escape sequence can be restricted to match only 'CR,' 'LF,' or
// 'CRLF' by the 'PCRE2_BSR_ANYCRLF' option.
//
// (h) The callout facility is PCRE2-specific.
//
// (i) The partial matching facility is PCRE2-specific.
//
// (j) The alternative matching function ('pcre2_dfa_match()' matches in a
// different way and is not Perl-compatible.
//
// (k) PCRE2 recognizes some special sequences such as '(*CR)' at the start of
// a pattern that set overall options that cannot be changed within the
// pattern.
//
///Additional Copyright Notice
///- - - - - - - - - - - - - -
//..
// Copyright (c) 1997-2015 University of Cambridge
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
//    * Redistributions of source code must retain the above copyright notice,
//      this list of conditions and the following disclaimer.
//
//    * Redistributions in binary form must reproduce the above copyright
//      notice, this list of conditions and the following disclaimer in the
//      documentation and/or other materials provided with the distribution.
//
//    * Neither the name of the University of Cambridge nor the names of any
//      contributors may be used to endorse or promote products derived from
//      this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 1997-2015 University of Cambridge
//..

#include <bdlscm_version.h>

#include <bslma_allocator.h>
#include <bslma_managedptr.h>
#include <bslma_usesbslmaallocator.h>

#include <bslmf_nestedtraitdeclaration.h>

#include <bsl_cstddef.h>

#include <bsls_types.h>

#include <bsl_string.h>
#include <bsl_utility.h>        // 'bsl::pair'
#include <bsl_vector.h>

#include <bsls_atomicoperations.h>

#ifndef _PCRE2_H
#define PCRE2_CODE_UNIT_WIDTH 8
#define PCRE2_STATIC
#include <pcre2/pcre2.h>
#endif

namespace BloombergLP {

namespace bdlpcre {

class RegEx_MatchContext;

                             // ===========
                             // class RegEx
                             // ===========

class RegEx {
    // This class provides a mechanism for compiling and matching regular
    // expressions.  A regular expression approximately compatible with Perl
    // 5.10 is compiled with the 'prepare' method.  Subsequently, strings are
    // matched against the compiled (prepared) pattern using the overloaded
    // 'match' methods.  Note that the underlying implementation uses the
    // open-source Perl Compatible Regular Expressions (PCRE2) library that was
    // developed at the University of Cambridge ('http://www.pcre.org/').

    // CLASS DATA
    static
    bsls::AtomicOperations::AtomicTypes::Int s_depthLimit;  // process-wide
                                                            // default maximum
                                                            // evaluation
                                                            // recursion depth

    // PRIVATE DATA
    int                    d_flags;             // prepare/match flags

    bsl::string            d_pattern;           // regular expression pattern

    pcre2_general_context *d_pcre2Context_p;    // PCRE2 general context

    pcre2_compile_context *d_compileContext_p;  // PCRE2 compile context

    pcre2_code            *d_patternCode_p;     // PCRE2 compiled pattern

    int                    d_depthLimit;        // evaluation recursion depth

    size_t                 d_jitStackSize;      // PCRE JIT stack size

    bslma::ManagedPtr<RegEx_MatchContext>
                           d_matchContext;      // match context helper

    bslma::Allocator      *d_allocator_p;       // allocator to supply memory

  private:
    // NOT IMPLEMENTED
    RegEx(const RegEx&);
    RegEx& operator=(const RegEx&);

    // PRIVATE ACCESSORS
    int privateMatch(const char          *subject,
                     size_t               subjectLength,
                     size_t               subjectOffset,
                     bool                 skipValidation,
                     pcre2_match_data    *matchData,
                     pcre2_match_context *matchContext) const;
        // Match the specified 'subject', having the specified 'subjectLength',
        // against the pattern held by this regular-expression object
        // ('pattern()').  Begin matching at the specified 'subjectOffset' in
        // 'subject'.  The specified 'skipValidation' flag indicates whether
        // UTF string validity check should be bypassed or not.  Use the
        // specified 'matchData' and 'matchContext' as PCRE2 match data and
        // context buffers respectively.  Return 0 on success, 1 if the depth
        // limit was exceeded, 2 if memory available for the JIT stack is not
        // large enough (applicable only if 'pattern()' was prepared with
        // 'k_FLAG_JIT'), and another non-zero value otherwise.  The behavior
        // is undefined unless 'isPrepared() == true',
        // 'subject || subjectLength == 0', 'subjectOffset <= subjectLength',
        // and 'matchData' and 'matchContext' point to a valid PCRE2 match data
        // buffers.  The behavior is also undefined if 'pattern()' was prepared
        // with 'k_FLAG_UTF8', but 'subject' is not valid UTF-8.  Note that
        // 'subject' need not be null-terminated and may contain embedded null
        // characters.

    void extractMatchResult(pcre2_match_data          *matchData,
                            bsl::pair<size_t, size_t> *result) const;
        // Extract result of matching from the specified 'matchData' and load
        // the specified 'result' with the '(offset, length)' pair indicating
        // the leftmost match of 'pattern()'.

    void extractMatchResult(pcre2_match_data  *matchData,
                            bslstl::StringRef *result,
                            const char        *subject) const;
        // Extract result of matching the specified 'subject' from the
        // specified 'matchData' and load the specified 'result' with the
        // 'bslstl::StringRef' indicating the leftmost match of 'pattern()'.

    void extractMatchResult(
                        pcre2_match_data                        *matchData,
                        bsl::vector<bsl::pair<size_t, size_t> > *result) const;
        // Extract result of matching from the specified 'matchData' and (1)
        // load the first element of the specified 'result' with
        // '(offset, length)' pair indicating the leftmost match of
        // 'pattern()', (2) load elements of 'result' in the range
        // '[ 1 .. numSubpatterns() ]' with the pairs indicating the respective
        // matches of sub-patterns (unmatched sub-patterns have their
        // respective 'result' elements loaded with the '(k_INVALID_OFFSET, 0)'
        // pair; sub-patterns matching multiple times have their respective
        // 'result' elements loaded with the pairs indicating the rightmost
        // match).  'result' will contain exactly 'numSubpatterns() + 1'
        // elements.

    void extractMatchResult(pcre2_match_data               *matchData,
                            bsl::vector<bslstl::StringRef> *result,
                            const char                     *subject) const;
        // Extract result of matching the specified 'subject' from the
        // specified 'matchData' and (1) load the first element of the
        // specified 'result' with 'bslstl::StringRef' indicating the leftmost
        // match of 'pattern()', (2) load elements of 'result' in the range
        // '[ 1 ..  numSubpatterns() ]' with the 'bslstl::StringRef' objects
        // indicating the respective matches of sub-patterns (unmatched
        // sub-patterns have their respective 'result' elements loaded with
        // empty 'StringRef'; sub-patterns matching multiple times have their
        // respective 'result' elements loaded with the objects indicating the
        // rightmost match).  'result' will contain exactly
        // 'numSubpatterns() + 1' elements.

  public:
    // TRAITS
    BSLMF_NESTED_TRAIT_DECLARATION(RegEx, bslma::UsesBslmaAllocator);

    // CONSTANTS
    enum {
        k_FLAG_CASELESS      = 1 << 0,  // case-insensitive matching

        k_FLAG_DOTMATCHESALL = 1 << 1,  // dot metacharacter matches all chars
                                        // (including newlines)

        k_FLAG_MULTILINE     = 1 << 2,  // multi-line matching

        k_FLAG_UTF8          = 1 << 3,  // UTF-8 support

        k_FLAG_JIT           = 1 << 4   // just-in-time compiling optimization
                                        // required
    };
        // This enumeration defines the flags that may be supplied to the
        // 'prepare' method to effect specific pattern matching behavior.

    static const size_t k_INVALID_OFFSET;
        // Value used to denote an invalid offset for match methods returning
        // pairs.

    // CLASS METHODS
    static int defaultDepthLimit();
        // Returns the process-wide default evaluation recursion depth limit.

    static bool isJitAvailable();
        // Return 'true' if just-in-time compiling optimization is supported by
        // current hardware platform and 'false' otherwise.  Note that JIT
        // support is limited to the following hardware platforms:
        //..
        //  ARM 32-bit (v5, v7, and Thumb2)
        //  ARM 64-bit
        //  Intel x86 32-bit and 64-bit
        //  MIPS 32-bit and 64-bit
        //  Power PC 32-bit and 64-bit
        //  SPARC 32-bit
        //..

    static int setDefaultDepthLimit(int depthLimit);
        // Set the process-wide default evaluation recursion depth limit to the
        // specified 'depthLimit'.  Returns the previous depth limit.

    // CREATORS
    RegEx(bslma::Allocator *basicAllocator = 0);                    // IMPLICIT
        // Create a regular-expression object in the "unprepared" state.
        // Optionally specify a 'basicAllocator' used to supply memory.  The
        // alignment strategy of the allocator must be "maximum" or "natural".
        // If 'basicAllocator' is 0, the currently installed default allocator
        // is used.

    ~RegEx();
        // Destroy this regular-expression object.

    // MANIPULATORS
    void clear();
        // Free resources used by this regular-expression object and put this
        // object into the "unprepared" state.  This method has no effect if
        // this object is already in the "unprepared" state.

    int prepare(bsl::string *errorMessage,
                size_t      *errorOffset,
                const char  *pattern,
                int          flags = 0,
                size_t       jitStackSize = 0);
        // Prepare this regular-expression object with the specified 'pattern'
        // and the optionally specified 'flags'.  'flags', if supplied, should
        // contain a bit-wise or of the 'k_FLAG_*' constants defined by this
        // class, which indicate additional configuration parameters for the
        // regular expression.  Optionally specify 'jitStackSize'.  If 'flags'
        // has the 'k_FLAG_JIT' flag set, 'jitStackSize' indicates the size of
        // the allocated JIT stack to be used for this pattern.  If 'flags'
        // has the 'k_FLAG_JIT' bit set and 'jitStackSize' is 0 (or not
        // supplied), no memory will be allocated for the JIT stack and the
        // program stack will be used as the JIT stack.  If 'flags' does not
        // have 'k_FLAG_JIT' set, or 'isJitAvailable is 'false', the
        // 'jitStackSize' parameter, if supplied, is ignored.  On success, put
        // this object into the "prepared" state and return 0, with no effect
        // on the specified 'errorMessage' and 'errorOffset'.  Otherwise, (1)
        // put this object into the "unprepared" state, (2) load 'errorMessage'
        // (if non-null) with a string describing the error detected, (3) load
        // 'errorOffset' (if non-null) with the offset in 'pattern' at which
        // the error was detected, and (4) return a non-zero value.  The
        // behavior is undefined unless 'flags' is the bit-wise inclusive-or of
        // 0 or more of the following values:
        //..
        //  k_FLAG_CASELESS
        //  k_FLAG_DOTMATCHESALL
        //  k_FLAG_MULTILINE
        //  k_FLAG_UTF8
        //  k_FLAG_JIT
        //..
        // Note that the flag 'k_FLAG_JIT' is ignored if 'isJitAvailable' is
        // 'false'.

    int setDepthLimit(int depthLimit);
        // Set the evaluation recursion depth limit for this regular-expression
        // object to the specified 'depthLimit'.  Return the previous depth
        // limit.

    // ACCESSORS
    int depthLimit() const;
        // Returns the evaluation recursion depth limit for this
        // regular-expression object.

    int flags() const;
        // Return the flags that were supplied to the most recent successful
        // call to the 'prepare' method of this regular-expression object.  The
        // behavior is undefined unless 'isPrepared() == true'.  Note that the
        // returned value will be the bit-wise inclusive-or of 0 or more of the
        // following values:
        //..
        //  k_FLAG_CASELESS
        //  k_FLAG_DOTMATCHESALL
        //  k_FLAG_MULTILINE
        //  k_FLAG_UTF8
        //  k_FLAG_JIT
        //..
        // Also note that 'k_FLAG_JIT' is ignored, but still returned by this
        // method, if 'isJitAvailable' is 'false'.

    bool isPrepared() const;
        // Return 'true' if this regular-expression object is in the "prepared"
        // state, and 'false' otherwise.

    size_t jitStackSize() const;
        // Return the size of the dynamically allocated JIT stack if it has
        // been specified explicitly with 'prepare' method.  Return '0' if zero
        // 'jitStackSize' value has been passed to 'prepare' method (or not
        // supplied at all).  Return '0' if 'isPrepared' is 'false'.

    int match(const char *subject,
              size_t      subjectLength,
              size_t      subjectOffset = 0) const;
        // Match the specified 'subject', having the specified 'subjectLength',
        // against the pattern held by this regular-expression object
        // ('pattern()').  Begin matching at the optionally specified
        // 'subjectOffset' in 'subject'.  If 'subjectOffset' is not specified,
        // then begin matching from the start of 'subject'.  Return 0 on
        // success, 1 if the depth limit was exceeded, 2 if memory available
        // for the JIT stack is not large enough (applicable only if
        // 'pattern()' was prepared with 'k_FLAG_JIT'), and another non-zero
        // value otherwise.  The behavior is undefined unless
        // 'isPrepared() == true', 'subject || subjectLength == 0', and
        // 'subjectOffset <= subjectLength'.  The behavior is also undefined if
        // 'pattern()' was prepared with 'k_FLAG_UTF8', but 'subject' is not
        // valid UTF-8.  Note that 'subject' need not be null-terminated and
        // may contain embedded null characters.

    int match(bsl::pair<size_t, size_t> *result,
              const char                *subject,
              size_t                     subjectLength,
              size_t                     subjectOffset = 0) const;
    int match(bslstl::StringRef *result,
              const char        *subject,
              size_t             subjectLength,
              size_t             subjectOffset = 0) const;
        // Match the specified 'subject', having the specified 'subjectLength',
        // against the pattern held by this regular-expression object
        // ('pattern()').  Begin matching at the optionally specified
        // 'subjectOffset' in 'subject'.  If 'subjectOffset' is not specified,
        // then begin matching from the start of 'subject'.  On success, load
        // the specified 'result' with respectively the '(offset, length)' pair
        // or 'bslstl::StringRef' indicating the leftmost match of 'pattern()',
        // and return 0.  Otherwise, return a non-zero value with no effect on
        // 'result'.  The return value is 1 if the failure is caused by
        // exceeding the depth limit, and 2 if memory available for the JIT
        // stack is not large enough (applicable only if 'pattern()' was
        // prepared with 'k_FLAG_JIT').  The behavior is undefined unless
        // 'isPrepared() == true', 'subject || subjectLength == 0' , and
        // 'subjectOffset <= subjectLength'.  The behavior is also undefined if
        // 'pattern()' was prepared with 'k_FLAG_UTF8', but 'subject' is not
        // valid UTF-8.  Note that 'subject' need not be null-terminated and
        // may contain embedded null characters.

    int match(bsl::vector<bsl::pair<size_t, size_t> > *result,
              const char                              *subject,
              size_t                                   subjectLength,
              size_t                                   subjectOffset = 0)
                                                                         const;
    int match(bsl::vector<bslstl::StringRef> *result,
              const char                     *subject,
              size_t                          subjectLength,
              size_t                          subjectOffset = 0) const;
        // Match the specified 'subject', having the specified 'subjectLength',
        // against the pattern held by this regular-expression object
        // ('pattern()').  Begin matching at the optionally specified
        // 'subjectOffset' in 'subject'.  If 'subjectOffset' is not specified,
        // then begin matching from the start of 'subject'.  On success, (1)
        // load the first element of the specified 'result' with respectively
        // '(offset, length)' pair or 'bslstl::StringRef' indicating the
        // leftmost match of 'pattern()', (2) load elements of 'result' in the
        // range '[ 1 .. numSubpatterns() ]' with the pairs
        // ('bslstl::StringRef') indicating the respective matches of
        // sub-patterns (unmatched sub-patterns have their respective 'result'
        // elements loaded with either the '(k_INVALID_OFFSET, 0)' pair or an
        // empty 'StringRef'; sub-patterns matching multiple times have their
        // respective 'result' elements loaded with the pairs indicating the
        // rightmost match), and (3) return 0.  Otherwise, return a non-zero
        // value with no effect on 'result'.  The return value is 1 if the
        // failure is caused by exceeding the depth limit, and 2 if memory
        // available for the JIT stack is not large enough (applicable only if
        // 'pattern()' was prepared with 'k_FLAG_JIT').  The behavior is
        // undefined unless 'isPrepared() == true', 'subject || subjectLength
        // == 0', and 'subjectOffset <= subjectLength'.  The behavior is also
        // undefined if 'pattern()' was prepared with 'k_FLAG_UTF8', but
        // 'subject' is not valid UTF-8.  Note that 'subject' need not be
        // null-terminated and may contain embedded null characters.  Also note
        // that after a successful call, 'result' will contain exactly
        // 'numSubpatterns() + 1' elements.

    int matchRaw(const char *subject,
                 size_t      subjectLength,
                 size_t      subjectOffset = 0) const;
        // Match the specified 'subject', having the specified 'subjectLength',
        // against the pattern held by this regular-expression object
        // ('pattern()'), but bypassing UTF string validity check.  Begin
        // matching at the optionally specified 'subjectOffset' in 'subject'.
        // If 'subjectOffset' is not specified, then begin matching from the
        // start of 'subject'.  Return 0 on success, 1 if the depth limit was
        // exceeded, 2 if memory available for the JIT stack is not large
        // enough (applicable only if 'pattern()' was prepared with
        // 'k_FLAG_JIT'), and another non-zero value otherwise.  The behavior
        // is undefined unless 'isPrepared() == true',
        // 'subject || subjectLength == 0', and
        // 'subjectOffset <= subjectLength'.  The behavior is also undefined if
        // 'pattern()' was prepared with 'k_FLAG_UTF8', but 'subject' is not
        // valid UTF-8.  Note that 'subject' need not be null-terminated and
        // may contain embedded null characters.  Also note that 'subject' may
        // be null if '0 == subjectLength' (denoting the empty string).

    int matchRaw(bsl::pair<size_t, size_t> *result,
                 const char                *subject,
                 size_t                     subjectLength,
                 size_t                     subjectOffset = 0) const;
    int matchRaw(bslstl::StringRef *result,
                 const char        *subject,
                 size_t             subjectLength,
                 size_t             subjectOffset = 0) const;
        // Match the specified 'subject', having the specified 'subjectLength',
        // against the pattern held by this regular-expression object
        // ('pattern()'), but bypassing UTF string validity check.  Begin
        // matching at the optionally specified 'subjectOffset' in 'subject'.
        // If 'subjectOffset' is not specified, then begin matching from the
        // start of 'subject'.  On success, load the specified 'result' with
        // respectively the '(offset, length)' pair or 'bslstl::StringRef'
        // indicating the leftmost match of 'pattern()', and return 0.
        // Otherwise, return a non-zero value with no effect on 'result'.  The
        // return value is 1 if the failure is caused by exceeding the depth
        // limit, and 2 if memory available for the JIT stack is not large
        // enough (applicable only if 'pattern()' was prepared with
        // 'k_FLAG_JIT').  The behavior is undefined unless
        // 'isPrepared() == true', 'subject || subjectLength == 0', and
        // 'subjectOffset <= subjectLength'.  The behavior is also undefined if
        // 'pattern()' was prepared with 'k_FLAG_UTF8', but 'subject' is not
        // valid UTF-8.  Note that 'subject' need not be null-terminated and
        // may contain embedded null characters.

    int matchRaw(bsl::vector<bsl::pair<size_t, size_t> > *result,
                 const char                              *subject,
                 size_t                                   subjectLength,
                 size_t                                   subjectOffset = 0)
                                                                         const;
    int matchRaw(bsl::vector<bslstl::StringRef> *result,
                 const char                     *subject,
                 size_t                          subjectLength,
                 size_t                          subjectOffset = 0) const;
        // Match the specified 'subject', having the specified 'subjectLength',
        // against the pattern held by this regular-expression object
        // ('pattern()'), but bypassing UTF string validity check.  Begin
        // matching at the optionally specified 'subjectOffset' in 'subject'.
        // If 'subjectOffset' is not specified, then begin matching from the
        // start of 'subject'.  On success, (1) load the first element of the
        // specified 'result' with respectively '(offset, length)' pair or
        // 'bslstl::StringRef' indicating the leftmost match of 'pattern()',
        // (2) load elements of 'result' in the range
        // '[ 1 .. numSubpatterns() ]' with the pairs ('bslstl::StringRef')
        // indicating the respective matches of sub-patterns (unmatched
        // sub-patterns have their respective 'result' elements loaded with
        // either the '(k_INVALID_OFFSET, 0)' pair or an empty 'StringRef';
        // sub-patterns matching multiple times have their respective 'result'
        // elements loaded with the pairs indicating the rightmost match), and
        // (3) return 0.  Otherwise, return a non-zero value with no effect on
        // 'result'.  The return value is 1 if the failure is caused by
        // exceeding the depth limit, and 2 if memory available for the JIT
        // stack is not large enough (applicable only if 'pattern()' was
        // prepared with 'k_FLAG_JIT').  The behavior is undefined unless
        // 'isPrepared() == true', 'subject || subjectLength == 0', and
        // 'subjectOffset <= subjectLength'.  The behavior is also undefined if
        // 'pattern()' was prepared with 'k_FLAG_UTF8', but 'subject' is not
        // valid UTF-8.  Note that 'subject' need not be null-terminated and
        // may contain embedded null characters.  Also note that after a
        // successful call, 'result' will contain exactly 'numSubpatterns() +
        // 1' elements.

    int numSubpatterns() const;
        // Return the number of sub-patterns in the pattern held by this
        // regular-expression object ('pattern()').  The behavior is undefined
        // unless 'isPrepared() == true'.

    const bsl::string& pattern() const;
        // Return a reference to the non-modifiable pattern held by this
        // regular-expression object.  The behavior is undefined unless
        // 'isPrepared() == true'.

    int subpatternIndex(const char *name) const;
        // Return the 1-based index of the sub-pattern having the specified
        // 'name' in the pattern held by this regular-expression object
        // ('pattern()'); return -1 if 'pattern()' does not contain a
        // sub-pattern identified by 'name'.  The behavior is undefined unless
        // 'isPrepared() == true'.  Note that the returned value is intended to
        // be used as an index into the 'bsl::vector<bsl::pair<int, int> >'
        // returned by 'match'.
};

// ============================================================================
//                              INLINE DEFINITIONS
// ============================================================================

                             // -----------
                             // class RegEx
                             // -----------

// CLASS METHODS
inline
int RegEx::defaultDepthLimit()
{
    return bsls::AtomicOperations::getIntRelaxed(&s_depthLimit);
}

inline
int RegEx::setDefaultDepthLimit(int depthLimit)
{
    int previous = defaultDepthLimit();

    bsls::AtomicOperations::setIntRelaxed(&s_depthLimit, depthLimit);

    return previous;
}

// CREATORS
inline
RegEx::~RegEx()
{
    clear();
    pcre2_compile_context_free(d_compileContext_p);
    pcre2_general_context_free(d_pcre2Context_p);
}

// ACCESSORS
inline
int RegEx::depthLimit() const
{
    return d_depthLimit;
}

inline
int RegEx::flags() const
{
    return d_flags;
}

inline
bool RegEx::isPrepared() const
{
    return (0 != d_patternCode_p);
}

inline
size_t RegEx::jitStackSize() const
{
    return d_jitStackSize;
}

inline
const bsl::string& RegEx::pattern() const
{
    return d_pattern;
}

}  // close package namespace

}  // close enterprise namespace

#endif

// ----------------------------------------------------------------------------
// Copyright 2016 Bloomberg Finance L.P.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------- END-OF-FILE ----------------------------------

redpajama_set_name: RedPajamaGithub


text:
using System;
using FasterTests.Core.Integration.Nunit.SetupFixturesContexts.SetupFixtures;
using FasterTests.Core.Interfaces.Models;
using FasterTests.Tests.NunitTestAssembly;
using Machine.Specifications;

namespace FasterTests.Tests.Core.Integration.Nunit.SetupFixturesContexts.SetupFixtures.SetupFixtureSpecs
{
    [Subject(typeof(SetupFixture))]
    public class When_teardown_is_executed_without_setup : SetupFixtureSpecification<RootSetupFixture>
    {
        Because of = () =>
            exception = Catch.Exception(() => Subject.Teardown(An<IObserver<TestResult>>()));

        It should_fail = () => exception.ShouldBeOfExactType<InvalidOperationException>();

        It should_not_change_state = () => Subject.IsExecuted.ShouldBeFalse();

        private static Exception exception;
    }
}